From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out28-5.mail.aliyun.com (out28-5.mail.aliyun.com [115.124.28.5]) (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 E6B043939B9 for ; Mon, 30 Mar 2026 02:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.28.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774839601; cv=none; b=iATwFx3z4ktsui09Msq50WWYUWBgX6N5bTLPSyyh++JI0wzHPUofh1vZGf/vA74JelIvLcLmRKCVzbEbIczRzRUDj2etlPO3QsfDKgOVWVdjTqEh5Mk3f+pQsIBpcHjr3XKW62vTo34/DrlZYh2OHRA0Yz0HTVL5GJWiD2ZBbds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774839601; c=relaxed/simple; bh=tlY2mpZeclKlGrAfYAS8M+zxJuid0ZdteDgP6M8Uk58=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=ep7od+OYhYhVStBwWNvtp2p3NPiGuF3JFqM7Im3Jf8lKZXTjBiGjiOUq1dV78fyhl6W2qdXDMsbGmqsfYulp1z+oXacjT7Wk/DbBmTHi1iKLHK03jQZAVDFIKQBp0Nao92HPD057FK+TsBz3WPJoPXl5hKJ5ElSeJoWwHo5FCrQ= 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.5 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.08482262|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.0135957-0.000588267-0.985816;FP=15411415820132746646|0|0|0|0|-1|-1|-1;HT=maildocker-contentspam033045018182;MF=fuhao@open-hieco.net;NM=1;PH=DS;RN=8;RT=8;SR=0;TI=SMTPD_---.h0pkZqI_1774839588; Received: from 172.25.21.240(mailfrom:fuhao@open-hieco.net fp:SMTPD_---.h0pkZqI_1774839588 cluster:ay29) by smtp.aliyun-inc.com; Mon, 30 Mar 2026 10:59:49 +0800 Subject: Re: [PATCH 1/8] x86/cpu/hygon: Adjust the die_id and logical_die_id for Hygon model 4h~8h To: Borislav Petkov Cc: puwen@hygon.cn, tglx@kernel.org, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org References: <20260328133402.GTacfYymkTOQYG0Yu2@fat_crate.local> From: Fu Hao Message-ID: <76e4048a-ef14-4b1e-7f65-7d2bd1fb6407@open-hieco.net> Date: Mon, 30 Mar 2026 10:59:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20260328133402.GTacfYymkTOQYG0Yu2@fat_crate.local> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 2026/3/28 21:34, Borislav Petkov wrote: > 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 >> --- >> 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. > Thank you very much for your suggestion. The Hygon model 4h~8h, which is also the Hygon family 0x18 model 0x4~0x8 series of processors. Using separate functions for encapsulation is primarily due to the consideration for subsequent new processors, there may be different ways to obtain the core ID, die ID and pkg ID. Of course, it can also be temporarily placed in the "init_hygon" function at present. What about your suggestion? -- Regards, Fu Hao