History

Merge tag 'kvmarm-fixes-for-5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm/fixes

Pull KVM/arm fixes from Marc Zyngier as per Paulo's request at: https://lkml.kernel.org/r/21ae69a2-2546-29d0-bff6-2ea825e3d968@redhat.com "One (hopefully last) set of fixes for KVM/arm for 5.3: an embarassing MMIO emulation regression, and a UBSAN splat. Oh well... - Don't overskip instructions on MMIO emulation - Fix UBSAN splat when initializing PPI priorities" * tag 'kvmarm-fixes-for-5.3-3' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm: KVM: arm/arm64: VGIC: Properly initialise private IRQ affinity KVM: arm/arm64: Only skip MMIO insn once

Will Deacon committed 7 years ago

Commit 087eeea2 parents d1abaeb 2e16f3e2 files · +27 −10Browse files

Unified · Split

2 files
  1. virt/kvm/arm/mmio.c +7 −0
  2. virt/kvm/arm/vgic/vgic-init.c +20 −10
virt/kvm/arm/mmio.c+7−0
@@ -86,6 +86,12 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run) · 85 unmodified lines
8686 unsigned int len;
8787 int mask;
8888
89+ /* Detect an already handled MMIO return */
90+ if (unlikely(!vcpu->mmio_needed))
91+ return 0;
92+
93+ vcpu->mmio_needed = 0;
94+
8995 if (!run->mmio.is_write) {
9096 len = run->mmio.len;
9197 if (len > sizeof(unsigned long))
@@ -188,6 +194,7 @@ int io_mem_abort(struct kvm_vcpu *vcpu, struct kvm_run *run, · 96 unmodified lines
188194 run->mmio.is_write = is_write;
189195 run->mmio.phys_addr = fault_ipa;
190196 run->mmio.len = len;
197+ vcpu->mmio_needed = 1;
191198
192199 if (!ret) {
193200 /* We handled the access successfully in the kernel. */
virt/kvm/arm/vgic/vgic-init.c+20−10
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <linux/cpu.h>
99 #include <linux/kvm_host.h>
1010 #include <kvm/arm_vgic.h>
11+#include <asm/kvm_emulate.h>
1112 #include <asm/kvm_mmu.h>
1213 #include "vgic.h"
1314
@@ -164,12 +165,18 @@ static int kvm_vgic_dist_init(struct kvm *kvm, unsigned int nr_spis) · 150 unmodified lines
164165 irq->vcpu = NULL;
165166 irq->target_vcpu = vcpu0;
166167 kref_init(&irq->refcount);
167− if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V2) {
168+ switch (dist->vgic_model) {
169+ case KVM_DEV_TYPE_ARM_VGIC_V2:
168170 irq->targets = 0;
169171 irq->group = 0;
170− } else {
172+ break;
173+ case KVM_DEV_TYPE_ARM_VGIC_V3:
171174 irq->mpidr = 0;
172175 irq->group = 1;
176+ break;
177+ default:
178+ kfree(dist->spis);
179+ return -EINVAL;
173180 }
174181 }
175182 return 0;
@@ -209,7 +216,6 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) · 33 unmodified lines
209216 irq->intid = i;
210217 irq->vcpu = NULL;
211218 irq->target_vcpu = vcpu;
212− irq->targets = 1U << vcpu->vcpu_id;
213219 kref_init(&irq->refcount);
214220 if (vgic_irq_is_sgi(i)) {
215221 /* SGIs */
@@ -219,11 +225,6 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) · 3 unmodified lines
219225 /* PPIs */
220226 irq->config = VGIC_CONFIG_LEVEL;
221227 }
222−
223− if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3)
224− irq->group = 1;
225− else
226− irq->group = 0;
227228 }
228229
229230 if (!irqchip_in_kernel(vcpu->kvm))
@@ -286,10 +287,19 @@ int vgic_init(struct kvm *kvm) · 56 unmodified lines
286287
287288 for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {
288289 struct vgic_irq *irq = &vgic_cpu->private_irqs[i];
289− if (dist->vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3)
290+ switch (dist->vgic_model) {
291+ case KVM_DEV_TYPE_ARM_VGIC_V3:
290292 irq->group = 1;
291− else
293+ irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);
294+ break;
295+ case KVM_DEV_TYPE_ARM_VGIC_V2:
292296 irq->group = 0;
297+ irq->targets = 1U << idx;
298+ break;
299+ default:
300+ ret = -EINVAL;
301+ goto out;
302+ }
293303 }
294304 }
295305

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t