public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor
@ 2023-01-18 14:20 Boeuf, Sebastien
  2023-01-19  7:54 ` Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: Boeuf, Sebastien @ 2023-01-18 14:20 UTC (permalink / raw)
  To: devel; +Cc: jiewen.yao, kraxel, sebastien.boeuf

From: Sebastien Boeuf <sebastien.boeuf@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@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.


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor
  2023-01-18 14:20 [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor Boeuf, Sebastien
@ 2023-01-19  7:54 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2023-01-19  7:54 UTC (permalink / raw)
  To: sebastien.boeuf; +Cc: devel, jiewen.yao

On Wed, Jan 18, 2023 at 03:20:15PM +0100, sebastien.boeuf@intel.com wrote:
> From: Sebastien Boeuf <sebastien.boeuf@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@intel.com>

Acked-by: Gerd Hoffmann <kraxel@redhat.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-19  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 14:20 [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor Boeuf, Sebastien
2023-01-19  7:54 ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox