On 26.01.2026 18:53, Andrew Cooper wrote:
> init_amd() tries to re-activate TOPOEXT on certain systems, but only after
> amd_init_levelling() has calculated the levelling defaults, meaning that the
> re-activation will be lost on the next context switch.
> 
> Move the logic into early_init_amd() so it takes effect before calculating the
> levelling defaults.
> 
> Signed-off-by: Andrew Cooper <[email protected]>

I'm sorry, but as this is being moved and tidied some, I've got some remarks:

> --- a/xen/arch/x86/cpu/amd.c
> +++ b/xen/arch/x86/cpu/amd.c
> @@ -620,9 +620,32 @@ void amd_process_freq(const struct cpuinfo_x86 *c,
>               *low_mhz = amd_parse_freq(c->x86, lo);
>  }
>  
> +static void amd_early_adjust_cpuid_extd(void)

__init?

> +{
> +    struct cpuinfo_x86 *c = &boot_cpu_data;
> +    uint64_t val;
> +
> +    /* Re-enable TopologyExtensions if switched off by BIOS */
> +    if ( c->family == 0x15 && c->model >= 0x10 && c->model <= 0x1f &&

If this is done by BIOSes, why would it be constrained to a certain model
range of a certain family?

> +         !boot_cpu_has(X86_FEATURE_TOPOEXT) &&
> +         !rdmsr_safe(MSR_K8_EXT_FEATURE_MASK, &val) )
> +    {
> +        val |= 1ULL << 54;
> +        wrmsr_safe(MSR_K8_EXT_FEATURE_MASK, val);
> +        val = rdmsr(MSR_K8_EXT_FEATURE_MASK);
> +        if ( val & (1ULL << 54) )
> +        {
> +            __set_bit(X86_FEATURE_TOPOEXT, c->x86_capability);

This shouldn't be needed, as identify_cpu() will obtain the updated value
anyway.

Jan

Reply via email to