From nobody Tue Feb 10 13:33:10 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+105969+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+105969+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686302227; cv=none; d=zohomail.com; s=zohoarc; b=ej0cN6Ib3BTS8MHY+8Z2a2wdaDT5rDKLyaGvSZ09bACv+4/6MWmAx+Q0Md81QDHTxT+WK77rJgH3hoA0YhB3ToOYHnMdNm/TAW7JIiu7jsHM0pq8Y7RhSB51FcHv2k/CaRowXmwvnXSM5g1rRmagtKeLbi0a/Sv7/BhNndEoO4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686302227; 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=1jF2wO7pDZcMhhCid16gzsxDxX7bfu3uM/5Kz1R8UmM=; b=NGbkVQNA6PAC9PcQd4gNnx0jUCnz4/4FR8QmXJIEwKVLRRLwKefKbqvuQQRbnowM9u75Gi3nAPtzQBJqNxMjfO8S4jISCn4ymEC1zpwnV1QsuvYObdUSJaTpmRSVxalFzl+KG3wA78KAIrtG6R/pZAPmIiR2z75OxV45JNBD9/w= 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+105969+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 1686302227856958.7909204705305; Fri, 9 Jun 2023 02:17:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zWjzYY1788612xwDoYyoIVaT; Fri, 09 Jun 2023 02:17:07 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.8934.1686302223831801951 for ; Fri, 09 Jun 2023 02:17:06 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="360914592" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="360914592" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 02:17:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="854679971" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="854679971" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.158]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 02:17:04 -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 V6 01/14] OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry Date: Fri, 9 Jun 2023 17:16:28 +0800 Message-Id: <20230609091629.798-2-dun.tan@intel.com> In-Reply-To: <20230609091629.798-1-dun.tan@intel.com> References: <20230609091629.798-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: lfDbIziPBLnKzKuTipTIpbQ7x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686302227; bh=p+S0RICxqvVjcmREdY9ELGUM7zpZUvfB2U6R0MVacdA=; h=Cc:Date:From:Reply-To:Subject:To; b=dsBxOOi9OvTcvXmpZWC1pSMhrD0AJJFQXSV2s+LYc7KZgWMR1YQ78VaQFfFYHDWuof8 F7Dxp+hW1F43DCk7X/SnSeWmGG87XUqYhTtlJGFD136LPky73o6bYBknet1I6hhiuJWAK x/rTYxL5mWsOmk3OrP4mEaHQT4ty0/Z6ZFk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686302229941100003 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 Reviewed-by: 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 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 (#105969): https://edk2.groups.io/g/devel/message/105969 Mute This Topic: https://groups.io/mt/99424819/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-