1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2020-2023 Loongson Technology Corporation Limited
6 #include <linux/kvm_host.h>
8 #include <asm/kvm_csr.h>
11 * kvm_flush_tlb_all() - Flush all root TLB entries for guests.
13 * Invalidate all entries including GVA-->GPA and GPA-->HPA mappings.
15 void kvm_flush_tlb_all(void)
19 local_irq_save(flags
);
20 invtlb_all(INVTLB_ALLGID
, 0, 0);
21 local_irq_restore(flags
);
24 void kvm_flush_tlb_gpa(struct kvm_vcpu
*vcpu
, unsigned long gpa
)
26 lockdep_assert_irqs_disabled();
27 gpa
&= (PAGE_MASK
<< 1);
28 invtlb(INVTLB_GID_ADDR
, read_csr_gstat() & CSR_GSTAT_GID
, gpa
);