]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: riscv: Use an rwlock for mmu_lock
authorJinyu Tang <tjytimi@163.com>
Sun, 17 May 2026 15:34:24 +0000 (23:34 +0800)
committerAnup Patel <anup@brainfault.org>
Wed, 3 Jun 2026 12:49:55 +0000 (18:19 +0530)
commitcc98f006c63c8e9f825ca5f89388fe5ace6a5c74
tree248b14f8106e8a142c31b6aac7e8bab469642de2
parent9090ba2e7cf8bf8a54879182db5665452d515bb0
KVM: riscv: Use an rwlock for mmu_lock

RISC-V KVM currently uses a spinlock for mmu_lock. That serializes all
G-stage MMU operations, including permission-only updates that do not
allocate or free page-table pages.

Use KVM's rwlock form of mmu_lock, as x86 and arm64 already do. Keep the
existing map, unmap and teardown paths on the write side. This prepares
RISC-V for read-side handling of G-stage permission updates.

Signed-off-by: Jinyu Tang <tjytimi@163.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260517153427.94889-3-tjytimi@163.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/include/asm/kvm_host.h
arch/riscv/kvm/gstage.c
arch/riscv/kvm/mmu.c