aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--virt/kvm/arm/vgic/vgic-v2.c7
-rw-r--r--virt/kvm/arm/vgic/vgic-v3.c7
-rw-r--r--virt/kvm/arm/vgic/vgic.c13
3 files changed, 15 insertions, 12 deletions
diff --git a/virt/kvm/arm/vgic/vgic-v2.c b/virt/kvm/arm/vgic/vgic-v2.c
index df5e6a6e3186..69b892abd7dc 100644
--- a/virt/kvm/arm/vgic/vgic-v2.c
+++ b/virt/kvm/arm/vgic/vgic-v2.c
@@ -62,7 +62,8 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu)
62 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; 62 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
63 struct vgic_v2_cpu_if *cpuif = &vgic_cpu->vgic_v2; 63 struct vgic_v2_cpu_if *cpuif = &vgic_cpu->vgic_v2;
64 int lr; 64 int lr;
65 unsigned long flags; 65
66 DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
66 67
67 cpuif->vgic_hcr &= ~GICH_HCR_UIE; 68 cpuif->vgic_hcr &= ~GICH_HCR_UIE;
68 69
@@ -83,7 +84,7 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu)
83 84
84 irq = vgic_get_irq(vcpu->kvm, vcpu, intid); 85 irq = vgic_get_irq(vcpu->kvm, vcpu, intid);
85 86
86 spin_lock_irqsave(&irq->irq_lock, flags); 87 spin_lock(&irq->irq_lock);
87 88
88 /* Always preserve the active bit */ 89 /* Always preserve the active bit */
89 irq->active = !!(val & GICH_LR_ACTIVE_BIT); 90 irq->active = !!(val & GICH_LR_ACTIVE_BIT);
@@ -126,7 +127,7 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu)
126 vgic_irq_set_phys_active(irq, false); 127 vgic_irq_set_phys_active(irq, false);
127 } 128 }
128 129
129 spin_unlock_irqrestore(&irq->irq_lock, flags); 130 spin_unlock(&irq->irq_lock);
130 vgic_put_irq(vcpu->kvm, irq); 131 vgic_put_irq(vcpu->kvm, irq);
131 } 132 }
132 133
diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
index 530b8491c892..9c0dd234ebe8 100644
--- a/virt/kvm/arm/vgic/vgic-v3.c
+++ b/virt/kvm/arm/vgic/vgic-v3.c
@@ -46,7 +46,8 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu)
46 struct vgic_v3_cpu_if *cpuif = &vgic_cpu->vgic_v3; 46 struct vgic_v3_cpu_if *cpuif = &vgic_cpu->vgic_v3;
47 u32 model = vcpu->kvm->arch.vgic.vgic_model; 47 u32 model = vcpu->kvm->arch.vgic.vgic_model;
48 int lr; 48 int lr;
49 unsigned long flags; 49
50 DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
50 51
51 cpuif->vgic_hcr &= ~ICH_HCR_UIE; 52 cpuif->vgic_hcr &= ~ICH_HCR_UIE;
52 53
@@ -75,7 +76,7 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu)
75 if (!irq) /* An LPI could have been unmapped. */ 76 if (!irq) /* An LPI could have been unmapped. */
76 continue; 77 continue;
77 78
78 spin_lock_irqsave(&irq->irq_lock, flags); 79 spin_lock(&irq->irq_lock);
79 80
80 /* Always preserve the active bit */ 81 /* Always preserve the active bit */
81 irq->active = !!(val & ICH_LR_ACTIVE_BIT); 82 irq->active = !!(val & ICH_LR_ACTIVE_BIT);
@@ -118,7 +119,7 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu)
118 vgic_irq_set_phys_active(irq, false); 119 vgic_irq_set_phys_active(irq, false);
119 } 120 }
120 121
121 spin_unlock_irqrestore(&irq->irq_lock, flags); 122 spin_unlock(&irq->irq_lock);
122 vgic_put_irq(vcpu->kvm, irq); 123 vgic_put_irq(vcpu->kvm, irq);
123 } 124 }
124 125
diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index c22cea678a66..7cfdfbc910e0 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -593,10 +593,11 @@ static void vgic_prune_ap_list(struct kvm_vcpu *vcpu)
593{ 593{
594 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; 594 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
595 struct vgic_irq *irq, *tmp; 595 struct vgic_irq *irq, *tmp;
596 unsigned long flags; 596
597 DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
597 598
598retry: 599retry:
599 spin_lock_irqsave(&vgic_cpu->ap_list_lock, flags); 600 spin_lock(&vgic_cpu->ap_list_lock);
600 601
601 list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) { 602 list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) {
602 struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB; 603 struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB;
@@ -637,7 +638,7 @@ retry:
637 /* This interrupt looks like it has to be migrated. */ 638 /* This interrupt looks like it has to be migrated. */
638 639
639 spin_unlock(&irq->irq_lock); 640 spin_unlock(&irq->irq_lock);
640 spin_unlock_irqrestore(&vgic_cpu->ap_list_lock, flags); 641 spin_unlock(&vgic_cpu->ap_list_lock);
641 642
642 /* 643 /*
643 * Ensure locking order by always locking the smallest 644 * Ensure locking order by always locking the smallest
@@ -651,7 +652,7 @@ retry:
651 vcpuB = vcpu; 652 vcpuB = vcpu;
652 } 653 }
653 654
654 spin_lock_irqsave(&vcpuA->arch.vgic_cpu.ap_list_lock, flags); 655 spin_lock(&vcpuA->arch.vgic_cpu.ap_list_lock);
655 spin_lock_nested(&vcpuB->arch.vgic_cpu.ap_list_lock, 656 spin_lock_nested(&vcpuB->arch.vgic_cpu.ap_list_lock,
656 SINGLE_DEPTH_NESTING); 657 SINGLE_DEPTH_NESTING);
657 spin_lock(&irq->irq_lock); 658 spin_lock(&irq->irq_lock);
@@ -676,7 +677,7 @@ retry:
676 677
677 spin_unlock(&irq->irq_lock); 678 spin_unlock(&irq->irq_lock);
678 spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock); 679 spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock);
679 spin_unlock_irqrestore(&vcpuA->arch.vgic_cpu.ap_list_lock, flags); 680 spin_unlock(&vcpuA->arch.vgic_cpu.ap_list_lock);
680 681
681 if (target_vcpu_needs_kick) { 682 if (target_vcpu_needs_kick) {
682 kvm_make_request(KVM_REQ_IRQ_PENDING, target_vcpu); 683 kvm_make_request(KVM_REQ_IRQ_PENDING, target_vcpu);
@@ -686,7 +687,7 @@ retry:
686 goto retry; 687 goto retry;
687 } 688 }
688 689
689 spin_unlock_irqrestore(&vgic_cpu->ap_list_lock, flags); 690 spin_unlock(&vgic_cpu->ap_list_lock);
690} 691}
691 692
692static inline void vgic_fold_lr_state(struct kvm_vcpu *vcpu) 693static inline void vgic_fold_lr_state(struct kvm_vcpu *vcpu)