From nobody Tue Feb 10 19:14:44 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+105894+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+105894+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686191305; cv=none; d=zohomail.com; s=zohoarc; b=XX2+3Unpyoz8yhTCsO1fPhxGrt57J7pDRZZPtcrW5dscZxlu1oaK5IJXUOVi8B42IhXg3/jL5+Au3t07R5aR16bSRBk0Lv7YqElQWXoevGu3uf+BKokODgWMtKvQwgpE4/4RKGTItgqYBhiNUTF6mg96qVpH+8um9v34EEZqVsg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686191305; 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=udyWx09mBPhLRspIH4+oMWICSHDub48P3pcD97BFGww=; b=ap+NFXtm3kP3Nb7R1uwMX86y1K7uWgZ9PfBR2qMhd4ZYJayetg9hB5gssJhaXbX3xCn6MVUO8OK4wFC3/Wg2aOODn7OeCG92vJxPRanmiozmWryO4aXUiXeznQ4Pq+Ht5/7p28W3pBxjN/yC3/D3idt4g1BAHK+QhmMPQqUnP0I= 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+105894+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 168619130510176.92905999079426; Wed, 7 Jun 2023 19:28:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JPjNYY1788612xvkydTsUP3Q; Wed, 07 Jun 2023 19:28:24 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.377.1686191300320666390 for ; Wed, 07 Jun 2023 19:28:24 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="357184164" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="357184164" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 19:28:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="774877674" X-IronPort-AV: E=Sophos;i="6.00,225,1681196400"; d="scan'208";a="774877674" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.158]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 19:28:21 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Tom Lendacky , Ray Ni Subject: [edk2-devel] [Patch V5 01/14] OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry Date: Thu, 8 Jun 2023 10:27:29 +0800 Message-Id: <20230608022742.1292-2-dun.tan@intel.com> In-Reply-To: <20230608022742.1292-1-dun.tan@intel.com> References: <20230608022742.1292-1-dun.tan@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,dun.tan@intel.com X-Gm-Message-State: 9qATUyzkvMghzNIlaJT3gZAlx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686191304; bh=cGvkEF8cMFgkOtHyS38utXClLx+RR8MhG9ZmvzHuCH0=; h=Cc:Date:From:Reply-To:Subject:To; b=d95AqAn40BqtKmJjA+FASKnxCihbZJHTjMxh+hdbX6DhFlZI79Z9/1p+9C4nLblXMUQ YMQNW3V0f2cSBLYXv6uehLlKry5XQ0zOmNYeHfwFL9jIyy6PUHDOl8HlMfpns0at9QI6x bi30/viu7Izj7ctvVzD0mx8WwuPiFWN5JDc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686191307089100003 Content-Type: text/plain; charset="utf-8" Remove code that apply AddressEncMask to non-leaf entry when split smm page table by MemEncryptSevLib. In FvbServicesSmm driver, it calls MemEncryptSevClearMmioPageEncMask to clear AddressEncMask bit in page table for a specific range. In AMD SEV feature, this AddressEncMask bit in page table is used to indicate if the memory is guest private memory or shared memory. But all memory used by page table are treated as encrypted regardless of encryption bit. So remove the EncMask bit for smm non-leaf page table entry doesn't impact AMD SEV feature. If page split happens in the AddressEncMask bit clear process, there will be some new non-leaf entries with AddressEncMask applied in smm page table. When ReadyToLock, code in PiSmmCpuDxe module will use CpuPageTableLib to modify smm page table. So remove code to apply AddressEncMask for new non-leaf entries since CpuPageTableLib doesn't consume the EncMask PCD. Signed-off-by: Dun Tan Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Tom Lendacky Cc: Ray Ni Acked-by: Gerd Hoffmann Reviewed-by: Ray Ni Tested-by: Gerd Hoffmann --- OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c= b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c index cf2441b551..aba2e8c081 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c @@ -233,7 +233,7 @@ Split2MPageTo4K ( // Fill in 2M page entry. // *PageEntry2M =3D ((UINT64)(UINTN)PageTableEntry1 | - IA32_PG_P | IA32_PG_RW | AddressEncMask); + IA32_PG_P | IA32_PG_RW); } =20 /** @@ -352,7 +352,7 @@ SetPageTablePoolReadOnly ( PhysicalAddress +=3D LevelSize[Level - 1]; } =20 - PageTable[Index] =3D (UINT64)(UINTN)NewPageTable | AddressEncMask | + PageTable[Index] =3D (UINT64)(UINTN)NewPageTable | IA32_PG_P | IA32_PG_RW; PageTable =3D NewPageTable; } @@ -440,7 +440,7 @@ Split1GPageTo2M ( // Fill in 1G page entry. // *PageEntry1G =3D ((UINT64)(UINTN)PageDirectoryEntry | - IA32_PG_P | IA32_PG_RW | AddressEncMask); + IA32_PG_P | IA32_PG_RW); =20 PhysicalAddress2M =3D PhysicalAddress; for (IndexOfPageDirectoryEntries =3D 0; --=20 2.31.1.windows.1 -=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 (#105894): https://edk2.groups.io/g/devel/message/105894 Mute This Topic: https://groups.io/mt/99399225/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-