linux/arch/loongarch
Bibo Mao b5d4e2325d LoongArch: KVM: Delay secondary mmu tlb flush until guest entry
With hardware assisted virtualization, there are two level HW mmu, one
is GVA to GPA mapping, the other is GPA to HPA mapping which is called
secondary mmu in generic. If there is page fault for secondary mmu,
there needs tlb flush operation indexed with fault GPA address and VMID.
VMID is stored at register CSR.GSTAT and will be reload or recalculated
before guest entry.

Currently CSR.GSTAT is not saved and restored during VCPU context
switch, instead it is recalculated during guest entry. So CSR.GSTAT is
effective only when a VCPU runs in guest mode, however it may not be
effective if the VCPU exits to host mode. Since register CSR.GSTAT may
be stale, it may records the VMID of the last schedule-out VCPU, rather
than the current VCPU.

Function kvm_flush_tlb_gpa() should be called with its real VMID, so
here move it to the guest entrance. Also an arch-specific request id
KVM_REQ_TLB_FLUSH_GPA is added to flush tlb for secondary mmu, and it
can be optimized if VMID is updated, since all guest tlb entries will
be invalid if VMID is updated.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2024-07-09 16:25:50 +08:00
..
boot LoongArch: Fix GMAC's phy-mode definitions in dts 2024-06-03 15:45:53 +08:00
configs LoongArch changes for v6.10 2024-05-22 09:43:07 -07:00
crypto LoongArch/crypto: Clean up useless assignment operations 2024-03-19 15:50:34 +08:00
include LoongArch: KVM: Delay secondary mmu tlb flush until guest entry 2024-07-09 16:25:50 +08:00
kernel syscalls: mmap(): use unsigned offset type consistently 2024-06-25 15:57:38 +02:00
kvm LoongArch: KVM: Delay secondary mmu tlb flush until guest entry 2024-07-09 16:25:50 +08:00
lib LoongArch: Select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 2024-05-14 12:24:18 +08:00
mm LoongArch changes for v6.10 2024-05-22 09:43:07 -07:00
net bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro() 2024-03-14 19:28:52 -07:00
pci LoongArch: Add FDT booting support from efi system table 2022-12-14 08:41:53 +08:00
power LoongArch: Give a chance to build with !CONFIG_SMP 2024-05-14 12:24:18 +08:00
vdso Makefile: remove redundant tool coverage variables 2024-05-14 23:35:48 +09:00
Kbuild LoongArch: Allow device trees be built into the kernel 2024-01-17 12:43:00 +08:00
Kconfig LoongArch: Only allow OBJTOOL & ORC unwinder if toolchain supports -mthin-add-sub 2024-06-21 10:18:40 +08:00
Kconfig.debug LoongArch: Only allow OBJTOOL & ORC unwinder if toolchain supports -mthin-add-sub 2024-06-21 10:18:40 +08:00
Makefile - A series ("kbuild: enable more warnings by default") from Arnd 2024-05-22 18:59:29 -07:00