From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web08.4385.1615780753128561890 for ; Sun, 14 Mar 2021 20:59:13 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: dandan.bi@intel.com) IronPort-SDR: UScd7LoOCq4m6UkEVnsKKnC4SO2CkBlfxuVopHWwprhYvjXTd1bU7YjuNqu0TYsusKy0QUT+hR vHRZEPZNla7w== X-IronPort-AV: E=McAfee;i="6000,8403,9923"; a="186653227" X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="186653227" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2021 20:59:03 -0700 IronPort-SDR: OW5lMLOpLmpgb1BuSgoi4cgYYtzk7JJiOwNon+Rgvpf1y6njkaUA/h3QY4/QYrBya6Q1HIuPFu VCBNSz4BE5Xg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="373297904" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.154.141]) by orsmga006.jf.intel.com with ESMTP; 14 Mar 2021 20:59:00 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Andrew Fish , Leif Lindholm , Laszlo Ersek , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [patch 00/28] Add a new library class RegisterFilterLib in edk2 to filter/trace port IO/MMIO/MSR access Date: Mon, 15 Mar 2021 11:58:16 +0800 Message-Id: <20210315035844.32756-1-dandan.bi@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3246 RFC: https://edk2.groups.io/g/devel/message/72530 Patch 1 is to add RegisterFilterLib Library Class in edk2 to filter/trace port IO/MMIO/MSR access and add a RegisterFilterLibNull instance. Last 2 patches are to update APIs in IoLib and BaseLib to filter/trace port IO/MMIO/MSR access. Remaining patches are to update related dsc files to consume RegisterFilterLibNull instance. Will submit patch 1 firstly and then update related dsc files in edk2 and edk2platform repo to consume RegisterFilterLibNull instance. At last will submit the patches to update IoLib and BaseLib to filter/trace port IO/MMIO/MSR access. Cc: Andrew Fish Cc: Leif Lindholm Cc: Laszlo Ersek Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Dandan Bi (28): MdePkg: Add RegisterFilterLib class and NULL instance ArmPkg: Consume RegisterFilterLibNull instance ArmPlatformPkg: Consume RegisterFilterLibNull instance ArmVirtPkg: Consume RegisterFilterLibNull instance CryptoPkg: Consume RegisterFilterLibNull instance DynamicTablesPkg: Consume RegisterFilterLibNull instance EmbeddedPkg: Consume RegisterFilterLibNull instance EmulatorPkg: Consume RegisterFilterLibNull instance FatPkg: Consume RegisterFilterLibNull instance FmpDevicePkg: Consume RegisterFilterLibNull instance IntelFsp2Pkg: Consume RegisterFilterLibNull instance IntelFsp2WrapperPkg: Consume RegisterFilterLibNull instance MdeModulePkg: Consume RegisterFilterLibNull instance MdePkg: Consume RegisterFilterLibNull instance NetworkPkg: Consume RegisterFilterLibNull instance OvmfPkg: Consume RegisterFilterLibNull instance PcAtChipsetPkg: Consume RegisterFilterLibNull instance RedfishPkg: Consume RegisterFilterLibNull instance SecurityPkg: Consume RegisterFilterLibNull instance ShellPkg: Consume RegisterFilterLibNull instance SignedCapsulePkg: Consume RegisterFilterLibNull instance SourceLevelDebugPkg: Consume RegisterFilterLibNull instance StandaloneMmPkg: Consume RegisterFilterLibNull instance UefiCpuPkg: Consume RegisterFilterLibNull instance UefiPayloadPkg: Consume RegisterFilterLibNull instance UnitTestFrameworkPkg: Consume RegisterFilterLibNull instance MdePkg/IoLib: Filter/trace port IO/MMIO access MdePkg/Baseib: Filter/trace MSR access for IA32/X64 ArmPkg/ArmPkg.dsc | 1 + ArmPlatformPkg/ArmPlatformPkg.dsc | 1 + ArmVirtPkg/ArmVirt.dsc.inc | 1 + CryptoPkg/CryptoPkg.dsc | 1 + DynamicTablesPkg/DynamicTablesPkg.dsc | 1 + EmbeddedPkg/EmbeddedPkg.dsc | 1 + EmulatorPkg/EmulatorPkg.dsc | 1 + FatPkg/FatPkg.dsc | 1 + FmpDevicePkg/FmpDevicePkg.dsc | 1 + IntelFsp2Pkg/IntelFsp2Pkg.dsc | 1 + IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dsc | 1 + MdeModulePkg/MdeModulePkg.dsc | 1 + MdePkg/Include/Library/RegisterFilterLib.h | 225 ++++++++++++++++ .../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 3 +- .../BaseIoLibIntrinsicArmVirt.inf | 3 +- .../BaseIoLibIntrinsicInternal.h | 3 +- .../BaseIoLibIntrinsicSev.inf | 3 +- MdePkg/Library/BaseIoLibIntrinsic/IoLib.c | 95 +++++-- .../Library/BaseIoLibIntrinsic/IoLibArmVirt.c | 82 +++++- MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c | 58 +++- MdePkg/Library/BaseIoLibIntrinsic/IoLibMsc.c | 81 ++++-- MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c | 74 ++++- MdePkg/Library/BaseLib/BaseLib.inf | 5 +- MdePkg/Library/BaseLib/Ia32/GccInlinePriv.c | 36 ++- MdePkg/Library/BaseLib/Ia32/ReadMsr64.c | 38 ++- MdePkg/Library/BaseLib/Ia32/WriteMsr64.c | 22 +- MdePkg/Library/BaseLib/X64/GccInlinePriv.c | 41 ++- MdePkg/Library/BaseLib/X64/ReadMsr64.c | 15 +- MdePkg/Library/BaseLib/X64/WriteMsr64.c | 13 +- .../RegisterFilterLibNull.c | 253 ++++++++++++++++++ .../RegisterFilterLibNull.inf | 23 ++ .../RegisterFilterLibNull.uni | 13 + MdePkg/MdePkg.dec | 7 +- MdePkg/MdePkg.dsc | 5 +- NetworkPkg/NetworkPkg.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfXen.dsc | 1 + PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 + RedfishPkg/RedfishPkg.dsc | 1 + SecurityPkg/SecurityPkg.dsc | 1 + ShellPkg/ShellPkg.dsc | 1 + SignedCapsulePkg/SignedCapsulePkg.dsc | 1 + SourceLevelDebugPkg/SourceLevelDebugPkg.dsc | 1 + StandaloneMmPkg/StandaloneMmPkg.dsc | 1 + UefiCpuPkg/UefiCpuPkg.dsc | 1 + UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + .../UnitTestFrameworkPkgTarget.dsc.inc | 1 + 49 files changed, 1008 insertions(+), 117 deletions(-) create mode 100644 MdePkg/Include/Library/RegisterFilterLib.h create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.c create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf create mode 100644 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.uni -- 2.18.0.windows.1