Merge tag 'docs-4.16' of git://git.lwn.net/linux
[sfrench/cifs-2.6.git] / arch / xtensa / kernel / setup.c
index 08175df7a69eecfcb7ad6a6fa68ce226a16b8d0a..a931af9075f29dd383d101bc5318666487b1d6bf 100644 (file)
@@ -36,6 +36,7 @@
 #endif
 
 #include <asm/bootparam.h>
+#include <asm/kasan.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
@@ -156,7 +157,7 @@ static int __init parse_bootparam(const bp_tag_t* tag)
        /* Boot parameters must start with a BP_TAG_FIRST tag. */
 
        if (tag->id != BP_TAG_FIRST) {
-               printk(KERN_WARNING "Invalid boot parameters!\n");
+               pr_warn("Invalid boot parameters!\n");
                return 0;
        }
 
@@ -165,15 +166,14 @@ static int __init parse_bootparam(const bp_tag_t* tag)
        /* Parse all tags. */
 
        while (tag != NULL && tag->id != BP_TAG_LAST) {
-               for (t = &__tagtable_begin; t < &__tagtable_end; t++) {
+               for (t = &__tagtable_begin; t < &__tagtable_end; t++) {
                        if (tag->id == t->tag) {
                                t->parse(tag);
                                break;
                        }
                }
                if (t == &__tagtable_end)
-                       printk(KERN_WARNING "Ignoring tag "
-                              "0x%08x\n", tag->id);
+                       pr_warn("Ignoring tag 0x%08x\n", tag->id);
                tag = (bp_tag_t*)((unsigned long)(tag + 1) + tag->size);
        }
 
@@ -208,6 +208,8 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
        /* round down to nearest 256MB boundary */
        xtensa_kio_paddr &= 0xf0000000;
 
+       init_kio();
+
        return 1;
 }
 #else
@@ -246,6 +248,14 @@ void __init early_init_devtree(void *params)
 
 void __init init_arch(bp_tag_t *bp_start)
 {
+       /* Initialize MMU. */
+
+       init_mmu();
+
+       /* Initialize initial KASAN shadow map */
+
+       kasan_early_init();
+
        /* Parse boot parameters */
 
        if (bp_start)
@@ -263,10 +273,6 @@ void __init init_arch(bp_tag_t *bp_start)
        /* Early hook for platforms */
 
        platform_init(bp_start);
-
-       /* Initialize MMU. */
-
-       init_mmu();
 }
 
 /*
@@ -277,13 +283,13 @@ extern char _end[];
 extern char _stext[];
 extern char _WindowVectors_text_start;
 extern char _WindowVectors_text_end;
-extern char _DebugInterruptVector_literal_start;
+extern char _DebugInterruptVector_text_start;
 extern char _DebugInterruptVector_text_end;
-extern char _KernelExceptionVector_literal_start;
+extern char _KernelExceptionVector_text_start;
 extern char _KernelExceptionVector_text_end;
-extern char _UserExceptionVector_literal_start;
+extern char _UserExceptionVector_text_start;
 extern char _UserExceptionVector_text_end;
-extern char _DoubleExceptionVector_literal_start;
+extern char _DoubleExceptionVector_text_start;
 extern char _DoubleExceptionVector_text_end;
 #if XCHAL_EXCM_LEVEL >= 2
 extern char _Level2InterruptVector_text_start;
@@ -317,6 +323,13 @@ static inline int mem_reserve(unsigned long start, unsigned long end)
 
 void __init setup_arch(char **cmdline_p)
 {
+       pr_info("config ID: %08x:%08x\n",
+               get_sr(SREG_EPC), get_sr(SREG_EXCSAVE));
+       if (get_sr(SREG_EPC) != XCHAL_HW_CONFIGID0 ||
+           get_sr(SREG_EXCSAVE) != XCHAL_HW_CONFIGID1)
+               pr_info("built for config ID: %08x:%08x\n",
+                       XCHAL_HW_CONFIGID0, XCHAL_HW_CONFIGID1);
+
        *cmdline_p = command_line;
        platform_setup(cmdline_p);
        strlcpy(boot_command_line, *cmdline_p, COMMAND_LINE_SIZE);
@@ -339,16 +352,16 @@ void __init setup_arch(char **cmdline_p)
        mem_reserve(__pa(&_WindowVectors_text_start),
                    __pa(&_WindowVectors_text_end));
 
-       mem_reserve(__pa(&_DebugInterruptVector_literal_start),
+       mem_reserve(__pa(&_DebugInterruptVector_text_start),
                    __pa(&_DebugInterruptVector_text_end));
 
-       mem_reserve(__pa(&_KernelExceptionVector_literal_start),
+       mem_reserve(__pa(&_KernelExceptionVector_text_start),
                    __pa(&_KernelExceptionVector_text_end));
 
-       mem_reserve(__pa(&_UserExceptionVector_literal_start),
+       mem_reserve(__pa(&_UserExceptionVector_text_start),
                    __pa(&_UserExceptionVector_text_end));
 
-       mem_reserve(__pa(&_DoubleExceptionVector_literal_start),
+       mem_reserve(__pa(&_DoubleExceptionVector_text_start),
                    __pa(&_DoubleExceptionVector_text_end));
 
 #if XCHAL_EXCM_LEVEL >= 2
@@ -380,7 +393,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
        parse_early_param();
        bootmem_init();
-
+       kasan_init();
        unflatten_and_copy_device_tree();
 
 #ifdef CONFIG_SMP
@@ -582,12 +595,14 @@ c_show(struct seq_file *f, void *slot)
                      "model\t\t: Xtensa " XCHAL_HW_VERSION_NAME "\n"
                      "core ID\t\t: " XCHAL_CORE_ID "\n"
                      "build ID\t: 0x%x\n"
+                     "config ID\t: %08x:%08x\n"
                      "byte order\t: %s\n"
                      "cpu MHz\t\t: %lu.%02lu\n"
                      "bogomips\t: %lu.%02lu\n",
                      num_online_cpus(),
                      cpumask_pr_args(cpu_online_mask),
                      XCHAL_BUILD_UNIQUE_ID,
+                     get_sr(SREG_EPC), get_sr(SREG_EXCSAVE),
                      XCHAL_HAVE_BE ?  "big" : "little",
                      ccount_freq/1000000,
                      (ccount_freq/10000) % 100,