[PATCH 10/11] staging: fsl-mc: properly set hwirq in msi set_desc

Stuart Yoder stuart.yoder at nxp.com
Wed Jun 22 21:40:51 UTC 2016


For an MSI domain the hwirq is an arbitrary but unique
id to identify an interrupt.  Previously the hwirq was set to
the MSI index of the interrupt, but that only works if there is
one DPRC.  Additional DPRCs require an expanded namespace.  Use
both the ICID (which is unique per DPRC) and the MSI index to
compose a hwirq value.

Signed-off-by: Stuart Yoder <stuart.yoder at nxp.com>
---
 drivers/staging/fsl-mc/bus/mc-msi.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/bus/mc-msi.c b/drivers/staging/fsl-mc/bus/mc-msi.c
index e202b2b..c7be156 100644
--- a/drivers/staging/fsl-mc/bus/mc-msi.c
+++ b/drivers/staging/fsl-mc/bus/mc-msi.c
@@ -20,11 +20,26 @@
 #include "../include/mc-sys.h"
 #include "dprc-cmd.h"
 
+/*
+ * Generate a unique ID identifying the interrupt (only used within the MSI
+ * irqdomain.  Combine the icid with the interrupt index.
+ */
+static irq_hw_number_t fsl_mc_domain_calc_hwirq(struct fsl_mc_device *dev,
+						struct msi_desc *desc)
+{
+	/*
+	 * Make the base hwirq value for ICID*10000 so it is readable
+	 * as a decimal value in /proc/interrupts.
+	 */
+	return (irq_hw_number_t)(desc->fsl_mc.msi_index + (dev->icid * 10000));
+}
+
 static void fsl_mc_msi_set_desc(msi_alloc_info_t *arg,
 				struct msi_desc *desc)
 {
 	arg->desc = desc;
-	arg->hwirq = (irq_hw_number_t)desc->fsl_mc.msi_index;
+	arg->hwirq = fsl_mc_domain_calc_hwirq(to_fsl_mc_device(desc->dev),
+					      desc);
 }
 
 static void fsl_mc_msi_update_dom_ops(struct msi_domain_info *info)
-- 
1.9.0



More information about the devel mailing list