mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
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>
This commit is contained in:
parent
2b351e3d04
commit
9eac3744db
|
|
@ -25,15 +25,12 @@ static DEFINE_SPINLOCK(vmid_lock);
|
|||
|
||||
void __init kvm_riscv_gstage_vmid_detect(void)
|
||||
{
|
||||
unsigned long old;
|
||||
|
||||
/* Figure-out number of VMID bits in HW */
|
||||
old = csr_read(CSR_HGATP);
|
||||
csr_write(CSR_HGATP, (kvm_riscv_gstage_mode << HGATP_MODE_SHIFT) | HGATP_VMID);
|
||||
vmid_bits = csr_read(CSR_HGATP);
|
||||
vmid_bits = (vmid_bits & HGATP_VMID) >> HGATP_VMID_SHIFT;
|
||||
vmid_bits = fls_long(vmid_bits);
|
||||
csr_write(CSR_HGATP, old);
|
||||
csr_write(CSR_HGATP, 0);
|
||||
|
||||
/* We polluted local TLB so flush all guest TLB */
|
||||
kvm_riscv_local_hfence_gvma_all();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user