From nobody Mon Feb 9 03:13:37 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+103387+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+103387+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1682066214; cv=none; d=zohomail.com; s=zohoarc; b=K/T7QULfYhfRg4znOu1tHk7aunQmXi6FrluErZY2M+ZBOFi53m872ihoRKrx1kWo/iSZ5sRpOD96UkCtkMANjANO3glK18Qbb/HlrWX3TCtoC1DEz5aJxNFcMq5XZfmi7sSn79s29UmquR2zrNA5lYBwrESIZBWsDyWp3PxV5Tw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682066214; 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=Quat2np0Kc1/oGZbRGhgeybTRwPJz0J7owjNsknZIn0=; b=gdpXVY5uleeGHCU8SttRFx2Ibwqi44Q1tTSDI0aPnN5sivAf/vqvr9XSdqNmSvdINZf68/1b15B+kkqaoPA4SHN6HkFNuU8SiweiSRfuWrlRqngyefAtR7n7CB0jFmgTNmNY6rwj1L8rDlBKin/+R27pcYrRQHBXKW3P5fQvVEE= 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+103387+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 1682066214832989.7846569309951; Fri, 21 Apr 2023 01:36:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oDtMYY1788612xFU3ZZRj8vx; Fri, 21 Apr 2023 01:36:54 -0700 X-Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.7047.1682066213863432703 for ; Fri, 21 Apr 2023 01:36:53 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="373869677" X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="373869677" X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2023 01:36:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="669650464" X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="669650464" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.92]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2023 01:36:51 -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 V3 03/11] OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry Date: Fri, 21 Apr 2023 16:36:20 +0800 Message-Id: <20230421083628.1408-4-dun.tan@intel.com> In-Reply-To: <20230421083628.1408-1-dun.tan@intel.com> References: <20230421083628.1408-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: 2Pff6W76MkjmMbC1kuoF6uX8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1682066214; bh=PDfHsUCEcVGkKNn3TZzXPoeN72QWdG9DziVd75LZxqA=; h=Cc:Date:From:Reply-To:Subject:To; b=wjhI6Xc912Ht5IOmq4m7JC5Zhc+T74TfzO0uxU0FK/w3mQK/p6GDOWq9v2VFX/RlC8c jzkrfq2ehfKNZUDYkRcglkSreeIbKxwNUH7QfDTxQQYAj89kMgvwG/YebQ2OwS22BjD3j yn91BMs2rwpNhfEI+uzVOms1g4uvEtxitJw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1682066215738100001 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 --- 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 a1f6e61c1e..f2b821f6d9 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.39.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 (#103387): https://edk2.groups.io/g/devel/message/103387 Mute This Topic: https://groups.io/mt/98406586/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-