From nobody Sat Feb 7 04:46:59 2026 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+81492+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+81492+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1633405267; cv=none; d=zohomail.com; s=zohoarc; b=eu95lU6bFUp1QffkuWAwb3TXwp/wvt8fmKSi8xcCSruWTmeqvNNibhC6Ux2v8N4RwnMT8BZeL0LP9oViXW3byipgmAb+r7QI5BDLdBL/Jc2nWEZ1YD4aYIwtqPE2KNf42CllpVlc0UOV9sKuQYXu0Ve80eDdRXiMRkGl+YAB+Rk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633405267; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=J+2Cw8G8+d0zJ3eN6tmR9mB0Kj7SRMmLlOX9OjPhN6A=; b=ndmPsdKC5elybeye45v7ozHpTD1ip3TcSCe/qnPNVmez7MzTmUoegh64zjz+L+ysirOLsoaVjUMuPF/Bb8uYW65VhohaYwIZgalTN1cs+seIt7GGgdSS3K+RUgU+a4j5xS5Ltw/c18SDPs+ygblezltUGhMh3GYIuDvuou7dG4Q= 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+81492+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 1633405267743118.66495094076163; Mon, 4 Oct 2021 20:41:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id llwlYY1788612xFKEFdF6NOT; Mon, 04 Oct 2021 20:41:07 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web09.20836.1633405265395581286 for ; Mon, 04 Oct 2021 20:41:05 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10127"; a="225958238" X-IronPort-AV: E=Sophos;i="5.85,347,1624345200"; d="scan'208";a="225958238" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2021 20:40:51 -0700 X-IronPort-AV: E=Sophos;i="5.85,347,1624345200"; d="scan'208";a="487828748" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.239]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2021 20:40:49 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Jian J Wang , Hao A Wu , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: [edk2-devel] [PATCH V2 20/28] MdeModulePkg: EFER should not be changed in TDX Date: Tue, 5 Oct 2021 11:39:31 +0800 Message-Id: <9f383ae10faa94b915750bec72ca8b5a28b8469b.1633401643.git.min.m.xu@intel.com> In-Reply-To: References: 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,min.m.xu@intel.com X-Gm-Message-State: eaoxBodpDIcOChetOOW084myx1787277AA= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1633405267; bh=yjMf96s9QCPeYfcXEPZBYURK20Mt/Rzb4Nqr0PoXqUg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=cIWpg3qhYkWli78xElAw+92KOph+OOaFqKRkcyteLIDeYtUu1SLAfTNA8oeSQrHDXra LJOzwJgDbBsMBY5RT5qUbQ6mUnmPTm9+lqaLt5FNQgPu1bXbdfaK8VKOOgDU6Ruu8SESn y1medBsFyMBgAZ+vxA6XSgAinoODBIbOWjM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1633405268758100016 RFC=EF=BC=9A https://bugzilla.tianocore.org/show_bug.cgi?id=3D3429 In TDX IA32_ERER is RO to host VMM. It could not be changed. PcdIa32EferChangeAllowed is added in MdeModulePkg.dec and it is to be set to FALSE in Tdx guest. Cc: Jian J Wang Cc: Hao A Wu Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Signed-off-by: Min Xu --- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 1 + MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 6 ++++++ MdeModulePkg/MdeModulePkg.dec | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf b/MdeModulePkg/Core/Dx= eIplPeim/DxeIpl.inf index 19b8a4c8aefa..106b679b6bd0 100644 --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf @@ -117,6 +117,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdUse5LevelPageTable ##= SOMETIMES_CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase ##= CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdIa32EferChangeAllowed ##= CONSUMES =20 [Pcd.IA32,Pcd.X64,Pcd.ARM,Pcd.AARCH64] gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ## SOMETIM= ES_CONSUMES diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePk= g/Core/DxeIplPeim/X64/VirtualMemory.c index 6831946c54d3..8a3b72509310 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -148,6 +148,12 @@ IsEnableNonExecNeeded ( return FALSE; } =20 + // + // Intel TDX sets this flag to FALSE. + // + if (!PcdGetBool (PcdIa32EferChangeAllowed)) { + return FALSE; + } // // XD flag (BIT63) in page table entry is only valid if IA32_EFER.NXE is= set. // Features controlled by Following PCDs need this feature to be enabled. diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 133e04ee86ca..007044a311c2 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -2138,6 +2138,11 @@ # @Prompt GHCB Pool Size gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbSize|0|UINT64|0x00030008 =20 + ## This dynamic PCD indicates if IA32_EFER can be changed. The default v= alue is TRUE but in + # Intel TDX change of IA32_EFER is not allowed. + # @Prompt The flag which indicates if IA32_EFER is allowed to be changed. + gEfiMdeModulePkgTokenSpaceGuid.PcdIa32EferChangeAllowed|TRUE|BOOLEAN|0x0= 0030009 + [PcdsDynamicEx] ## This dynamic PCD enables the default variable setting. # Its value is the default store ID value. The default value is zero as= Standard default. --=20 2.29.2.windows.2 -=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 (#81492): https://edk2.groups.io/g/devel/message/81492 Mute This Topic: https://groups.io/mt/86085761/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-