From nobody Mon Feb 9 19:05:14 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+87972+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+87972+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1648080758; cv=none; d=zohomail.com; s=zohoarc; b=FbvO4UaZp+9g/WtWR+Jxpo2iW2+8HSk1pkFT0Jw7QL9Z4NsYc1W234nrecZvRvTJS/EcFxXpgUVc/LCQS5fgljatlrJ+7e61zTWoGT3vPUz7OK+frMavbzbuRlFes6FXMXBOxlGTNY+VatzHbYSxMshc3nwTv7uns/qRE3ATLU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648080758; h=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=p0P50E6LJmT8nxMpU/cad2jygHRJxc9zoc9ADb+v1uQ=; b=Wb47aT0ipcRr1sci9enH5ItcQJqpnXwZj1osh+bQM8P7H1Vb4HjTrU8k6wO4vdL39e1S+kEg2cQwwbGAxv/Yx1zy2/mr28Q2dfJtEMI3+p19Q1TTuzoDpdMKhBGOKjo36JPtYU5i2P6zbmPs6YKsP/j7fBoJYyWt1F3bUtxxwN8= 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+87972+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 1648080758427322.86126393962695; Wed, 23 Mar 2022 17:12:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id jgr1YY1788612xHqFN6Ehl1G; Wed, 23 Mar 2022 17:12:38 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web09.4791.1648080751988371354 for ; Wed, 23 Mar 2022 17:12:37 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10295"; a="258207790" X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="258207790" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:12:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,205,1643702400"; d="scan'208";a="649651563" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.90]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2022 17:12:34 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH V10 37/47] UefiCpuPkg: Update AddressEncMask in CpuPageTable Date: Thu, 24 Mar 2022 08:10:23 +0800 Message-Id: <20220324001033.1169-38-min.m.xu@intel.com> In-Reply-To: <20220324001033.1169-1-min.m.xu@intel.com> References: <20220324001033.1169-1-min.m.xu@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,min.m.xu@intel.com X-Gm-Message-State: 1ng8pqULcL2yRJ2UwWt21MyVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648080758; bh=h9i4Q45+W8vbyWnFkOWox3GMEq6p0pDTgrX7Maynrmg=; h=Cc:Date:From:Reply-To:Subject:To; b=GAI0Qew//mAaX8abibcszrhOA14od2TVj1Zn6FjfFUcNy2HYIMAV77VK0MIqz05pyLn /CO8lNGZySm4iYN/7GSvQxxMJdb1rEUOUqLEg3CuOPOdpbsqWkDHqCZYWKJzAj6vE/zSE B4ph0R3SelSoE9V6eOnizqYQBMg1p1r/EoA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648080760329100002 Content-Type: text/plain; charset="utf-8" RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3429 MMIO region in Tdx guest is set with PcdTdxSharedBitMask in TdxDxe's entry point. In SEV guest the page table entries is set with PcdPteMemoryEncryptionAddressOrMask when creating 1:1 identity table. So the AddressEncMask in GetPageTableEntry (@CpuPageTable.c) is either PcdPteMemoryEncryptionAddressOrMask (in SEV guest), or PcdTdxSharedBitMask (in TDX guest), or all-0 (in Legacy guest). Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Acked-by: Gerd Hoffmann Reviewed-by: Ray Ni Signed-off-by: Min Xu --- UefiCpuPkg/CpuDxe/CpuDxe.inf | 1 + UefiCpuPkg/CpuDxe/CpuPageTable.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf index d87fe503d152..235241899222 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.inf +++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf @@ -80,6 +80,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ##= CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList ##= CONSUMES gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize ##= CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask ##= CONSUMES =20 [Depex] TRUE diff --git a/UefiCpuPkg/CpuDxe/CpuPageTable.c b/UefiCpuPkg/CpuDxe/CpuPageTa= ble.c index d9e65ab4b22a..f7a4d92e921a 100644 --- a/UefiCpuPkg/CpuDxe/CpuPageTable.c +++ b/UefiCpuPkg/CpuDxe/CpuPageTable.c @@ -307,6 +307,9 @@ GetPageTableEntry ( // Make sure AddressEncMask is contained to smallest supported address f= ield. // AddressEncMask =3D PcdGet64 (PcdPteMemoryEncryptionAddressOrMask) & PAGI= NG_1G_ADDRESS_MASK_64; + if (AddressEncMask =3D=3D 0) { + AddressEncMask =3D PcdGet64 (PcdTdxSharedBitMask) & PAGING_1G_ADDRESS_= MASK_64; + } =20 if (PagingContext->MachineType =3D=3D IMAGE_FILE_MACHINE_X64) { if ((PagingContext->ContextData.X64.Attributes & PAGE_TABLE_LIB_PAGING= _CONTEXT_IA32_X64_ATTRIBUTES_5_LEVEL) !=3D 0) { --=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 (#87972): https://edk2.groups.io/g/devel/message/87972 Mute This Topic: https://groups.io/mt/89989275/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-