loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: fengchengwen <fengchengwen@huawei.com>
To: Bjorn Helgaas <helgaas@kernel.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>, Ingo Molnar <mingo@redhat.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>,
	Peter Zijlstra <peterz@infradead.org>,
	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 v8 1/3] ACPI: Refactor get_acpi_id_for_cpu() to acpi_get_cpu_uid() on non-x86
Date: Thu, 19 Mar 2026 15:13:09 +0800	[thread overview]
Message-ID: <264525a9-aa36-4848-80c0-f8cf246f93b8@huawei.com> (raw)
In-Reply-To: <20260318213458.GA474040@bhelgaas>

On 3/19/2026 5:34 AM, Bjorn Helgaas wrote:
> On Wed, Mar 18, 2026 at 02:01:49PM +0800, Chengwen Feng wrote:
>> Unify CPU ACPI ID retrieval interface across architectures by
>> refactoring get_acpi_id_for_cpu() to acpi_get_cpu_uid() on
>> arm64/riscv/loongarch:
>> - Add input parameter validation
>> - Adjust interface to int acpi_get_cpu_uid(unsigned int cpu, u32 *uid)
>>   (old: u32 get_acpi_id_for_cpu(unsigned int cpu), no input check)
>>
>> This refactoring (not a pure rename) enhances interface robustness while
>> preparing for consistent ACPI Processor UID retrieval across all
>> ACPI-enabled platforms. Valid inputs retain original behavior.
>>
>> Note: Move the ARM64-specific get_cpu_for_acpi_id() implementation to
>>       arch/arm64/kernel/acpi.c to fix compilation errors from circular
>>       header dependencies introduced by the rename.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>> ---
>>  arch/arm64/include/asm/acpi.h      | 16 +---------
>>  arch/arm64/kernel/acpi.c           | 30 ++++++++++++++++++
>>  arch/loongarch/include/asm/acpi.h  |  5 ---
>>  arch/loongarch/kernel/acpi.c       |  9 ++++++
>>  arch/riscv/include/asm/acpi.h      |  4 ---
>>  arch/riscv/kernel/acpi.c           | 16 ++++++++++
>>  arch/riscv/kernel/acpi_numa.c      |  9 ++++--
>>  drivers/acpi/pptt.c                | 50 ++++++++++++++++++++++--------
>>  drivers/acpi/riscv/rhct.c          |  7 ++++-
>>  drivers/perf/arm_cspmu/arm_cspmu.c |  6 ++--
>>  include/linux/acpi.h               | 13 ++++++++
>>  11 files changed, 122 insertions(+), 43 deletions(-)
> 
> There's a lot going on in this single patch, which makes it hard to
> review.  I think this might make more sense as several patches:
> 
>   - arm64: declare acpi_get_cpu_uid() in arch/arm64/include, implement
>     it, and use in drivers/perf/arm_cspmu/arm_cspmu.c
> 
>   - loongarch: declare acpi_get_cpu_uid() in arch/loongarch/include
>     and implement
> 
>   - riscv: declare acpi_get_cpu_uid() in arch/riscv/include, implement
>     it, and use in rhct.c, riscv/kernel/acpi_numa.c
> 
>   - x86: declare acpi_get_cpu_uid() in arch/x86/include, implement it,
>     and use in xen
> 
>   - declare acpi_get_cpu_uid() in include/linux/acpi.h, remove
>     declarations from arm64, loongarch, riscv, x86
> 
>   - convert acpi/pptt.c to use acpi_get_cpu_uid(), remove unused
>     get_acpi_id_for_cpu() from arm64, loongarch, riscv
> 
>   - use acpi_get_cpu_uid() in tph.c

Thanks for the detailed guidance, done in v9

> 
> Doc nit below.
> 

...

>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 4d2f0bed7a06..035094a55f18 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -324,6 +324,19 @@ int acpi_unmap_cpu(int cpu);
>>  
>>  acpi_handle acpi_get_processor_handle(int cpu);
>>  
>> +#ifndef CONFIG_X86
>> +/*
>> + * acpi_get_cpu_uid() - Get ACPI Processor UID of a specified CPU from MADT table
>> + * @cpu: Logical CPU number (0-based)
>> + * @uid: Pointer to store the ACPI Processor UID (valid only on successful return)
> 
> This would normally go at the implementation, but it probably does
> make sense here because each arch has its own implementation.
> 
> Should start with "/**" to make it kernel-doc though.
> 
> Wrap to fit in 78 columns, like other comments in this file.

done in v9

Thanks

> 
>> + * Return: 0 on successful retrieval (the ACPI Processor ID is stored in *uid);
>> + *         -EINVAL if the CPU number is invalid or out of range;
>> + *         -ENODEV if the ACPI Processor UID for the specified CPU is not found.
>> + */
>> +int acpi_get_cpu_uid(unsigned int cpu, u32 *uid);
>> +#endif
> 


  reply	other threads:[~2026-03-19  7:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18  6:01 [PATCH v8 0/3] Fix get cpu steer-tag fail on ARM64 platform Chengwen Feng
2026-03-18  6:01 ` [PATCH v8 1/3] ACPI: Refactor get_acpi_id_for_cpu() to acpi_get_cpu_uid() on non-x86 Chengwen Feng
2026-03-18 21:34   ` Bjorn Helgaas
2026-03-19  7:13     ` fengchengwen [this message]
2026-03-18  6:01 ` [PATCH v8 2/3] x86: Implement acpi_get_cpu_uid() Chengwen Feng
2026-03-18  6:01 ` [PATCH v8 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=264525a9-aa36-4848-80c0-f8cf246f93b8@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=Eric.VanTassell@amd.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=anshuman.khandual@arm.com \
    --cc=bhelgaas@google.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bwicaksono@nvidia.com \
    --cc=catalin.marinas@arm.com \
    --cc=chenl311@chinatelecom.cn \
    --cc=corbet@lwn.net \
    --cc=darwi@linutronix.de \
    --cc=guohanjun@huawei.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=helgaas@kernel.org \
    --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=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=pawan.kumar.gupta@linux.intel.com \
    --cc=peterz@infradead.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=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=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=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).