From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.80768.1673594263982383415 for ; Thu, 12 Jan 2023 23:17:44 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=XY5Scxoe; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: jiaxin.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673594263; x=1705130263; h=from:to:subject:date:message-id; bh=GkmlqvykQ4uAHNmBLKo3QlQiorRA27fjNrLfO4IrfCw=; b=XY5ScxoeiWugOB5YYT2CMMAcSLPm/11CQkr9xTzNoJqSfT9mE+G75eki o0RPqpad7y9CC/mZTIDT4fVTZY8dkrxZAquzWmFK/jQj57UCAdXJ7yd1Y +eeViJuPQ1YvB/V5se1P2sc8HfuAco81qWwCStMa/xedh8GF0E2IMnm4b o8gg9fmoefKcov/QMTiLog0Dxv8yf6J6xDQyGdXtsMaqpLigZ6rCiN7a7 lacdpzGHR2srq79EHB1eUwCt1Hqtl8+/mzecJKsyHr+A5tzdjSrhaDwO+ gxqK1rQ+mSx/bTTsBcda6xsR3C6Mtq1bYW02e9uE7Hn/rZexRLOb+PaA8 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="410169713" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="410169713" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 23:17:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="688646167" X-IronPort-AV: E=Sophos;i="5.97,213,1669104000"; d="scan'208";a="688646167" Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.79]) by orsmga008.jf.intel.com with ESMTP; 12 Jan 2023 23:17:42 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Subject: [PATCH v1 0/4] Support SMM Relocated SmBase handling Date: Fri, 13 Jan 2023 15:17:34 +0800 Message-Id: <20230113071738.15868-1-jiaxin.wu@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Below serial patches are to support the SMM Relocated SmBase handling. To achieve, new hob interface is procuded, and will be consumed by SMM CPU driver & SmmCpuFeaturesLib to do SmBase initialization: The Smm Base HOB is used to store the relocated SmBase in array for each Processors. If gSmmBaseHobGuid produced, indicate SmBase for each Processors have been relocated. The SmBase address in hob can be guaranteed the SMRAM state save areas for all processors do not overlap. SMM CPU driver will retrieve the SMBASE addresses from SMM Base Hob and installs the SMI handler at [SMBASE+8000h] for each processor instead of relocating SMM Base addresses from SMRAM again. With SMM Base Hob, SMM CPU driver does not need the RSM instruction to reload the SMBASE register with the new allocated value in SMBASE field each time it exits SMM. SMBASE Register for each processors have already been programmed in parallel since the same default SMBASE Address(0x30000) is not used, thus the CPUs over-writing each other's SMM Save State Area will not happen. This way will save boot time on multi-core system. Beside, If gSmmBaseHobGuid found, no need to do the relocation in SmmCpuFeaturesInitializeProcessor(). Jiaxin Wu (4): UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info UefiCpuPkg/SmmCpuFeaturesLib: Skip to configure SMBASE OvmfPkg/SmmCpuFeaturesLib: Skip to configure SMBASE .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 39 ++++-- .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 4 + UefiCpuPkg/Include/Guid/SmmBaseHob.h | 51 +++++++ .../Library/SmmCpuFeaturesLib/CpuFeaturesLib.h | 2 + .../SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c | 25 +++- .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 4 + .../SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf | 1 + UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmStm.c | 1 - .../StandaloneMmCpuFeaturesLib.inf | 4 + UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 40 +++++- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 25 +++- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 155 ++++++++++++++++----- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 21 ++- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/UefiCpuPkg.dec | 3 + 15 files changed, 318 insertions(+), 58 deletions(-) create mode 100644 UefiCpuPkg/Include/Guid/SmmBaseHob.h -- 2.16.2.windows.1