From: "Wasim Khan" <wasim.khan@nxp.com>
To: Laszlo Ersek <lersek@redhat.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"afish@apple.com" <afish@apple.com>,
Leif Lindholm <leif@nuviainc.com>
Cc: Mike Kinney <michael.d.kinney@intel.com>,
"liming.gao@intel.com" <liming.gao@intel.com>
Subject: Re: [edk2-devel] [edk2-discuss] Need memory barriers in IoLib for AARCH64
Date: Fri, 17 Jul 2020 06:43:34 +0000 [thread overview]
Message-ID: <VE1PR04MB67029FA3747C25A23E870D75907C0@VE1PR04MB6702.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <0d68b7da-01c9-f696-7eb4-ebbef8a5cf0f@redhat.com>
> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Monday, July 13, 2020 9:02 PM
> To: devel@edk2.groups.io; afish@apple.com; Wasim Khan
> <wasim.khan@nxp.com>
> Cc: Mike Kinney <michael.d.kinney@intel.com>; liming.gao@intel.com; Leif
> Lindholm (Nuvia address) <leif@nuviainc.com>
> 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 <wasim.khan@nxp.com> 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: michael.d.kinney@intel.com; liming.gao@intel.com;
> >>> devel@edk2.groups.io
> >>> 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
> >>
> >>
> >>
> >
> >
> >
> >
> >
next prev parent reply other threads:[~2020-07-17 6:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-10 12:49 [edk2-discuss] Need memory barriers in IoLib for AARCH64 Wasim Khan
2020-07-12 5:17 ` Wasim Khan
2020-07-12 16:54 ` [edk2-devel] " Andrew Fish
2020-07-13 15:31 ` Laszlo Ersek
2020-07-13 15:57 ` Andrew Fish
2020-07-17 6:43 ` Wasim Khan [this message]
2020-07-18 20:08 ` Andrew Fish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=VE1PR04MB67029FA3747C25A23E870D75907C0@VE1PR04MB6702.eurprd04.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox