On 10/29/15 02:32, Jordan Justen wrote:
> By setting this PCD, we allow the CpuDxe driver to proceed earlier
> after all of the processors have started.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jordan Justen <[email protected]>
> Cc: Jeff Fan <[email protected]>
> Cc: Laszlo Ersek <[email protected]>
> ---
> OvmfPkg/OvmfPkgIa32.dsc | 2 ++
> OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++
> OvmfPkg/OvmfPkgX64.dsc | 2 ++
> OvmfPkg/PlatformPei/Platform.c | 17 +++++++++++++++++
> OvmfPkg/PlatformPei/PlatformPei.inf | 1 +
> 5 files changed, 24 insertions(+)
>
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 77fd21c..43b02ae 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -379,6 +379,8 @@
> gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|FALSE
> gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable|FALSE
>
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64
> +
>
> ################################################################################
> #
> # Components Section - list of all EDK II Modules needed by this Platform.
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 47cc311..f6360a6 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -385,6 +385,8 @@
> gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|FALSE
> gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable|FALSE
>
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64
> +
>
> ################################################################################
> #
> # Components Section - list of all EDK II Modules needed by this Platform.
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 44b9c79..e851df9 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -384,6 +384,8 @@
> gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|FALSE
> gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable|FALSE
>
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber|64
> +
Please add a dynamic default here for PcdCpuApInitTimeOutInMicroSeconds
as well (the declaration in UefiCpuPkg.dec allows that already). I think
the default can simply copy the UefiCpuPkg default, same as
PcdCpuMaxLogicalProcessorNumber does.
>
> ################################################################################
> #
> # Components Section - list of all EDK II Modules needed by this Platform.
> diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
> index a6d9616..f465f44 100644
> --- a/OvmfPkg/PlatformPei/Platform.c
> +++ b/OvmfPkg/PlatformPei/Platform.c
> @@ -306,6 +306,21 @@ NoexecDxeInitialization (
> }
>
> VOID
> +UpdateMaxNumberOfProcessors (
> + VOID
> + )
> +{
> + UINT32 MaxProcessors;
> +
> + if (QemuFwCfgIsAvailable ()) {
> + QemuFwCfgSelectItem (QemuFwCfgItemSmpCpuCount);
> + MaxProcessors = (UINT32) QemuFwCfgRead16 ();
I don't think the cast is necessary, but if you'd like to keep it, then
please remove the space character after (UINT32).
> + ASSERT (MaxProcessors > 0);
> + PcdSet32 (PcdCpuMaxLogicalProcessorNumber, MaxProcessors);
I think that when this branch is active, then
PcdCpuApInitTimeOutInMicroSeconds should *also* be set, namely to
MAX_UINT32 (~71 minutes, the closest we can get to "infinity"). When
this hint is available from QEMU, then we should practically disable the
timeout option in CpuDxe's AP counting.
> + }
> +}
> +
> +VOID
> MiscInitialization (
> VOID
> )
> @@ -327,6 +342,8 @@ MiscInitialization (
> //
> BuildCpuHob (mPhysMemAddressWidth, 16);
>
> + UpdateMaxNumberOfProcessors ();
> +
This will run on the S3 resume path as well. That's probably the safe
choice, yes.
> //
> // Determine platform type and save Host Bridge DID to PCD
> //
> diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf
> b/OvmfPkg/PlatformPei/PlatformPei.inf
> index c2c7da9..da23141 100644
> --- a/OvmfPkg/PlatformPei/PlatformPei.inf
> +++ b/OvmfPkg/PlatformPei/PlatformPei.inf
> @@ -86,6 +86,7 @@
> gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
> gEfiMdeModulePkgTokenSpaceGuid.PcdPropertiesTableEnable
> gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
> + gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber
>
> [Ppis]
> gEfiPeiMasterBootModePpiGuid
>
Thanks!
Laszlo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel