Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RISC-V: KVM: Remove unnecessary HGATP csr_read

The HGATP has been set to zero in gstage_mode_detect(), so there
is no need to save the old context. Unify the code convention
with gstage_mode_detect().

Reviewed-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Link: https://lore.kernel.org/r/20250821142542.2472079-3-guoren@kernel.org
Signed-off-by: Anup Patel <anup@brainfault.org>

authored by

Guo Ren (Alibaba DAMO Academy) and committed by
Anup Patel
9eac3744 2b351e3d

+1 -4
+1 -4
arch/riscv/kvm/vmid.c
··· 25 25 26 26 void __init kvm_riscv_gstage_vmid_detect(void) 27 27 { 28 - unsigned long old; 29 - 30 28 /* Figure-out number of VMID bits in HW */ 31 - old = csr_read(CSR_HGATP); 32 29 csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID); 33 30 vmid_bits = csr_read(CSR_HGATP); 34 31 vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT; 35 32 vmid_bits = fls_long(vmid_bits); 36 - csr_write(CSR_HGATP, old); 33 + csr_write(CSR_HGATP, 0); 37 34 38 35 /* We polluted local TLB so flush all guest TLB */ 39 36 kvm_riscv_local_hfence_gvma_all();