BACKPORT: arm64: Disable TTBR0_EL1 during normal kernel execution
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / kernel / vmlinux.lds.S
index ab2c6df55a0af689d4b848ecf19f4be97d839919..7a5228c7abdd7cc9c8226df887a2ec9e7b4d053d 100644 (file)
@@ -46,6 +46,16 @@ jiffies = jiffies_64;
        *(.idmap.text)                                  \
        VMLINUX_SYMBOL(__idmap_text_end) = .;
 
+#ifdef CONFIG_HIBERNATION
+#define HIBERNATE_TEXT                                 \
+       . = ALIGN(SZ_4K);                               \
+       VMLINUX_SYMBOL(__hibernate_exit_text_start) = .;\
+       *(.hibernate_exit.text)                         \
+       VMLINUX_SYMBOL(__hibernate_exit_text_end) = .;
+#else
+#define HIBERNATE_TEXT
+#endif
+
 /*
  * The size of the PE/COFF section that covers the kernel image, which
  * runs from stext to _edata, must be a round multiple of the PE/COFF
@@ -93,6 +103,7 @@ SECTIONS
                *(.discard)
                *(.discard.*)
                *(.interp .dynamic)
+               *(.dynsym .dynstr .hash)
        }
 
        . = KIMAGE_VADDR + TEXT_OFFSET;
@@ -107,11 +118,14 @@ SECTIONS
                        *(.exception.text)
                        __exception_text_end = .;
                        IRQENTRY_TEXT
+                       ENTRY_TEXT
                        TEXT_TEXT
                        SCHED_TEXT
                        LOCK_TEXT
+                       KPROBES_TEXT
                        HYPERVISOR_TEXT
                        IDMAP_TEXT
+                       HIBERNATE_TEXT
                        *(.fixup)
                        *(.gnu.warning)
                . = ALIGN(16);
@@ -119,12 +133,13 @@ SECTIONS
        }
 
        . = ALIGN(SEGMENT_ALIGN);
-       RO_DATA(PAGE_SIZE)              /* everything from this point to */
-       EXCEPTION_TABLE(8)              /* _etext will be marked RO NX   */
+       _etext = .;                     /* End of text section */
+
+       RO_DATA(PAGE_SIZE)              /* everything from this point to     */
+       EXCEPTION_TABLE(8)              /* __init_begin will be marked RO NX */
        NOTES
 
        . = ALIGN(SEGMENT_ALIGN);
-       _etext = .;                     /* End of text and rodata section */
        __init_begin = .;
 
        INIT_TEXT_SECTION(8)
@@ -158,19 +173,9 @@ SECTIONS
        .rela : ALIGN(8) {
                *(.rela .rela*)
        }
-       .dynsym : ALIGN(8) {
-               *(.dynsym)
-       }
-       .dynstr : {
-               *(.dynstr)
-       }
-       .hash : {
-               *(.hash)
-       }
 
-       __rela_offset   = ADDR(.rela) - KIMAGE_VADDR;
+       __rela_offset   = ABSOLUTE(ADDR(.rela) - KIMAGE_VADDR);
        __rela_size     = SIZEOF(.rela);
-       __dynsym_offset = ADDR(.dynsym) - KIMAGE_VADDR;
 
        . = ALIGN(SEGMENT_ALIGN);
        __init_end = .;
@@ -189,6 +194,11 @@ SECTIONS
        swapper_pg_dir = .;
        . += SWAPPER_DIR_SIZE;
 
+#ifdef CONFIG_ARM64_SW_TTBR0_PAN
+       reserved_ttbr0 = .;
+       . += RESERVED_TTBR0_SIZE;
+#endif
+
        _end = .;
 
        STABS_DEBUG
@@ -204,6 +214,10 @@ ASSERT(__hyp_idmap_text_end - (__hyp_idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
        "HYP init code too big or misaligned")
 ASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K,
        "ID map text too big or misaligned")
+#ifdef CONFIG_HIBERNATION
+ASSERT(__hibernate_exit_text_end - (__hibernate_exit_text_start & ~(SZ_4K - 1))
+       <= SZ_4K, "Hibernate exit text too big or misaligned")
+#endif
 
 /*
  * If padding is applied before .head.text, virt<->phys conversions will fail.