Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / arch / x86 / kernel / apic / x2apic_uv_x.c
index cb0673c..aeef53c 100644 (file)
@@ -533,11 +533,8 @@ static unsigned int x2apic_get_apic_id(unsigned long x)
 
 static unsigned long set_apic_id(unsigned int id)
 {
-       unsigned long x;
-
-       /* maskout x2apic_extra_bits ? */
-       x = id;
-       return x;
+       /* CHECKME: Do we need to mask out the xapic extra bits? */
+       return id;
 }
 
 static unsigned int uv_read_apic_id(void)
@@ -560,7 +557,7 @@ static int uv_probe(void)
        return apic == &apic_x2apic_uv_x;
 }
 
-static struct apic __refdata apic_x2apic_uv_x = {
+static struct apic apic_x2apic_uv_x __ro_after_init = {
 
        .name                           = "UV large system",
        .probe                          = uv_probe,
@@ -927,7 +924,7 @@ static void uv_heartbeat(unsigned long ignored)
        mod_timer(timer, jiffies + SCIR_CPU_HB_INTERVAL);
 }
 
-static void uv_heartbeat_enable(int cpu)
+static int uv_heartbeat_enable(unsigned int cpu)
 {
        while (!uv_cpu_scir_info(cpu)->enabled) {
                struct timer_list *timer = &uv_cpu_scir_info(cpu)->timer;
@@ -941,43 +938,24 @@ static void uv_heartbeat_enable(int cpu)
                /* also ensure that boot cpu is enabled */
                cpu = 0;
        }
+       return 0;
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-static void uv_heartbeat_disable(int cpu)
+static int uv_heartbeat_disable(unsigned int cpu)
 {
        if (uv_cpu_scir_info(cpu)->enabled) {
                uv_cpu_scir_info(cpu)->enabled = 0;
                del_timer(&uv_cpu_scir_info(cpu)->timer);
        }
        uv_set_cpu_scir_bits(cpu, 0xff);
-}
-
-/*
- * cpu hotplug notifier
- */
-static int uv_scir_cpu_notify(struct notifier_block *self, unsigned long action,
-                             void *hcpu)
-{
-       long cpu = (long)hcpu;
-
-       switch (action & ~CPU_TASKS_FROZEN) {
-       case CPU_DOWN_FAILED:
-       case CPU_ONLINE:
-               uv_heartbeat_enable(cpu);
-               break;
-       case CPU_DOWN_PREPARE:
-               uv_heartbeat_disable(cpu);
-               break;
-       default:
-               break;
-       }
-       return NOTIFY_OK;
+       return 0;
 }
 
 static __init void uv_scir_register_cpu_notifier(void)
 {
-       hotcpu_notifier(uv_scir_cpu_notify, 0);
+       cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "x86/x2apic-uvx:online",
+                                 uv_heartbeat_enable, uv_heartbeat_disable);
 }
 
 #else /* !CONFIG_HOTPLUG_CPU */