[rtems commit] drvmgr: ability to configure IRQ affinity

Daniel Hellstrom danielh at rtems.org
Tue May 2 10:38:43 UTC 2017


Module:    rtems
Branch:    master
Commit:    7075fb1134b61f029e77b1428d7de4bb5631369b
Changeset: http://git.rtems.org/rtems/commit/?id=7075fb1134b61f029e77b1428d7de4bb5631369b

Author:    Daniel Hellstrom <daniel at gaisler.com>
Date:      Fri Apr  7 08:30:46 2017 +0200

drvmgr: ability to configure IRQ affinity

---

 cpukit/libdrvmgr/drvmgr.h        | 20 ++++++++++++++++++++
 cpukit/libdrvmgr/drvmgr_drvinf.c | 13 +++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/cpukit/libdrvmgr/drvmgr.h b/cpukit/libdrvmgr/drvmgr.h
index 194de66..a8e1c8c 100644
--- a/cpukit/libdrvmgr/drvmgr.h
+++ b/cpukit/libdrvmgr/drvmgr.h
@@ -14,6 +14,7 @@
 #include <drvmgr/drvmgr_list.h>
 #include <stdint.h>
 #include <rtems/score/basedefs.h>
+#include <rtems/score/smpimpl.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -137,6 +138,10 @@ struct drvmgr_bus_ops {
 	int	(*int_clear)(struct drvmgr_dev *, int index);
 	int	(*int_mask)(struct drvmgr_dev *, int index);
 	int	(*int_unmask)(struct drvmgr_dev *, int index);
+#ifdef RTEMS_SMP
+	int	(*int_set_affinity)(struct drvmgr_dev *, int index,
+				    Processor_mask cpus);
+#endif
 
 	/* Get Parameters */
 	int	(*get_params)(struct drvmgr_dev *, struct drvmgr_bus_params *);
@@ -628,6 +633,21 @@ extern int drvmgr_interrupt_mask(
 	struct drvmgr_dev *dev,
 	int index);
 
+/*! Force masking/disable an interrupt on the interrupt controller, this is not normally performed
+ *  since this will stop all other (shared) ISRs to be disabled until _unmask() is called.
+ *
+ *  \param dev        Device to mask interrupt for.
+ *  \param index      Index is used to identify the IRQ number if hardware has multiple IRQ sources.
+ *                    Normally Index is set to 0 to indicated the first and only IRQ source.
+ *                    A negative index is interpreted as a absolute bus IRQ number.
+ */
+#ifdef RTEMS_SMP
+extern int drvmgr_interrupt_set_affinity(
+	struct drvmgr_dev *dev,
+	int index,
+	Processor_mask cpus);
+#endif
+
 /*! drvmgr_translate() translation options */
 enum drvmgr_tr_opts {
 	/* Translate CPU RAM Address (input) to DMA unit accessible address
diff --git a/cpukit/libdrvmgr/drvmgr_drvinf.c b/cpukit/libdrvmgr/drvmgr_drvinf.c
index e0cd50d..5bb6e6e 100644
--- a/cpukit/libdrvmgr/drvmgr_drvinf.c
+++ b/cpukit/libdrvmgr/drvmgr_drvinf.c
@@ -138,6 +138,19 @@ int drvmgr_interrupt_mask(
 	return dev->parent->ops->int_mask(dev, index);
 }
 
+#ifdef RTEMS_SMP
+int drvmgr_interrupt_set_affinity(
+	struct drvmgr_dev *dev,
+	int index,
+	Processor_mask cpus)
+{
+	if (!dev || !dev->parent || !dev->parent->ops->int_set_affinity)
+		return -1;
+
+	return dev->parent->ops->int_set_affinity(dev, index, cpus);
+}
+#endif
+
 int drvmgr_on_rootbus(struct drvmgr_dev *dev)
 {
 	if (dev->parent && dev->parent->dev && dev->parent->dev->parent)



More information about the vc mailing list