summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnkur Arora <ankur.a.arora@oracle.com>2021-03-11 22:26:56 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-03-16 13:21:46 +0000
commitf3bdfc41866edf7c256e689deb9d091a950c8fca (patch)
treec107db278ba2ac9346489ac3f08ece1ac113e8df
parentf0532888630226db321c5fa30e53db5018a0b74d (diff)
downloadedk2-f3bdfc41866edf7c256e689deb9d091a950c8fca.tar.gz
edk2-f3bdfc41866edf7c256e689deb9d091a950c8fca.tar.bz2
edk2-f3bdfc41866edf7c256e689deb9d091a950c8fca.zip
OvmfPkg/SmmControl2Dxe: negotiate CPU hot-unplug
Advertise OVMF support for CPU hot-unplug and negotiate it if QEMU requests the feature. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Aaron Young <aaron.young@oracle.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132 Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com> Message-Id: <20210312062656.2477515-11-ankur.a.arora@oracle.com> [lersek@redhat.com: preserve the empty line between the ICH9_LPC_SMI_F_* group of macro definitions and the SCRATCH_BUFFER type definition] Reviewed-by: Laszlo Ersek <lersek@redhat.com>
-rw-r--r--OvmfPkg/SmmControl2Dxe/SmiFeatures.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
index c9d8755432..bd0653e6b1 100644
--- a/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
+++ b/OvmfPkg/SmmControl2Dxe/SmiFeatures.c
@@ -28,6 +28,12 @@
// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.
//
#define ICH9_LPC_SMI_F_CPU_HOTPLUG BIT1
+//
+// The following bit value stands for "enable CPU hot-unplug, and inject an SMI
+// with control value ICH9_APM_CNT_CPU_HOTPLUG upon hot-unplug", in the
+// "etc/smi/supported-features" and "etc/smi/requested-features" fw_cfg files.
+//
+#define ICH9_LPC_SMI_F_CPU_HOT_UNPLUG BIT2
//
// Provides a scratch buffer (allocated in EfiReservedMemoryType type memory)
@@ -112,7 +118,8 @@ NegotiateSmiFeatures (
QemuFwCfgReadBytes (sizeof mSmiFeatures, &mSmiFeatures);
//
- // We want broadcast SMI, SMI on CPU hotplug, and nothing else.
+ // We want broadcast SMI, SMI on CPU hotplug, SMI on CPU hot-unplug
+ // and nothing else.
//
RequestedFeaturesMask = ICH9_LPC_SMI_F_BROADCAST;
if (!MemEncryptSevIsEnabled ()) {
@@ -120,6 +127,7 @@ NegotiateSmiFeatures (
// For now, we only support hotplug with SEV disabled.
//
RequestedFeaturesMask |= ICH9_LPC_SMI_F_CPU_HOTPLUG;
+ RequestedFeaturesMask |= ICH9_LPC_SMI_F_CPU_HOT_UNPLUG;
}
mSmiFeatures &= RequestedFeaturesMask;
QemuFwCfgSelectItem (mRequestedFeaturesItem);
@@ -166,6 +174,13 @@ NegotiateSmiFeatures (
__FUNCTION__));
}
+ if ((mSmiFeatures & ICH9_LPC_SMI_F_CPU_HOT_UNPLUG) == 0) {
+ DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug not negotiated\n", __FUNCTION__));
+ } else {
+ DEBUG ((DEBUG_INFO, "%a: CPU hot-unplug with SMI negotiated\n",
+ __FUNCTION__));
+ }
+
//
// Negotiation successful (although we may not have gotten the optimal
// feature set).