]> git.baikalelectronics.ru Git - kernel.git/commit
x86/apic/of: Fix CPU devicetree-node lookups
authorJohan Hovold <johan@kernel.org>
Fri, 12 Mar 2021 09:20:33 +0000 (10:20 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 19 Mar 2021 22:01:49 +0000 (23:01 +0100)
commitcff53ab9b792ba35e905f0dc38d88cc9124dcc6c
tree7ba8c1bd2c8853046bc97a51ec39b7c0f85bfa3a
parentce5707fd1f734836c1392aa1966cc4f3862afbca
x86/apic/of: Fix CPU devicetree-node lookups

Architectures that describe the CPU topology in devicetree and do not have
an identity mapping between physical and logical CPU ids must override the
default implementation of arch_match_cpu_phys_id().

Failing to do so breaks CPU devicetree-node lookups using of_get_cpu_node()
and of_cpu_device_node_get() which several drivers rely on. It also causes
the CPU struct devices exported through sysfs to point to the wrong
devicetree nodes.

On x86, CPUs are described in devicetree using their APIC ids and those
do not generally coincide with the logical ids, even if CPU0 typically
uses APIC id 0.

Add the missing implementation of arch_match_cpu_phys_id() so that CPU-node
lookups work also with SMP.

Apart from fixing the broken sysfs devicetree-node links this likely does
not affect current users of mainline kernels on x86.

Fixes: 4b7380c5a33a ("x86/devicetree: Use CPU description from Device Tree")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210312092033.26317-1-johan@kernel.org
arch/x86/kernel/apic/apic.c