> -----Original Message----- > From: Laszlo Ersek <[email protected]> > Sent: Monday, July 13, 2020 9:02 PM > To: [email protected]; [email protected]; Wasim Khan > <[email protected]> > Cc: Mike Kinney <[email protected]>; [email protected]; Leif > Lindholm (Nuvia address) <[email protected]> > Subject: Re: [edk2-devel] [edk2-discuss] Need memory barriers in IoLib for > AARCH64 > > On 07/12/20 18:54, Andrew Fish via groups.io wrote: > > > > > >> On Jul 11, 2020, at 10:17 PM, Wasim Khan <[email protected]> wrote: > >> > >> Hello > >> > >> Any comments ? > >> > > > > I don’t see IoLibArm.c in master? I see IoLibNoIo.c. > > That's due to the rename in commit 089e9c19a8c1 > ("MdePkg/BaseIoLibIntrinsic: Rename IoLibArm.c=>IoLibNoIo.c", 2020-05-07), > which has been first included in edk2-stable202005. > > I think Ard is away at the moment, so I'm adding Leif to the CC list. > > Thanks > Laszlo > > > The MMIO function look like ARM assembler with the correct barrier > instructions. The IO operations in this lib are the x86 in/out instructions, > so they > just ASSERT on ARM. > > > > On the X86 MemoryFence() is just a serializing intrinsic for the compiler to > prevent optimizations from breaking the code, kind of like how you need to > make MMIO as volatile in C. > > > > Thanks, > > > > Andrew Fish
Thank you Andrew and Laszlo for you response. My problem was that because there is no MemoryFence() in MmioRead/Write functions in IoLibNoIo.c, I was facing some serializing problem with AARCH64. I have two options: Either put MemoryFence() in my code under edl2-platforms before and after MmioRead/Write calls OR Add the MemoryFence() in MmioRead/Write itself for IoLibNoIo.c, like it is done for IoLib.c . Because I don’t see any harm to make sure that MmioRead/Write operation are serialized by using MemoryFence() in it. I prefer later option, if there is no specific reason for not adding MemoryFence() for IoLibNoIo.c. > > > >>> -----Original Message----- > >>> From: Wasim Khan > >>> Sent: Friday, July 10, 2020 6:20 PM > >>> To: [email protected]; [email protected]; > >>> [email protected] > >>> Subject: [edk2-discuss] Need memory barriers in IoLib for AARCH64 > >>> > >>> Hello, > >>> > >>> MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf: > >>> IoLib library uses IoLibArm.c for AARCH64/ARM architecture and > >>> IoLib.c for other architectures. > >>> > >>> While IoLib.c already has memory barriers in MmioWrite functions, > >>> there barriers are missing in IoLibArm.c Is there any reason for > >>> **not** adding these memory barriers in IoLibArm.c to guarantee that > >>> all MMIO operations are serialized ? > >>> > >>> I am facing some issues and I need to add memory barriers in > >>> IoLibArm.c for > >>> AARCH64 also . > >>> > >>> > >>> Regards, > >>> Wasim > >> > >> > >> > > > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62733): https://edk2.groups.io/g/devel/message/62733 Mute This Topic: https://groups.io/mt/75417094/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
