From: "Ard Biesheuvel" <ardb@kernel.org>
To: edk2-devel-groups-io <devel@edk2.groups.io>, sean@starlabs.systems
Cc: Patrick Rudolph <patrick.rudolph@9elements.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Jiewen Yao <jiewen.yao@intel.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [edk2-devel] [PATCH 2/2] OvmfPkg: Fix PciHostBridgeLibScan
Date: Thu, 31 Mar 2022 08:25:50 +0200 [thread overview]
Message-ID: <CAMj1kXEcezshD0F1YzjXZYr6m10Qo9_-fEsyXJScp=-3O2QR0g@mail.gmail.com> (raw)
In-Reply-To: <9e5f18683a8877ab4cf04210f2047e4e20157c75.1648664943.git.sean@starlabs.systems>
On Wed, 30 Mar 2022 at 20:29, Sean Rhodes <sean@starlabs.systems> wrote:
>
> From: Patrick Rudolph <patrick.rudolph@9elements.com>
>
> Don't assume a 64bit register always holds an address greater than 4GB.
> Check the value in the register and decide which Aperature it should be
> assigned to.
>
> The same code caused an issue on real hardware. It's unclear if this is an
> issue here as well, as it's intended to run on emulated hardware only.
>
Do you have a link to such a supported issue? Or could you elaborate?
Does it have to do with running out of 64-bit BAR space for resource
that could be located in a 32-bit region as well?
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> ---
> .../PciHostBridgeLibScan/ScanForRootBridges.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c b/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
> index 5fb02a89b9..1ff96be57f 100644
> --- a/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
> +++ b/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
> @@ -331,14 +331,18 @@ ScanForRootBridges (
> Base = ((UINT32)Pci.Bridge.PrefetchableMemoryBase & 0xfff0) << 16;
> Limit = (((UINT32)Pci.Bridge.PrefetchableMemoryLimit & 0xfff0)
> << 16) | 0xfffff;
> - MemAperture = &Mem;
> if (Value == BIT0) {
> - Base |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);
> - Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);
> - MemAperture = &MemAbove4G;
> + Base |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);
> + Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);
> }
>
> if (Base < Limit) {
> + if (Base < BASE_4GB) {
> + MemAperture = &Mem;
> + } else {
> + MemAperture = &MemAbove4G;
> + }
> +
> if (MemAperture->Base > Base) {
> MemAperture->Base = Base;
> }
> --
> 2.32.0
>
>
>
> ------------
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#88266): https://edk2.groups.io/g/devel/message/88266
> Mute This Topic: https://groups.io/mt/90138165/5717338
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ardb+tianocore@kernel.org]
> ------------
>
>
next prev parent reply other threads:[~2022-03-31 6:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 18:29 [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib Sean Rhodes
2022-03-30 18:29 ` [PATCH 2/2] OvmfPkg: Fix PciHostBridgeLibScan Sean Rhodes
2022-03-31 6:25 ` Ard Biesheuvel [this message]
2022-05-17 12:08 ` [edk2-devel] " Sheng Lean Tan
2022-03-30 18:29 ` [PATCH 1/2] UefiPayloadPkg: Fix PciHostBridgeLib Sean Rhodes
2022-03-30 23:00 ` Guo Dong
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='CAMj1kXEcezshD0F1YzjXZYr6m10Qo9_-fEsyXJScp=-3O2QR0g@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