Commit b4963255 authored by Milton Miller's avatar Milton Miller Committed by Benjamin Herrenschmidt

powerpc/xics: Factor out cpu joining/unjoining the GIQ

This factors out processors joining and unjoining the Global Interrupt
Queue into a separate function.

There is a bit of math to calculate the arguments to rtas to join
or leave the global interrupt queue, and a warning on failure
afterwards.  Make a helper for the 3 callers.
Signed-off-by: default avatarMilton Miller <miltonm@bga.com>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent a244a957
...@@ -727,20 +727,19 @@ static void xics_set_cpu_priority(unsigned char cppr) ...@@ -727,20 +727,19 @@ static void xics_set_cpu_priority(unsigned char cppr)
iosync(); iosync();
} }
/* Have the calling processor join or leave the specified global queue */
static void xics_set_cpu_giq(unsigned int gserver, unsigned int join)
{
int status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE,
(1UL << interrupt_server_size) - 1 - gserver, join);
WARN_ON(status < 0);
}
void xics_setup_cpu(void) void xics_setup_cpu(void)
{ {
xics_set_cpu_priority(0xff); xics_set_cpu_priority(0xff);
/* xics_set_cpu_giq(default_distrib_server, 1);
* 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.
*
* XXX: undo of teardown on kexec needs this too, as may hotplug
*/
rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE,
(1UL << interrupt_server_size) - 1 - default_distrib_server, 1);
} }
void xics_teardown_cpu(void) void xics_teardown_cpu(void)
...@@ -749,9 +748,7 @@ void xics_teardown_cpu(void) ...@@ -749,9 +748,7 @@ void xics_teardown_cpu(void)
xics_set_cpu_priority(0); xics_set_cpu_priority(0);
/* /* Clear any pending IPI request */
* Clear IPI
*/
if (firmware_has_feature(FW_FEATURE_LPAR)) if (firmware_has_feature(FW_FEATURE_LPAR))
lpar_qirr_info(cpu, 0xff); lpar_qirr_info(cpu, 0xff);
else else
...@@ -785,9 +782,7 @@ void xics_kexec_teardown_cpu(int secondary) ...@@ -785,9 +782,7 @@ void xics_kexec_teardown_cpu(int secondary)
* so leave the master cpu in the group. * so leave the master cpu in the group.
*/ */
if (secondary) if (secondary)
rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, xics_set_cpu_giq(default_distrib_server, 0);
(1UL << interrupt_server_size) - 1 -
default_distrib_server, 0);
} }
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
...@@ -795,7 +790,6 @@ void xics_kexec_teardown_cpu(int secondary) ...@@ -795,7 +790,6 @@ void xics_kexec_teardown_cpu(int secondary)
/* Interrupts are disabled. */ /* Interrupts are disabled. */
void xics_migrate_irqs_away(void) void xics_migrate_irqs_away(void)
{ {
int status;
int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id(); int cpu = smp_processor_id(), hw_cpu = hard_smp_processor_id();
unsigned int irq, virq; unsigned int irq, virq;
...@@ -806,10 +800,8 @@ void xics_migrate_irqs_away(void) ...@@ -806,10 +800,8 @@ void xics_migrate_irqs_away(void)
/* Reject any interrupt that was queued to us... */ /* Reject any interrupt that was queued to us... */
xics_set_cpu_priority(0); xics_set_cpu_priority(0);
/* remove ourselves from the global interrupt queue */ /* Remove ourselves from the global interrupt queue */
status = rtas_set_indicator_fast(GLOBAL_INTERRUPT_QUEUE, xics_set_cpu_giq(default_distrib_server, 0);
(1UL << interrupt_server_size) - 1 - default_distrib_server, 0);
WARN_ON(status < 0);
/* Allow IPIs again... */ /* Allow IPIs again... */
xics_set_cpu_priority(DEFAULT_PRIORITY); xics_set_cpu_priority(DEFAULT_PRIORITY);
...@@ -817,6 +809,7 @@ void xics_migrate_irqs_away(void) ...@@ -817,6 +809,7 @@ void xics_migrate_irqs_away(void)
for_each_irq(virq) { for_each_irq(virq) {
struct irq_desc *desc; struct irq_desc *desc;
int xics_status[2]; int xics_status[2];
int status;
unsigned long flags; unsigned long flags;
/* We cant set affinity on ISA interrupts */ /* We cant set affinity on ISA interrupts */
......
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