public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Boeuf, Sebastien" <sebastien.boeuf@intel.com>
To: devel@edk2.groups.io
Cc: jiewen.yao@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com
Subject: [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor
Date: Wed, 18 Jan 2023 15:20:15 +0100	[thread overview]
Message-ID: <4354b16fa5364a6b0e77e787582136e45e5f325b.1674051530.git.sebastien.boeuf@intel.com> (raw)

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.


             reply	other threads:[~2023-01-18 14:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 14:20 Boeuf, Sebastien [this message]
2023-01-19  7:54 ` [PATCH] OvmfPkg: Report proper address space width for Cloud Hypervisor Gerd Hoffmann

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=4354b16fa5364a6b0e77e787582136e45e5f325b.1674051530.git.sebastien.boeuf@intel.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