1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (C) 2020-2023 Loongson Technology Corporation Limited 4 */ 5 6 #include <linux/kvm_host.h> 7 #include <asm/tlb.h> 8 #include <asm/kvm_csr.h> 9 10 /* 11 * kvm_flush_tlb_all() - Flush all root TLB entries for guests. 12 * 13 * Invalidate all entries including GVA-->GPA and GPA-->HPA mappings. 14 */ 15 void kvm_flush_tlb_all(void) 16 { 17 unsigned long flags; 18 19 local_irq_save(flags); 20 invtlb_all(INVTLB_ALLGID, 0, 0); 21 local_irq_restore(flags); 22 } 23 24 void kvm_flush_tlb_gpa(struct kvm_vcpu *vcpu, unsigned long gpa) 25 { 26 lockdep_assert_irqs_disabled(); 27 gpa &= (PAGE_MASK << 1); 28 invtlb(INVTLB_GID_ADDR, read_csr_gstat() & CSR_GSTAT_GID, gpa); 29 } 30
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.