From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out28-197.mail.aliyun.com (out28-197.mail.aliyun.com [115.124.28.197]) (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 23DFA3A0B24 for ; Tue, 7 Apr 2026 08:21:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775550104; cv=none; b=TR+XD43Um6rRbF7jJhHjv9Ex93Gpfm87vQEZ20x2zJXasd1Fu7dRa6B4uiVCHBSYQoDZOvqXKv53GPgUUWBVNXr6dbzON1sxCv169EC9w6RhTCDmcIobSKtxmuvgcBKuvSLVpGqSB1ikAypffYmuyZjfBCHUXK8ZUlZw3lRzP/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775550104; c=relaxed/simple; bh=GQE1Yvwmd2mqYQ1WAAHuDxHn4Z6f1tS6Cti+YexE7Yc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=PzaH/AzJQCopvbz2REANuzDx8DS0g6XE6pZ+LUQ4Z5pR4xHnS/bJkckuoUfIDnFVhmr07ST0VjpYujhMRDcrvMK6wtijNKltF8pG7WgAXb46Pj9V4fBFC3ZHe/Y7vcFE+b+rk4XMbVkqE/FHMY+2jh/ranpL+YLaTsyd+I4h6eg= 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=115.124.28.197 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.2888092|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0077927-6.21147e-05-0.992145;FP=14402608404107038143|1|1|1|0|-1|-1|-1;HT=maildocker-contentspam033037021217;MF=fuhao@open-hieco.net;NM=1;PH=DS;RN=9;RT=9;SR=0;TI=SMTPD_---.h6UZe7i_1775550086; Received: from higon..(mailfrom:fuhao@open-hieco.net fp:SMTPD_---.h6UZe7i_1775550086 cluster:ay29) by smtp.aliyun-inc.com; Tue, 07 Apr 2026 16:21:33 +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 v2 1/8] x86/cpu/hygon: Adjust the die_id and logical_die_id for Hygon models 0x4-0x8 Date: Tue, 7 Apr 2026 16:22:42 +0800 Message-Id: <643b60a2f121e8f2cc7c7e7543503ee945776fd2.1775548724.git.fuhao@open-hieco.net> 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: 8bit The die ID should be got from the NodeId field of CPUID leaf 0x8000001e ecx for Hygon models 0x4-0x8 processors. Signed-off-by: Fu Hao --- arch/x86/kernel/cpu/hygon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kernel/cpu/hygon.c b/arch/x86/kernel/cpu/hygon.c index 7f95a74e4..0bf99072f 100644 --- a/arch/x86/kernel/cpu/hygon.c +++ b/arch/x86/kernel/cpu/hygon.c @@ -191,6 +191,16 @@ static void init_hygon(struct cpuinfo_x86 *c) init_hygon_cacheinfo(c); + /* + * Adjust the die_id and logical_die_id for Hygon models 0x4-0x8. + */ + 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); + } + if (cpu_has(c, X86_FEATURE_SVM)) { rdmsrq(MSR_VM_CR, vm_cr); if (vm_cr & SVM_VM_CR_SVM_DIS_MASK) { -- 2.34.1