Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sandor Bodo-Merle and committed by
Bjorn Helgaas
fc54bae2 9e66317d

+12 -7
+12 -7
drivers/pci/host/pcie-iproc-msi.c
··· 179 179 180 180 static struct msi_domain_info iproc_msi_domain_info = { 181 181 .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, 183 183 .chip = &iproc_msi_irq_chip, 184 184 }; 185 185 ··· 237 237 addr = msi->msi_addr + iproc_msi_addr_offset(msi, data->hwirq); 238 238 msg->address_lo = lower_32_bits(addr); 239 239 msg->address_hi = upper_32_bits(addr); 240 - msg->data = data->hwirq; 240 + msg->data = data->hwirq << 5; 241 241 } 242 242 243 243 static struct irq_chip iproc_msi_bottom_irq_chip = { ··· 251 251 void *args) 252 252 { 253 253 struct iproc_msi *msi = domain->host_data; 254 - int hwirq; 254 + int hwirq, i; 255 255 256 256 mutex_lock(&msi->bitmap_lock); 257 257 ··· 267 267 268 268 mutex_unlock(&msi->bitmap_lock); 269 269 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 + } 272 276 273 - return 0; 277 + return hwirq; 274 278 } 275 279 276 280 static void iproc_msi_irq_domain_free(struct irq_domain *domain, ··· 306 302 307 303 offs = iproc_msi_eq_offset(msi, eq) + head * sizeof(u32); 308 304 msg = (u32 *)(msi->eq_cpu + offs); 309 - hwirq = *msg & IPROC_MSI_EQ_MASK; 305 + hwirq = readl(msg); 306 + hwirq = (hwirq >> 5) + (hwirq & 0x1f); 310 307 311 308 /* 312 309 * Since we have multiple hwirq mapped to a single MSI vector,