diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-13 13:28:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-11-13 13:28:53 -0500 |
commit | e234832afb623fe5c7d1d5703d6619494d8d703f (patch) | |
tree | bc9b5572c3fab768a39d64bb0951d029e684fbca /arch/arm64 | |
parent | e861d890c02c1105d0c82e3904c67f0386352fe2 (diff) | |
parent | 05d36a7dff0b091803034a0d70b41af86aecbc8d (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM fixes from Paolo Bonzini:
"ARM fixes. There are a couple pending x86 patches but they'll have to
wait for next week"
* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: arm/arm64: vgic: Kick VCPUs when queueing already pending IRQs
KVM: arm/arm64: vgic: Prevent access to invalid SPIs
arm/arm64: KVM: Perform local TLB invalidation when multiplexing vcpus on a single CPU
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/asm/kvm_asm.h | 1 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_host.h | 3 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_mmu.h | 2 | ||||
-rw-r--r-- | arch/arm64/kvm/hyp/tlb.c | 15 |
4 files changed, 20 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h index 18f746551bf6..ec3553eb9349 100644 --- a/arch/arm64/include/asm/kvm_asm.h +++ b/arch/arm64/include/asm/kvm_asm.h | |||
@@ -54,6 +54,7 @@ extern char __kvm_hyp_vector[]; | |||
54 | extern void __kvm_flush_vm_context(void); | 54 | extern void __kvm_flush_vm_context(void); |
55 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); | 55 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); |
56 | extern void __kvm_tlb_flush_vmid(struct kvm *kvm); | 56 | extern void __kvm_tlb_flush_vmid(struct kvm *kvm); |
57 | extern void __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu); | ||
57 | 58 | ||
58 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); | 59 | extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu); |
59 | 60 | ||
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index bd94e6766759..e5050388e062 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
@@ -62,6 +62,9 @@ struct kvm_arch { | |||
62 | /* VTTBR value associated with above pgd and vmid */ | 62 | /* VTTBR value associated with above pgd and vmid */ |
63 | u64 vttbr; | 63 | u64 vttbr; |
64 | 64 | ||
65 | /* The last vcpu id that ran on each physical CPU */ | ||
66 | int __percpu *last_vcpu_ran; | ||
67 | |||
65 | /* The maximum number of vCPUs depends on the used GIC model */ | 68 | /* The maximum number of vCPUs depends on the used GIC model */ |
66 | int max_vcpus; | 69 | int max_vcpus; |
67 | 70 | ||
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index a79b969c26fc..6f72fe8b0e3e 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h | |||
@@ -128,7 +128,7 @@ static inline unsigned long __kern_hyp_va(unsigned long v) | |||
128 | return v; | 128 | return v; |
129 | } | 129 | } |
130 | 130 | ||
131 | #define kern_hyp_va(v) (typeof(v))(__kern_hyp_va((unsigned long)(v))) | 131 | #define kern_hyp_va(v) ((typeof(v))(__kern_hyp_va((unsigned long)(v)))) |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * We currently only support a 40bit IPA. | 134 | * We currently only support a 40bit IPA. |
diff --git a/arch/arm64/kvm/hyp/tlb.c b/arch/arm64/kvm/hyp/tlb.c index 9cc0ea784ae6..88e2f2b938f0 100644 --- a/arch/arm64/kvm/hyp/tlb.c +++ b/arch/arm64/kvm/hyp/tlb.c | |||
@@ -64,6 +64,21 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) | |||
64 | write_sysreg(0, vttbr_el2); | 64 | write_sysreg(0, vttbr_el2); |
65 | } | 65 | } |
66 | 66 | ||
67 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) | ||
68 | { | ||
69 | struct kvm *kvm = kern_hyp_va(kern_hyp_va(vcpu)->kvm); | ||
70 | |||
71 | /* Switch to requested VMID */ | ||
72 | write_sysreg(kvm->arch.vttbr, vttbr_el2); | ||
73 | isb(); | ||
74 | |||
75 | asm volatile("tlbi vmalle1" : : ); | ||
76 | dsb(nsh); | ||
77 | isb(); | ||
78 | |||
79 | write_sysreg(0, vttbr_el2); | ||
80 | } | ||
81 | |||
67 | void __hyp_text __kvm_flush_vm_context(void) | 82 | void __hyp_text __kvm_flush_vm_context(void) |
68 | { | 83 | { |
69 | dsb(ishst); | 84 | dsb(ishst); |