All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] [PATCH] rtdm: Restrict/clarify usage of rtdm_irq_request/free/enable/disable
@ 2012-09-20 12:32 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2012-09-20 12:32 UTC (permalink / raw)
  To: Philippe Gerum, Xenomai

We cannot support line enabling/disabling over non-Linux contexts for
all IRQ types (e.g.: changes to legacy MSIs). Requesting and releasing
IRQs includes enabling/disabling them, so we better avoid conflicts by
restricting the usage of rtdm_irq_request/free.

On the other hand, there are users of rtdm_irq_enable/disable over
interrupt context for supported IRQ types. Therefore, clarify the
documentation of those functions that even more extreme care has to be
applied when relying on them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 include/rtdm/rtdm_driver.h |    1 +
 ksrc/skins/rtdm/drvlib.c   |   16 ++++++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h
index 68135e4..3006d59 100644
--- a/include/rtdm/rtdm_driver.h
+++ b/include/rtdm/rtdm_driver.h
@@ -899,6 +899,7 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no,
 #ifndef DOXYGEN_CPP /* Avoid static inline tags for RTDM in doxygen */
 static inline int rtdm_irq_free(rtdm_irq_t *irq_handle)
 {
+	XENO_ASSERT(RTDM, xnpod_root_p(), return -EPERM;);
 	return xnintr_detach(irq_handle);
 }
 
diff --git a/ksrc/skins/rtdm/drvlib.c b/ksrc/skins/rtdm/drvlib.c
index 4b74042..e5c470c 100644
--- a/ksrc/skins/rtdm/drvlib.c
+++ b/ksrc/skins/rtdm/drvlib.c
@@ -1617,8 +1617,7 @@ EXPORT_SYMBOL_GPL(rtdm_mutex_timedlock);
  * This service can be called from:
  *
  * - Kernel module initialization/cleanup code
- * - Kernel-based task
- * - User-space task (RT, non-RT)
+ * - User-space task (non-RT)
  *
  * Rescheduling: never.
  */
@@ -1628,6 +1627,8 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no,
 {
 	int err;
 
+	XENO_ASSERT(RTDM, xnpod_root_p(), return -EPERM;);
+
 	xnintr_init(irq_handle, device_name, irq_no, handler, NULL, flags);
 
 	err = xnintr_attach(irq_handle, arg);
@@ -1661,8 +1662,7 @@ EXPORT_SYMBOL_GPL(rtdm_irq_request);
  * This service can be called from:
  *
  * - Kernel module initialization/cleanup code
- * - Kernel-based task
- * - User-space task (RT, non-RT)
+ * - User-space task (non-RT)
  *
  * Rescheduling: never.
  */
@@ -1679,7 +1679,9 @@ int rtdm_irq_free(rtdm_irq_t *irq_handle);
  * interrupt masking at device level (via corresponding control registers etc.)
  * over masking at line level. Keep in mind that the latter is incompatible
  * with IRQ line sharing and can also be more costly as interrupt controller
- * access requires broader synchronization.
+ * access requires broader synchronization. Also, certain IRQ types may not
+ * allow the invocation over RT and interrupt contexts. The caller is
+ * responsible for excluding such conflicts.
  *
  * Environments:
  *
@@ -1705,7 +1707,9 @@ int rtdm_irq_enable(rtdm_irq_t *irq_handle);
  * interrupt masking at device level (via corresponding control registers etc.)
  * over masking at line level. Keep in mind that the latter is incompatible
  * with IRQ line sharing and can also be more costly as interrupt controller
- * access requires broader synchronization.
+ * access requires broader synchronization. Also, certain IRQ types may not
+ * allow the invocation over RT and interrupt contexts. The caller is
+ * responsible for excluding such conflicts.
  *
  * Environments:
  *
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-20 12:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-20 12:32 [Xenomai] [PATCH] rtdm: Restrict/clarify usage of rtdm_irq_request/free/enable/disable Jan Kiszka

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.