On 10/15/15 00:26, Laszlo Ersek wrote:
> From: Paolo Bonzini <[email protected]>
>
> Port 0xb2 on QEMU only sends an SMI to the currently executing processor.
> The SMI handler, however, and in particular SmmWaitForApArrival, currently
> expects that SmmControl2DxeTrigger triggers an SMI IPI on all processors
> rather than just the BSP. Thus all SMM invocations loop for a second (the
> default value of PcdCpuSmmApSyncTimeout) before SmmWaitForApArrival sends
> another SMI IPI to the APs.
>
> With the default SmmCpuFeaturesLib, 32-bit machines must broadcast SMIs
> because 32-bit machines must reset the MTRRs on each entry to system
> management modes (they have no SMRRs). However, our virtual platform
> does not have problems with cacheability of SMRAM, so we can use "directed"
> SMIs instead. To do this, just set
> gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode
> to 1 (aka SmmCpuSyncModeRelaxedAp). This fixes SMM on multiprocessor virtual
> machines.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Paolo Bonzini <[email protected]>
> ---
>
> Notes:
> v3:
> - new in v3
>
> OvmfPkg/OvmfPkgIa32.dsc | 4 ++++
> OvmfPkg/OvmfPkgIa32X64.dsc | 4 ++++
> OvmfPkg/OvmfPkgX64.dsc | 4 ++++
> 3 files changed, 12 insertions(+)
>
I plan to drop this patch, dependent on testing, and on how a new QEMU
patch I've written will be received on qemu-devel.
That QEMU patch implements a possibility for broadcast SMIs. I've modified
[edk2] [PATCH v3 13/52] OvmfPkg: implement EFI_SMM_CONTROL2_PROTOCOL
with a DXE_RUNTIME_DRIVER
accordingly (so that its Trigger() function requests the broadcast SMI
from QEMU).
Thus far it works great; in my TCG Fedlet guest, 32-bit, 2 VCPUs,
variable access is similarly fast regardless of BSP vs. AP. (Running
"efibootmgr" exclusively on the AP has fallen from 30+ seconds to 4-5
seconds, which is consistent with the BSP's time.)
I'll do some more testing (64-bit TCG, maybe KVM too).
Thanks
Laszlo
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index f115ce5..263d4d0 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -398,6 +398,10 @@ [PcdsFixedAtBuild]
> gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04,
> 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
> !endif
>
> +!if $(SMM_REQUIRE) == TRUE
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
> +!endif
> +
> !if $(SECURE_BOOT_ENABLE) == TRUE
> # override the default values from SecurityPkg to ensure images from all
> sources are verified in secure boot
> gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 4949028..8101d91 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -404,6 +404,10 @@ [PcdsFixedAtBuild]
> !endif
>
> [PcdsFixedAtBuild.X64]
> +!if $(SMM_REQUIRE) == TRUE
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
> +!endif
> +
> !if $(SECURE_BOOT_ENABLE) == TRUE
> # override the default values from SecurityPkg to ensure images from all
> sources are verified in secure boot
> gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 4095ce9..0482232 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -403,6 +403,10 @@ [PcdsFixedAtBuild]
> gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04,
> 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
> !endif
>
> +!if $(SMM_REQUIRE) == TRUE
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmSyncMode|0x01
> +!endif
> +
> !if $(SECURE_BOOT_ENABLE) == TRUE
> # override the default values from SecurityPkg to ensure images from all
> sources are verified in secure boot
> gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
>
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel