linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Mike Qiu <qiudayu@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, Mike Qiu <qiudayu@linux.vnet.ibm.com>
Subject: [PATCH 1/3] irq: Set multiple MSI descriptor data for multiple IRQs
Date: Tue, 15 Jan 2013 15:38:54 +0800	[thread overview]
Message-ID: <1358235536-32741-2-git-send-email-qiudayu@linux.vnet.ibm.com> (raw)
In-Reply-To: <1358235536-32741-1-git-send-email-qiudayu@linux.vnet.ibm.com>

Multiple MSI only requires the IRQ in msi_desc entry to be set as
the value of irq_base.

This patch implements the above mentioned technique.

Signed-off-by: Mike Qiu <qiudayu@linux.vnet.ibm.com>
---
 include/linux/irq.h |    2 ++
 kernel/irq/chip.c   |   40 ++++++++++++++++++++++++++++++----------
 2 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index fdf2c4a..60ef45b 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -528,6 +528,8 @@ extern int irq_set_handler_data(unsigned int irq, void *data);
 extern int irq_set_chip_data(unsigned int irq, void *data);
 extern int irq_set_irq_type(unsigned int irq, unsigned int type);
 extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
+extern int irq_set_multiple_msi_desc(unsigned int irq_base, unsigned int nvec,
+					struct msi_desc *entry);
 extern struct irq_data *irq_get_irq_data(unsigned int irq);
 
 static inline struct irq_chip *irq_get_chip(unsigned int irq)
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 3aca9f2..c4c39d3 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -90,6 +90,35 @@ int irq_set_handler_data(unsigned int irq, void *data)
 EXPORT_SYMBOL(irq_set_handler_data);
 
 /**
+ *	irq_set_multiple_msi_desc - set Multiple MSI descriptor data
+ *	for multiple IRQs
+ *	@irq_base:	Interrupt number base
+ *	@nvec:	The number of interrupts
+ *	@entry:	Pointer to MSI descriptor data
+ *
+ *	Set IRQ descriptors for multiple MSIs
+ */
+int irq_set_multiple_msi_desc(unsigned int irq_base, unsigned int nvec,
+				struct msi_desc *entry)
+{
+	unsigned long flags, i;
+	struct irq_desc *desc;
+
+	for (i = 0; i < nvec; i++) {
+		desc = irq_get_desc_lock(irq_base + i, &flags,
+					IRQ_GET_DESC_CHECK_GLOBAL);
+		if (!desc)
+			return -EINVAL;
+		desc->irq_data.msi_desc = entry;
+		if (i == 0 && entry)
+			entry->irq = irq_base;
+		irq_put_desc_unlock(desc, flags);
+	}
+
+	return 0;
+}
+
+/**
  *	irq_set_msi_desc - set MSI descriptor data for an irq
  *	@irq:	Interrupt number
  *	@entry:	Pointer to MSI descriptor data
@@ -98,16 +127,7 @@ EXPORT_SYMBOL(irq_set_handler_data);
  */
 int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
 {
-	unsigned long flags;
-	struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
-
-	if (!desc)
-		return -EINVAL;
-	desc->irq_data.msi_desc = entry;
-	if (entry)
-		entry->irq = irq;
-	irq_put_desc_unlock(desc, flags);
-	return 0;
+	return irq_set_multiple_msi_desc(irq, 1, entry);
 }
 
 /**
-- 
1.7.7.6

  reply	other threads:[~2013-01-15  7:39 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15  7:38 [PATCH 0/3] Enable multiple MSI feature in pSeries Mike Qiu
2013-01-15  7:38 ` Mike Qiu [this message]
2013-06-05 23:03   ` [PATCH 1/3] irq: Set multiple MSI descriptor data for multiple IRQs Grant Likely
2013-01-15  7:38 ` [PATCH 2/3] irq: Add hw continuous IRQs map to virtual continuous IRQs support Mike Qiu
2013-03-05  2:23   ` Michael Ellerman
2013-03-05  7:19     ` Mike Qiu
2013-03-06  3:54       ` Michael Ellerman
2013-03-06  5:34         ` Mike Qiu
2013-03-06  5:42           ` Michael Ellerman
2013-03-06  7:02             ` Mike Qiu
2013-03-05  2:41   ` Paul Mundt
2013-03-05  7:44     ` Mike Qiu
2013-01-15  7:38 ` [PATCH 3/3] powerpc/pci: Enable pSeries multiple MSI feature Mike Qiu
2013-01-31  2:10 ` [PATCH 0/3] Enable multiple MSI feature in pSeries Mike
2013-02-04  3:23 ` Michael Ellerman
2013-02-04  3:49   ` Mike Qiu
2013-02-04  5:56     ` Michael Ellerman
2013-02-04  6:43       ` Mike Qiu
2013-03-01  3:07 ` Mike
2013-03-01  3:08 ` Mike
2013-03-01  3:54   ` Michael Ellerman
2013-03-04  3:14     ` Mike Qiu
2013-03-05  0:28       ` Michael Ellerman
2013-05-21 14:45 ` Alexander Gordeev
2013-05-22  0:15   ` Benjamin Herrenschmidt
2013-05-22  6:16     ` Mike Qiu
2013-05-22  5:57   ` Mike Qiu

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=1358235536-32741-2-git-send-email-qiudayu@linux.vnet.ibm.com \
    --to=qiudayu@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tglx@linutronix.de \
    /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).