[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v8 1/3] ACPI: Refactor get_acpi_id_for_cpu() to acpi_get_cpu_uid() on non-x86



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@xxxxxxxxxxxxxxx
>> Signed-off-by: Chengwen Feng <fengchengwen@xxxxxxxxxx>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
>> ---
>>  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
> 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.