From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.135614.1671117052986226917 for ; Thu, 15 Dec 2022 07:10:56 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Or2eGXry; spf=pass (domain: intel.com, ip: 192.55.52.151, 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=1671117056; x=1702653056; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TnezW+sYOuBmV1RqZ20h4dPTcV6yOfP2XLDk8v6QJDs=; b=Or2eGXry9hqa/xloL0H+2bjoWusiWTM0qbvEWYFnThhKVBtc1pwpLOMe ZioZy3lJLd3T4SrxbXqGCaVbnjgL3CPi94GLJHxygMRmd+6lBxcCx65xL J9NLQdW4xLncAul1MOU1oDpyBM7U4t3bIGe5CaCF5In48S6uBuSuO8W88 Pn4OlAqoWo9en3Kh2mXBWrBFlrZSRzevZsyPiIhdx5DU3pjsFxe54ZXKd rRbXjOMKFbFPo4HqX/oY/cOlSidKN3TovBeDLy149Bc4PfpwMox4Gd23l r/KOOHbBIbPGMx5L4lANvqOtxaM0CLXS0fm+AvgUMrEN62Hh5YPA+HNfq Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="299048790" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="299048790" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:55 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="773759877" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="773759877" Received: from bholthau-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.60.50]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:14 -0800 From: "Boeuf, Sebastien" To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, min.m.xu@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [PATCH v2 1/3] OvmfPkg/PlatformInitLib: Differentiate TDX case for Cloud Hypervisor Date: Thu, 15 Dec 2022 16:10:02 +0100 Message-Id: <4b74449fbc48ed50be509cb0e3d1ba2e9ec1913f.1671116367.git.sebastien.boeuf@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Sebastien Boeuf Rely on the CcProbe() function to identify when running on TDX. This allows the firmware to follow a different codepath for Cloud Hypervisor, which means it doesn't rely on PVH to find out about memory below 4GiB. instead it falls back onto the CMOS to retrieve that information. Signed-off-by: Sebastien Boeuf --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index b8feae4309..6dbdbf9306 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -26,6 +26,7 @@ Module Name: // #include #include +#include #include #include #include @@ -312,7 +313,9 @@ PlatformGetSystemMemorySizeBelow4gb ( UINT8 Cmos0x34; UINT8 Cmos0x35; = - if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { + if ((PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) && + (CcProbe () !=3D CcGuestTypeIntelTdx)) + { // Get the information from PVH memmap return (UINT32)GetHighestSystemMemoryAddressFromPvhMemmap (TRUE); } -- = 2.34.1 --------------------------------------------------------------------- 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.