From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.17915.1684231210780691710 for ; Tue, 16 May 2023 03:00:11 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Dup5ZooI; spf=pass (domain: intel.com, ip: 134.134.136.100, 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=1684231211; x=1715767211; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=InX2agibThkJwxRSP6/4LU99LyLS2P/SA/iQDTJ/0EA=; b=Dup5ZooIvg0/3NEr9neJUC14bKByEpniG3nIRlRrW9H5hoHmFvyFuDPC XWjujnyoQis7jiK0q8eMoMC3WoCRvtFisbRhkziVePYIafOS6UuhBKBZS LqNrth/CQL6TwxrkwRxJL5ql90KG5BzLKeOx9ohP+Xg9zI0N95hTYaGRV TR8N8EV10CGnG3D5ch/0gM5bK1vBvIkP1azsyxOtO5hxuLe+ks1NlEy3K cMuR31lvi92qA8m0qVQneMXCPiOygq0cNkKvPT+lTbmLQxfCEyT5cgjYb Raf6sOE/iP+eUgDoDRK5G1M4ucehLj6PHBdaehvJWPXPuwkqX5JR8/pkM A==; X-IronPort-AV: E=McAfee;i="6600,9927,10711"; a="417093123" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="417093123" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 03:00:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10711"; a="791019365" X-IronPort-AV: E=Sophos;i="5.99,278,1677571200"; d="scan'208";a="791019365" Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.158]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2023 03:00:09 -0700 From: "duntan" To: devel@edk2.groups.io Subject: [Patch V4 00/15] Use CpuPageTableLib to create and update smm page table Date: Tue, 16 May 2023 17:59:17 +0800 Message-Id: <20230516095932.1525-1-dun.tan@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In V4 patch set: 1.Add a new patch 'MdeModulePkg: Remove RO and NX protection when unset guard page' 2.Add a new patch 'UefiCpuPkg/PiSmmCpuDxeSmm: Clear CR0.WP before modify page table', the assumption that smm page table is always RW should be dropped. 3.Add DEBUG_CODE in 'UefiCpuPkg: Use CpuPageTableLib to convert SMM paging attribute.' to indicate that when mapping a range to present and EFI_MEMORY_RO or EFI_MEMORY_XP is not specificed, existing Present range in input range is set to NX disable and ReadOnly. 4.Sort mSmmCpuSmramRanges and mProtectionMemRange in seperate patches. 5.Seperate patches for creating smm runtime page table and smm s3 page table. Dun Tan (15): OvmfPkg: Add CpuPageTableLib required by PiSmmCpuDxe UefiPayloadPkg: Add CpuPageTableLib required by PiSmmCpuDxe OvmfPkg:Remove code that apply AddressEncMask to non-leaf entry MdeModulePkg: Remove RO and NX protection when unset guard page UefiCpuPkg: Use CpuPageTableLib to convert SMM paging attribute. UefiCpuPkg/PiSmmCpuDxeSmm: Avoid setting non-present range to RO/NX UefiCpuPkg/PiSmmCpuDxeSmm: Add 2 function to disable/enable CR0.WP UefiCpuPkg/PiSmmCpuDxeSmm: Clear CR0.WP before modify page table UefiCpuPkg: Extern mSmmShadowStackSize in PiSmmCpuDxeSmm.h UefiCpuPkg: Add GenSmmPageTable() to create smm page table UefiCpuPkg: Use GenSmmPageTable() to create Smm S3 page table UefiCpuPkg: Sort mSmmCpuSmramRanges in FindSmramInfo UefiCpuPkg: Sort mProtectionMemRange when ReadyToLock UefiCpuPkg: Refinement to smm runtime InitPaging() code UefiCpuPkg/PiSmmCpuDxeSmm: Remove unnecessary function MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 2 +- 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 | 43 +++++++++++++++++++++++++++++++++++++++++-- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 801 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 231 +++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 3 +-- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmProfileArch.c | 19 ++----------------- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- 19 files changed, 683 insertions(+), 1024 deletions(-) -- 2.31.1.windows.1