From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 7BD4831197B; Thu, 12 Mar 2026 11:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773313353; cv=none; b=saFs87MIOxzxibDDFh3DLL8DSvOchx6zEy/JwiCsMxP9kxcwDaxxSv04SxZ3iDF9rzRJfJ851q8aoXYhVrYaeXMxxIU+Y0D2CYYLpkw1F/hake3hp4O260aZFoF9eF4naCjr0zvTRV/IpG89xNaJW2kObp2M9bfR+M7gRQcSJh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773313353; c=relaxed/simple; bh=6J5SDcO5DMKytvtsx36wcU0BxOxT41bThTx/x7rN40A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=STu/k8JsFuXRTxS46Vl7xmYHy7AghX1B+chg/i0BNbsy90JLqqsTA4QClfg4ZmEkAURtKeWOwDTHf3+Wmjp5dpd639EZ1ITztH2Fo+n3CgIZoSEAMI29OEdy8ehzAlt4cjPcnAzlLKqUuZXoOqc9jddjvRhHU+47oPbU0b0uuxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=an8qvmMR; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="an8qvmMR" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TKIEX/tTmZZzj6V6Q9LOzPYb6+bhVRh9N9evN1bqSfc=; b=an8qvmMRT6e0/uIgvv6SvD7SLo 4m+UvPB5+18GpbDiaL9IxO3UA1h4nyJ0FZtTMBA4+J8t9buo20vz5+l2obe0Hhuhm03AWzFimVp4D YtHlF5LCr5cNGTsUr/nANJN0G/ar8NTW96doAb79xogVjlFtfvWv3tS4G8vgrwid1zRyuKnnoOtRg cRE6fVkUPmEULPsE/mtiFGjwxhTv0E57tOdjLrOaPqcviA5Hx/nImdKNCvkkIHyFLP9mr/wm0JSMb 0Thh4CDgCwqZ4HpWOjjPbbgfQIiKl0MIq4avo+r94PhokRILHHajLVnNT16BcpXuKO/m4C7RcJSQ1 afukQ/VQ==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w0dnq-0000000BDV6-3EQ0; Thu, 12 Mar 2026 11:02:06 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id AC3B5300462; Thu, 12 Mar 2026 12:02:05 +0100 (CET) Date: Thu, 12 Mar 2026 12:02:05 +0100 From: Peter Zijlstra To: Chengwen Feng Cc: Bjorn Helgaas , Catalin Marinas , Will Deacon , "Rafael J . Wysocki" , Jonathan Corbet , Shuah Khan , Huacai Chen , WANG Xuerui , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Juergen Gross , Boris Ostrovsky , Len Brown , Sunil V L , Mark Rutland , Jonathan Cameron , Kees Cook , Yanteng Si , Sean Christopherson , Kai Huang , Tom Lendacky , Thomas Huth , Thorsten Blum , Kevin Loughlin , Zheyun Shen , Pawan Gupta , Xin Li , "Ahmed S . Darwish" , Sohil Mehta , Ilkka Koskinen , Robin Murphy , James Clark , Besar Wicaksono , Ma Ke , Wei Huang , Andy Gospodarek , Somnath Kotur , 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() Message-ID: <20260312110205.GG606826@noisy.programming.kicks-ass.net> References: <20260312072316.4806-1-fengchengwen@huawei.com> <20260312072316.4806-3-fengchengwen@huawei.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260312072316.4806-3-fengchengwen@huawei.com> 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 > --- > 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 > #include > #include > +#include > > #include > #include > @@ -57,6 +58,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -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.