]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/x86/kernel/setup.c
platform/x86: intel_telemetry_debugfs: fix oops when load/unload module
[karo-tx-linux.git] / arch / x86 / kernel / setup.c
index 21a3db1b9fecbfc17cac7795f5ac62bbd25d64dc..0b4d3c686b1ef94463c8caabce01e38404d1b8c1 100644 (file)
@@ -70,6 +70,7 @@
 #include <linux/tboot.h>
 #include <linux/jiffies.h>
 
+#include <linux/usb/xhci-dbgp.h>
 #include <video/edid.h>
 
 #include <asm/mtrr.h>
@@ -811,6 +812,26 @@ dump_kernel_offset(struct notifier_block *self, unsigned long v, void *p)
        return 0;
 }
 
+static void __init simple_udelay_calibration(void)
+{
+       unsigned int tsc_khz, cpu_khz;
+       unsigned long lpj;
+
+       if (!boot_cpu_has(X86_FEATURE_TSC))
+               return;
+
+       cpu_khz = x86_platform.calibrate_cpu();
+       tsc_khz = x86_platform.calibrate_tsc();
+
+       tsc_khz = tsc_khz ? : cpu_khz;
+       if (!tsc_khz)
+               return;
+
+       lpj = tsc_khz * 1000;
+       do_div(lpj, HZ);
+       loops_per_jiffy = lpj;
+}
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -959,6 +980,8 @@ void __init setup_arch(char **cmdline_p)
         */
        x86_configure_nx();
 
+       simple_udelay_calibration();
+
        parse_early_param();
 
 #ifdef CONFIG_MEMORY_HOTPLUG
@@ -1095,6 +1118,9 @@ void __init setup_arch(char **cmdline_p)
        memblock_set_current_limit(ISA_END_ADDRESS);
        e820__memblock_setup();
 
+       if (!early_xdbc_setup_hardware())
+               early_xdbc_register_console();
+
        reserve_bios_regions();
 
        if (efi_enabled(EFI_MEMMAP)) {
@@ -1199,6 +1225,21 @@ void __init setup_arch(char **cmdline_p)
 
        kasan_init();
 
+#ifdef CONFIG_X86_32
+       /* sync back kernel address range */
+       clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
+                       swapper_pg_dir     + KERNEL_PGD_BOUNDARY,
+                       KERNEL_PGD_PTRS);
+
+       /*
+        * sync back low identity map too.  It is used for example
+        * in the 32-bit EFI stub.
+        */
+       clone_pgd_range(initial_page_table,
+                       swapper_pg_dir     + KERNEL_PGD_BOUNDARY,
+                       min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
+#endif
+
        tboot_probe();
 
        map_vsyscall();