From nobody Mon Feb 9 01:17:04 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+88126+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+88126+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1648455038; cv=none; d=zohomail.com; s=zohoarc; b=c4ts7H/6GEUM2efCUFKEqEU+WPus8pOS0Kcq1THTzxl3ZxFe22zlkbLHAy/AmHUT2rWUaBM5iZZFbQAa1PNvqFksO4wNuhoHpYdzHAvzJMRIw/hgwqtDVp8/MDyHkPM44GTiW97lfP6H61bxevAlmzbSdgKViRId+q2OeRZizSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648455038; 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=nsTdE8qfoqWvwYXDEjnkJHwLsv+rilseZOiQpZS/V7E=; b=Wg9k8YXMmC0sKR0m5PtNkCXF0eGanQv0oGfeDVR9PSL+YdN3qT9hQ+umv16L27TEgurGC0q4tFXY25+g7/I0D8jG/OGjEt/aVRLM5dPqZc47K2uTTjMLhbr6g6esDb+aFVCFw4P+hof4u8P1a40hKU6EjmjG7hByh0FJXDmtb4k= 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+88126+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 164845503867569.70441688607218; Mon, 28 Mar 2022 01:10:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6sMnYY1788612xOTtGw6GVAt; Mon, 28 Mar 2022 01:10:38 -0700 X-Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web12.8487.1648455017030517745 for ; Mon, 28 Mar 2022 01:10:37 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10299"; a="257771385" X-IronPort-AV: E=Sophos;i="5.90,216,1643702400"; d="scan'208";a="257771385" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 01:10:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,216,1643702400"; d="scan'208";a="563428553" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.175.167]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2022 01:10: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 V11 37/47] UefiCpuPkg: Update AddressEncMask in CpuPageTable Date: Mon, 28 Mar 2022 16:08:16 +0800 Message-Id: <1c3df6874e1d74f7946c53b09a83d6a1707dffa6.1648454441.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: L9Zi2EOilvRx0tcxIcvjFWjhx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1648455038; bh=oiLB8hWIhV/68kMzKVmpZSl4H4u7GWE6eEuTVjCRoBE=; h=Cc:Date:From:Reply-To:Subject:To; b=ge+7ebxMBPLvfbLnbhzxMHkZsv0cWZJtF4WRJtVgXPQjumnW51fvWqF/p0QG59+R6Jn zKMYoT4MTWjDrtkaeGO67i8vyom3ziwayq4CDNb0q9rbhVIKCeDt/vW4g+/s0ivIVLNhr ZFzWWmlwbE1pFfEbYmBCP3BBQ67jgCXCnB0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1648455039919100009 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 (#88126): https://edk2.groups.io/g/devel/message/88126 Mute This Topic: https://groups.io/mt/90080014/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-