Skip to content

Commit 63306c2

Browse files
Andre-ARMchazy
authored andcommitted
KVM: arm/arm64: vgic: avoid map in kvm_vgic_unmap_phys_irq()
kvm_vgic_unmap_phys_irq() only needs the virtual IRQ number, so let's just pass that between the arch timer and the VGIC to get rid of the irq_phys_map pointer. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Eric Auger <eric.auger@linaro.org> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
1 parent e262f41 commit 63306c2

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎include/kvm/arm_vgic.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg);
347347
int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu);
348348
struct irq_phys_map *kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu,
349349
int virt_irq, int irq);
350-
int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map);
350+
int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int virt_irq);
351351
bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int virt_irq);
352352

353353
#define irqchip_in_kernel(k) (!!((k)->arch.vgic.in_kernel))

‎virt/kvm/arm/arch_timer.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu)
486486

487487
timer_disarm(timer);
488488
if (timer->map)
489-
kvm_vgic_unmap_phys_irq(vcpu, timer->map);
489+
kvm_vgic_unmap_phys_irq(vcpu, timer->map->virt_irq);
490490
}
491491

492492
void kvm_timer_enable(struct kvm *kvm)

‎virt/kvm/arm/vgic.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,25 +1812,22 @@ static void vgic_free_phys_irq_map_rcu(struct rcu_head *rcu)
18121812
/**
18131813
* kvm_vgic_unmap_phys_irq - Remove a virtual to physical IRQ mapping
18141814
* @vcpu: The VCPU pointer
1815-
* @map: The pointer to a mapping obtained through kvm_vgic_map_phys_irq
1815+
* @virt_irq: The virtual IRQ number to be unmapped
18161816
*
18171817
* Remove an existing mapping between virtual and physical interrupts.
18181818
*/
1819-
int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map)
1819+
int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int virt_irq)
18201820
{
18211821
struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
18221822
struct irq_phys_map_entry *entry;
18231823
struct list_head *root;
18241824

1825-
if (!map)
1826-
return -EINVAL;
1827-
1828-
root = vgic_get_irq_phys_map_list(vcpu, map->virt_irq);
1825+
root = vgic_get_irq_phys_map_list(vcpu, virt_irq);
18291826

18301827
spin_lock(&dist->irq_phys_map_lock);
18311828

18321829
list_for_each_entry(entry, root, entry) {
1833-
if (&entry->map == map) {
1830+
if (entry->map.virt_irq == virt_irq) {
18341831
list_del_rcu(&entry->entry);
18351832
call_rcu(&entry->rcu, vgic_free_phys_irq_map_rcu);
18361833
break;

0 commit comments

Comments
 (0)