diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2019-10-03 06:08:50 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-10-03 06:08:50 -0400 |
commit | d53a4c8e77dae2b71cd9b3fd249ae538f137caeb (patch) | |
tree | 14fd3036fbef9f86d921a54f193d0bc31b5ba596 | |
parent | 24c29b7ac0da3e2eb589553f7a98bade6d0a0e60 (diff) | |
parent | aac60f1a867773de9eb164013d89c99f3ea1f009 (diff) |
Merge tag 'kvmarm-fixes-5.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
KVM/arm fixes for 5.4, take #1
- Remove the now obsolete hyp_alternate_select construct
- Fix the TRACE_INCLUDE_PATH macro in the vgic code
-rw-r--r-- | arch/arm64/include/asm/kvm_hyp.h | 24 | ||||
-rw-r--r-- | arch/arm64/kvm/hyp/switch.c | 17 | ||||
-rw-r--r-- | arch/arm64/kvm/hyp/tlb.c | 36 | ||||
-rw-r--r-- | virt/kvm/arm/vgic/trace.h | 2 |
4 files changed, 25 insertions, 54 deletions
diff --git a/arch/arm64/include/asm/kvm_hyp.h b/arch/arm64/include/asm/kvm_hyp.h index 86825aa20852..97f21cc66657 100644 --- a/arch/arm64/include/asm/kvm_hyp.h +++ b/arch/arm64/include/asm/kvm_hyp.h | |||
@@ -47,30 +47,6 @@ | |||
47 | #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1) | 47 | #define read_sysreg_el2(r) read_sysreg_elx(r, _EL2, _EL1) |
48 | #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1) | 48 | #define write_sysreg_el2(v,r) write_sysreg_elx(v, r, _EL2, _EL1) |
49 | 49 | ||
50 | /** | ||
51 | * hyp_alternate_select - Generates patchable code sequences that are | ||
52 | * used to switch between two implementations of a function, depending | ||
53 | * on the availability of a feature. | ||
54 | * | ||
55 | * @fname: a symbol name that will be defined as a function returning a | ||
56 | * function pointer whose type will match @orig and @alt | ||
57 | * @orig: A pointer to the default function, as returned by @fname when | ||
58 | * @cond doesn't hold | ||
59 | * @alt: A pointer to the alternate function, as returned by @fname | ||
60 | * when @cond holds | ||
61 | * @cond: a CPU feature (as described in asm/cpufeature.h) | ||
62 | */ | ||
63 | #define hyp_alternate_select(fname, orig, alt, cond) \ | ||
64 | typeof(orig) * __hyp_text fname(void) \ | ||
65 | { \ | ||
66 | typeof(alt) *val = orig; \ | ||
67 | asm volatile(ALTERNATIVE("nop \n", \ | ||
68 | "mov %0, %1 \n", \ | ||
69 | cond) \ | ||
70 | : "+r" (val) : "r" (alt)); \ | ||
71 | return val; \ | ||
72 | } | ||
73 | |||
74 | int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu); | 50 | int __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu); |
75 | 51 | ||
76 | void __vgic_v3_save_state(struct kvm_vcpu *vcpu); | 52 | void __vgic_v3_save_state(struct kvm_vcpu *vcpu); |
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index bd978ad71936..3d3815020e36 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c | |||
@@ -229,20 +229,6 @@ static void __hyp_text __hyp_vgic_restore_state(struct kvm_vcpu *vcpu) | |||
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | static bool __hyp_text __true_value(void) | ||
233 | { | ||
234 | return true; | ||
235 | } | ||
236 | |||
237 | static bool __hyp_text __false_value(void) | ||
238 | { | ||
239 | return false; | ||
240 | } | ||
241 | |||
242 | static hyp_alternate_select(__check_arm_834220, | ||
243 | __false_value, __true_value, | ||
244 | ARM64_WORKAROUND_834220); | ||
245 | |||
246 | static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar) | 232 | static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar) |
247 | { | 233 | { |
248 | u64 par, tmp; | 234 | u64 par, tmp; |
@@ -298,7 +284,8 @@ static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu) | |||
298 | * resolve the IPA using the AT instruction. | 284 | * resolve the IPA using the AT instruction. |
299 | */ | 285 | */ |
300 | if (!(esr & ESR_ELx_S1PTW) && | 286 | if (!(esr & ESR_ELx_S1PTW) && |
301 | (__check_arm_834220()() || (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) { | 287 | (cpus_have_const_cap(ARM64_WORKAROUND_834220) || |
288 | (esr & ESR_ELx_FSC_TYPE) == FSC_PERM)) { | ||
302 | if (!__translate_far_to_hpfar(far, &hpfar)) | 289 | if (!__translate_far_to_hpfar(far, &hpfar)) |
303 | return false; | 290 | return false; |
304 | } else { | 291 | } else { |
diff --git a/arch/arm64/kvm/hyp/tlb.c b/arch/arm64/kvm/hyp/tlb.c index c466060b76d6..eb0efc5557f3 100644 --- a/arch/arm64/kvm/hyp/tlb.c +++ b/arch/arm64/kvm/hyp/tlb.c | |||
@@ -67,10 +67,14 @@ static void __hyp_text __tlb_switch_to_guest_nvhe(struct kvm *kvm, | |||
67 | isb(); | 67 | isb(); |
68 | } | 68 | } |
69 | 69 | ||
70 | static hyp_alternate_select(__tlb_switch_to_guest, | 70 | static void __hyp_text __tlb_switch_to_guest(struct kvm *kvm, |
71 | __tlb_switch_to_guest_nvhe, | 71 | struct tlb_inv_context *cxt) |
72 | __tlb_switch_to_guest_vhe, | 72 | { |
73 | ARM64_HAS_VIRT_HOST_EXTN); | 73 | if (has_vhe()) |
74 | __tlb_switch_to_guest_vhe(kvm, cxt); | ||
75 | else | ||
76 | __tlb_switch_to_guest_nvhe(kvm, cxt); | ||
77 | } | ||
74 | 78 | ||
75 | static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm, | 79 | static void __hyp_text __tlb_switch_to_host_vhe(struct kvm *kvm, |
76 | struct tlb_inv_context *cxt) | 80 | struct tlb_inv_context *cxt) |
@@ -98,10 +102,14 @@ static void __hyp_text __tlb_switch_to_host_nvhe(struct kvm *kvm, | |||
98 | write_sysreg(0, vttbr_el2); | 102 | write_sysreg(0, vttbr_el2); |
99 | } | 103 | } |
100 | 104 | ||
101 | static hyp_alternate_select(__tlb_switch_to_host, | 105 | static void __hyp_text __tlb_switch_to_host(struct kvm *kvm, |
102 | __tlb_switch_to_host_nvhe, | 106 | struct tlb_inv_context *cxt) |
103 | __tlb_switch_to_host_vhe, | 107 | { |
104 | ARM64_HAS_VIRT_HOST_EXTN); | 108 | if (has_vhe()) |
109 | __tlb_switch_to_host_vhe(kvm, cxt); | ||
110 | else | ||
111 | __tlb_switch_to_host_nvhe(kvm, cxt); | ||
112 | } | ||
105 | 113 | ||
106 | void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) | 114 | void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) |
107 | { | 115 | { |
@@ -111,7 +119,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) | |||
111 | 119 | ||
112 | /* Switch to requested VMID */ | 120 | /* Switch to requested VMID */ |
113 | kvm = kern_hyp_va(kvm); | 121 | kvm = kern_hyp_va(kvm); |
114 | __tlb_switch_to_guest()(kvm, &cxt); | 122 | __tlb_switch_to_guest(kvm, &cxt); |
115 | 123 | ||
116 | /* | 124 | /* |
117 | * We could do so much better if we had the VA as well. | 125 | * We could do so much better if we had the VA as well. |
@@ -154,7 +162,7 @@ void __hyp_text __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa) | |||
154 | if (!has_vhe() && icache_is_vpipt()) | 162 | if (!has_vhe() && icache_is_vpipt()) |
155 | __flush_icache_all(); | 163 | __flush_icache_all(); |
156 | 164 | ||
157 | __tlb_switch_to_host()(kvm, &cxt); | 165 | __tlb_switch_to_host(kvm, &cxt); |
158 | } | 166 | } |
159 | 167 | ||
160 | void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) | 168 | void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) |
@@ -165,13 +173,13 @@ void __hyp_text __kvm_tlb_flush_vmid(struct kvm *kvm) | |||
165 | 173 | ||
166 | /* Switch to requested VMID */ | 174 | /* Switch to requested VMID */ |
167 | kvm = kern_hyp_va(kvm); | 175 | kvm = kern_hyp_va(kvm); |
168 | __tlb_switch_to_guest()(kvm, &cxt); | 176 | __tlb_switch_to_guest(kvm, &cxt); |
169 | 177 | ||
170 | __tlbi(vmalls12e1is); | 178 | __tlbi(vmalls12e1is); |
171 | dsb(ish); | 179 | dsb(ish); |
172 | isb(); | 180 | isb(); |
173 | 181 | ||
174 | __tlb_switch_to_host()(kvm, &cxt); | 182 | __tlb_switch_to_host(kvm, &cxt); |
175 | } | 183 | } |
176 | 184 | ||
177 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) | 185 | void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) |
@@ -180,13 +188,13 @@ void __hyp_text __kvm_tlb_flush_local_vmid(struct kvm_vcpu *vcpu) | |||
180 | struct tlb_inv_context cxt; | 188 | struct tlb_inv_context cxt; |
181 | 189 | ||
182 | /* Switch to requested VMID */ | 190 | /* Switch to requested VMID */ |
183 | __tlb_switch_to_guest()(kvm, &cxt); | 191 | __tlb_switch_to_guest(kvm, &cxt); |
184 | 192 | ||
185 | __tlbi(vmalle1); | 193 | __tlbi(vmalle1); |
186 | dsb(nsh); | 194 | dsb(nsh); |
187 | isb(); | 195 | isb(); |
188 | 196 | ||
189 | __tlb_switch_to_host()(kvm, &cxt); | 197 | __tlb_switch_to_host(kvm, &cxt); |
190 | } | 198 | } |
191 | 199 | ||
192 | void __hyp_text __kvm_flush_vm_context(void) | 200 | void __hyp_text __kvm_flush_vm_context(void) |
diff --git a/virt/kvm/arm/vgic/trace.h b/virt/kvm/arm/vgic/trace.h index 55fed77a9f73..4fd4f6db181b 100644 --- a/virt/kvm/arm/vgic/trace.h +++ b/virt/kvm/arm/vgic/trace.h | |||
@@ -30,7 +30,7 @@ TRACE_EVENT(vgic_update_irq_pending, | |||
30 | #endif /* _TRACE_VGIC_H */ | 30 | #endif /* _TRACE_VGIC_H */ |
31 | 31 | ||
32 | #undef TRACE_INCLUDE_PATH | 32 | #undef TRACE_INCLUDE_PATH |
33 | #define TRACE_INCLUDE_PATH ../../../virt/kvm/arm/vgic | 33 | #define TRACE_INCLUDE_PATH ../../virt/kvm/arm/vgic |
34 | #undef TRACE_INCLUDE_FILE | 34 | #undef TRACE_INCLUDE_FILE |
35 | #define TRACE_INCLUDE_FILE trace | 35 | #define TRACE_INCLUDE_FILE trace |
36 | 36 | ||