mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@hotmail.com>
To: bp@alien8.de, tglx@kernel.org, mingo@redhat.com,
	ludloff@gmail.com, xuyongwei@open-hieco.net,
	dave.hansen@linux.intel.com, pawan.kumar.gupta@linux.intel.com
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, wei.w.wang@hotmail.com
Subject: [RESEND PATCH v1] x86/cpu/topology: Consolidate AMD and Hygon cases in parse_topology()
Date: Mon, 23 Mar 2026 16:07:19 +0800	[thread overview]
Message-ID: <SI2PR01MB4393D6B7E17AB05612AEE925DC4BA@SI2PR01MB4393.apcprd01.prod.exchangelabs.com> (raw)

Merge the two separate switch cases for AMD and Hygon as they share the
common cpu_parse_topology_amd().

Also drop the IS_ENABLED(CONFIG_CPU_SUP_AMD/HYGON) guards, because
1) they are dead code: when a vendor's CONFIG_CPU_SUP_* is disabled, its
   vendor detection code (in amd.c / hygon.c) is not compiled, so
   x86_vendor will never be set to X86_VENDOR_AMD / X86_VENDOR_HYGON,
   instead it will default to X86_VENDOR_UNKNOWN and those switch cases
   are unreachable.
2) topology_amd.o is always built (obj-y), so cpu_parse_topology_amd() is
   always available regardless of CPU_SUP_* configuration.

Signed-off-by: Wei Wang <wei.w.wang@hotmail.com>
Tested-by: Yongwei Xu <xuyongwei@open-hieco.net>
---
RESEND changes
- Add Tested-by from Yongwei
- Rebase to 7.0.0-rc4

 arch/x86/kernel/cpu/topology_common.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/cpu/topology_common.c b/arch/x86/kernel/cpu/topology_common.c
index 71625795d711..d0d79d5b8eb9 100644
--- a/arch/x86/kernel/cpu/topology_common.c
+++ b/arch/x86/kernel/cpu/topology_common.c
@@ -157,8 +157,8 @@ static void parse_topology(struct topo_scan *tscan, bool early)
 
 	switch (c->x86_vendor) {
 	case X86_VENDOR_AMD:
-		if (IS_ENABLED(CONFIG_CPU_SUP_AMD))
-			cpu_parse_topology_amd(tscan);
+	case X86_VENDOR_HYGON:
+		cpu_parse_topology_amd(tscan);
 		break;
 	case X86_VENDOR_CENTAUR:
 	case X86_VENDOR_ZHAOXIN:
@@ -170,10 +170,6 @@ static void parse_topology(struct topo_scan *tscan, bool early)
 		if (c->cpuid_level >= 0x1a)
 			c->topo.cpu_type = cpuid_eax(0x1a);
 		break;
-	case X86_VENDOR_HYGON:
-		if (IS_ENABLED(CONFIG_CPU_SUP_HYGON))
-			cpu_parse_topology_amd(tscan);
-		break;
 	}
 }
 

base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
-- 
2.51.0


             reply	other threads:[~2026-03-23  8:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-23  8:07 Wei Wang [this message]
2026-03-23 14:29 ` Yongwei Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SI2PR01MB4393D6B7E17AB05612AEE925DC4BA@SI2PR01MB4393.apcprd01.prod.exchangelabs.com \
    --to=wei.w.wang@hotmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludloff@gmail.com \
    --cc=mingo@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    --cc=xuyongwei@open-hieco.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®