From: Timur Tabi <timur@freescale.com>
To: kumar.gala@freescale.com, benh@kernel.crashing.org,
greg@kroah.com, akpm@kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linux-console@vger.kernel.org
Subject: [PATCH 1/7] powerpc: make irq_choose_cpu() available to all PIC drivers
Date: Thu, 19 May 2011 08:54:26 -0500 [thread overview]
Message-ID: <1305813272-31826-2-git-send-email-timur@freescale.com> (raw)
In-Reply-To: <1305813272-31826-1-git-send-email-timur@freescale.com>
From: Stuart Yoder <stuart.yoder@freescale.com>
Move irq_choose_cpu() into arch/powerpc/kernel/irq.c so that it can be used
by other PIC drivers. The function is not MPIC-specific.
Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Timur Tabi <timur@freescale.com>
---
arch/powerpc/include/asm/irq.h | 2 ++
arch/powerpc/kernel/irq.c | 35 +++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/mpic.c | 36 ------------------------------------
3 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index 67ab5fb..1792d84 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -342,5 +342,7 @@ extern int call_handle_irq(int irq, void *p1,
struct thread_info *tp, void *func);
extern void do_IRQ(struct pt_regs *regs);
+int irq_choose_cpu(const struct cpumask *mask);
+
#endif /* _ASM_IRQ_H */
#endif /* __KERNEL__ */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index f621b7d..ce9bf93 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -870,6 +870,41 @@ unsigned int irq_find_mapping(struct irq_host *host,
}
EXPORT_SYMBOL_GPL(irq_find_mapping);
+#ifdef CONFIG_SMP
+int irq_choose_cpu(const struct cpumask *mask)
+{
+ int cpuid;
+
+ if (cpumask_equal(mask, cpu_all_mask)) {
+ static int irq_rover;
+ static DEFINE_RAW_SPINLOCK(irq_rover_lock);
+ unsigned long flags;
+
+ /* Round-robin distribution... */
+do_round_robin:
+ raw_spin_lock_irqsave(&irq_rover_lock, flags);
+
+ irq_rover = cpumask_next(irq_rover, cpu_online_mask);
+ if (irq_rover >= nr_cpu_ids)
+ irq_rover = cpumask_first(cpu_online_mask);
+
+ cpuid = irq_rover;
+
+ raw_spin_unlock_irqrestore(&irq_rover_lock, flags);
+ } else {
+ cpuid = cpumask_first_and(mask, cpu_online_mask);
+ if (cpuid >= nr_cpu_ids)
+ goto do_round_robin;
+ }
+
+ return get_hard_smp_processor_id(cpuid);
+}
+#else
+int irq_choose_cpu(const struct cpumask *mask)
+{
+ return hard_smp_processor_id();
+}
+#endif
unsigned int irq_radix_revmap_lookup(struct irq_host *host,
irq_hw_number_t hwirq)
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index f91c065..5ae1142 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -571,42 +571,6 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
#endif /* CONFIG_MPIC_U3_HT_IRQS */
-#ifdef CONFIG_SMP
-static int irq_choose_cpu(const struct cpumask *mask)
-{
- int cpuid;
-
- if (cpumask_equal(mask, cpu_all_mask)) {
- static int irq_rover = 0;
- static DEFINE_RAW_SPINLOCK(irq_rover_lock);
- unsigned long flags;
-
- /* Round-robin distribution... */
- do_round_robin:
- raw_spin_lock_irqsave(&irq_rover_lock, flags);
-
- irq_rover = cpumask_next(irq_rover, cpu_online_mask);
- if (irq_rover >= nr_cpu_ids)
- irq_rover = cpumask_first(cpu_online_mask);
-
- cpuid = irq_rover;
-
- raw_spin_unlock_irqrestore(&irq_rover_lock, flags);
- } else {
- cpuid = cpumask_first_and(mask, cpu_online_mask);
- if (cpuid >= nr_cpu_ids)
- goto do_round_robin;
- }
-
- return get_hard_smp_processor_id(cpuid);
-}
-#else
-static int irq_choose_cpu(const struct cpumask *mask)
-{
- return hard_smp_processor_id();
-}
-#endif
-
#define mpic_irq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
/* Find an mpic associated with a given linux interrupt */
--
1.7.3.4
next prev parent reply other threads:[~2011-05-19 13:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-19 13:54 [PATCH 0/7] This patchset adds support for running Linux under the Freescale hypervisor, Timur Tabi
2011-05-19 13:54 ` Timur Tabi [this message]
2011-06-22 11:41 ` [PATCH 1/7] powerpc: make irq_choose_cpu() available to all PIC drivers Kumar Gala
2011-05-19 13:54 ` [PATCH 2/7] powerpc: introduce ePAPR embedded hypervisor hcall interface Timur Tabi
2011-06-22 11:41 ` Kumar Gala
2011-05-19 13:54 ` [PATCH 3/7] powerpc: introduce the ePAPR embedded hypervisor vmpic driver Timur Tabi
2011-06-22 11:41 ` Kumar Gala
2011-05-19 13:54 ` [PATCH 4/7] powerpc: add Freescale hypervisor partition control functions Timur Tabi
2011-06-22 11:41 ` Kumar Gala
2011-05-19 13:54 ` [PATCH 5/7] powerpc/85xx: add board support for the Freescale hypervisor Timur Tabi
2011-06-22 11:42 ` Kumar Gala
2011-05-19 13:54 ` [PATCH 6/7] tty/powerpc: introduce the ePAPR embedded hypervisor byte channel driver Timur Tabi
2011-05-19 14:22 ` Greg KH
2011-05-19 14:27 ` Timur Tabi
2011-05-19 14:36 ` Alan Cox
2011-05-19 14:33 ` Alan Cox
2011-05-19 15:14 ` Timur Tabi
2011-05-19 15:50 ` Alan Cox
2011-05-19 15:54 ` Timur Tabi
2011-05-19 16:00 ` Alan Cox
2011-05-19 16:02 ` Greg KH
2011-05-19 16:18 ` Timur Tabi
2011-05-19 16:05 ` Timur Tabi
2011-05-20 9:54 ` Alan Cox
2011-05-19 16:31 ` Timur Tabi
2011-05-19 17:25 ` Alan Cox
2011-05-19 15:02 ` Arnd Bergmann
2011-05-19 15:09 ` Timur Tabi
2011-05-19 13:54 ` [PATCH 7/7] drivers/misc: introduce Freescale hypervisor management driver Timur Tabi
2011-05-19 13:56 ` [PATCH 0/7] This patchset adds support for running Linux under the Freescale hypervisor, Timur Tabi
2011-05-20 20:29 ` Kumar Gala
2011-05-23 21:09 ` Tabi Timur-B04825
2011-05-23 22:27 ` Kumar Gala
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=1305813272-31826-2-git-send-email-timur@freescale.com \
--to=timur@freescale.com \
--cc=akpm@kernel.org \
--cc=benh@kernel.crashing.org \
--cc=greg@kroah.com \
--cc=kumar.gala@freescale.com \
--cc=linux-console@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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).