Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / loongarch / kvm / tlb.c
blobebdbe9264e9c60f57f316545572097c0362fcbf0
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (C) 2020-2023 Loongson Technology Corporation Limited
4 */
6 #include <linux/kvm_host.h>
7 #include <asm/tlb.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)
17 unsigned long flags;
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);