The Quark_EDKII_v1.1.0/IA32FamilyCpuBasePkg/CpuArchDxe
driver applies any MTRR changes to APs, if the EFI_MP_SERVICES_PROTOCOL is available. We should do the same; port it to UefiCpuPkg. The broadcast should occur even if PcdCpuSyncMtrrToAcpiNvs is set to FALSE; in that case we just use a local MTRR_SETTINGS buffer, rather than the firmware-wide "mMtrrTable" object. Cc: Jeff Fan <jeff....@intel.com> Cc: Chen Fan <chen.fan.f...@cn.fujitsu.com> Cc: Jordan Justen <jordan.l.jus...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- UefiCpuPkg/CpuDxe/CpuDxe.c | 46 +++++++++++++++++--- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 3d11807..269f834 100644 --- a/UefiCpuPkg/CpuDxe/CpuDxe.c +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c @@ -407,11 +407,47 @@ CpuSetMemoryAttributes ( ); if (!RETURN_ERROR (Status)) { - if (FeaturePcdGet (PcdCpuSyncMtrrToAcpiNvs)) { - // - // Sync saved MTRR settings - // - MtrrGetAllMtrrs (mMtrrTable); + MTRR_SETTINGS *SyncToBuffer; + MTRR_SETTINGS LocalBuffer; + EFI_STATUS MpStatus; + EFI_MP_SERVICES_PROTOCOL *MpService; + + SyncToBuffer = + FeaturePcdGet (PcdCpuSyncMtrrToAcpiNvs) ? mMtrrTable : &LocalBuffer; + MpStatus = gBS->LocateProtocol ( + &gEfiMpServiceProtocolGuid, + NULL, + (VOID **) &MpService + ); + + // + // Sync saved MTRR settings if (a) we have to reflect them to AcpiNVS, or + // (b) broadcast them to APs, or (c) both. + // + if (FeaturePcdGet (PcdCpuSyncMtrrToAcpiNvs) || !EFI_ERROR (MpStatus)) { + MtrrGetAllMtrrs (SyncToBuffer); + } + + // + // Synchronize the update with all APs + // + if (!EFI_ERROR (MpStatus)) { + MpStatus = MpService->StartupAllAPs ( + MpService, // This + LoadMtrrData, // Procedure + TRUE, // SingleThread + NULL, // WaitEvent + 0, // TimeoutInMicrosecsond + SyncToBuffer, // ProcedureArgument + NULL // FailedCpuList + ); + if (MpStatus == EFI_NOT_STARTED) { + // + // If no enabled APs exit in the system, return success + // + MpStatus = EFI_SUCCESS; + } + ASSERT_EFI_ERROR (MpStatus); } } return (EFI_STATUS) Status; -- 1.8.3.1 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel