OSDN Git Service

arm64: kvm: Add standalone ticket spinlock implementation for use at hyp
authorWill Deacon <will@kernel.org>
Fri, 19 Mar 2021 10:01:11 +0000 (10:01 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 19 Mar 2021 12:01:19 +0000 (12:01 +0000)
commit67c2d326332ee28079348e43cf4f17bbfe63b260
treeabb7c5e42e7e5a70ebfd502a578853a8b4f47157
parent7b4a7b5e6fefd15f708f959dd43e188444e252ec
arm64: kvm: Add standalone ticket spinlock implementation for use at hyp

We will soon need to synchronise multiple CPUs in the hyp text at EL2.
The qspinlock-based locking used by the host is overkill for this purpose
and relies on the kernel's "percpu" implementation for the MCS nodes.

Implement a simple ticket locking scheme based heavily on the code removed
by commit c11090474d70 ("arm64: locking: Replace ticket lock implementation
with qspinlock").

Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210319100146.1149909-4-qperret@google.com
arch/arm64/kvm/hyp/include/nvhe/spinlock.h [new file with mode: 0644]