From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web11.16370.1674051623901069371 for ; Wed, 18 Jan 2023 06:20:24 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ZctmW4Lk; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: sebastien.boeuf@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674051623; x=1705587623; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EMFlT6wfTkUOedou+rnYdiMgnNkU4n35cp4LVKczjB4=; b=ZctmW4LkxfzDpNSgpTxRRDTM9ArbpF9mAcvYVdMg1gV7XGsgIW4GjpBG FVArOlZAFDvGkKHnSgOy4WXufo2E8kWfj8dihVJOb76BYO4gwqPzFiTr0 HjSG/LB7guG59AW5srWI6IYbH2oEuSnbSe1P1PlrEzbLaoC1PuhaUxF7P 7bTbDVHdROIaRDlbop/Tz0WPL4Xl+iXkhWMCmmK2tEgjHPat64zX/ziEZ AZEifrthwTkCiqQTCgqcJlCMADjTLBHu7dEyUDW7SiCnEDWFhYpmU0N5w CvLGpTuREbOhGJ8bn3f7Vn/6HIOeV1fDNdxutmA8dAgQIhYH7Lm+kHLon Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="323677017" X-IronPort-AV: E=Sophos;i="5.97,226,1669104000"; d="scan'208";a="323677017" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 06:20:23 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10593"; a="652957041" X-IronPort-AV: E=Sophos;i="5.97,226,1669104000"; d="scan'208";a="652957041" Received: from aeagersx-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.27.174]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2023 06:20:21 -0800 From: "Boeuf, Sebastien" 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 Message-Id: <4354b16fa5364a6b0e77e787582136e45e5f325b.1674051530.git.sebastien.boeuf@intel.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Sebastien Boeuf 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 --- 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 =3D=3D 0xffff /* microvm */) { PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE); @@ -863,7 +864,13 @@ PlatformAddressWidthInitialization ( PlatformGetFirstNonAddress (PlatformInfoHob); } = - PlatformAddressWidthFromCpuid (PlatformInfoHob, TRUE); + if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { + QemuQuirk =3D FALSE; + } else { + QemuQuirk =3D TRUE; + } + + PlatformAddressWidthFromCpuid (PlatformInfoHob, QemuQuirk); if (PlatformInfoHob->PhysMemAddressWidth !=3D 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.