Skip to content

Commit fc54bae

Browse files
sbodomerlebjorn-helgaas
authored andcommitted
PCI: iproc: Allow allocation of multiple MSIs
Add support for allocating multiple MSIs at the same time, so that the MSI_FLAG_MULTI_PCI_MSI flag can be added to the msi_domain_info structure. Avoid storing the hwirq in the low 5 bits of the message data, as it is used by the device. Also fix an endianness problem by using readl(). Signed-off-by: Sandor Bodo-Merle <sbodomerle@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
1 parent 9e66317 commit fc54bae

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎drivers/pci/host/pcie-iproc-msi.c‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static struct irq_chip iproc_msi_irq_chip = {
179179

180180
static struct msi_domain_info iproc_msi_domain_info = {
181181
.flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
182-
MSI_FLAG_PCI_MSIX,
182+
MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
183183
.chip = &iproc_msi_irq_chip,
184184
};
185185

@@ -237,7 +237,7 @@ static void iproc_msi_irq_compose_msi_msg(struct irq_data *data,
237237
addr = msi->msi_addr + iproc_msi_addr_offset(msi, data->hwirq);
238238
msg->address_lo = lower_32_bits(addr);
239239
msg->address_hi = upper_32_bits(addr);
240-
msg->data = data->hwirq;
240+
msg->data = data->hwirq << 5;
241241
}
242242

243243
static struct irq_chip iproc_msi_bottom_irq_chip = {
@@ -251,7 +251,7 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,
251251
void *args)
252252
{
253253
struct iproc_msi *msi = domain->host_data;
254-
int hwirq;
254+
int hwirq, i;
255255

256256
mutex_lock(&msi->bitmap_lock);
257257

@@ -267,10 +267,14 @@ static int iproc_msi_irq_domain_alloc(struct irq_domain *domain,
267267

268268
mutex_unlock(&msi->bitmap_lock);
269269

270-
irq_domain_set_info(domain, virq, hwirq, &iproc_msi_bottom_irq_chip,
271-
domain->host_data, handle_simple_irq, NULL, NULL);
270+
for (i = 0; i < nr_irqs; i++) {
271+
irq_domain_set_info(domain, virq + i, hwirq + i,
272+
&iproc_msi_bottom_irq_chip,
273+
domain->host_data, handle_simple_irq,
274+
NULL, NULL);
275+
}
272276

273-
return 0;
277+
return hwirq;
274278
}
275279

276280
static void iproc_msi_irq_domain_free(struct irq_domain *domain,
@@ -302,7 +306,8 @@ static inline u32 decode_msi_hwirq(struct iproc_msi *msi, u32 eq, u32 head)
302306

303307
offs = iproc_msi_eq_offset(msi, eq) + head * sizeof(u32);
304308
msg = (u32 *)(msi->eq_cpu + offs);
305-
hwirq = *msg & IPROC_MSI_EQ_MASK;
309+
hwirq = readl(msg);
310+
hwirq = (hwirq >> 5) + (hwirq & 0x1f);
306311

307312
/*
308313
* Since we have multiple hwirq mapped to a single MSI vector,

0 commit comments

Comments
 (0)