From nobody Sun May 19 11:31:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+98809+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98809+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1674051626; cv=none; d=zohomail.com; s=zohoarc; b=WGN25PEUQiPOoZqJn9+R1woU31YLRG2ukjH/2xI7CIZoG0k+V/2RPTjgDPWi41Fbzvripi74MDEHjJ1NP+55CgsTGQKNV0ZsaYM9IOvuq9w/+5l0B1BsdGJfyWG0L06BbT5yEz4OIPJuCDzWMRGKrNyPbTbo7uQGjHloCZK5Kdg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674051626; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=UFVJ7VTjmlU2c3m0wmJ3+GUGFYDvo2PuWlAtIMppy1M=; b=Hjgd4KIouBIhq/3a1faQZZkJbpEn+1kwLE5ppe0zLZ+zEX0kNKUWTco+xAg1QvmOfwdLsFSnlgSQzTfe3j/+L6Z03bFCW1HtLi0G2vkiJYZb/pdwDDJorNsEoxOGA5UwoZaXzSV8+4nG1gQ451JrQXbqrXJ/Xo2AnHpKoXGVk5g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+98809+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 167405162601257.353404184669785; Wed, 18 Jan 2023 06:20:26 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hQiyYY1788612x1ieSR6NCh5; Wed, 18 Jan 2023 06:20:25 -0800 X-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 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" X-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" X-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: [edk2-devel] [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> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sebastien.boeuf@intel.com X-Gm-Message-State: yB52fEG3SXuF9bbFvQeEYY4Zx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1674051625; bh=39UMPlxgyDia2qOjPqgja5Hfzidzd4aaDh+kOoDwRas=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=XNxp2fn4ZIbSWD21SD7u1crHT3fqRJm8GRUUky9RIRNzeSDTJjFxtAFR6vRqETuq4gQ x91lq2DSS3GOKyyFzd+oUkpEjIi1BYI+0ZTYSMzIamo2e83Vz07V6JjhiXFtWYNlJ4eRU D1SgaJ3om3vAXS+mztmlp5j8q0+pqbSd7tk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1674051626549100001 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Gerd Hoffmann --- 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; =20 if (PlatformInfoHob->HostBridgeDevId =3D=3D 0xffff /* microvm */) { PlatformAddressWidthFromCpuid (PlatformInfoHob, FALSE); @@ -863,7 +864,13 @@ PlatformAddressWidthInitialization ( PlatformGetFirstNonAddress (PlatformInfoHob); } =20 - 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); --=20 2.37.2 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris,=20 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. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- 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/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-