Re: [PATCH 1/8] x86/cpu/hygon: Adjust the die_id and logical_die_id for Hygon model 4h~8h

From: Borislav Petkov

Date: Sat Mar 28 2026 - 09:34:42 EST


On Fri, Mar 27, 2026 at 04:07:31PM +0800, Fu Hao wrote:
> The die id should be get from the NodeId field of CPUID leaf 0x8000001e
^^^^^^^^^^^^^

Pls run all your English text through an LLM so that corrects it for you.

Also "die ID".

> ecx for Hygon model 4h~8h processors.
>
> Signed-off-by: Fu Hao <fuhao@xxxxxxxxxxxxxx>
> ---
> arch/x86/kernel/cpu/hygon.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c
> index 7f95a74e4..f39d32a68 100644
> --- a/arch/x86/kernel/cpu/hygon.c
> +++ b/arch/x86/kernel/cpu/hygon.c
> @@ -168,6 +168,19 @@ static void early_init_hygon(struct cpuinfo_x86 *c)
> set_cpu_cap(c, X86_FEATURE_VMMCALL);
> }
>
> +/*
> + * Adjust the die_id and logical_die_id for Hygon model 4h~8h.

What does "model 4h~8h" mean?

Models 0x4-0x8 ?

> + */
> +static void cpu_topology_fixup_hygon(struct cpuinfo_x86 *c)
> +{
> + if (c->x86_model >= 0x4 && c->x86_model <= 0x8) {
> + c->topo.die_id = cpuid_ecx(0x8000001e) & 0xff;
> + c->topo.logical_die_id = (c->topo.die_id >> 4) *
> + topology_amd_nodes_per_pkg() +
> + (c->topo.die_id & 0xf);
> + }
> +}

Does this really need to be a separate function or can you stick the
if-conditional along with the comment where it needs to be executed?

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette