[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201124134247.2668-1-johan@kernel.org>
Date: Tue, 24 Nov 2020 14:42:47 +0100
From: Johan Hovold <johan@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Rob Herring <robh@...nel.org>, linux-kernel@...r.kernel.org,
Johan Hovold <johan@...nel.org>
Subject: [PATCH] x86/apic: Fix CPU devicetree-node lookups
Fix CPU devicetree-node lookups by implementing
arch_match_cpu_phys_id().
This allows using of_get_cpu_node() and of_cpu_device_node_get() to look
up CPU devicetree nodes and specifically makes sure that CPU struct
devices are linked to the correct devicetree nodes.
Note that CPUs are described in devicetree using their APIC ids and
that those do not generally coincide with the logical ids (e.g. used by
the default arch_match_cpu_phys_id() implementation).
Signed-off-by: Johan Hovold <johan@...nel.org>
---
arch/x86/kernel/apic/apic.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index b3eef1d5c903..19c0119892dd 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2311,6 +2311,11 @@ static int cpuid_to_apicid[] = {
[0 ... NR_CPUS - 1] = -1,
};
+bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
+{
+ return phys_id == cpuid_to_apicid[cpu];
+}
+
#ifdef CONFIG_SMP
/**
* apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread
--
2.26.2
Powered by blists - more mailing lists