summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-11-30 20:06:34 +0100
committerLaszlo Ersek <lersek@redhat.com>2017-02-07 12:27:19 +0100
commita316d7ac91d302085b5c35d76db703f2208ec026 (patch)
tree51c4b0a0f2198179aabd5c83977b4c2e0e04c7c3 /OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
parent22d7be69c45ecc7ce2b21252710c37be7122c1bd (diff)
downloadedk2-a316d7ac91d302085b5c35d76db703f2208ec026.tar.gz
edk2-a316d7ac91d302085b5c35d76db703f2208ec026.tar.bz2
edk2-a316d7ac91d302085b5c35d76db703f2208ec026.zip
OvmfPkg/SmmControl2Dxe: select broadcast SMI if available
When writing to IO port 0xB2 (ICH9_APM_CNT), QEMU by default injects an SMI only on the VCPU that is writing the port. This has exposed corner cases and strange behavior with edk2 code, which generally expects a software SMI to affect all CPUs at once. We've experienced instability despite the fact that OVMF sets PcdCpuSmmApSyncTimeout and PcdCpuSmmSyncMode differently from the UefiCpuPkg defaults, such that they match QEMU's unicast SMIs better. (Refer to edk2 commits 9b1e378811ff and bb0f18b0bce6.) Using the new fw_cfg-based SMI feature negotiation in QEMU (see commits 50de920b372b "hw/isa/lpc_ich9: add SMI feature negotiation via fw_cfg" and 5ce45c7a2b15 "hw/isa/lpc_ich9: add broadcast SMI feature"), we can ask QEMU to broadcast SMIs. Extensive testing from earlier proves that broadcast SMIs are only reliable if we use the UefiCpuPkg defaults for the above PCDs. With those settings however, the broadcast is very reliable -- the most reliable configuration encountered thus far. Therefore negotiate broadcast SMIs with QEMU, and if the negotiation is successful, dynamically revert the PCDs to the UefiCpuPkg defaults. Setting the PCDs in this module is safe: - only PiSmmCpuDxeSmm consumes them, - PiSmmCpuDxeSmm is a DXE_SMM_DRIVER, launched by the SMM_CORE (MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf), - the SMM_CORE is launched by the SMM IPL runtime DXE driver (MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf), - the SMM IPL has a DEPEX on EFI_SMM_CONTROL2_PROTOCOL, - OvmfPkg/SmmControl2Dxe produces that protocol. The end result is that PiSmmCpuDxeSmm cannot be dispatched before SmmControl2Dxe installs EFI_SMM_CONTROL2_PROTOCOL and returns from its entry point. Hence we can set the PCD's consumed by PiSmmCpuDxeSmm in SmmControl2Dxe. Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=230 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf')
-rw-r--r--OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf8
1 files changed, 8 insertions, 0 deletions
diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
index 0e9f98c287..31c80bd444 100644
--- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
+++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf
@@ -39,16 +39,20 @@
#
[Sources]
+ SmiFeatures.h
+ SmiFeatures.c
SmmControl2Dxe.c
[Packages]
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses]
BaseLib
DebugLib
IoLib
+ MemoryAllocationLib
PcdLib
PciLib
QemuFwCfgLib
@@ -59,6 +63,10 @@
gEfiS3SaveStateProtocolGuid ## SOMETIMES_CONSUMES
gEfiSmmControl2ProtocolGuid ## PRODUCES
+[Pcd]
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmApSyncTimeout ## SOMETIMES_PRODUCES
+ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode ## SOMETIMES_PRODUCES
+
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire