Skip to content

Commit 0de5cb2

Browse files
Sticklyman1936gregkh
authored andcommitted
irqchip/gic-v5: Allocate ITS parent LPIs as a range
commit a7c7e42654b6a8676610ee09d22901432c4851af upstream. The ITS MSI domain no longer manages LPI allocation directly. LPIs are allocated and freed by the parent LPI domain, which can now handle a full range of interrupts and unwind partial allocations internally. Make the ITS domain request and release the parent IRQs as a single range instead of iterating over each interrupt. The ITS allocation path then only needs to reserve EventIDs, allocate the parent range, and fill in the ITS irq_data for each MSI. Since no operation in the per-MSI loop can fail, the partial parent-free unwind becomes unnecessary. On teardown, reset the ITS irq_data for the range and then release the parent range in one call, leaving LPI teardown to the LPI domain. Fixes: 0f01013 ("irqchip/gic-v5: Add GICv5 LPI/IPI support") Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260506093634.382062-4-sascha.bischoff@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2cbd4ab commit 0de5cb2

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

drivers/irqchip/irq-gic-v5-its.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ static int gicv5_its_irq_domain_alloc(struct irq_domain *domain, unsigned int vi
935935
int ret, i;
936936

937937
its_dev = info->scratchpad[0].ptr;
938+
device_id = its_dev->device_id;
938939

939940
ret = gicv5_its_alloc_eventid(its_dev, info, nr_irqs, &event_id_base);
940941
if (ret)
@@ -944,14 +945,11 @@ static int gicv5_its_irq_domain_alloc(struct irq_domain *domain, unsigned int vi
944945
if (ret)
945946
goto out_eventid;
946947

947-
device_id = its_dev->device_id;
948+
ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, NULL);
949+
if (ret)
950+
goto out_eventid;
948951

949952
for (i = 0; i < nr_irqs; i++) {
950-
ret = irq_domain_alloc_irqs_parent(domain, virq + i, 1, NULL);
951-
if (ret) {
952-
goto out_free_irqs;
953-
}
954-
955953
/*
956954
* Store eventid and deviceid into the hwirq for later use.
957955
*
@@ -970,12 +968,6 @@ static int gicv5_its_irq_domain_alloc(struct irq_domain *domain, unsigned int vi
970968

971969
return 0;
972970

973-
out_free_irqs:
974-
while (--i >= 0) {
975-
irqd = irq_domain_get_irq_data(domain, virq + i);
976-
irq_domain_reset_irq_data(irqd);
977-
irq_domain_free_irqs_parent(domain, virq + i, 1);
978-
}
979971
out_eventid:
980972
gicv5_its_free_eventid(its_dev, event_id_base, nr_irqs);
981973
return ret;
@@ -998,14 +990,14 @@ static void gicv5_its_irq_domain_free(struct irq_domain *domain, unsigned int vi
998990
bitmap_release_region(its_dev->event_map, event_id_base,
999991
get_count_order(nr_irqs));
1000992

1001-
/* Hierarchically free irq data */
1002993
for (i = 0; i < nr_irqs; i++) {
1003994
d = irq_domain_get_irq_data(domain, virq + i);
1004-
1005995
irq_domain_reset_irq_data(d);
1006-
irq_domain_free_irqs_parent(domain, virq + i, 1);
1007996
}
1008997

998+
/* Hierarchically free irq data */
999+
irq_domain_free_irqs_parent(domain, virq, nr_irqs);
1000+
10091001
gicv5_its_syncr(its, its_dev);
10101002
gicv5_irs_syncr();
10111003
}

0 commit comments

Comments
 (0)