From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Yinghai Lu <yhlu.kernel@gmail.com>
Subject: [PATCH 4/5] x86: unify mask_IO_APIC_irq
Date: Sat, 16 Aug 2008 03:07:28 -0700 [thread overview]
Message-ID: <1218881249-3028-5-git-send-email-yhlu.kernel@gmail.com> (raw)
In-Reply-To: <1218881249-3028-4-git-send-email-yhlu.kernel@gmail.com>
use MACRO for 32 bit too
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/io_apic.c | 80 ++++++++++++----------------------------------
1 file changed, 21 insertions(+), 59 deletions(-)
Index: linux-2.6/arch/x86/kernel/io_apic.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/io_apic.c
+++ linux-2.6/arch/x86/kernel/io_apic.c
@@ -608,18 +608,7 @@ static void __init replace_pin_at_irq(un
add_pin_to_irq(irq, newapic, newpin);
}
-#ifdef CONFIG_X86_64
-/*
- * Synchronize the IO-APIC and the CPU by doing
- * a dummy read from the IO-APIC
- */
-static inline void io_apic_sync(unsigned int apic)
-{
- struct io_apic __iomem *io_apic = io_apic_base(apic);
- readl(&io_apic->data);
-}
-
-#define __DO_ACTION(R, ACTION, FINAL) \
+#define __DO_ACTION(R, ACTION_ENABLE, ACTION_DISABLE, FINAL) \
\
{ \
int pin; \
@@ -634,7 +623,8 @@ static inline void io_apic_sync(unsigned
break; \
pin = entry->pin; \
reg = io_apic_read(entry->apic, 0x10 + R + pin*2); \
- reg ACTION; \
+ reg ACTION_DISABLE; \
+ reg ACTION_ENABLE; \
io_apic_modify(entry->apic, 0x10 + R + pin*2, reg); \
FINAL; \
if (!entry->next) \
@@ -643,66 +633,38 @@ static inline void io_apic_sync(unsigned
} \
}
-#define DO_ACTION(name,R,ACTION, FINAL) \
+#define DO_ACTION(name,R, ACTION_ENABLE, ACTION_DISABLE, FINAL) \
\
static void name##_IO_APIC_irq (unsigned int irq) \
- __DO_ACTION(R, ACTION, FINAL)
-
-/* mask = 1 */
-DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, io_apic_sync(entry->apic))
+ __DO_ACTION(R, ACTION_ENABLE, ACTION_DISABLE, FINAL)
/* mask = 0 */
-DO_ACTION(__unmask, 0, &= ~IO_APIC_REDIR_MASKED, )
+DO_ACTION(__unmask, 0, |= 0, &= ~IO_APIC_REDIR_MASKED, )
-#else
-
-static void __modify_IO_APIC_irq(unsigned int irq, unsigned long enable, unsigned long disable)
+#ifdef CONFIG_X86_64
+/*
+ * Synchronize the IO-APIC and the CPU by doing
+ * a dummy read from the IO-APIC
+ */
+static inline void io_apic_sync(unsigned int apic)
{
- struct irq_cfg *cfg;
- struct irq_pin_list *entry;
- unsigned int pin, reg;
-
- cfg = irq_cfg(irq);
- entry = cfg->irq_2_pin;
- for (;;) {
- if (!entry)
- break;
- pin = entry->pin;
- reg = io_apic_read(entry->apic, 0x10 + pin*2);
- reg &= ~disable;
- reg |= enable;
- io_apic_modify(entry->apic, 0x10 + pin*2, reg);
- if (!entry->next)
- break;
- entry = entry->next;
- }
+ struct io_apic __iomem *io_apic = io_apic_base(apic);
+ readl(&io_apic->data);
}
/* mask = 1 */
-static void __mask_IO_APIC_irq(unsigned int irq)
-{
- __modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED, 0);
-}
+DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, &= ~0, io_apic_sync(entry->apic))
-/* mask = 0 */
-static void __unmask_IO_APIC_irq(unsigned int irq)
-{
- __modify_IO_APIC_irq(irq, 0, IO_APIC_REDIR_MASKED);
-}
+#else
+
+/* mask = 1 */
+DO_ACTION(__mask, 0, |= IO_APIC_REDIR_MASKED, &= ~0, )
/* mask = 1, trigger = 0 */
-static void __mask_and_edge_IO_APIC_irq(unsigned int irq)
-{
- __modify_IO_APIC_irq(irq, IO_APIC_REDIR_MASKED,
- IO_APIC_REDIR_LEVEL_TRIGGER);
-}
+DO_ACTION(__mask_and_edge, 0, |= IO_APIC_REDIR_MASKED, &= ~IO_APIC_REDIR_LEVEL_TRIGGER, )
/* mask = 0, trigger = 1 */
-static void __unmask_and_level_IO_APIC_irq(unsigned int irq)
-{
- __modify_IO_APIC_irq(irq, IO_APIC_REDIR_LEVEL_TRIGGER,
- IO_APIC_REDIR_MASKED);
-}
+DO_ACTION(__unmask_and_level, 0, |= IO_APIC_REDIR_LEVEL_TRIGGER, &= ~IO_APIC_REDIR_MASKED, )
#endif
next prev parent reply other threads:[~2008-08-16 10:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 10:07 [PATCH 0/5] merge io_apic_xx.c -- fix Yinghai Lu
2008-08-16 10:07 ` [PATCH 1/5] pci: change msi-x vector to 32bit Yinghai Lu
2008-08-16 10:07 ` Yinghai Lu
2008-08-16 10:07 ` [PATCH 3/5] x86: irq: interrupt array size should be NR_VECTORS Yinghai Lu
2008-08-16 10:07 ` Yinghai Lu [this message]
2008-08-16 10:07 ` [PATCH 5/5] x86: unify ack_apic_edge Yinghai Lu
2008-08-16 13:35 ` [PATCH 0/5] merge io_apic_xx.c -- fix Ingo Molnar
2008-08-19 22:21 ` Randy Dunlap
2008-08-20 0:24 ` Yinghai Lu
2008-08-20 0:27 ` Andrew Morton
2008-08-20 0:32 ` Randy Dunlap
2008-08-20 10:53 ` Ingo Molnar
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=1218881249-3028-5-git-send-email-yhlu.kernel@gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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.