From: Lucas Stach <l.stach@pengutronix.de>
To: Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org
Cc: Jingoo Han <jingoohan1@gmail.com>,
Pratyush Anand <pratyush.anand@gmail.com>,
patchwork-lst@pengutronix.de, kernel@pengutronix.de
Subject: [PATCH v4 3/5] PCI: designware: implement multivector MSI irq setup
Date: Mon, 17 Aug 2015 13:06:16 +0200 [thread overview]
Message-ID: <1439809578-13654-4-git-send-email-l.stach@pengutronix.de> (raw)
In-Reply-To: <1439809578-13654-1-git-send-email-l.stach@pengutronix.de>
Allows to set up and use multiple MSI irqs per device.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Pratyush Anand <pratyush.anand@gmail.com>
---
v3: use new MSI msg setup function.
---
drivers/pci/host/pcie-designware.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
index 0ec435c56a8b..74034395cf2a 100644
--- a/drivers/pci/host/pcie-designware.c
+++ b/drivers/pci/host/pcie-designware.c
@@ -286,6 +286,9 @@ static int assign_irq(int no_irqs, struct msi_desc *desc, int *pos)
}
*pos = pos0;
+ desc->nvec_used = no_irqs;
+ desc->msi_attrib.multiple = order_base_2(no_irqs);
+
return irq;
no_valid_irq:
@@ -329,6 +332,33 @@ static int dw_msi_setup_irq(struct msi_controller *chip, struct pci_dev *pdev,
return 0;
}
+static int dw_msi_setup_irqs(struct msi_controller *chip, struct pci_dev *pdev,
+ int nvec, int type)
+{
+#ifdef CONFIG_PCI_MSI
+ int irq, pos;
+ struct msi_desc *desc;
+ struct pcie_port *pp = sys_to_pcie(pdev->bus->sysdata);
+
+ /* MSI-X interrupts are not supported */
+ if (type == PCI_CAP_ID_MSIX)
+ return -EINVAL;
+
+ WARN_ON(!list_is_singular(&pdev->msi_list));
+ desc = list_entry(pdev->msi_list.next, struct msi_desc, list);
+
+ irq = assign_irq(nvec, desc, &pos);
+ if (irq < 0)
+ return irq;
+
+ dw_msi_setup_msg(pp, irq, pos);
+
+ return 0;
+#else
+ return -ENOSYS;
+#endif
+}
+
static void dw_msi_teardown_irq(struct msi_controller *chip, unsigned int irq)
{
struct irq_data *data = irq_get_irq_data(irq);
@@ -340,6 +370,7 @@ static void dw_msi_teardown_irq(struct msi_controller *chip, unsigned int irq)
static struct msi_controller dw_pcie_msi_chip = {
.setup_irq = dw_msi_setup_irq,
+ .setup_irqs = dw_msi_setup_irqs,
.teardown_irq = dw_msi_teardown_irq,
};
--
2.4.6
next prev parent reply other threads:[~2015-08-17 11:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 11:06 [PATCH v4 0/5] Designware host multivector MSI and 64bit MSI fixes Lucas Stach
2015-08-17 11:06 ` [PATCH v4 1/5] PCI: allow MSI chip providers to implement their own multivector MSI setup Lucas Stach
2015-08-17 11:06 ` [PATCH v4 2/5] PCI: designware: factor out MSI msg setup Lucas Stach
2015-08-17 11:06 ` Lucas Stach [this message]
2015-08-17 11:06 ` [PATCH v4 4/5] PCI: designware: change prototype of get_msi_addr Lucas Stach
2015-08-17 11:06 ` [PATCH v4 5/5] PCI: designware: set up high part of MSI target address Lucas Stach
2015-08-18 3:52 ` Pratyush Anand
2015-09-02 22:44 ` [PATCH v4 0/5] Designware host multivector MSI and 64bit MSI fixes Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439809578-13654-4-git-send-email-l.stach@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=bhelgaas@google.com \
--cc=jingoohan1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-pci@vger.kernel.org \
--cc=patchwork-lst@pengutronix.de \
--cc=pratyush.anand@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).