[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240821-loongarch_archnuma-v1-2-f47b191beee8@flygoat.com>
Date: Wed, 21 Aug 2024 14:12:16 +0100
From: Jiaxun Yang <jiaxun.yang@...goat.com>
To: Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org,
Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: [PATCH 2/3] LoongArch: ACPI: Introduce get_cpu_for_acpi_id
This would allow us to reverse lookup cpu_id from apic_id.
Since it won't be a hot function, just use simple iteration match.
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
arch/loongarch/include/asm/acpi.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/arch/loongarch/include/asm/acpi.h b/arch/loongarch/include/asm/acpi.h
index 313f66f7913a..5d4f8f5efdb6 100644
--- a/arch/loongarch/include/asm/acpi.h
+++ b/arch/loongarch/include/asm/acpi.h
@@ -45,6 +45,18 @@ static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
}
+static inline int get_cpu_for_acpi_id(u32 acpi_id)
+{
+ int cpu;
+
+ for_each_possible_cpu(cpu) {
+ if (acpi_core_pic[cpu_logical_map(cpu)].processor_id == acpi_id)
+ return cpu;
+ }
+
+ return -1;
+}
+
#endif /* !CONFIG_ACPI */
#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
--
2.46.0
Powered by blists - more mailing lists