Re: [PATCH v2] x86/topology: Unify srat_detect_node among amd and hygon

From: Ahmed S. Darwish

Date: Fri May 15 2026 - 15:39:44 EST


On Fri, 15 May 2026, Nikola Z. Ivanov wrote:
>
> --- a/arch/x86/kernel/cpu/cpu.h
> +++ b/arch/x86/kernel/cpu/cpu.h
> @@ -65,6 +65,7 @@ extern void check_null_seg_clears_base(struct cpuinfo_x86 *c);
>
> void cacheinfo_amd_init_llc_id(struct cpuinfo_x86 *c, u16 die_id);
> void cacheinfo_hygon_init_llc_id(struct cpuinfo_x86 *c);
> +void srat_detect_node(struct cpuinfo_x86 *c);
>

This is very confusing from the perspective of common.c.

The moved srat_detect_node() function there has zero indication that it is
AMD/Hygon specific.

When I was refactoring the cacheinfo code some time ago, I marked the
vendor-specific cacheinfo.c functions with amd and/or hygon tags to
identify which is which. You see that clearly in the two lines above your
new function declaration.

IMHO, you need to do something similar. Please continue below.

>
> --- a/arch/x86/kernel/cpu/intel.c
> +++ b/arch/x86/kernel/cpu/intel.c
> @@ -468,7 +468,7 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
> }
> #endif
>
> -static void srat_detect_node(struct cpuinfo_x86 *c)
> +static void srat_detect_node_intel(struct cpuinfo_x86 *c)
> {
> #ifdef CONFIG_NUMA
> unsigned node;
> @@ -614,7 +614,7 @@ static void init_intel(struct cpuinfo_x86 *c)
> set_cpu_cap(c, X86_FEATURE_PREFER_YMM);
>
> /* Work around errata */
> - srat_detect_node(c);
> + srat_detect_node_intel(c);
>

I think it would be nice to have:

amd_hygon_srat_detect_node()
intel_srat_detect_node()

This would also go better in line with the existing intel.c functions like
intel_unlock_cpuid_leafs(), intel_tlb_lookup(), intel_detect_tlb(), etc.

Thanks,
Ahmed