Commit d00da3f8 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: interrupt code cleanup

- Move some function prototypes into header files.
- Remove late_setup_cpu, put the set indicator and vpa init into xics
  probe instead
- rtas-proc was doing weird stuff with the 9005 indicator. Get rid of
  it.
- Dont open code the set_indicator call in the hotplug code
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f52cf14b
...@@ -19,9 +19,7 @@ ...@@ -19,9 +19,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -40,7 +38,6 @@ ...@@ -40,7 +38,6 @@
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/paca.h> #include <asm/paca.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/ppcdebug.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/xics.h> #include <asm/xics.h>
#include <asm/cputable.h> #include <asm/cputable.h>
...@@ -89,9 +86,6 @@ static int query_cpu_stopped(unsigned int pcpu) ...@@ -89,9 +86,6 @@ static int query_cpu_stopped(unsigned int pcpu)
int pSeries_cpu_disable(void) int pSeries_cpu_disable(void)
{ {
/* FIXME: go put this in a header somewhere */
extern void xics_migrate_irqs_away(void);
systemcfg->processorCount--; systemcfg->processorCount--;
/*fix boot_cpuid here*/ /*fix boot_cpuid here*/
...@@ -250,8 +244,6 @@ static void smp_xics_message_pass(int target, int msg) ...@@ -250,8 +244,6 @@ static void smp_xics_message_pass(int target, int msg)
} }
} }
extern void xics_request_IPIs(void);
static int __init smp_xics_probe(void) static int __init smp_xics_probe(void)
{ {
xics_request_IPIs(); xics_request_IPIs();
...@@ -263,6 +255,18 @@ static void __devinit smp_xics_setup_cpu(int cpu) ...@@ -263,6 +255,18 @@ static void __devinit smp_xics_setup_cpu(int cpu)
{ {
if (cpu != boot_cpuid) if (cpu != boot_cpuid)
xics_setup_cpu(); xics_setup_cpu();
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
vpa_init(cpu);
#ifdef CONFIG_IRQ_ALL_CPUS
/*
* Put the calling processor into the GIQ. This is really only
* necessary from a secondary thread as the OF start-cpu interface
* performs this function for us on primary threads.
*/
rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE, default_distrib_server, 1);
#endif
} }
static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED; static spinlock_t timebase_lock = SPIN_LOCK_UNLOCKED;
...@@ -290,26 +294,7 @@ static void __devinit pSeries_take_timebase(void) ...@@ -290,26 +294,7 @@ static void __devinit pSeries_take_timebase(void)
spin_unlock(&timebase_lock); spin_unlock(&timebase_lock);
} }
static void __devinit pSeries_late_setup_cpu(int cpu) static void __devinit smp_pSeries_kick_cpu(int nr)
{
extern unsigned int default_distrib_server;
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
vpa_init(cpu);
}
#ifdef CONFIG_IRQ_ALL_CPUS
/* Put the calling processor into the GIQ. This is really only
* necessary from a secondary thread as the OF start-cpu interface
* performs this function for us on primary threads.
*/
/* TODO: 9005 is #defined in rtas-proc.c -- move to a header */
rtas_set_indicator(9005, default_distrib_server, 1);
#endif
}
void __devinit smp_pSeries_kick_cpu(int nr)
{ {
BUG_ON(nr < 0 || nr >= NR_CPUS); BUG_ON(nr < 0 || nr >= NR_CPUS);
...@@ -329,7 +314,6 @@ static struct smp_ops_t pSeries_mpic_smp_ops = { ...@@ -329,7 +314,6 @@ static struct smp_ops_t pSeries_mpic_smp_ops = {
.probe = smp_mpic_probe, .probe = smp_mpic_probe,
.kick_cpu = smp_pSeries_kick_cpu, .kick_cpu = smp_pSeries_kick_cpu,
.setup_cpu = smp_mpic_setup_cpu, .setup_cpu = smp_mpic_setup_cpu,
.late_setup_cpu = pSeries_late_setup_cpu,
}; };
static struct smp_ops_t pSeries_xics_smp_ops = { static struct smp_ops_t pSeries_xics_smp_ops = {
...@@ -337,7 +321,6 @@ static struct smp_ops_t pSeries_xics_smp_ops = { ...@@ -337,7 +321,6 @@ static struct smp_ops_t pSeries_xics_smp_ops = {
.probe = smp_xics_probe, .probe = smp_xics_probe,
.kick_cpu = smp_pSeries_kick_cpu, .kick_cpu = smp_pSeries_kick_cpu,
.setup_cpu = smp_xics_setup_cpu, .setup_cpu = smp_xics_setup_cpu,
.late_setup_cpu = pSeries_late_setup_cpu,
}; };
/* This is called very early */ /* This is called very early */
...@@ -372,9 +355,6 @@ void __init smp_init_pSeries(void) ...@@ -372,9 +355,6 @@ void __init smp_init_pSeries(void)
} }
} }
if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
vpa_init(boot_cpuid);
/* Non-lpar has additional take/give timebase */ /* Non-lpar has additional take/give timebase */
if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) { if (rtas_token("freeze-time-base") != RTAS_UNKNOWN_SERVICE) {
smp_ops->give_timebase = pSeries_give_timebase; smp_ops->give_timebase = pSeries_give_timebase;
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#define IBM_VOLTAGE 0x232a /* 9002 */ #define IBM_VOLTAGE 0x232a /* 9002 */
#define IBM_DRCONNECTOR 0x232b /* 9003 */ #define IBM_DRCONNECTOR 0x232b /* 9003 */
#define IBM_POWERSUPPLY 0x232c /* 9004 */ #define IBM_POWERSUPPLY 0x232c /* 9004 */
#define IBM_INTQUEUE 0x232d /* 9005 */
/* Status return values */ /* Status return values */
#define SENSOR_CRITICAL_HIGH 13 #define SENSOR_CRITICAL_HIGH 13
...@@ -107,7 +106,6 @@ ...@@ -107,7 +106,6 @@
#define DR_ACTION 0x2329 /* 9001 */ #define DR_ACTION 0x2329 /* 9001 */
#define DR_INDICATOR 0x232a /* 9002 */ #define DR_INDICATOR 0x232a /* 9002 */
/* 9003 - 9004: Vendor specific */ /* 9003 - 9004: Vendor specific */
#define GLOBAL_INTERRUPT_QUEUE 0x232d /* 9005 */
/* 9006 - 9999: Vendor specific */ /* 9006 - 9999: Vendor specific */
/* other */ /* other */
...@@ -553,7 +551,6 @@ static void ppc_rtas_process_sensor(struct seq_file *m, ...@@ -553,7 +551,6 @@ static void ppc_rtas_process_sensor(struct seq_file *m,
"No current flow" }; "No current flow" };
const char * ibm_drconnector[] = { "Empty", "Present", "Unusable", const char * ibm_drconnector[] = { "Empty", "Present", "Unusable",
"Exchange" }; "Exchange" };
const char * ibm_intqueue[] = { "Disabled", "Enabled" };
int have_strings = 0; int have_strings = 0;
int num_states = 0; int num_states = 0;
...@@ -665,15 +662,6 @@ static void ppc_rtas_process_sensor(struct seq_file *m, ...@@ -665,15 +662,6 @@ static void ppc_rtas_process_sensor(struct seq_file *m,
case IBM_POWERSUPPLY: case IBM_POWERSUPPLY:
seq_printf(m, "Powersupply:\t"); seq_printf(m, "Powersupply:\t");
break; break;
case IBM_INTQUEUE:
seq_printf(m, "Interrupt queue:\t");
num_states = sizeof(ibm_intqueue) / sizeof(char *);
if (state < num_states) {
seq_printf(m, "%s\t",
ibm_intqueue[state]);
have_strings = 1;
}
break;
default: default:
seq_printf(m, "Unknown sensor (type %d), ignoring it\n", seq_printf(m, "Unknown sensor (type %d), ignoring it\n",
s->token); s->token);
......
...@@ -22,9 +22,7 @@ ...@@ -22,9 +22,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -38,12 +36,10 @@ ...@@ -38,12 +36,10 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/io.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/paca.h> #include <asm/paca.h>
#include <asm/time.h> #include <asm/time.h>
#include <asm/ppcdebug.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/cputable.h> #include <asm/cputable.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -58,7 +54,6 @@ ...@@ -58,7 +54,6 @@
#endif #endif
int smp_threads_ready; int smp_threads_ready;
unsigned long cache_decay_ticks;
cpumask_t cpu_possible_map = CPU_MASK_NONE; cpumask_t cpu_possible_map = CPU_MASK_NONE;
cpumask_t cpu_online_map = CPU_MASK_NONE; cpumask_t cpu_online_map = CPU_MASK_NONE;
...@@ -77,10 +72,6 @@ void smp_call_function_interrupt(void); ...@@ -77,10 +72,6 @@ void smp_call_function_interrupt(void);
int smt_enabled_at_boot = 1; int smt_enabled_at_boot = 1;
/* Low level assembly function used to backup CPU 0 state */
extern void __save_cpu_setup(void);
#ifdef CONFIG_PPC_MULTIPLATFORM #ifdef CONFIG_PPC_MULTIPLATFORM
void smp_mpic_message_pass(int target, int msg) void smp_mpic_message_pass(int target, int msg)
{ {
...@@ -507,9 +498,6 @@ int __devinit start_secondary(void *unused) ...@@ -507,9 +498,6 @@ int __devinit start_secondary(void *unused)
if (smp_ops->take_timebase) if (smp_ops->take_timebase)
smp_ops->take_timebase(); smp_ops->take_timebase();
if (smp_ops->late_setup_cpu)
smp_ops->late_setup_cpu(cpu);
spin_lock(&call_lock); spin_lock(&call_lock);
cpu_set(cpu, cpu_online_map); cpu_set(cpu, cpu_online_map);
spin_unlock(&call_lock); spin_unlock(&call_lock);
......
...@@ -643,19 +643,15 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask) ...@@ -643,19 +643,15 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
/* Interrupts are disabled. */ /* Interrupts are disabled. */
void xics_migrate_irqs_away(void) void xics_migrate_irqs_away(void)
{ {
int set_indicator = rtas_token("set-indicator"); int status;
const unsigned int giqs = 9005UL; /* Global Interrupt Queue Server */
int status = 0;
unsigned int irq, virq, cpu = smp_processor_id(); unsigned int irq, virq, cpu = smp_processor_id();
BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE);
/* Reject any interrupt that was queued to us... */ /* Reject any interrupt that was queued to us... */
ops->cppr_info(cpu, 0); ops->cppr_info(cpu, 0);
iosync(); iosync();
/* Refuse any new interrupts... */ /* Refuse any new interrupts... */
rtas_call(set_indicator, 3, 1, &status, giqs, status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
hard_smp_processor_id(), 0); hard_smp_processor_id(), 0);
WARN_ON(status != 0); WARN_ON(status != 0);
......
...@@ -28,7 +28,6 @@ struct smp_ops_t { ...@@ -28,7 +28,6 @@ struct smp_ops_t {
int (*probe)(void); int (*probe)(void);
void (*kick_cpu)(int nr); void (*kick_cpu)(int nr);
void (*setup_cpu)(int nr); void (*setup_cpu)(int nr);
void (*late_setup_cpu)(int nr);
void (*take_timebase)(void); void (*take_timebase)(void);
void (*give_timebase)(void); void (*give_timebase)(void);
int (*cpu_disable)(void); int (*cpu_disable)(void);
......
...@@ -241,4 +241,6 @@ extern void rtas_stop_self(void); ...@@ -241,4 +241,6 @@ extern void rtas_stop_self(void);
/* RMO buffer reserved for user-space RTAS use */ /* RMO buffer reserved for user-space RTAS use */
extern unsigned long rtas_rmo_buf; extern unsigned long rtas_rmo_buf;
#define GLOBAL_INTERRUPT_QUEUE 9005
#endif /* _PPC64_RTAS_H */ #endif /* _PPC64_RTAS_H */
...@@ -18,6 +18,8 @@ void xics_init_IRQ(void); ...@@ -18,6 +18,8 @@ void xics_init_IRQ(void);
int xics_get_irq(struct pt_regs *); int xics_get_irq(struct pt_regs *);
void xics_setup_cpu(void); void xics_setup_cpu(void);
void xics_cause_IPI(int cpu); void xics_cause_IPI(int cpu);
void xics_request_IPIs(void);
void xics_migrate_irqs_away(void);
/* first argument is ignored for now*/ /* first argument is ignored for now*/
void pSeriesLP_cppr_info(int n_cpu, u8 value); void pSeriesLP_cppr_info(int n_cpu, u8 value);
...@@ -28,4 +30,6 @@ struct xics_ipi_struct { ...@@ -28,4 +30,6 @@ struct xics_ipi_struct {
extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned; extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
extern unsigned int default_distrib_server;
#endif /* _PPC64_KERNEL_XICS_H */ #endif /* _PPC64_KERNEL_XICS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment