Re: [PATCH v4 4/5] x86/amd_node: Skip SMN setup on Hygon Fam18h models 0x04-0x08

From: Borislav Petkov

Date: Fri Sep 04 2026 - 01:39:38 EST


On Thu, Sep 03, 2026 at 09:49:58AM +0800, Lin Wang wrote:
>
>
> On 9/2/2026 11:13 PM, Borislav Petkov wrote:
> > On Wed, Sep 02, 2026 at 02:22:13PM +0800, Lin Wang wrote:
> > > Please let me know how you would prefer this to be handled.
> >
> > Well, X86_FEATURE_ZEN isn't Hygon apparently. Otherwise, we wouldn't be having
> > this conversation. And we wouldn't need ugly workarounds like that.
> >
> > Which means, you cannot set it on Hygon. Instead, you should check vendor or
> > define your own X86_FEATURE_HYGON if you think it would be useful to denote
> > common set of features between all Hygon cores.
> >
> > Reusing an AMD-specific flag but then having different hardware which needs
> > hacks and workarounds to the code is not what you do. Hygon is a different
> > vendor and it should be treated as such - not piggyback on AMD code.
> >
> > Unless you wanna piggyback. But then you have to extract it properly and make
> > it generic so that it can be shared. I have been asking all people submitting
> > Hygon code to do that and you are starting to do it but then you need to stick
> > to it and do only that.
> >
>
> Hi Boris,
>
> Thanks for clarifying the direction.
>
> My proposed approach is to use explicit vendor checks to make
> init_amd_nbs() and amd_smn_init() AMD-only. Hygon node enumeration and
> SMN setup would remain in Hygon code.
>
> Sashiko's concern with v3 was that the AMD initializers were restricted
> while Hygon call sites remained. However, as currently implemented, the
> AMD NB and SMN paths are based on AMD topology assumptions and cannot
> provide the Hygon node and SMN mappings.
>
> I would first stop the affected Hygon call sites from entering those AMD
> paths, and then make the two initializers AMD-only in the same series.
> Later driver support would use the Hygon interfaces.
>
> Would this ordering address the Sashiko concern?

This should address my concerns - we can then see what Sashiko complains
about and sanity-check it.

And I explained it already - you basically carve out/split/separate Hygon
paths from AMD paths and you basically forget X86_FEATURE_ZEN. I don't care if
Zen and Hygon systems are/were the same or almost the same.

Obviously they will start diverging so you can carve out Hygon-specific pieces
now and then keep adding new functionality to them. Just as if this is
a completely different x86 CPU.

This way, the code is untangled from the very beginning and there won't be any
ugly and unmaintainable

if (vendor)

sprinkling all over the x86 AMD code where neither you nor we will be happy
about going forward.

Thx.

--
Regards/Gruss,
Boris.

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