Skip to contentSkip to conversation

avoid installing inappropriate IRQ dispatcher

PATCH Applied Jan Kiszka 2 participants 2 messages Oct 16, 2006 – Oct 20, 2006

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 avoid installing inappropriate IRQ dispatcher

In the (corner) case that someone requests to install a shared edge IRQ while the related support is not enabled (!CONFIG_XENO_OPT_SHIRQ_EDGE), BUT the opposite type (CONFIG_XENO_OPT_SHIRQ_LEVEL), Xenomai so far incorrectly installs the level-type handler. For the other way around, the non-shared dispatch handler is installed, which is also not correct.

This patch fixes the issue by returning an error on registration, clearly indicating the system misconfiguration to the caller.

Jan

---
 ChangeLog           |    5 +++++
 ksrc/nucleus/intr.c |   15 ++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
nucleus/intr.c renamed from nucleus/intr.c.orig +10 -5
Index: ksrc/nucleus/intr.c
===================================================================
@@ -340,14 +340,19 @@ static inline int xnintr_irq_attach(xnin
 		void (*handler) (unsigned, void *) = &xnintr_irq_handler;
 
 		if (intr->flags & XN_ISR_SHARED) {
-#if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL)
-			handler = &xnintr_shirq_handler;
-#endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL */
-
-#if defined(CONFIG_XENO_OPT_SHIRQ_EDGE)
 			if (intr->flags & XN_ISR_EDGE)
+#if defined(CONFIG_XENO_OPT_SHIRQ_EDGE)
 				handler = &xnintr_edge_shirq_handler;
+#else /* !CONFIG_XENO_OPT_SHIRQ_EDGE */
+				return -ENOSYS;
 #endif /* CONFIG_XENO_OPT_SHIRQ_EDGE */
+			else
+#if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL)
+				handler = &xnintr_shirq_handler;
+#else /* !CONFIG_XENO_OPT_SHIRQ_LEVEL */
+				return -ENOSYS;
+#endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL */
+
 		}
 		shirq->unhandled = 0;
 
ChangeLog renamed from ChangeLog.orig +5 -0
Index: ChangeLog
===================================================================
@@ -1,3 +1,8 @@
+2006-10-16  Jan Kiszka  <[email protected]>
+
+	* ksrc/nucleus/intr.x (xnintr_irq_attach): Return error on
+	mismatching shared-IRQ support.
+
 2006-10-15  Philippe Gerum  <[email protected]>
 
 	* ksrc/arch/powerpc/patches: Upgrade to 2.6.14-ppc-1.5-00.
#1 lore raw
Quoted 9 lines · Jan Kiszka

In the (corner) case that someone requests to install a shared edge IRQ while the related support is not enabled (!CONFIG_XENO_OPT_SHIRQ_EDGE), BUT the opposite type (CONFIG_XENO_OPT_SHIRQ_LEVEL), Xenomai so far incorrectly installs the level-type handler. For the other way around, the non-shared dispatch handler is installed, which is also not correct.

This patch fixes the issue by returning an error on registration, clearly indicating the system misconfiguration to the caller.

Merged, thanks.

Quoted 53 lines

Jan
plain text document attachment (pick-shared-irq-handler.patch)

---
 ChangeLog           |    5 +++++
 ksrc/nucleus/intr.c |   15 ++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

Index: ksrc/nucleus/intr.c
===================================================================

nucleus/intr.c renamed from nucleus/intr.c.orig +10 -5
@@ -340,14 +340,19 @@ static inline int xnintr_irq_attach(xnin
 		void (*handler) (unsigned, void *) = &xnintr_irq_handler;
 
 		if (intr->flags & XN_ISR_SHARED) {
-#if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL)
-			handler = &xnintr_shirq_handler;
-#endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL */
-
-#if defined(CONFIG_XENO_OPT_SHIRQ_EDGE)
 			if (intr->flags & XN_ISR_EDGE)
+#if defined(CONFIG_XENO_OPT_SHIRQ_EDGE)
 				handler = &xnintr_edge_shirq_handler;
+#else /* !CONFIG_XENO_OPT_SHIRQ_EDGE */
+				return -ENOSYS;
 #endif /* CONFIG_XENO_OPT_SHIRQ_EDGE */
+			else
+#if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL)
+				handler = &xnintr_shirq_handler;
+#else /* !CONFIG_XENO_OPT_SHIRQ_LEVEL */
+				return -ENOSYS;
+#endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL */
+
 		}
 		shirq->unhandled = 0;
 

Index: ChangeLog
===================================================================

ChangeLog renamed from ChangeLog.orig +5 -0
@@ -1,3 +1,8 @@
+2006-10-16  Jan Kiszka  <[email protected]>
+
+	* ksrc/nucleus/intr.x (xnintr_irq_attach): Return error on
+	mismatching shared-IRQ support.
+
 2006-10-15  Philippe Gerum  <[email protected]>
 
 	* ksrc/arch/powerpc/patches: Upgrade to 2.6.14-ppc-1.5-00.

_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core

Signature · 1 line
Philippe.