From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web11.7046.1682066202952586572 for ; Fri, 21 Apr 2023 01:36:43 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=TuuCAEpT; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682066202; x=1713602202; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=F0Dfpe4xt6C6DinDnROoyGYNafCYjQAts3mR/GAr3ZM=; b=TuuCAEpTeZWuqL84g8O/6yDWiG1istrTWl9DfEL9RKBCImaGsB86ql3Y 1VDpdZYjA/l7tF42nGZKge7yyP9OX4rPiABXWrBrcdP8szm1o1801nxDu ftQUAmOxfzhCw+cGjEUNcsO+Ttp/cYzI0f+Swe7jgBIQygFBz6cZNk3AJ bOaYw6nKgtg3P3eQEIRoyXUX3uSCsolwYewMacrXw3vvfxhrdbNkMxG3K B0cFmAW29tgFw54hc+CeRRgSnzzLNB8MEbGUKKQ5B2bHd5RpkEqXNDqCU FMw1OnodQ+McZEyi9ar+ZkAqx2UoCHE5Jrtb/30CX3RCjgRqwN2MDtbV6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="373869579" X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="373869579" 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:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="669650446" X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="669650446" 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:41 -0700 From: "duntan" To: devel@edk2.groups.io Subject: [Patch V3 00/11] Use CpuPageTableLib to create and update smm page table Date: Fri, 21 Apr 2023 16:36:17 +0800 Message-Id: <20230421083628.1408-1-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In V3 patch set: 1.Add a new patch 'Remove code that apply AddressEncMask to non-leaf entry'. This patch is to avoid apply AddressEncMask to non-leaf entry when split smm page table. 2.Add two new patches to clear CR0.WP before modify smm page table when ReadyToLock. This is because FvbServicesSmm driver may set a part of smm page table memory as RO before ReadyToLock. With these three patches, this patch set successfully boots an SEV guest with SMM enabled. Dun Tan (11): OvmfPkg: Add CpuPageTableLib required by PiSmmCpuDxe UefiPayloadPkg: Add CpuPageTableLib required by PiSmmCpuDxe OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry UefiCpuPkg: Use CpuPageTableLib to convert SMM paging attribute. UefiCpuPkg/PiSmmCpuDxeSmm: Avoid setting non-present range to RO/NX UefiCpuPkg: Extern mSmmShadowStackSize in PiSmmCpuDxeSmm.h UefiCpuPkg/PiSmmCpuDxeSmm: Add 2 function to disable/enable CR0.WP UefiCpuPkg/PiSmmCpuDxeSmm: Clear CR0.WP before modify page table UefiCpuPkg: Refinement to current smm page table generation code UefiCpuPkg: Refinement to code about updating smm page table UefiCpuPkg/PiSmmCpuDxeSmm: Remove unnecessary function OvmfPkg/CloudHv/CloudHvX64.dsc | 2 +- OvmfPkg/Library/BaseMemEncryptSevLib/X64/PeiDxeVirtualMemory.c | 6 +++--- OvmfPkg/OvmfPkgIa32.dsc | 3 ++- OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- OvmfPkg/OvmfPkgX64.dsc | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 5 +++-- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c | 3 +-- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmProfileArch.c | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 132 ------------------------------------------------------------------------------------------------------------------------------------ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 8 ++++++-- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 755 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 229 ++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 3 +-- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c | 19 ++----------------- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- 18 files changed, 618 insertions(+), 1028 deletions(-) -- 2.39.1.windows.1