Skip to content

Commit 7310397

Browse files
Julien GrallMarc Zyngier
authored andcommitted
irqchip/gic-v3-mbi: Don't map the MSI page in mbi_compose_m{b, s}i_msg()
The functions mbi_compose_m{b, s}i_msg may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg() requires to be called from a preemptible context. A recent patch split iommu_dma_map_msi_msg in two new functions: one that should be called in preemptible context, the other does not have any requirement. The GICv3 MSI driver is reworked to avoid executing preemptible code in non-preemptible context. This can be achieved by preparing the MSI mapping when allocating the MSI interrupt. Signed-off-by: Julien Grall <[email protected]> [maz: only call iommu_dma_prepare_msi once, fix commit log accordingly] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 2cb3b16 commit 7310397

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/irqchip/irq-gic-v3-mbi.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static void mbi_free_msi(struct mbi_range *mbi, unsigned int hwirq,
8484
static int mbi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
8585
unsigned int nr_irqs, void *args)
8686
{
87+
msi_alloc_info_t *info = args;
8788
struct mbi_range *mbi = NULL;
8889
int hwirq, offset, i, err = 0;
8990

@@ -104,6 +105,11 @@ static int mbi_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
104105

105106
hwirq = mbi->spi_start + offset;
106107

108+
err = iommu_dma_prepare_msi(info->desc,
109+
mbi_phys_base + GICD_SETSPI_NSR);
110+
if (err)
111+
return err;
112+
107113
for (i = 0; i < nr_irqs; i++) {
108114
err = mbi_irq_gic_domain_alloc(domain, virq + i, hwirq + i);
109115
if (err)
@@ -142,7 +148,7 @@ static void mbi_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
142148
msg[0].address_lo = lower_32_bits(mbi_phys_base + GICD_SETSPI_NSR);
143149
msg[0].data = data->parent_data->hwirq;
144150

145-
iommu_dma_map_msi_msg(data->irq, msg);
151+
iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), msg);
146152
}
147153

148154
#ifdef CONFIG_PCI_MSI
@@ -202,7 +208,7 @@ static void mbi_compose_mbi_msg(struct irq_data *data, struct msi_msg *msg)
202208
msg[1].address_lo = lower_32_bits(mbi_phys_base + GICD_CLRSPI_NSR);
203209
msg[1].data = data->parent_data->hwirq;
204210

205-
iommu_dma_map_msi_msg(data->irq, &msg[1]);
211+
iommu_dma_compose_msi_msg(irq_data_get_msi_desc(data), &msg[1]);
206212
}
207213

208214
/* Platform-MSI specific irqchip */

0 commit comments

Comments
 (0)