]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: PPTT: Use acpi_get_cpu_uid() and remove get_acpi_id_for_cpu()
authorChengwen Feng <fengchengwen@huawei.com>
Wed, 1 Apr 2026 08:16:39 +0000 (16:16 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 6 Apr 2026 14:55:16 +0000 (16:55 +0200)
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>
arch/arm64/include/asm/acpi.h
arch/loongarch/include/asm/acpi.h
arch/riscv/include/asm/acpi.h
drivers/acpi/pptt.c

index bdb0ecf95b5c65c399ce4535422de495a55eda1e..8a54ca6ba60282ef503e6f900201986b55227d77 100644 (file)
@@ -114,10 +114,6 @@ static inline bool acpi_has_cpu_in_madt(void)
 }
 
 struct acpi_madt_generic_interrupt *acpi_cpu_get_madt_gicc(int cpu);
-static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
-{
-       return  acpi_cpu_get_madt_gicc(cpu)->uid;
-}
 int get_cpu_for_acpi_id(u32 uid);
 
 static inline void arch_fix_phys_package_id(int num, u32 slot) { }
index 7376840fa9f78a657188da556d31b12ce89ef194..eda9d4d0a493c125127ee194a04ae565b663acaa 100644 (file)
@@ -40,11 +40,6 @@ extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
 
 extern int __init parse_acpi_topology(void);
 
-static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
-{
-       return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
-}
-
 #endif /* !CONFIG_ACPI */
 
 #define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
index 6e13695120bc218573c35170313dc4029ec59e58..26ab37c171bcf64a7da94d5ffea53243afec0a16 100644 (file)
@@ -61,10 +61,6 @@ static inline void arch_fix_phys_package_id(int num, u32 slot) { }
 
 void acpi_init_rintc_map(void);
 struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu);
-static inline u32 get_acpi_id_for_cpu(int cpu)
-{
-       return acpi_cpu_get_madt_rintc(cpu)->uid;
-}
 
 int acpi_get_riscv_isa(struct acpi_table_header *table,
                       unsigned int cpu, const char **isa);
index de5f8c018333d7f82f08e0a80c2b6b0be476599e..7bd5bc1f225a41f0cd231fc1489cd0640dc35308 100644 (file)
@@ -459,11 +459,14 @@ static void cache_setup_acpi_cpu(struct acpi_table_header *table,
 {
        struct acpi_pptt_cache *found_cache;
        struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
-       u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+       u32 acpi_cpu_id;
        struct cacheinfo *this_leaf;
        unsigned int index = 0;
        struct acpi_pptt_processor *cpu_node = NULL;
 
+       if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
+               return;
+
        while (index < get_cpu_cacheinfo(cpu)->num_leaves) {
                this_leaf = this_cpu_ci->info_list + index;
                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,
                                     unsigned int cpu, int level, int flag)
 {
        struct acpi_pptt_processor *cpu_node;
-       u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+       u32 acpi_cpu_id;
+
+       if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
+               return -ENOENT;
 
        cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
        if (cpu_node) {
@@ -614,18 +620,22 @@ static int find_acpi_cpu_topology_tag(unsigned int cpu, int level, int flag)
  *
  * Check the node representing a CPU for a given flag.
  *
- * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
- *        the table revision isn't new enough.
+ * Return: -ENOENT if can't get CPU's ACPI Processor UID, the PPTT doesn't
+ *        exist, the CPU cannot be found or the table revision isn't new
+ *        enough.
  *        1, any passed flag set
  *        0, flag unset
  */
 static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
 {
        struct acpi_table_header *table;
-       u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+       u32 acpi_cpu_id;
        struct acpi_pptt_processor *cpu_node = NULL;
        int ret = -ENOENT;
 
+       if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
+               return -ENOENT;
+
        table = acpi_get_pptt();
        if (!table)
                return -ENOENT;
@@ -651,7 +661,8 @@ static int check_acpi_cpu_flag(unsigned int cpu, int rev, u32 flag)
  * in the PPTT. Errors caused by lack of a PPTT table, or otherwise, return 0
  * indicating we didn't find any cache levels.
  *
- * Return: -ENOENT if no PPTT table or no PPTT processor struct found.
+ * Return: -ENOENT if no PPTT table, can't get CPU's ACPI Process UID or no PPTT
+ *        processor struct found.
  *        0 on success.
  */
 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,
 
        pr_debug("Cache Setup: find cache levels for CPU=%d\n", cpu);
 
-       acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+       if (acpi_get_cpu_uid(cpu, &acpi_cpu_id))
+               return -ENOENT;
+
        cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
        if (!cpu_node)
                return -ENOENT;
@@ -780,8 +793,9 @@ int find_acpi_cpu_topology_package(unsigned int cpu)
  * It may not exist in single CPU systems. In simple multi-CPU systems,
  * it may be equal to the package topology level.
  *
- * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found
- * or there is no toplogy level above the CPU..
+ * Return: -ENOENT if the PPTT doesn't exist, can't get CPU's ACPI
+ * Processor UID, the CPU cannot be found or there is no toplogy level
+ * above the CPU.
  * Otherwise returns a value which represents the package for this CPU.
  */
 
@@ -797,7 +811,9 @@ int find_acpi_cpu_topology_cluster(unsigned int cpu)
        if (!table)
                return -ENOENT;
 
-       acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+       if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
+               return -ENOENT;
+
        cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
        if (!cpu_node || !cpu_node->parent)
                return -ENOENT;
@@ -872,7 +888,9 @@ static void acpi_pptt_get_child_cpus(struct acpi_table_header *table_hdr,
        cpumask_clear(cpus);
 
        for_each_possible_cpu(cpu) {
-               acpi_id = get_acpi_id_for_cpu(cpu);
+               if (acpi_get_cpu_uid(cpu, &acpi_id) != 0)
+                       continue;
+
                cpu_node = acpi_find_processor_node(table_hdr, acpi_id);
 
                while (cpu_node) {
@@ -966,10 +984,13 @@ int find_acpi_cache_level_from_id(u32 cache_id)
        for_each_possible_cpu(cpu) {
                bool empty;
                int level = 1;
-               u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+               u32 acpi_cpu_id;
                struct acpi_pptt_cache *cache;
                struct acpi_pptt_processor *cpu_node;
 
+               if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
+                       continue;
+
                cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
                if (!cpu_node)
                        continue;
@@ -1030,10 +1051,13 @@ int acpi_pptt_get_cpumask_from_cache_id(u32 cache_id, cpumask_t *cpus)
        for_each_possible_cpu(cpu) {
                bool empty;
                int level = 1;
-               u32 acpi_cpu_id = get_acpi_id_for_cpu(cpu);
+               u32 acpi_cpu_id;
                struct acpi_pptt_cache *cache;
                struct acpi_pptt_processor *cpu_node;
 
+               if (acpi_get_cpu_uid(cpu, &acpi_cpu_id) != 0)
+                       continue;
+
                cpu_node = acpi_find_processor_node(table, acpi_cpu_id);
                if (!cpu_node)
                        continue;