Skip to content

Commit a7034e9

Browse files
fengchengwenrafaeljw
authored andcommitted
ACPI: PPTT: Use acpi_get_cpu_uid() and remove get_acpi_id_for_cpu()
Update acpi/pptt.c to use acpi_get_cpu_uid() and remove unused get_acpi_id_for_cpu() from arm64/loongarch/riscv, completing PPTT's migration to the unified ACPI CPU UID interface Signed-off-by: Chengwen Feng <fengchengwen@huawei.com> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> Link: https://patch.msgid.link/20260401081640.26875-8-fengchengwen@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 1ab0318 commit a7034e9

4 files changed

Lines changed: 37 additions & 26 deletions

File tree

arch/arm64/include/asm/acpi.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ static inline bool acpi_has_cpu_in_madt(void)
114114
}
115115

116116
struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu);
117-
static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
118-
{
119-
return acpi_cpu_get_madt_gicc(cpu)->uid;
120-
}
121117
int get_cpu_for_acpi_id(u32 uid);
122118

123119
static inline void arch_fix_phys_package_id(int num, u32 slot) { }

arch/loongarch/include/asm/acpi.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
4040

4141
extern int __init parse_acpi_topology(void);
4242

43-
static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
44-
{
45-
return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
46-
}
47-
4843
#endif /* !CONFIG_ACPI */
4944

5045
#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT

arch/riscv/include/asm/acpi.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { }
6161

6262
void acpi_init_rintc_map(void);
6363
struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu);
64-
static inline u32 get_acpi_id_for_cpu(int cpu)
65-
{
66-
return acpi_cpu_get_madt_rintc(cpu)->uid;
67-
}
6864

6965
int acpi_get_riscv_isa(struct acpi_table_header *table,
7066
unsigned int cpu, const char **isa);

drivers/acpi/pptt.c

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,14 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
459459
{
460460
struct acpi_pptt_cache *found_cache;
461461
struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
462-
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
462+
u32 acpi_cpu_id;
463463
struct cacheinfo *this_leaf;
464464
unsigned int index = 0;
465465
struct acpi_pptt_processor *cpu_node = NULL;
466466

467+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
468+
return;
469+
467470
while (index < get_cpu_cacheinfo(cpu)->num_leaves) {
468471
this_leaf = this_cpu_ci->info_list + index;
469472
found_cache = acpi_find_cache_node(table, acpi_cpu_id,
@@ -546,7 +549,10 @@ static int topology_get_acpi_cpu_tag(struct acpi_table_header *table,
546549
unsigned int cpu, int level, int flag)
547550
{
548551
struct acpi_pptt_processor *cpu_node;
549-
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
552+
u32 acpi_cpu_id;
553+
554+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
555+
return -ENOENT;
550556

551557
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
552558
if (cpu_node) {
@@ -614,18 +620,22 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
614620
*
615621
* Check the node representing a CPU for a given flag.
616622
*
617-
* Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
618-
* the table revision isn't new enough.
623+
* Return: -ENOENT if can't get CPU's ACPI Processor UID, the PPTT doesn't
624+
* exist, the CPU cannot be found or the table revision isn't new
625+
* enough.
619626
* 1, any passed flag set
620627
* 0, flag unset
621628
*/
622629
static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
623630
{
624631
struct acpi_table_header *table;
625-
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
632+
u32 acpi_cpu_id;
626633
struct acpi_pptt_processor *cpu_node = NULL;
627634
int ret = -ENOENT;
628635

636+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
637+
return -ENOENT;
638+
629639
table = acpi_get_pptt();
630640
if (!table)
631641
return -ENOENT;
@@ -651,7 +661,8 @@ static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
651661
* in the PPTT. Errors caused by lack of a PPTT table, or otherwise, return 0
652662
* indicating we didn't find any cache levels.
653663
*
654-
* Return: -ENOENT if no PPTT table or no PPTT processor struct found.
664+
* Return: -ENOENT if no PPTT table, can't get CPU's ACPI Process UID or no PPTT
665+
* processor struct found.
655666
* 0 on success.
656667
*/
657668
int acpi_get_cache_info(unsigned int cpu, unsigned int *levels,
@@ -671,7 +682,9 @@ int acpi_get_cache_info(unsigned int cpu, unsigned int *levels,
671682

672683
pr_debug("Cache Setup: find cache levels for CPU=%d\n", cpu);
673684

674-
acpi_cpu_id = get_acpi_id_for_cpu(cpu);
685+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id))
686+
return -ENOENT;
687+
675688
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
676689
if (!cpu_node)
677690
return -ENOENT;
@@ -780,8 +793,9 @@ int find_acpi_cpu_topology_package(unsigned int cpu)
780793
* It may not exist in single CPU systems. In simple multi-CPU systems,
781794
* it may be equal to the package topology level.
782795
*
783-
* Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found
784-
* or there is no toplogy level above the CPU..
796+
* Return: -ENOENT if the PPTT doesn't exist, can't get CPU's ACPI
797+
* Processor UID, the CPU cannot be found or there is no toplogy level
798+
* above the CPU.
785799
* Otherwise returns a value which represents the package for this CPU.
786800
*/
787801

@@ -797,7 +811,9 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu)
797811
if (!table)
798812
return -ENOENT;
799813

800-
acpi_cpu_id = get_acpi_id_for_cpu(cpu);
814+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
815+
return -ENOENT;
816+
801817
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
802818
if (!cpu_node || !cpu_node->parent)
803819
return -ENOENT;
@@ -872,7 +888,9 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_header *table_hdr,
872888
cpumask_clear(cpus);
873889

874890
for_each_possible_cpu(cpu) {
875-
acpi_id = get_acpi_id_for_cpu(cpu);
891+
if (acpi_get_cpu_uid(cpu, &acpi_id) != 0)
892+
continue;
893+
876894
cpu_node = acpi_find_processor_node(table_hdr, acpi_id);
877895

878896
while (cpu_node) {
@@ -966,10 +984,13 @@ int find_acpi_cache_level_from_id(u32 cache_id)
966984
for_each_possible_cpu(cpu) {
967985
bool empty;
968986
int level = 1;
969-
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
987+
u32 acpi_cpu_id;
970988
struct acpi_pptt_cache *cache;
971989
struct acpi_pptt_processor *cpu_node;
972990

991+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
992+
continue;
993+
973994
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
974995
if (!cpu_node)
975996
continue;
@@ -1030,10 +1051,13 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus)
10301051
for_each_possible_cpu(cpu) {
10311052
bool empty;
10321053
int level = 1;
1033-
u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
1054+
u32 acpi_cpu_id;
10341055
struct acpi_pptt_cache *cache;
10351056
struct acpi_pptt_processor *cpu_node;
10361057

1058+
if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
1059+
continue;
1060+
10371061
cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
10381062
if (!cpu_node)
10391063
continue;

0 commit comments

Comments
 (0)