All of lore.kernel.org
 help / color / mirror / Atom feed
From: majun258@huawei.com (majun (F))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4]: Change msi to support the Mbigen interrupt
Date: Sat, 30 May 2015 11:19:09 +0800	[thread overview]
Message-ID: <55692C2D.50005@huawei.com> (raw)

This patch is applied to support the interrupts from Mbigen.

As a interrupt controller, Mbigen is used as a child domain of MSI
domain just like pci device.

Change log:
--add IRQ_DOMAIN_FLAG_MBIGEN to presents the interrupt from mbigen
--add function is_mbigen_domain to check the interrupt domain
--modified irq_chip_write_msi_msg to use the different message write function
  for interrupt from mbigen

Signed-off-by: Ma Jun <majun258@huawei.com>
---
 include/linux/irqdomain.h |    2 +-
 include/linux/msi.h       |    1 +
 kernel/irq/msi.c          |   22 +++++++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 include/linux/msi.h
 mode change 100644 => 100755 kernel/irq/msi.c

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 676d730..cb6b33a 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -136,7 +136,7 @@ enum {

 	/* Core calls alloc/free recursive through the domain hierarchy. */
 	IRQ_DOMAIN_FLAG_AUTO_RECURSIVE	= (1 << 1),
-
+	IRQ_DOMAIN_FLAG_MBIGEN = (1 << 2),
 	/*
 	 * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
 	 * for implementation specific purposes and ignored by the
diff --git a/include/linux/msi.h b/include/linux/msi.h
old mode 100644
new mode 100755
index 8ac4a68..3e2b6c7
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -239,5 +239,6 @@ irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
 int pci_msi_domain_check_cap(struct irq_domain *domain,
 			     struct msi_domain_info *info, struct device *dev);
 #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
+bool is_mbigen_domain(struct irq_data *data);

 #endif /* LINUX_MSI_H */
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
old mode 100644
new mode 100755
index 474de5c..1dba07e
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -31,11 +31,31 @@ void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
 }
 EXPORT_SYMBOL_GPL(get_cached_msi_msg);

+bool is_mbigen_domain(struct irq_data *data)
+{
+	int virq;
+	struct irq_domain *domain;
+	struct irq_data *source_irq_data;
+
+	virq = data->irq;
+	source_irq_data = irq_get_irq_data(virq);
+	domain = source_irq_data->domain;
+
+	if (domain->flags & IRQ_DOMAIN_FLAG_MBIGEN)
+		return true;
+	else
+		return false;
+
+}
+
 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
 static inline void irq_chip_write_msi_msg(struct irq_data *data,
 					  struct msi_msg *msg)
 {
-	data->chip->irq_write_msi_msg(data, msg);
+	if (is_mbigen_domain(data))
+		data->chip->irq_write_mbi_msg(data, msg);
+	else
+		data->chip->irq_write_msi_msg(data, msg);
 }

 /**
-- 
1.7.1

WARNING: multiple messages have this Message-ID (diff)
From: "majun (F)" <majun258@huawei.com>
To: catalin Marinas <Catalin.Marinas@arm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Will Deacon <Will.Deacon@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: [PATCH 2/4]: Change msi to support the Mbigen interrupt
Date: Sat, 30 May 2015 11:19:09 +0800	[thread overview]
Message-ID: <55692C2D.50005@huawei.com> (raw)

This patch is applied to support the interrupts from Mbigen.

As a interrupt controller, Mbigen is used as a child domain of MSI
domain just like pci device.

Change log:
--add IRQ_DOMAIN_FLAG_MBIGEN to presents the interrupt from mbigen
--add function is_mbigen_domain to check the interrupt domain
--modified irq_chip_write_msi_msg to use the different message write function
  for interrupt from mbigen

Signed-off-by: Ma Jun <majun258@huawei.com>
---
 include/linux/irqdomain.h |    2 +-
 include/linux/msi.h       |    1 +
 kernel/irq/msi.c          |   22 +++++++++++++++++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 include/linux/msi.h
 mode change 100644 => 100755 kernel/irq/msi.c

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 676d730..cb6b33a 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -136,7 +136,7 @@ enum {

 	/* Core calls alloc/free recursive through the domain hierarchy. */
 	IRQ_DOMAIN_FLAG_AUTO_RECURSIVE	= (1 << 1),
-
+	IRQ_DOMAIN_FLAG_MBIGEN = (1 << 2),
 	/*
 	 * Flags starting from IRQ_DOMAIN_FLAG_NONCORE are reserved
 	 * for implementation specific purposes and ignored by the
diff --git a/include/linux/msi.h b/include/linux/msi.h
old mode 100644
new mode 100755
index 8ac4a68..3e2b6c7
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -239,5 +239,6 @@ irq_hw_number_t pci_msi_domain_calc_hwirq(struct pci_dev *dev,
 int pci_msi_domain_check_cap(struct irq_domain *domain,
 			     struct msi_domain_info *info, struct device *dev);
 #endif /* CONFIG_PCI_MSI_IRQ_DOMAIN */
+bool is_mbigen_domain(struct irq_data *data);

 #endif /* LINUX_MSI_H */
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
old mode 100644
new mode 100755
index 474de5c..1dba07e
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -31,11 +31,31 @@ void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg)
 }
 EXPORT_SYMBOL_GPL(get_cached_msi_msg);

+bool is_mbigen_domain(struct irq_data *data)
+{
+	int virq;
+	struct irq_domain *domain;
+	struct irq_data *source_irq_data;
+
+	virq = data->irq;
+	source_irq_data = irq_get_irq_data(virq);
+	domain = source_irq_data->domain;
+
+	if (domain->flags & IRQ_DOMAIN_FLAG_MBIGEN)
+		return true;
+	else
+		return false;
+
+}
+
 #ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN
 static inline void irq_chip_write_msi_msg(struct irq_data *data,
 					  struct msi_msg *msg)
 {
-	data->chip->irq_write_msi_msg(data, msg);
+	if (is_mbigen_domain(data))
+		data->chip->irq_write_mbi_msg(data, msg);
+	else
+		data->chip->irq_write_msi_msg(data, msg);
 }

 /**
-- 
1.7.1




             reply	other threads:[~2015-05-30  3:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30  3:19 majun (F) [this message]
2015-05-30  3:19 ` [PATCH 2/4]: Change msi to support the Mbigen interrupt majun (F)
2015-06-01  8:55 ` Marc Zyngier
2015-06-01  8:55   ` Marc Zyngier

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=55692C2D.50005@huawei.com \
    --to=majun258@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.