[edk2-devel] [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor

Boeuf, Sebastien sebastien.boeuf at intel.com
Wed Jan 18 14:20:15 UTC 2023


From: Sebastien Boeuf <sebastien.boeuf at intel.com>

The address space width isn't properly calculated when the platform is
Cloud Hypervisor. The function PlatformAddressWidthFromCpuid() must not
be invoked with the QemuQuirk boolean set to true in the Cloud
Hypervisor case.

Relying on the host bridge identifier, we can set the QemuQuirk to the
appropriate value, which results in the address space size to be
correctly returned for Cloud Hypervisor.

Having the correct address space width allows the code to calculate
dynamically the MMIO space available for devices in the 64-bit address
space, preventing it to fallback onto the default value (32GiB).

Signed-off-by: Sebastien Boeuf <sebastien.boeuf at intel.com>
---
 OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 5aeeeff89f..a14e5c4247 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -838,6 +838,7 @@ PlatformAddressWidthInitialization (
 {
   UINT8       PhysMemAddressWidth;
   EFI_STATUS  Status;
+  BOOLEAN     QemuQuirk;
 
   if (PlatformInfoHob->HostBridgeDevId == 0xffff /* microvm */) {
     PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE);
@@ -863,7 +864,13 @@ PlatformAddressWidthInitialization (
     PlatformGetFirstNonAddress (PlatformInfoHob);
   }
 
-  PlatformAddressWidthFromCpuid (PlatformInfoHob, TRUE);
+  if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
+    QemuQuirk = FALSE;
+  } else {
+    QemuQuirk = TRUE;
+  }
+
+  PlatformAddressWidthFromCpuid (PlatformInfoHob, QemuQuirk);
   if (PlatformInfoHob->PhysMemAddressWidth != 0) {
     // physical address width is known
     PlatformDynamicMmioWindow (PlatformInfoHob);
-- 
2.37.2

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 5 208 026.16 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98809): https://edk2.groups.io/g/devel/message/98809
Mute This Topic: https://groups.io/mt/96354531/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