From nobody Mon Feb 9 04:41:08 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+87712+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+87712+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1647564505; cv=none; d=zohomail.com; s=zohoarc; b=VyBPaenu5iVfGD7+sQcEtIGrM70ejLD8ct+a8syf0+V2i66wHnsjLAw7Adz9lRj4YMrilQF/TY3HEUOxL9Vq3sQqZlI+BMJo9XXAVSD3uzbhoNHReVf5VK/11h4gqlPcwjxt9/qsVJhx9yzIA2j3xXTL2zHYTCjVjBtZr1Gnhq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647564505; 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=RqnL7OhbGfCArz2lEBHvHyeGcX3TJEt05dVmS2PGMAs=; b=HlR9m+BUuyHHGa2H6vj7VHh23uqTvbIdAf5LL8ZYu5EimeY3y7bHVQAZyAjH+vNE/BF8P8FkcuyoTz72og94ZnUdvwLpH/oK3wIDnljDD0F7mCpytyMHCA9GQsqSMsDU9gyluufrgwa/ekXXyizShv7f3zvLIafKrIaeH1Lp1KQ= 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+87712+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 1647564505823110.29940805772901; Thu, 17 Mar 2022 17:48:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AfVJYY1788612xKiSCnJ0Ui2; Thu, 17 Mar 2022 17:48:25 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.4358.1647564503613587744 for ; Thu, 17 Mar 2022 17:48:24 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10289"; a="281818439" X-IronPort-AV: E=Sophos;i="5.90,190,1643702400"; d="scan'208";a="281818439" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2022 17:48:18 -0700 X-IronPort-AV: E=Sophos;i="5.90,190,1643702400"; d="scan'208";a="541603309" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.172.84]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2022 17:48:15 -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 V9 37/47] UefiCpuPkg: Update AddressEncMask in CpuPageTable Date: Fri, 18 Mar 2022 08:45:55 +0800 Message-Id: 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: Bi4uORQU0V9dLqgCvv34qj4yx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1647564505; bh=EI+9Fs2hPVw1t9FpOftsW+9NE5N08CHwAe8Dyx6BPaw=; h=Cc:Date:From:Reply-To:Subject:To; b=KVnHDbcRkd1s8AR5z6f5rYCF0/Dqb/EFRrrzm2xhql7q3cs1GX584D9rNwWJfrsvgSY sxJlx5Ri7Qv/cRinSGyCCx6RacHW3BwROZx9Dj+mhnUTqIk/bSrkVIpKtvbuLURfC5kGf w6KhrIdp5nK1S5N1qfauAjJJiOtpiHgLdYw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1647564506212100015 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 (#87712): https://edk2.groups.io/g/devel/message/87712 Mute This Topic: https://groups.io/mt/89859054/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-