OSDN Git Service

UPSTREAM: arm64: make cpu number a percpu variable
authorMark Rutland <mark.rutland@arm.com>
Thu, 3 Nov 2016 20:23:11 +0000 (20:23 +0000)
committerZubin Mithra <zsm@google.com>
Wed, 9 Aug 2017 14:23:23 +0000 (15:23 +0100)
commitf7f69dfb0277528bfcad3c08558dc7d60bc906dd
treecd32fd3a64427993dba0bf7c5b5ee0c4da57d554
parentd8cd9de39f1d1c16354e3342f27366ab0203474f
UPSTREAM: arm64: make cpu number a percpu variable

In the absence of CONFIG_THREAD_INFO_IN_TASK, core code maintains
thread_info::cpu, and low-level architecture code can access this to
build raw_smp_processor_id(). With CONFIG_THREAD_INFO_IN_TASK, core code
maintains task_struct::cpu, which for reasons of hte header soup is not
accessible to low-level arch code.

Instead, we can maintain a percpu variable containing the cpu number.

For both the old and new implementation of raw_smp_processor_id(), we
read a syreg into a GPR, add an offset, and load the result. As the
offset is now larger, it may not be folded into the load, but otherwise
the assembly shouldn't change much.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Laura Abbott <labbott@redhat.com>
Cc: James Morse <james.morse@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Bug: 38331309
Change-Id: I154927b0f9fc0ebbbed88c9958408bbb19cf09de
(cherry picked from commit 57c82954e77fa12c1023e87210d2ede77aaa0058)
Signed-off-by: Zubin Mithra <zsm@google.com>
arch/arm64/include/asm/smp.h
arch/arm64/kernel/smp.c