On Wed, 30 Mar 2022 at 20:29, Sean Rhodes <sean@starlabs.systems> wrote: > > From: Patrick Rudolph <patrick.rudo...@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+tianoc...@kernel.org> > Cc: Jiewen Yao <jiewen....@intel.com> > Cc: Jordan Justen <jordan.l.jus...@intel.com> > Cc: Gerd Hoffmann <kra...@redhat.com> > Signed-off-by: Patrick Rudolph <patrick.rudo...@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+ow...@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ardb+tianoc...@kernel.org] > ------------ > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88288): https://edk2.groups.io/g/devel/message/88288 Mute This Topic: https://groups.io/mt/90138165/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-