From nobody Thu Apr 2 18:47:47 2026 Received: from out198-43.us.a.mail.aliyun.com (out198-43.us.a.mail.aliyun.com [47.90.198.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 130743D3487 for ; Fri, 27 Mar 2026 08:08:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.198.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774598900; cv=none; b=Nt+aYFmIkY0UQPp97VcTHWKgIBZ0bCPz93GsuUN7+LMlA0nf45u6rq4HMOa2HncBO3QifSfAyMne1X9ZK/Ig55NEnQ2gR0JMM3l7bbcVd6ndbMpzjoZBJEBma68y6shC6zvZwx2YXkH2rDU9vZ8MxqZNJnR/FDVgbc3H3R2TcuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774598900; c=relaxed/simple; bh=WoeG3l1mHc9f4LWhnNTOR3i5tWatcLIAz9VUayUc4zQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Fl72teU0c0moa/PQPHKu6brcxhAfau5OZq2LE0vvXnWJDXGkzvXJewTZvGx0KImc0S9yIjPu/QML0v5RIBueu+b8t7GDEsVwE89jSG3pVotL+zKUehV8c5ltVWGFKke2D78GvzC6nxThSf/weqObllF3me9D4l58Jcwfpt+blTc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=open-hieco.net; spf=pass smtp.mailfrom=open-hieco.net; arc=none smtp.client-ip=47.90.198.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=open-hieco.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=open-hieco.net X-Alimail-AntiSpam: AC=CONTINUE;BC=0.1280032|-1;CH=blue;DM=|OVERLOAD|false|;DS=CONTINUE|ham_alarm|0.00862387-8.83284e-05-0.991288;FP=14403770588962881983|4|1|1|0|-1|-1|-1;HT=maildocker-contentspam033037032089;MF=fuhao@open-hieco.net;NM=1;PH=DS;RN=9;RT=9;SR=0;TI=SMTPD_---.h.BSWZF_1774598870; Received: from higon..(mailfrom:fuhao@open-hieco.net fp:SMTPD_---.h.BSWZF_1774598870 cluster:ay29) by smtp.aliyun-inc.com; Fri, 27 Mar 2026 16:07:56 +0800 From: Fu Hao To: puwen@hygon.cn, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, Fu Hao Subject: [PATCH 1/8] x86/cpu/hygon: Adjust the die_id and logical_die_id for Hygon model 4h~8h Date: Fri, 27 Mar 2026 16:07:31 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The die id should be get from the NodeId field of CPUID leaf 0x8000001e ecx for Hygon model 4h~8h processors. Signed-off-by: Fu Hao --- 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); } =20 +/* + * Adjust the die_id and logical_die_id for Hygon model 4h~8h. + */ +static void cpu_topology_fixup_hygon(struct cpuinfo_x86 *c) +{ + if (c->x86_model >=3D 0x4 && c->x86_model <=3D 0x8) { + c->topo.die_id =3D cpuid_ecx(0x8000001e) & 0xff; + c->topo.logical_die_id =3D (c->topo.die_id >> 4) * + topology_amd_nodes_per_pkg() + + (c->topo.die_id & 0xf); + } +} + static void init_hygon(struct cpuinfo_x86 *c) { u64 vm_cr; @@ -191,6 +204,8 @@ static void init_hygon(struct cpuinfo_x86 *c) =20 init_hygon_cacheinfo(c); =20 + cpu_topology_fixup_hygon(c); + if (cpu_has(c, X86_FEATURE_SVM)) { rdmsrq(MSR_VM_CR, vm_cr); if (vm_cr & SVM_VM_CR_SVM_DIS_MASK) { --=20 2.34.1