From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: linux-arch@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@linux-foundation.org>,
x86@kernel.org, Peter Zijlstra <peterz@infradead.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mundt <lethal@linux-sh.org>,
Russell King <linux@arm.linux.org.uk>,
David Woodhouse <dwmw2@infradead.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Yinghai Lu <yinghai@kernel.org>,
Grant Likely <grant.likely@secretlab.ca>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [patch 25/47] x86: Cleanup io_apic
Date: Thu, 30 Sep 2010 23:16:35 -0000 [thread overview]
Message-ID: <20100930221740.937343375@linutronix.de> (raw)
In-Reply-To: 20100930221351.682772535@linutronix.de
[-- Attachment #1: x86-cleanup-ioapic.patch --]
[-- Type: text/plain, Size: 7804 bytes --]
Sanitize functions. Remove irq_desc pointer magic.
Preparatory patch for further cleanups.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/kernel/apic/io_apic.c | 109 +++++++++++++++--------------------------
1 file changed, 42 insertions(+), 67 deletions(-)
Index: linux-2.6-tip/arch/x86/kernel/apic/io_apic.c
===================================================================
--- linux-2.6-tip.orig/arch/x86/kernel/apic/io_apic.c
+++ linux-2.6-tip/arch/x86/kernel/apic/io_apic.c
@@ -572,11 +572,6 @@ static void __unmask_and_level_IO_APIC_i
IO_APIC_REDIR_LEVEL_TRIGGER, NULL);
}
-static void __unmask_IO_APIC_irq(struct irq_cfg *cfg)
-{
- io_apic_modify_irq(cfg, ~IO_APIC_REDIR_MASKED, 0, NULL);
-}
-
static void io_apic_sync(struct irq_pin_list *entry)
{
/*
@@ -588,44 +583,41 @@ static void io_apic_sync(struct irq_pin_
readl(&io_apic->data);
}
-static void __mask_IO_APIC_irq(struct irq_cfg *cfg)
+static void mask_ioapic(struct irq_cfg *cfg)
{
+ unsigned long flags;
+
+ raw_spin_lock_irqsave(&ioapic_lock, flags);
io_apic_modify_irq(cfg, ~0, IO_APIC_REDIR_MASKED, &io_apic_sync);
+ raw_spin_unlock_irqrestore(&ioapic_lock, flags);
}
-static void mask_IO_APIC_irq_desc(struct irq_desc *desc)
+static void mask_ioapic_irq(unsigned int irq)
{
- struct irq_cfg *cfg = get_irq_desc_chip_data(desc);
- unsigned long flags;
+ struct irq_cfg *cfg = get_irq_chip_data(irq);
- BUG_ON(!cfg);
+ mask_ioapic(cfg);
+}
- raw_spin_lock_irqsave(&ioapic_lock, flags);
- __mask_IO_APIC_irq(cfg);
- raw_spin_unlock_irqrestore(&ioapic_lock, flags);
+static void __unmask_ioapic(struct irq_cfg *cfg)
+{
+ io_apic_modify_irq(cfg, ~IO_APIC_REDIR_MASKED, 0, NULL);
}
-static void unmask_IO_APIC_irq_desc(struct irq_desc *desc)
+static void unmask_ioapic(struct irq_cfg *cfg)
{
- struct irq_cfg *cfg = get_irq_desc_chip_data(desc);
unsigned long flags;
raw_spin_lock_irqsave(&ioapic_lock, flags);
- __unmask_IO_APIC_irq(cfg);
+ __unmask_ioapic(cfg);
raw_spin_unlock_irqrestore(&ioapic_lock, flags);
}
-static void mask_IO_APIC_irq(unsigned int irq)
+static void unmask_ioapic_irq(unsigned int irq)
{
- struct irq_desc *desc = irq_to_desc(irq);
+ struct irq_cfg *cfg = get_irq_chip_data(irq);
- mask_IO_APIC_irq_desc(desc);
-}
-static void unmask_IO_APIC_irq(unsigned int irq)
-{
- struct irq_desc *desc = irq_to_desc(irq);
-
- unmask_IO_APIC_irq_desc(desc);
+ unmask_ioapic(cfg);
}
static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
@@ -2253,7 +2245,7 @@ static unsigned int startup_ioapic_irq(u
was_pending = 1;
}
cfg = irq_cfg(irq);
- __unmask_IO_APIC_irq(cfg);
+ __unmask_ioapic(cfg);
raw_spin_unlock_irqrestore(&ioapic_lock, flags);
return was_pending;
@@ -2512,10 +2504,8 @@ unlock:
irq_exit();
}
-static void __irq_complete_move(struct irq_desc **descp, unsigned vector)
+static void __irq_complete_move(struct irq_cfg *cfg, unsigned vector)
{
- struct irq_desc *desc = *descp;
- struct irq_cfg *cfg = get_irq_desc_chip_data(desc);
unsigned me;
if (likely(!cfg->move_in_progress))
@@ -2527,30 +2517,29 @@ static void __irq_complete_move(struct i
send_cleanup_vector(cfg);
}
-static void irq_complete_move(struct irq_desc **descp)
+static void irq_complete_move(struct irq_cfg *cfg)
{
- __irq_complete_move(descp, ~get_irq_regs()->orig_ax);
+ __irq_complete_move(cfg, ~get_irq_regs()->orig_ax);
}
void irq_force_complete_move(int irq)
{
- struct irq_desc *desc = irq_to_desc(irq);
- struct irq_cfg *cfg = get_irq_desc_chip_data(desc);
+ struct irq_cfg *cfg = get_irq_chip_data(irq);
if (!cfg)
return;
- __irq_complete_move(&desc, cfg->vector);
+ __irq_complete_move(cfg, cfg->vector);
}
#else
-static inline void irq_complete_move(struct irq_desc **descp) {}
+static inline void irq_complete_move(struct irq_cfg *cfg) { }
#endif
static void ack_apic_edge(unsigned int irq)
{
- struct irq_desc *desc = irq_to_desc(irq);
+ struct irq_cfg *cfg = get_irq_chip_data(irq);
- irq_complete_move(&desc);
+ irq_complete_move(cfg);
move_native_irq(irq);
ack_APIC_irq();
}
@@ -2573,10 +2562,12 @@ atomic_t irq_mis_count;
* Otherwise, we simulate the EOI message manually by changing the trigger
* mode to edge and then back to level, with RTE being masked during this.
*/
-static void __eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
+static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
{
struct irq_pin_list *entry;
+ unsigned long flags;
+ raw_spin_lock_irqsave(&ioapic_lock, flags);
for_each_irq_pin(entry, cfg->irq_2_pin) {
if (mp_ioapics[entry->apic].apicver >= 0x20) {
/*
@@ -2594,36 +2585,22 @@ static void __eoi_ioapic_irq(unsigned in
__unmask_and_level_IO_APIC_irq(entry);
}
}
-}
-
-static void eoi_ioapic_irq(struct irq_desc *desc)
-{
- struct irq_cfg *cfg;
- unsigned long flags;
- unsigned int irq;
-
- irq = desc->irq;
- cfg = get_irq_desc_chip_data(desc);
-
- raw_spin_lock_irqsave(&ioapic_lock, flags);
- __eoi_ioapic_irq(irq, cfg);
raw_spin_unlock_irqrestore(&ioapic_lock, flags);
}
static void ack_apic_level(unsigned int irq)
{
struct irq_desc *desc = irq_to_desc(irq);
+ struct irq_cfg *cfg = get_irq_desc_chip_data(desc);
+ int i, do_unmask_irq = 0;
unsigned long v;
- int i;
- struct irq_cfg *cfg;
- int do_unmask_irq = 0;
- irq_complete_move(&desc);
+ irq_complete_move(cfg);
#ifdef CONFIG_GENERIC_PENDING_IRQ
/* If we are moving the irq we need to mask it */
if (unlikely(desc->status & IRQ_MOVE_PENDING)) {
do_unmask_irq = 1;
- mask_IO_APIC_irq_desc(desc);
+ mask_ioapic(cfg);
}
#endif
@@ -2659,7 +2636,6 @@ static void ack_apic_level(unsigned int
* we use the above logic (mask+edge followed by unmask+level) from
* Manfred Spraul to clear the remote IRR.
*/
- cfg = get_irq_desc_chip_data(desc);
i = cfg->vector;
v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
@@ -2679,7 +2655,7 @@ static void ack_apic_level(unsigned int
if (!(v & (1 << (i & 0x1f)))) {
atomic_inc(&irq_mis_count);
- eoi_ioapic_irq(desc);
+ eoi_ioapic_irq(irq, cfg);
}
/* Now we can move and renable the irq */
@@ -2710,10 +2686,9 @@ static void ack_apic_level(unsigned int
* accurate and is causing problems then it is a hardware bug
* and you can go talk to the chipset vendor about it.
*/
- cfg = get_irq_desc_chip_data(desc);
if (!io_apic_level_ack_pending(cfg))
move_masked_irq(irq);
- unmask_IO_APIC_irq_desc(desc);
+ unmask_ioapic(cfg);
}
}
@@ -2725,18 +2700,18 @@ static void ir_ack_apic_edge(unsigned in
static void ir_ack_apic_level(unsigned int irq)
{
- struct irq_desc *desc = irq_to_desc(irq);
+ struct irq_cfg *cfg = get_irq_chip_data(irq);
ack_APIC_irq();
- eoi_ioapic_irq(desc);
+ eoi_ioapic_irq(irq, cfg);
}
#endif /* CONFIG_INTR_REMAP */
static struct irq_chip ioapic_chip __read_mostly = {
.name = "IO-APIC",
.startup = startup_ioapic_irq,
- .mask = mask_IO_APIC_irq,
- .unmask = unmask_IO_APIC_irq,
+ .mask = mask_ioapic_irq,
+ .unmask = unmask_ioapic_irq,
.ack = ack_apic_edge,
.eoi = ack_apic_level,
#ifdef CONFIG_SMP
@@ -2748,8 +2723,8 @@ static struct irq_chip ioapic_chip __rea
static struct irq_chip ir_ioapic_chip __read_mostly = {
.name = "IR-IO-APIC",
.startup = startup_ioapic_irq,
- .mask = mask_IO_APIC_irq,
- .unmask = unmask_IO_APIC_irq,
+ .mask = mask_ioapic_irq,
+ .unmask = unmask_ioapic_irq,
#ifdef CONFIG_INTR_REMAP
.ack = ir_ack_apic_edge,
.eoi = ir_ack_apic_level,
@@ -3010,7 +2985,7 @@ static inline void __init check_timer(vo
int idx;
idx = find_irq_entry(apic1, pin1, mp_INT);
if (idx != -1 && irq_trigger(idx))
- unmask_IO_APIC_irq_desc(desc);
+ unmask_ioapic(cfg);
}
if (timer_irq_works()) {
if (nmi_watchdog == NMI_IO_APIC) {
next prev parent reply other threads:[~2010-09-30 23:17 UTC|newest]
Thread overview: 158+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-30 23:14 [patch 00/47] Sparse irq rework Thomas Gleixner
2010-09-30 23:14 ` [patch 01/47] x86: Plug memory leak in sparse irq Thomas Gleixner
2010-09-30 23:14 ` [patch 02/47] x86: Hpet: Fix bogus error check in hpet_assign_irq() Thomas Gleixner
2010-09-30 23:14 ` Thomas Gleixner
2010-09-30 23:14 ` [patch 03/47] genirq: Provide status modifier Thomas Gleixner
2010-09-30 23:14 ` Thomas Gleixner
2010-09-30 23:14 ` [patch 04/47] arm: Use irq " Thomas Gleixner
2010-09-30 23:14 ` Thomas Gleixner
2010-09-30 23:14 ` [patch 05/47] genirq-sanitize-irq-data-accessors.patch Thomas Gleixner
2010-09-30 23:14 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 06/47] genirq: Distangle kernel/irq/handle.c Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 07/47] genirq: Remove early_init_irq_lock_class() Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 08/47] genirq: Move core only inlines to kernel/irq Thomas Gleixner
2010-09-30 23:15 ` [patch 09/47] isdn: hisax: Replace the bogus access to irq stats Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 10/47] genirq: Remove export of kstat_irqs_cpu Thomas Gleixner
2010-09-30 23:15 ` [patch 11/47] genirq: Provide default irq init flags Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 12/47] arm: Use ARCH_IRQ_INIT_FLAGS Thomas Gleixner
2010-09-30 23:15 ` [patch 13/47] powerpc: " Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 14/47] genirq: Implement a sane sparse_irq allocator Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-10-01 5:28 ` Yinghai Lu
2010-10-01 20:36 ` Thomas Gleixner
2010-09-30 23:15 ` [patch 15/47] genirq: Prepare proc for real sparse irq support Thomas Gleixner
2010-09-30 23:15 ` [patch 16/47] genirq: Implement sane enumeration Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-10-03 10:55 ` Grant Likely
2010-09-30 23:15 ` [patch 17/47] genirq-update-kerneldoc.patch Thomas Gleixner
2010-09-30 23:15 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 18/47] genirq: Use sane sparse allocator Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 19/47] genirq: Query arch for number of early descriptors Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 20/47] x86: Remove useless reinitialization of irq descriptors Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-10-03 15:21 ` Eric W. Biederman
2010-10-03 18:26 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 21/47] x86: Sanitize apb timer interrupt handling Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 22/47] x86: lguest: Convert to new irq chip functions Thomas Gleixner
2010-09-30 23:16 ` [patch 23/47] x86: Cleanup visws interrupt handling Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 24/47] x86: i8259: Convert to new irq_chip functions Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner [this message]
2010-09-30 23:16 ` [patch 26/47] x86: io_apic: Convert startup to new irq_chip function Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 27/47] x86: ioapic: Convert mask " Thomas Gleixner
2010-09-30 23:16 ` [patch 28/47] x86: ioapic/hpet: Convert to new chip functions Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-09-30 23:16 ` [patch 29/47] pci: Convert msi to new irq_chip functions Thomas Gleixner
2010-09-30 23:16 ` Thomas Gleixner
2010-10-11 17:09 ` Jesse Barnes
2010-10-11 17:09 ` Jesse Barnes
2010-09-30 23:16 ` [patch 30/47] dmar: Convert to new irq chip functions Thomas Gleixner
2010-09-30 23:17 ` [patch 31/47] ht: Convert to new irq_chip functions Thomas Gleixner
2010-09-30 23:17 ` Thomas Gleixner
2010-09-30 23:17 ` [patch 32/47] x86: ioapic: Clean up the direct access to irq_desc Thomas Gleixner
2010-09-30 23:17 ` Thomas Gleixner
2010-09-30 23:17 ` [patch 33/47] pci: Cleanup the irq_desc mess in msi Thomas Gleixner
2010-10-11 17:08 ` Jesse Barnes
2010-10-11 17:08 ` Jesse Barnes
2010-09-30 23:17 ` [patch 34/47] x86: ioapic: Convert irq affinity to new chip functions Thomas Gleixner
2010-09-30 23:17 ` [patch 35/47] x86: ioapic: Cleanup some more Thomas Gleixner
2010-09-30 23:17 ` [patch 36/47] x86: ioapic: Cleanup sparse irq code Thomas Gleixner
2010-09-30 23:17 ` Thomas Gleixner
2010-09-30 23:17 ` [patch 37/47] x86: uv: Clean up the direct access to irq_desc Thomas Gleixner
2010-09-30 23:17 ` [patch 38/47] x86: Use sane enumeration Thomas Gleixner
2010-09-30 23:17 ` [patch 39/47] genirq: Remove arch_init_chip_data() Thomas Gleixner
2010-09-30 23:17 ` [patch 40/47] genirq: Sanitize dynamic irq handling Thomas Gleixner
2010-09-30 23:17 ` Thomas Gleixner
2010-10-01 5:47 ` Yinghai Lu
2010-09-30 23:18 ` [patch 41/47] arm: davinci: Cleanup irq_desc access Thomas Gleixner
2010-09-30 23:18 ` Thomas Gleixner
2010-09-30 23:18 ` [patch 42/47] genirq: Remove the now unused sparse irq leftovers Thomas Gleixner
2010-09-30 23:18 ` Thomas Gleixner
2010-09-30 23:18 ` [patch 43/47] x86: xen: Sanitise sparse_irq handling Thomas Gleixner
2010-09-30 23:18 ` Thomas Gleixner
2010-09-30 23:18 ` [patch 44/47] sh: Sanitize sparse irq Thomas Gleixner
2010-09-30 23:18 ` [patch 45/47] x86: lguest: Use new irq allocator Thomas Gleixner
2010-09-30 23:18 ` Thomas Gleixner
2010-09-30 23:18 ` [patch 46/47] powerpc: " Thomas Gleixner
2010-09-30 23:18 ` Thomas Gleixner
2010-10-01 0:42 ` Benjamin Herrenschmidt
2010-10-01 13:07 ` Thomas Gleixner
2010-10-01 20:46 ` Benjamin Herrenschmidt
2010-10-01 21:11 ` Grant Likely
2010-10-01 21:17 ` Benjamin Herrenschmidt
2010-10-03 16:53 ` Eric W. Biederman
2010-10-03 16:53 ` Eric W. Biederman
2010-10-03 18:34 ` Thomas Gleixner
2010-10-03 20:04 ` Thomas Gleixner
2010-10-03 22:54 ` Benjamin Herrenschmidt
2010-10-03 22:54 ` Benjamin Herrenschmidt
2010-10-04 0:15 ` Eric W. Biederman
2010-10-04 0:37 ` Benjamin Herrenschmidt
2010-10-04 16:46 ` Grant Likely
2010-09-30 23:18 ` [patch 47/47] genirq: Remove the old sparse irq allocator function Thomas Gleixner
2010-09-30 23:18 ` Thomas Gleixner
2010-10-01 3:32 ` [patch 00/47] Sparse irq rework Linus Torvalds
2010-10-01 3:32 ` Linus Torvalds
2010-10-01 5:54 ` Yinghai Lu
2010-10-01 5:54 ` Yinghai Lu
2010-10-01 20:35 ` Thomas Gleixner
2010-10-03 11:23 ` Grant Likely
2010-10-03 11:29 ` Russell King - ARM Linux
2010-10-03 11:29 ` Russell King - ARM Linux
2010-10-03 11:57 ` Grant Likely
2010-10-03 13:48 ` Thomas Gleixner
2010-10-05 10:22 ` Thomas Gleixner
2010-10-05 10:22 ` Thomas Gleixner
2010-10-06 22:45 ` Yinghai Lu
2010-10-06 22:52 ` Thomas Gleixner
2010-10-06 23:37 ` Yinghai Lu
2010-10-07 0:16 ` Yinghai Lu
2010-10-07 4:01 ` Thomas Gleixner
2010-10-07 4:38 ` Yinghai Lu
2010-10-08 21:50 ` Thomas Gleixner
2010-10-08 21:54 ` Thomas Gleixner
2010-10-09 4:26 ` Yinghai Lu
2010-10-09 5:44 ` Yinghai Lu
2010-10-09 6:34 ` Thomas Gleixner
2010-10-09 7:08 ` Yinghai Lu
2010-10-09 7:08 ` Yinghai Lu
2010-10-09 12:08 ` Thomas Gleixner
2010-10-10 9:32 ` Thomas Gleixner
2010-10-10 9:32 ` Thomas Gleixner
2010-10-10 13:30 ` Anca Emanuel
2010-10-11 2:20 ` Yinghai Lu
2010-10-11 2:20 ` Yinghai Lu
2010-10-11 3:50 ` Yinghai Lu
2010-10-11 3:50 ` Yinghai Lu
2010-10-11 8:16 ` Thomas Gleixner
2010-10-11 11:34 ` Benjamin Herrenschmidt
2010-10-11 16:19 ` Yinghai Lu
2010-10-11 16:19 ` Yinghai Lu
2010-10-09 6:10 ` Thomas Gleixner
2010-10-09 7:03 ` Yinghai Lu
2010-10-09 12:12 ` Thomas Gleixner
2010-10-10 2:32 ` Yinghai Lu
2010-10-10 2:32 ` Yinghai Lu
2010-10-10 5:11 ` Yinghai Lu
2010-10-10 5:11 ` Yinghai Lu
2010-10-10 8:20 ` Thomas Gleixner
2010-10-03 16:41 ` Eric W. Biederman
2010-10-03 16:41 ` Eric W. Biederman
2010-10-03 19:16 ` Thomas Gleixner
2010-10-03 22:57 ` Benjamin Herrenschmidt
2010-10-04 16:31 ` Grant Likely
2010-10-04 0:49 ` Eric W. Biederman
2010-10-04 8:05 ` Thomas Gleixner
2010-10-04 1:13 ` Eric W. Biederman
2010-10-04 1:13 ` Eric W. Biederman
2010-10-04 6:36 ` 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=20100930221740.937343375@linutronix.de \
--to=tglx@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=dwmw2@infradead.org \
--cc=ebiederm@xmission.com \
--cc=grant.likely@secretlab.ca \
--cc=jbarnes@virtuousgeek.org \
--cc=lethal@linux-sh.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=peterz@infradead.org \
--cc=torvalds@osdl.org \
--cc=x86@kernel.org \
--cc=yinghai@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).