summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2017-02-01 05:03:45 -0500
committerChristoffer Dall <christoffer.dall@linaro.org>2017-02-01 05:56:35 -0500
commit11710dec8a45084a3e0ad2f6da944c990fad23a4 (patch)
tree607fa996a76cb204964692d390fc9d671fd9a2a7 /virt
parent9d93dc1c96ec446bef9c34a189ea24556f1af89a (diff)
KVM: arm/arm64: Remove kvm_vgic_inject_mapped_irq
The only benefit of having kvm_vgic_inject_mapped_irq separate from kvm_vgic_inject_irq is that we pass a boolean that we use for error checking on the injection path. While this could potentially help in some aspect of robustness, it's also a little bit of a defensive move, and arguably callers into the vgic should have make sure they have marked their virtual IRQs as mapped if required. Acked-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/arch_timer.c3
-rw-r--r--virt/kvm/arm/vgic/vgic.c50
2 files changed, 18 insertions, 35 deletions
diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 6a084cd57b88..91ecf48f7fe2 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -175,7 +175,8 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level)
175 timer->irq.level = new_level; 175 timer->irq.level = new_level;
176 trace_kvm_timer_update_irq(vcpu->vcpu_id, timer->irq.irq, 176 trace_kvm_timer_update_irq(vcpu->vcpu_id, timer->irq.irq,
177 timer->irq.level); 177 timer->irq.level);
178 ret = kvm_vgic_inject_mapped_irq(vcpu->kvm, vcpu->vcpu_id, 178
179 ret = kvm_vgic_inject_irq(vcpu->kvm, vcpu->vcpu_id,
179 timer->irq.irq, 180 timer->irq.irq,
180 timer->irq.level); 181 timer->irq.level);
181 WARN_ON(ret); 182 WARN_ON(ret);
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index dea12df2b879..654dfd40e449 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -335,9 +335,22 @@ retry:
335 return true; 335 return true;
336} 336}
337 337
338static int vgic_update_irq_pending(struct kvm *kvm, int cpuid, 338/**
339 unsigned int intid, bool level, 339 * kvm_vgic_inject_irq - Inject an IRQ from a device to the vgic
340 bool mapped_irq) 340 * @kvm: The VM structure pointer
341 * @cpuid: The CPU for PPIs
342 * @intid: The INTID to inject a new state to.
343 * @level: Edge-triggered: true: to trigger the interrupt
344 * false: to ignore the call
345 * Level-sensitive true: raise the input signal
346 * false: lower the input signal
347 *
348 * The VGIC is not concerned with devices being active-LOW or active-HIGH for
349 * level-sensitive interrupts. You can think of the level parameter as 1
350 * being HIGH and 0 being LOW and all devices being active-HIGH.
351 */
352int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
353 bool level)
341{ 354{
342 struct kvm_vcpu *vcpu; 355 struct kvm_vcpu *vcpu;
343 struct vgic_irq *irq; 356 struct vgic_irq *irq;
@@ -357,11 +370,6 @@ static int vgic_update_irq_pending(struct kvm *kvm, int cpuid,
357 if (!irq) 370 if (!irq)
358 return -EINVAL; 371 return -EINVAL;
359 372
360 if (irq->hw != mapped_irq) {
361 vgic_put_irq(kvm, irq);
362 return -EINVAL;
363 }
364
365 spin_lock(&irq->irq_lock); 373 spin_lock(&irq->irq_lock);
366 374
367 if (!vgic_validate_injection(irq, level)) { 375 if (!vgic_validate_injection(irq, level)) {
@@ -382,32 +390,6 @@ static int vgic_update_irq_pending(struct kvm *kvm, int cpuid,
382 return 0; 390 return 0;
383} 391}
384 392
385/**
386 * kvm_vgic_inject_irq - Inject an IRQ from a device to the vgic
387 * @kvm: The VM structure pointer
388 * @cpuid: The CPU for PPIs
389 * @intid: The INTID to inject a new state to.
390 * @level: Edge-triggered: true: to trigger the interrupt
391 * false: to ignore the call
392 * Level-sensitive true: raise the input signal
393 * false: lower the input signal
394 *
395 * The VGIC is not concerned with devices being active-LOW or active-HIGH for
396 * level-sensitive interrupts. You can think of the level parameter as 1
397 * being HIGH and 0 being LOW and all devices being active-HIGH.
398 */
399int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
400 bool level)
401{
402 return vgic_update_irq_pending(kvm, cpuid, intid, level, false);
403}
404
405int kvm_vgic_inject_mapped_irq(struct kvm *kvm, int cpuid, unsigned int intid,
406 bool level)
407{
408 return vgic_update_irq_pending(kvm, cpuid, intid, level, true);
409}
410
411int kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, u32 virt_irq, u32 phys_irq) 393int kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, u32 virt_irq, u32 phys_irq)
412{ 394{
413 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, virt_irq); 395 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, virt_irq);