x86, apic: Handle a bad TSC more gracefully
[firefly-linux-kernel-4.4.55.git] / arch / x86 / kernel / apic / apic.c
index 6b35d308688c82f888e367cddbdd94143f8b56d4..24b5894396a06c76b073435f52143f5ca420748f 100644 (file)
@@ -1297,7 +1297,7 @@ void setup_local_APIC(void)
        unsigned int value, queued;
        int i, j, acked = 0;
        unsigned long long tsc = 0, ntsc;
-       long long max_loops = cpu_khz;
+       long long max_loops = cpu_khz ? cpu_khz : 1000000;
 
        if (cpu_has_tsc)
                rdtscll(tsc);
@@ -1342,17 +1342,6 @@ void setup_local_APIC(void)
        /* always use the value from LDR */
        early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
                logical_smp_processor_id();
-
-       /*
-        * Some NUMA implementations (NUMAQ) don't initialize apicid to
-        * node mapping during NUMA init.  Now that logical apicid is
-        * guaranteed to be known, give it another chance.  This is already
-        * a bit too late - percpu allocation has already happened without
-        * proper NUMA affinity.
-        */
-       if (apic->x86_32_numa_cpu_node)
-               set_apicid_to_node(early_per_cpu(x86_cpu_to_apicid, cpu),
-                                  apic->x86_32_numa_cpu_node(cpu));
 #endif
 
        /*
@@ -1394,7 +1383,7 @@ void setup_local_APIC(void)
                        break;
                }
                if (queued) {
-                       if (cpu_has_tsc) {
+                       if (cpu_has_tsc && cpu_khz) {
                                rdtscll(ntsc);
                                max_loops = (cpu_khz << 10) - (ntsc - tsc);
                        } else
@@ -2053,8 +2042,6 @@ void __init connect_bsp_APIC(void)
                imcr_pic_to_apic();
        }
 #endif
-       if (apic->enable_apic_mode)
-               apic->enable_apic_mode();
 }
 
 /**