mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	"Rafael J . Wysocki" <rafael@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>, Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Juergen Gross <jgross@suse.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Len Brown <lenb@kernel.org>, Sunil V L <sunilvl@ventanamicro.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Kees Cook <kees@kernel.org>, Yanteng Si <si.yanteng@linux.dev>,
	Sean Christopherson <seanjc@google.com>,
	Kai Huang <kai.huang@intel.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Thomas Huth <thuth@redhat.com>,
	Thorsten Blum <thorsten.blum@linux.dev>,
	Kevin Loughlin <kevinloughlin@google.com>,
	Zheyun Shen <szy0127@sjtu.edu.cn>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Xin Li <xin@zytor.com>, "Ahmed S . Darwish" <darwi@linutronix.de>,
	Sohil Mehta <sohil.mehta@intel.com>,
	Ilkka Koskinen <ilkka@os.amperecomputing.com>,
	Robin Murphy <robin.murphy@arm.com>,
	James Clark <james.clark@linaro.org>,
	Besar Wicaksono <bwicaksono@nvidia.com>,
	Ma Ke <make24@iscas.ac.cn>, Wei Huang <wei.huang2@amd.com>,
	Andy Gospodarek <andrew.gospodarek@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	<punit.agrawal@oss.qualcomm.com>, <guohanjun@huawei.com>,
	<suzuki.poulose@arm.com>, <ryan.roberts@arm.com>,
	<chenl311@chinatelecom.cn>, <masahiroy@kernel.org>,
	<wangyuquan1236@phytium.com.cn>, <anshuman.khandual@arm.com>,
	<heinrich.schuchardt@canonical.com>, <Eric.VanTassell@amd.com>,
	<wangzhou1@hisilicon.com>, <wanghuiqiang@huawei.com>,
	<liuyonglong@huawei.com>, <linux-pci@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<loongarch@lists.linux.dev>, <linux-riscv@lists.infradead.org>,
	<xen-devel@lists.xenproject.org>, <linux-acpi@vger.kernel.org>,
	<linux-perf-users@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH v6 2/3] x86: Implement acpi_get_cpu_uid()
Date: Fri, 13 Mar 2026 10:32:31 +0800	[thread overview]
Message-ID: <90505ea3-d842-4092-9743-6ed58c59ca55@huawei.com> (raw)
In-Reply-To: <20260312110205.GG606826@noisy.programming.kicks-ass.net>

On 3/12/2026 7:02 PM, Peter Zijlstra wrote:
> On Thu, Mar 12, 2026 at 03:23:15PM +0800, Chengwen Feng wrote:
>> Add acpi_get_cpu_uid() implementation for x86, replacing the existing
>> cpu_acpi_id() function. This completes the unified ACPI Processor UID
>> retrieval interface across all ACPI-enabled architectures.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> ---
>>  arch/x86/include/asm/cpu.h   |  1 -
>>  arch/x86/include/asm/smp.h   |  1 -
>>  arch/x86/kernel/cpu/common.c | 15 +++++++++++++++
>>  arch/x86/xen/enlighten_hvm.c |  5 +++--
>>  include/linux/acpi.h         |  2 --
>>  5 files changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
>> index ad235dda1ded..57a0786dfd75 100644
>> --- a/arch/x86/include/asm/cpu.h
>> +++ b/arch/x86/include/asm/cpu.h
>> @@ -11,7 +11,6 @@
>>  
>>  #ifndef CONFIG_SMP
>>  #define cpu_physical_id(cpu)			boot_cpu_physical_apicid
>> -#define cpu_acpi_id(cpu)			0
>>  #endif /* CONFIG_SMP */
>>  
>>  #ifdef CONFIG_HOTPLUG_CPU
>> diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
>> index 84951572ab81..05d1d479b4cf 100644
>> --- a/arch/x86/include/asm/smp.h
>> +++ b/arch/x86/include/asm/smp.h
>> @@ -130,7 +130,6 @@ __visible void smp_call_function_interrupt(struct pt_regs *regs);
>>  __visible void smp_call_function_single_interrupt(struct pt_regs *r);
>>  
>>  #define cpu_physical_id(cpu)	per_cpu(x86_cpu_to_apicid, cpu)
>> -#define cpu_acpi_id(cpu)	per_cpu(x86_cpu_to_acpiid, cpu)
>>  
>>  /*
>>   * This function is needed by all SMP systems. It must _always_ be valid
>> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
>> index 1c3261cae40c..3081557542c7 100644
>> --- a/arch/x86/kernel/cpu/common.c
>> +++ b/arch/x86/kernel/cpu/common.c
>> @@ -28,6 +28,7 @@
>>  #include <linux/stackprotector.h>
>>  #include <linux/utsname.h>
>>  #include <linux/efi.h>
>> +#include <linux/acpi.h>
>>  
>>  #include <asm/alternative.h>
>>  #include <asm/cmdline.h>
>> @@ -57,6 +58,7 @@
>>  #include <asm/asm.h>
>>  #include <asm/bugs.h>
>>  #include <asm/cpu.h>
>> +#include <asm/smp.h>
>>  #include <asm/mce.h>
>>  #include <asm/msr.h>
>>  #include <asm/cacheinfo.h>
>> @@ -2643,3 +2645,16 @@ void __init arch_cpu_finalize_init(void)
>>  	 */
>>  	mem_encrypt_init();
>>  }
>> +
>> +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid)
>> +{
>> +	if (cpu >= nr_cpu_ids)
>> +		return -EINVAL;
>> +#ifndef CONFIG_SMP
>> +	*uid = 0;
>> +#else
>> +	*uid = per_cpu(x86_cpu_to_acpiid, cpu);
>> +#endif
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(acpi_get_cpu_uid);
>> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
>> index fe57ff85d004..2f9fa27e5a3c 100644
>> --- a/arch/x86/xen/enlighten_hvm.c
>> +++ b/arch/x86/xen/enlighten_hvm.c
>> @@ -151,6 +151,7 @@ static void xen_hvm_crash_shutdown(struct pt_regs *regs)
>>  
>>  static int xen_cpu_up_prepare_hvm(unsigned int cpu)
>>  {
>> +	u32 cpu_uid;
>>  	int rc = 0;
>>  
>>  	/*
>> @@ -161,8 +162,8 @@ static int xen_cpu_up_prepare_hvm(unsigned int cpu)
>>  	 */
>>  	xen_uninit_lock_cpu(cpu);
>>  
>> -	if (cpu_acpi_id(cpu) != CPU_ACPIID_INVALID)
>> -		per_cpu(xen_vcpu_id, cpu) = cpu_acpi_id(cpu);
>> +	if (acpi_get_cpu_uid(cpu, &cpu_uid) == 0)
>> +		per_cpu(xen_vcpu_id, cpu) = cpu_uid;
>>  	else
>>  		per_cpu(xen_vcpu_id, cpu) = cpu;
>>  	xen_vcpu_setup(cpu);
> 
> This doesn't look right, it will now set CPU_ACPIID_INVALID, while
> previously it would not.

This is indeed an issue, it has been fixed in v7 (by treating CPU_ACPIID_INVALID as an error).

Thanks

> 
> 


  reply	other threads:[~2026-03-13  2:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  7:23 [PATCH v6 0/3] Fix get cpu steer-tag fail on ARM64 platform Chengwen Feng
2026-03-12  7:23 ` [PATCH v6 1/3] ACPI: Rename get_acpi_id_for_cpu() to acpi_get_cpu_uid() on non-x86 Chengwen Feng
2026-03-12 11:07   ` Jonathan Cameron
2026-03-13  2:30     ` fengchengwen
2026-03-12  7:23 ` [PATCH v6 2/3] x86: Implement acpi_get_cpu_uid() Chengwen Feng
2026-03-12 10:55   ` Jonathan Cameron
2026-03-12 11:02   ` Peter Zijlstra
2026-03-13  2:32     ` fengchengwen [this message]
2026-03-12  7:23 ` [PATCH v6 3/3] PCI/TPH: Fix get cpu steer-tag fail on ARM64 platform Chengwen Feng

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=90505ea3-d842-4092-9743-6ed58c59ca55@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=Eric.VanTassell@amd.com \
    --cc=alex@ghiti.fr \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=anshuman.khandual@arm.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bhelgaas@google.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=bwicaksono@nvidia.com \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=chenl311@chinatelecom.cn \
    --cc=corbet@lwn.net \
    --cc=darwi@linutronix.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=guohanjun@huawei.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=hpa@zytor.com \
    --cc=ilkka@os.amperecomputing.com \
    --cc=james.clark@linaro.org \
    --cc=jgross@suse.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kai.huang@intel.com \
    --cc=kees@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=kevinloughlin@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liuyonglong@huawei.com \
    --cc=loongarch@lists.linux.dev \
    --cc=make24@iscas.ac.cn \
    --cc=mark.rutland@arm.com \
    --cc=masahiroy@kernel.org \
    --cc=mingo@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=peterz@infradead.org \
    --cc=pjw@kernel.org \
    --cc=punit.agrawal@oss.qualcomm.com \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=seanjc@google.com \
    --cc=si.yanteng@linux.dev \
    --cc=skhan@linuxfoundation.org \
    --cc=sohil.mehta@intel.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=stable@vger.kernel.org \
    --cc=sunilvl@ventanamicro.com \
    --cc=suzuki.poulose@arm.com \
    --cc=szy0127@sjtu.edu.cn \
    --cc=tglx@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=thorsten.blum@linux.dev \
    --cc=thuth@redhat.com \
    --cc=wanghuiqiang@huawei.com \
    --cc=wangyuquan1236@phytium.com.cn \
    --cc=wangzhou1@hisilicon.com \
    --cc=wei.huang2@amd.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xin@zytor.com \
    /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®