From: "Ard Biesheuvel" <ard.biesheuvel@linaro.org>
To: Wasim Khan <wasim.khan@nxp.com>
Cc: edk2-devel-groups-io <devel@edk2.groups.io>,
Varun Sethi <v.sethi@nxp.com>, "Wu, Hao A" <hao.a.wu@intel.com>,
"Ni, Ray" <ray.ni@intel.com>
Subject: Re: [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks
Date: Thu, 23 Apr 2020 20:56:30 +0200 [thread overview]
Message-ID: <CAKv+Gu9WdRAq2yYvMgj-8QKY36tKDfCZZd0hkMkVMtdChc+iuw@mail.gmail.com> (raw)
In-Reply-To: <1587638612-13056-1-git-send-email-wasim.khan@nxp.com>
On Thu, 23 Apr 2020 at 12:43, Wasim Khan <wasim.khan@nxp.com> wrote:
>
> With Address Translation Support, it is possible and
> also correct that Mem and Pmem Limit cross the 4GB boundary.
> Update the checks so that Mem/PMem Limit should not cross 4GB
> from the Mem/PMem Base address.
>
> Signed-off-by: Wasim Khan <wasim.khan@nxp.com>
> ---
> MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> index d304fae..9cf7e98 100644
> --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> @@ -117,8 +117,8 @@ CreateRootBridge (
> // Make sure Mem and MemAbove4G apertures are valid
> //
> if (RESOURCE_VALID (&Bridge->Mem)) {
> - ASSERT (Bridge->Mem.Limit < SIZE_4GB);
> - if (Bridge->Mem.Limit >= SIZE_4GB) {
> + ASSERT (Bridge->Mem.Limit < (Bridge->Mem.Base + SIZE_4GB));
> + if (Bridge->Mem.Limit >= (Bridge->Mem.Base + SIZE_4GB)) {
> return NULL;
> }
> }
> @@ -129,8 +129,8 @@ CreateRootBridge (
> }
> }
> if (RESOURCE_VALID (&Bridge->PMem)) {
> - ASSERT (Bridge->PMem.Limit < SIZE_4GB);
> - if (Bridge->PMem.Limit >= SIZE_4GB) {
> + ASSERT (Bridge->PMem.Limit < (Bridge->PMem.Base + SIZE_4GB));
> + if (Bridge->PMem.Limit >= (Bridge->PMem.Base + SIZE_4GB)) {
> return NULL;
> }
> }
> --
> 2.7.4
>
This is not the right fix.
The translation offset should be taken into account for these checks
next prev parent reply other threads:[~2020-04-23 18:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 10:43 [PATCH] MdeModulePkg/PciHostBridge: Update Mem and PMem Limit Checks Wasim Khan
2020-04-23 11:36 ` Ni, Ray
2020-04-23 13:52 ` Wasim Khan
2020-04-23 14:28 ` [edk2-devel] " Ni, Ray
2020-04-23 14:53 ` Wasim Khan
2020-04-23 15:17 ` Ni, Ray
2020-04-23 16:04 ` Wasim Khan
2020-04-23 18:56 ` Ard Biesheuvel [this message]
2020-04-24 4:35 ` Wasim Khan
2020-04-24 6:07 ` [edk2-devel] " Ard Biesheuvel
2020-04-24 7:32 ` Wasim Khan
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=CAKv+Gu9WdRAq2yYvMgj-8QKY36tKDfCZZd0hkMkVMtdChc+iuw@mail.gmail.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