All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main <adeos-main@gna.org>
Subject: [Adeos-main] [PATCH 1/3] ipipe: Provide wrapper for IRQ mask/unmask at chip level
Date: Thu, 25 Nov 2010 17:38:42 +0100	[thread overview]
Message-ID: <4CEE9112.90808@domain.hid> (raw)
In-Reply-To: <4CEE8FF0.6000704@domain.hid>

We need to overload these services for irqchips that cannot be hardened
to work from arbitrary contexts.

Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---

I'm still lagging behind with making use of this for MSI masking or
refactoring the Xenomai HAL to use it, but it's a start.

 include/linux/ipipe.h      |   22 ++++++++++++++++++++++
 include/linux/ipipe_base.h |    1 +
 include/linux/irq.h        |    2 ++
 kernel/ipipe/core.c        |    6 ++++++
 4 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/include/linux/ipipe.h b/include/linux/ipipe.h
index 854f132..da2bd68 100644
--- a/include/linux/ipipe.h
+++ b/include/linux/ipipe.h
@@ -28,6 +28,7 @@
 #include <linux/mutex.h>
 #include <linux/linkage.h>
 #include <linux/ipipe_base.h>
+#include <linux/irq.h>
 #include <asm/ipipe.h>
 #include <asm/bug.h>
 
@@ -440,6 +441,27 @@ int ipipe_control_irq(struct ipipe_domain *ipd,
 		      unsigned clrmask,
 		      unsigned setmask);
 
+static inline void ipipe_irq_chip_mask(unsigned int irq, struct irq_desc *desc)
+{
+	desc->ipipe_mask(irq);
+}
+
+static inline void
+ipipe_irq_chip_unmask(unsigned int irq, struct irq_desc *desc)
+{
+	desc->ipipe_unmask(irq);
+}
+
+void __ipipe_irq_chip_nop(unsigned int irq);
+
+#ifndef HAVE_IPIPE_IRQ_DESC_SET_HANDLERS
+static inline void ipipe_irq_desc_set_handlers(struct irq_desc *desc)
+{
+	desc->ipipe_mask = desc->chip->mask ? : __ipipe_irq_chip_nop;
+	desc->ipipe_unmask = desc->chip->unmask ? : __ipipe_irq_chip_nop;
+}
+#endif
+
 unsigned ipipe_alloc_virq(void);
 
 int ipipe_free_virq(unsigned virq);
diff --git a/include/linux/ipipe_base.h b/include/linux/ipipe_base.h
index 3f43ba5..7152485 100644
--- a/include/linux/ipipe_base.h
+++ b/include/linux/ipipe_base.h
@@ -110,6 +110,7 @@ static inline void ipipe_check_context(struct ipipe_domain *border_ipd) { }
 #define __IPIPE_FEATURE_PREPARE_PANIC		1
 #define __IPIPE_FEATURE_ROOT_PREEMPT_NOTIFIER	1
 #define __IPIPE_FEATURE_CONTROL_IRQ		1
+#define __IPIPE_FEATURE_IRQ_CHIP_MASK		1
 
 #else /* !CONFIG_IPIPE */
 
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 630e995..a6969d6 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -181,6 +181,8 @@ struct irq_desc {
 					     struct irq_desc *desc);
 	void			(*ipipe_end)(unsigned int irq,
 					     struct irq_desc *desc);
+	void			(*ipipe_mask)(unsigned int irq);
+	void			(*ipipe_unmask)(unsigned int irq);
 #endif /* CONFIG_IPIPE */
 	unsigned int		irq;
 	struct timer_rand_state *timer_rand_state;
diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
index 9d025b2..756ad02 100644
--- a/kernel/ipipe/core.c
+++ b/kernel/ipipe/core.c
@@ -889,6 +889,10 @@ unsigned ipipe_alloc_virq(void)
 	return irq;
 }
 
+void __ipipe_irq_chip_nop(unsigned int irq)
+{
+}
+
 /*
  * ipipe_virtualize_irq() -- Set a per-domain pipelined interrupt
  * handler.
@@ -981,6 +985,8 @@ int ipipe_virtualize_irq(struct ipipe_domain *ipd,
 	if (desc == NULL)
 		goto unlock_and_exit;
 
+	ipipe_irq_desc_set_handlers(desc);
+
 	if (irq < NR_IRQS && !ipipe_virtual_irq_p(irq)) {
 		__ipipe_enable_irqdesc(ipd, irq);
 		/*


  reply	other threads:[~2010-11-25 16:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 16:33 [Adeos-main] [git pull] Updates for ipipe-2.6.36-noarch Jan Kiszka
2010-11-25 16:38 ` Jan Kiszka [this message]
2010-11-25 16:38 ` [Adeos-main] [PATCH 2/3] ipipe: Drop spurious irq_enter/exit from __ipipe_sync_stage Jan Kiszka
2010-11-25 16:38 ` [Adeos-main] [PATCH 3/3] ipipe: Provide __ipipe_spin_trylock_irq for !CONFIG_IPIPE Jan Kiszka
2011-01-18 17:13 ` [Adeos-main] [git pull] Updates for ipipe-2.6.36-noarch Philippe Gerum
2011-01-18 17:22   ` Jan Kiszka
2011-01-18 17:27     ` Philippe Gerum
2011-01-18 17:30       ` Jan Kiszka
2011-01-18 17:37         ` Gilles Chanteperdrix
2011-01-18 17:44           ` Jan Kiszka
2011-01-25 19:45   ` Philippe Gerum

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=4CEE9112.90808@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=adeos-main@gna.org \
    --cc=rpm@xenomai.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.