[edk2-devel] [PATCH 1/1] OvmfPkg/PlatformInitLib: pass through reservations from qemu

Lendacky, Thomas via groups.io thomas.lendacky=amd.com at groups.io
Thu Jan 12 17:09:27 UTC 2023


On 12/6/22 23:32, Gerd Hoffmann via groups.io wrote:
> qemu uses the etc/e820 fw_cfg file not only for memory, but
> also for reservations.  Handle reservations by adding resource
> descriptor hobs for them.
> 
> A typical qemu configuration has a small reservation between
> lapic and flash:
> 
>    # sudo cat /proc/iomem
>    [ ... ]
>    fee00000-fee00fff : Local APIC
>    feffc000-feffffff : Reserved          <= HERE
>    ffc00000-ffffffff : Reserved
>    [ ... ]
> 
> Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>

On newer versions of Qemu, this patch causes a boot failure on my
AMD system with the following output:

...
PciHostBridgeUtilityInitRootBridge: populated root bus 0, with room for 255 subordinate bus(es)
RootBridge: PciRoot(0x0)
   Support/Attr: 70069 / 70069
     DmaAbove4G: No
NoExtConfSpace: No
      AllocAttr: 3 (CombineMemPMem Mem64Decode)
            Bus: 0 - FF Translation=0
             Io: 6000 - FFFF Translation=0
            Mem: C0000000 - FBFFFFFF Translation=0
     MemAbove4G: E000000000 - FFFFFFFFFF Translation=0
           PMem: FFFFFFFFFFFFFFFF - 0 Translation=0
    PMemAbove4G: FFFFFFFFFFFFFFFF - 0 Translation=0
PciHostBridgeDxe: IntersectMemoryDescriptor: desc [FD00000000, 10000000000) type 1 cap 8000000000026000 conflicts with aperture [E000000000, 10000000000) cap 1

ASSERT_EFI_ERROR (Status = Invalid Parameter)
ASSERT [PciHostBridgeDxe] /root/kernels/ovmf-build-X64/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c(550): !(((INTN)(RETURN_STATUS)(Status)) < 0)

Doing some bisecting, before Qemu patch

    8504f129450b ("i386/pc: relocate 4g start to 1T where applicable")

this issue wasn't observed. And before this OVMF patch, the newer version
of Qemu doesn't have an issue.

Also, if I add host-phys-bits=true to the Qemu -cpu parameter, then
the issue isn't observed regardless of Qemu/OVMF level.

I'm hoping someone has an understanding of what is going on and what
can be done to fix it.

Thanks,
Tom


> ---
>   OvmfPkg/Library/PlatformInitLib/MemDetect.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> index b8feae4309de..a7a4e028ad50 100644
> --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> @@ -228,6 +228,22 @@ PlatformScanOrAdd64BitE820Ram (
>               ));
>           }
>         }
> +    } else if (E820Entry.Type == EfiAcpiAddressRangeReserved) {
> +      if (AddHighHob) {
> +        DEBUG ((
> +          DEBUG_INFO,
> +          "%a: Reserved: Base=0x%Lx Length=0x%Lx\n",
> +          __FUNCTION__,
> +          E820Entry.BaseAddr,
> +          E820Entry.Length
> +          ));
> +        BuildResourceDescriptorHob (
> +          EFI_RESOURCE_MEMORY_RESERVED,
> +          0,
> +          E820Entry.BaseAddr,
> +          E820Entry.Length
> +          );
> +      }
>       }
>     }
>   


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98384): https://edk2.groups.io/g/devel/message/98384
Mute This Topic: https://groups.io/mt/95510762/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list