diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-09-08 02:41:52 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-09-08 02:41:52 -0400 |
commit | 2b3061c77ce7e429b25a25560ba088e8e7193a67 (patch) | |
tree | 0266198d083a4a489cb3d8f47394b7b83263d212 | |
parent | 01175255fd8e3e993353a779f819ec8c0c59137e (diff) | |
parent | 25dfe4785332723f09311dcb7fd91015a60c022f (diff) |
Merge branch 'x86/mm' into x86/asm, to unify the two branches for simplicity
Signed-off-by: Ingo Molnar <mingo@kernel.org>
27 files changed, 73 insertions, 39 deletions
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index 4e10d73cf018..12080d87da3b 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h | |||
@@ -36,7 +36,7 @@ static inline void fill_ldt(struct desc_struct *desc, const struct user_desc *in | |||
36 | 36 | ||
37 | extern struct desc_ptr idt_descr; | 37 | extern struct desc_ptr idt_descr; |
38 | extern gate_desc idt_table[]; | 38 | extern gate_desc idt_table[]; |
39 | extern struct desc_ptr debug_idt_descr; | 39 | extern const struct desc_ptr debug_idt_descr; |
40 | extern gate_desc debug_idt_table[]; | 40 | extern gate_desc debug_idt_table[]; |
41 | 41 | ||
42 | struct gdt_page { | 42 | struct gdt_page { |
diff --git a/arch/x86/include/asm/fpu/xstate.h b/arch/x86/include/asm/fpu/xstate.h index ae55a43e09c0..d4957ac72b48 100644 --- a/arch/x86/include/asm/fpu/xstate.h +++ b/arch/x86/include/asm/fpu/xstate.h | |||
@@ -45,7 +45,8 @@ | |||
45 | extern u64 xfeatures_mask; | 45 | extern u64 xfeatures_mask; |
46 | extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; | 46 | extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; |
47 | 47 | ||
48 | extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask); | 48 | extern void __init update_regset_xstate_info(unsigned int size, |
49 | u64 xstate_mask); | ||
49 | 50 | ||
50 | void fpu__xstate_clear_all_cpu_caps(void); | 51 | void fpu__xstate_clear_all_cpu_caps(void); |
51 | void *get_xsave_addr(struct xregs_state *xsave, int xstate); | 52 | void *get_xsave_addr(struct xregs_state *xsave, int xstate); |
diff --git a/arch/x86/include/asm/kaslr.h b/arch/x86/include/asm/kaslr.h index 2674ee3de748..1052a797d71d 100644 --- a/arch/x86/include/asm/kaslr.h +++ b/arch/x86/include/asm/kaslr.h | |||
@@ -6,6 +6,7 @@ unsigned long kaslr_get_random_long(const char *purpose); | |||
6 | #ifdef CONFIG_RANDOMIZE_MEMORY | 6 | #ifdef CONFIG_RANDOMIZE_MEMORY |
7 | extern unsigned long page_offset_base; | 7 | extern unsigned long page_offset_base; |
8 | extern unsigned long vmalloc_base; | 8 | extern unsigned long vmalloc_base; |
9 | extern unsigned long vmemmap_base; | ||
9 | 10 | ||
10 | void kernel_randomize_memory(void); | 11 | void kernel_randomize_memory(void); |
11 | #else | 12 | #else |
diff --git a/arch/x86/include/asm/pgtable_64_types.h b/arch/x86/include/asm/pgtable_64_types.h index 6fdef9eef2d5..3a264200c62f 100644 --- a/arch/x86/include/asm/pgtable_64_types.h +++ b/arch/x86/include/asm/pgtable_64_types.h | |||
@@ -57,11 +57,13 @@ typedef struct { pteval_t pte; } pte_t; | |||
57 | #define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL) | 57 | #define MAXMEM _AC(__AC(1, UL) << MAX_PHYSMEM_BITS, UL) |
58 | #define VMALLOC_SIZE_TB _AC(32, UL) | 58 | #define VMALLOC_SIZE_TB _AC(32, UL) |
59 | #define __VMALLOC_BASE _AC(0xffffc90000000000, UL) | 59 | #define __VMALLOC_BASE _AC(0xffffc90000000000, UL) |
60 | #define VMEMMAP_START _AC(0xffffea0000000000, UL) | 60 | #define __VMEMMAP_BASE _AC(0xffffea0000000000, UL) |
61 | #ifdef CONFIG_RANDOMIZE_MEMORY | 61 | #ifdef CONFIG_RANDOMIZE_MEMORY |
62 | #define VMALLOC_START vmalloc_base | 62 | #define VMALLOC_START vmalloc_base |
63 | #define VMEMMAP_START vmemmap_base | ||
63 | #else | 64 | #else |
64 | #define VMALLOC_START __VMALLOC_BASE | 65 | #define VMALLOC_START __VMALLOC_BASE |
66 | #define VMEMMAP_START __VMEMMAP_BASE | ||
65 | #endif /* CONFIG_RANDOMIZE_MEMORY */ | 67 | #endif /* CONFIG_RANDOMIZE_MEMORY */ |
66 | #define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL)) | 68 | #define VMALLOC_END (VMALLOC_START + _AC((VMALLOC_SIZE_TB << 40) - 1, UL)) |
67 | #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) | 69 | #define MODULES_VADDR (__START_KERNEL_map + KERNEL_IMAGE_SIZE) |
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 5b2ae106bd4a..8862da76ef6f 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c | |||
@@ -25,7 +25,7 @@ | |||
25 | static struct apic apic_physflat; | 25 | static struct apic apic_physflat; |
26 | static struct apic apic_flat; | 26 | static struct apic apic_flat; |
27 | 27 | ||
28 | struct apic __read_mostly *apic = &apic_flat; | 28 | struct apic *apic __ro_after_init = &apic_flat; |
29 | EXPORT_SYMBOL_GPL(apic); | 29 | EXPORT_SYMBOL_GPL(apic); |
30 | 30 | ||
31 | static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) | 31 | static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
@@ -154,7 +154,7 @@ static int flat_probe(void) | |||
154 | return 1; | 154 | return 1; |
155 | } | 155 | } |
156 | 156 | ||
157 | static struct apic apic_flat = { | 157 | static struct apic apic_flat __ro_after_init = { |
158 | .name = "flat", | 158 | .name = "flat", |
159 | .probe = flat_probe, | 159 | .probe = flat_probe, |
160 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, | 160 | .acpi_madt_oem_check = flat_acpi_madt_oem_check, |
@@ -248,7 +248,7 @@ static int physflat_probe(void) | |||
248 | return 0; | 248 | return 0; |
249 | } | 249 | } |
250 | 250 | ||
251 | static struct apic apic_physflat = { | 251 | static struct apic apic_physflat __ro_after_init = { |
252 | 252 | ||
253 | .name = "physical flat", | 253 | .name = "physical flat", |
254 | .probe = physflat_probe, | 254 | .probe = physflat_probe, |
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c index c05688b2deff..b109e4389c92 100644 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c | |||
@@ -108,7 +108,7 @@ static void noop_apic_write(u32 reg, u32 v) | |||
108 | WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !disable_apic); | 108 | WARN_ON_ONCE(boot_cpu_has(X86_FEATURE_APIC) && !disable_apic); |
109 | } | 109 | } |
110 | 110 | ||
111 | struct apic apic_noop = { | 111 | struct apic apic_noop __ro_after_init = { |
112 | .name = "noop", | 112 | .name = "noop", |
113 | .probe = noop_probe, | 113 | .probe = noop_probe, |
114 | .acpi_madt_oem_check = NULL, | 114 | .acpi_madt_oem_check = NULL, |
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index 06dbaa458bfe..56012010332c 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c | |||
@@ -142,7 +142,7 @@ static int probe_bigsmp(void) | |||
142 | return dmi_bigsmp; | 142 | return dmi_bigsmp; |
143 | } | 143 | } |
144 | 144 | ||
145 | static struct apic apic_bigsmp = { | 145 | static struct apic apic_bigsmp __ro_after_init = { |
146 | 146 | ||
147 | .name = "bigsmp", | 147 | .name = "bigsmp", |
148 | .probe = probe_bigsmp, | 148 | .probe = probe_bigsmp, |
diff --git a/arch/x86/kernel/apic/msi.c b/arch/x86/kernel/apic/msi.c index ade25320df96..015bbf30e3e3 100644 --- a/arch/x86/kernel/apic/msi.c +++ b/arch/x86/kernel/apic/msi.c | |||
@@ -269,7 +269,7 @@ static void hpet_msi_write_msg(struct irq_data *data, struct msi_msg *msg) | |||
269 | hpet_msi_write(irq_data_get_irq_handler_data(data), msg); | 269 | hpet_msi_write(irq_data_get_irq_handler_data(data), msg); |
270 | } | 270 | } |
271 | 271 | ||
272 | static struct irq_chip hpet_msi_controller = { | 272 | static struct irq_chip hpet_msi_controller __ro_after_init = { |
273 | .name = "HPET-MSI", | 273 | .name = "HPET-MSI", |
274 | .irq_unmask = hpet_msi_unmask, | 274 | .irq_unmask = hpet_msi_unmask, |
275 | .irq_mask = hpet_msi_mask, | 275 | .irq_mask = hpet_msi_mask, |
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 7c43e716c158..e5fb2f086460 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c | |||
@@ -72,7 +72,7 @@ static int probe_default(void) | |||
72 | return 1; | 72 | return 1; |
73 | } | 73 | } |
74 | 74 | ||
75 | static struct apic apic_default = { | 75 | static struct apic apic_default __ro_after_init = { |
76 | 76 | ||
77 | .name = "default", | 77 | .name = "default", |
78 | .probe = probe_default, | 78 | .probe = probe_default, |
@@ -126,7 +126,7 @@ static struct apic apic_default = { | |||
126 | 126 | ||
127 | apic_driver(apic_default); | 127 | apic_driver(apic_default); |
128 | 128 | ||
129 | struct apic *apic = &apic_default; | 129 | struct apic *apic __ro_after_init = &apic_default; |
130 | EXPORT_SYMBOL_GPL(apic); | 130 | EXPORT_SYMBOL_GPL(apic); |
131 | 131 | ||
132 | static int cmdline_apic __initdata; | 132 | static int cmdline_apic __initdata; |
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index 54f35d988025..200af5ae9662 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c | |||
@@ -227,7 +227,7 @@ static void cluster_vector_allocation_domain(int cpu, struct cpumask *retmask, | |||
227 | cpumask_and(retmask, mask, per_cpu(cpus_in_cluster, cpu)); | 227 | cpumask_and(retmask, mask, per_cpu(cpus_in_cluster, cpu)); |
228 | } | 228 | } |
229 | 229 | ||
230 | static struct apic apic_x2apic_cluster = { | 230 | static struct apic apic_x2apic_cluster __ro_after_init = { |
231 | 231 | ||
232 | .name = "cluster x2apic", | 232 | .name = "cluster x2apic", |
233 | .probe = x2apic_cluster_probe, | 233 | .probe = x2apic_cluster_probe, |
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index 4f13f54f1b1f..ff111f05a314 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c | |||
@@ -98,7 +98,7 @@ static int x2apic_phys_probe(void) | |||
98 | return apic == &apic_x2apic_phys; | 98 | return apic == &apic_x2apic_phys; |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct apic apic_x2apic_phys = { | 101 | static struct apic apic_x2apic_phys __ro_after_init = { |
102 | 102 | ||
103 | .name = "physical x2apic", | 103 | .name = "physical x2apic", |
104 | .probe = x2apic_phys_probe, | 104 | .probe = x2apic_phys_probe, |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index cb0673c1e940..b9f6157d4271 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -560,7 +560,7 @@ static int uv_probe(void) | |||
560 | return apic == &apic_x2apic_uv_x; | 560 | return apic == &apic_x2apic_uv_x; |
561 | } | 561 | } |
562 | 562 | ||
563 | static struct apic __refdata apic_x2apic_uv_x = { | 563 | static struct apic apic_x2apic_uv_x __ro_after_init = { |
564 | 564 | ||
565 | .name = "UV large system", | 565 | .name = "UV large system", |
566 | .probe = uv_probe, | 566 | .probe = uv_probe, |
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index e374c19b9ddc..06919427d451 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -1265,9 +1265,14 @@ static __init int setup_disablecpuid(char *arg) | |||
1265 | __setup("clearcpuid=", setup_disablecpuid); | 1265 | __setup("clearcpuid=", setup_disablecpuid); |
1266 | 1266 | ||
1267 | #ifdef CONFIG_X86_64 | 1267 | #ifdef CONFIG_X86_64 |
1268 | struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table }; | 1268 | struct desc_ptr idt_descr __ro_after_init = { |
1269 | struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1, | 1269 | .size = NR_VECTORS * 16 - 1, |
1270 | (unsigned long) debug_idt_table }; | 1270 | .address = (unsigned long) idt_table, |
1271 | }; | ||
1272 | const struct desc_ptr debug_idt_descr = { | ||
1273 | .size = NR_VECTORS * 16 - 1, | ||
1274 | .address = (unsigned long) debug_idt_table, | ||
1275 | }; | ||
1271 | 1276 | ||
1272 | DEFINE_PER_CPU_FIRST(union irq_stack_union, | 1277 | DEFINE_PER_CPU_FIRST(union irq_stack_union, |
1273 | irq_stack_union) __aligned(PAGE_SIZE) __visible; | 1278 | irq_stack_union) __aligned(PAGE_SIZE) __visible; |
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c index 28f1b54b7fad..24e87e74990d 100644 --- a/arch/x86/kernel/cpu/mtrr/main.c +++ b/arch/x86/kernel/cpu/mtrr/main.c | |||
@@ -72,14 +72,14 @@ static DEFINE_MUTEX(mtrr_mutex); | |||
72 | u64 size_or_mask, size_and_mask; | 72 | u64 size_or_mask, size_and_mask; |
73 | static bool mtrr_aps_delayed_init; | 73 | static bool mtrr_aps_delayed_init; |
74 | 74 | ||
75 | static const struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM]; | 75 | static const struct mtrr_ops *mtrr_ops[X86_VENDOR_NUM] __ro_after_init; |
76 | 76 | ||
77 | const struct mtrr_ops *mtrr_if; | 77 | const struct mtrr_ops *mtrr_if; |
78 | 78 | ||
79 | static void set_mtrr(unsigned int reg, unsigned long base, | 79 | static void set_mtrr(unsigned int reg, unsigned long base, |
80 | unsigned long size, mtrr_type type); | 80 | unsigned long size, mtrr_type type); |
81 | 81 | ||
82 | void set_mtrr_ops(const struct mtrr_ops *ops) | 82 | void __init set_mtrr_ops(const struct mtrr_ops *ops) |
83 | { | 83 | { |
84 | if (ops->vendor && ops->vendor < X86_VENDOR_NUM) | 84 | if (ops->vendor && ops->vendor < X86_VENDOR_NUM) |
85 | mtrr_ops[ops->vendor] = ops; | 85 | mtrr_ops[ops->vendor] = ops; |
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.h b/arch/x86/kernel/cpu/mtrr/mtrr.h index 6c7ced07d16d..ad8bd763efa5 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.h +++ b/arch/x86/kernel/cpu/mtrr/mtrr.h | |||
@@ -54,7 +54,7 @@ void fill_mtrr_var_range(unsigned int index, | |||
54 | bool get_mtrr_state(void); | 54 | bool get_mtrr_state(void); |
55 | void mtrr_bp_pat_init(void); | 55 | void mtrr_bp_pat_init(void); |
56 | 56 | ||
57 | extern void set_mtrr_ops(const struct mtrr_ops *ops); | 57 | extern void __init set_mtrr_ops(const struct mtrr_ops *ops); |
58 | 58 | ||
59 | extern u64 size_or_mask, size_and_mask; | 59 | extern u64 size_or_mask, size_and_mask; |
60 | extern const struct mtrr_ops *mtrr_if; | 60 | extern const struct mtrr_ops *mtrr_if; |
diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c index c2bedaea11f7..4afc67f5facc 100644 --- a/arch/x86/kernel/ksysfs.c +++ b/arch/x86/kernel/ksysfs.c | |||
@@ -184,7 +184,7 @@ out: | |||
184 | 184 | ||
185 | static struct kobj_attribute type_attr = __ATTR_RO(type); | 185 | static struct kobj_attribute type_attr = __ATTR_RO(type); |
186 | 186 | ||
187 | static struct bin_attribute data_attr = { | 187 | static struct bin_attribute data_attr __ro_after_init = { |
188 | .attr = { | 188 | .attr = { |
189 | .name = "data", | 189 | .name = "data", |
190 | .mode = S_IRUGO, | 190 | .mode = S_IRUGO, |
diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c index 1d39bfbd26bb..0964399ef942 100644 --- a/arch/x86/kernel/kvmclock.c +++ b/arch/x86/kernel/kvmclock.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <asm/x86_init.h> | 29 | #include <asm/x86_init.h> |
30 | #include <asm/reboot.h> | 30 | #include <asm/reboot.h> |
31 | 31 | ||
32 | static int kvmclock = 1; | 32 | static int kvmclock __ro_after_init = 1; |
33 | static int msr_kvm_system_time = MSR_KVM_SYSTEM_TIME; | 33 | static int msr_kvm_system_time = MSR_KVM_SYSTEM_TIME; |
34 | static int msr_kvm_wall_clock = MSR_KVM_WALL_CLOCK; | 34 | static int msr_kvm_wall_clock = MSR_KVM_WALL_CLOCK; |
35 | static cycle_t kvm_sched_clock_offset; | 35 | static cycle_t kvm_sched_clock_offset; |
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index ad5bc9578a73..b8e4680a2e0b 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c | |||
@@ -389,7 +389,7 @@ NOKPROBE_SYMBOL(native_load_idt); | |||
389 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_64) | 389 | #define PTE_IDENT __PV_IS_CALLEE_SAVE(_paravirt_ident_64) |
390 | #endif | 390 | #endif |
391 | 391 | ||
392 | struct pv_mmu_ops pv_mmu_ops = { | 392 | struct pv_mmu_ops pv_mmu_ops __ro_after_init = { |
393 | 393 | ||
394 | .read_cr2 = native_read_cr2, | 394 | .read_cr2 = native_read_cr2, |
395 | .write_cr2 = native_write_cr2, | 395 | .write_cr2 = native_write_cr2, |
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c index a1606eadd9ce..5b88a1b26fc7 100644 --- a/arch/x86/kernel/ptrace.c +++ b/arch/x86/kernel/ptrace.c | |||
@@ -1250,7 +1250,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
1250 | 1250 | ||
1251 | #ifdef CONFIG_X86_64 | 1251 | #ifdef CONFIG_X86_64 |
1252 | 1252 | ||
1253 | static struct user_regset x86_64_regsets[] __read_mostly = { | 1253 | static struct user_regset x86_64_regsets[] __ro_after_init = { |
1254 | [REGSET_GENERAL] = { | 1254 | [REGSET_GENERAL] = { |
1255 | .core_note_type = NT_PRSTATUS, | 1255 | .core_note_type = NT_PRSTATUS, |
1256 | .n = sizeof(struct user_regs_struct) / sizeof(long), | 1256 | .n = sizeof(struct user_regs_struct) / sizeof(long), |
@@ -1291,7 +1291,7 @@ static const struct user_regset_view user_x86_64_view = { | |||
1291 | #endif /* CONFIG_X86_64 */ | 1291 | #endif /* CONFIG_X86_64 */ |
1292 | 1292 | ||
1293 | #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION | 1293 | #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION |
1294 | static struct user_regset x86_32_regsets[] __read_mostly = { | 1294 | static struct user_regset x86_32_regsets[] __ro_after_init = { |
1295 | [REGSET_GENERAL] = { | 1295 | [REGSET_GENERAL] = { |
1296 | .core_note_type = NT_PRSTATUS, | 1296 | .core_note_type = NT_PRSTATUS, |
1297 | .n = sizeof(struct user_regs_struct32) / sizeof(u32), | 1297 | .n = sizeof(struct user_regs_struct32) / sizeof(u32), |
@@ -1344,7 +1344,7 @@ static const struct user_regset_view user_x86_32_view = { | |||
1344 | */ | 1344 | */ |
1345 | u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; | 1345 | u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; |
1346 | 1346 | ||
1347 | void update_regset_xstate_info(unsigned int size, u64 xstate_mask) | 1347 | void __init update_regset_xstate_info(unsigned int size, u64 xstate_mask) |
1348 | { | 1348 | { |
1349 | #ifdef CONFIG_X86_64 | 1349 | #ifdef CONFIG_X86_64 |
1350 | x86_64_regsets[REGSET_XSTATE].n = size / sizeof(u64); | 1350 | x86_64_regsets[REGSET_XSTATE].n = size / sizeof(u64); |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 63bf27d972b7..e244c19a2451 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -705,7 +705,7 @@ static void native_machine_power_off(void) | |||
705 | tboot_shutdown(TB_SHUTDOWN_HALT); | 705 | tboot_shutdown(TB_SHUTDOWN_HALT); |
706 | } | 706 | } |
707 | 707 | ||
708 | struct machine_ops machine_ops = { | 708 | struct machine_ops machine_ops __ro_after_init = { |
709 | .power_off = native_machine_power_off, | 709 | .power_off = native_machine_power_off, |
710 | .shutdown = native_machine_shutdown, | 710 | .shutdown = native_machine_shutdown, |
711 | .emergency_restart = native_machine_emergency_restart, | 711 | .emergency_restart = native_machine_emergency_restart, |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 0fa60f5f5a16..44c868ebc314 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -210,9 +210,9 @@ EXPORT_SYMBOL(boot_cpu_data); | |||
210 | 210 | ||
211 | 211 | ||
212 | #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64) | 212 | #if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64) |
213 | __visible unsigned long mmu_cr4_features; | 213 | __visible unsigned long mmu_cr4_features __ro_after_init; |
214 | #else | 214 | #else |
215 | __visible unsigned long mmu_cr4_features = X86_CR4_PAE; | 215 | __visible unsigned long mmu_cr4_features __ro_after_init = X86_CR4_PAE; |
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | /* Boot loader ID and version as integers, for the benefit of proc_dointvec */ | 218 | /* Boot loader ID and version as integers, for the benefit of proc_dointvec */ |
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c index d182799c4264..2bbd27f89802 100644 --- a/arch/x86/kernel/setup_percpu.c +++ b/arch/x86/kernel/setup_percpu.c | |||
@@ -33,7 +33,7 @@ EXPORT_PER_CPU_SYMBOL(cpu_number); | |||
33 | DEFINE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET; | 33 | DEFINE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off) = BOOT_PERCPU_OFFSET; |
34 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); | 34 | EXPORT_PER_CPU_SYMBOL(this_cpu_off); |
35 | 35 | ||
36 | unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = { | 36 | unsigned long __per_cpu_offset[NR_CPUS] __ro_after_init = { |
37 | [0 ... NR_CPUS-1] = BOOT_PERCPU_OFFSET, | 37 | [0 ... NR_CPUS-1] = BOOT_PERCPU_OFFSET, |
38 | }; | 38 | }; |
39 | EXPORT_SYMBOL(__per_cpu_offset); | 39 | EXPORT_SYMBOL(__per_cpu_offset); |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 76c5e52436c4..0bd9f1287f39 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -91,7 +91,7 @@ struct x86_cpuinit_ops x86_cpuinit = { | |||
91 | static void default_nmi_init(void) { }; | 91 | static void default_nmi_init(void) { }; |
92 | static int default_i8042_detect(void) { return 1; }; | 92 | static int default_i8042_detect(void) { return 1; }; |
93 | 93 | ||
94 | struct x86_platform_ops x86_platform = { | 94 | struct x86_platform_ops x86_platform __ro_after_init = { |
95 | .calibrate_cpu = native_calibrate_cpu, | 95 | .calibrate_cpu = native_calibrate_cpu, |
96 | .calibrate_tsc = native_calibrate_tsc, | 96 | .calibrate_tsc = native_calibrate_tsc, |
97 | .get_wallclock = mach_get_cmos_time, | 97 | .get_wallclock = mach_get_cmos_time, |
@@ -108,7 +108,7 @@ struct x86_platform_ops x86_platform = { | |||
108 | EXPORT_SYMBOL_GPL(x86_platform); | 108 | EXPORT_SYMBOL_GPL(x86_platform); |
109 | 109 | ||
110 | #if defined(CONFIG_PCI_MSI) | 110 | #if defined(CONFIG_PCI_MSI) |
111 | struct x86_msi_ops x86_msi = { | 111 | struct x86_msi_ops x86_msi __ro_after_init = { |
112 | .setup_msi_irqs = native_setup_msi_irqs, | 112 | .setup_msi_irqs = native_setup_msi_irqs, |
113 | .teardown_msi_irq = native_teardown_msi_irq, | 113 | .teardown_msi_irq = native_teardown_msi_irq, |
114 | .teardown_msi_irqs = default_teardown_msi_irqs, | 114 | .teardown_msi_irqs = default_teardown_msi_irqs, |
@@ -137,7 +137,7 @@ void arch_restore_msi_irqs(struct pci_dev *dev) | |||
137 | } | 137 | } |
138 | #endif | 138 | #endif |
139 | 139 | ||
140 | struct x86_io_apic_ops x86_io_apic_ops = { | 140 | struct x86_io_apic_ops x86_io_apic_ops __ro_after_init = { |
141 | .read = native_io_apic_read, | 141 | .read = native_io_apic_read, |
142 | .disable = native_disable_io_apic, | 142 | .disable = native_disable_io_apic, |
143 | }; | 143 | }; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index af523d84d102..1e6b84b96ea6 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -4961,7 +4961,7 @@ static inline void avic_post_state_restore(struct kvm_vcpu *vcpu) | |||
4961 | avic_handle_ldr_update(vcpu); | 4961 | avic_handle_ldr_update(vcpu); |
4962 | } | 4962 | } |
4963 | 4963 | ||
4964 | static struct kvm_x86_ops svm_x86_ops = { | 4964 | static struct kvm_x86_ops svm_x86_ops __ro_after_init = { |
4965 | .cpu_has_kvm_support = has_svm, | 4965 | .cpu_has_kvm_support = has_svm, |
4966 | .disabled_by_bios = is_disabled, | 4966 | .disabled_by_bios = is_disabled, |
4967 | .hardware_setup = svm_hardware_setup, | 4967 | .hardware_setup = svm_hardware_setup, |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a45d8580f91e..87eaa6bfc26a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -11175,7 +11175,7 @@ static void vmx_setup_mce(struct kvm_vcpu *vcpu) | |||
11175 | ~FEATURE_CONTROL_LMCE; | 11175 | ~FEATURE_CONTROL_LMCE; |
11176 | } | 11176 | } |
11177 | 11177 | ||
11178 | static struct kvm_x86_ops vmx_x86_ops = { | 11178 | static struct kvm_x86_ops vmx_x86_ops __ro_after_init = { |
11179 | .cpu_has_kvm_support = cpu_has_kvm_support, | 11179 | .cpu_has_kvm_support = cpu_has_kvm_support, |
11180 | .disabled_by_bios = vmx_disabled_by_bios, | 11180 | .disabled_by_bios = vmx_disabled_by_bios, |
11181 | .hardware_setup = hardware_setup, | 11181 | .hardware_setup = hardware_setup, |
diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c index ec8654f117d8..aec03aa96312 100644 --- a/arch/x86/mm/kaslr.c +++ b/arch/x86/mm/kaslr.c | |||
@@ -40,17 +40,26 @@ | |||
40 | * You need to add an if/def entry if you introduce a new memory region | 40 | * You need to add an if/def entry if you introduce a new memory region |
41 | * compatible with KASLR. Your entry must be in logical order with memory | 41 | * compatible with KASLR. Your entry must be in logical order with memory |
42 | * layout. For example, ESPFIX is before EFI because its virtual address is | 42 | * layout. For example, ESPFIX is before EFI because its virtual address is |
43 | * before. You also need to add a BUILD_BUG_ON in kernel_randomize_memory to | 43 | * before. You also need to add a BUILD_BUG_ON() in kernel_randomize_memory() to |
44 | * ensure that this order is correct and won't be changed. | 44 | * ensure that this order is correct and won't be changed. |
45 | */ | 45 | */ |
46 | static const unsigned long vaddr_start = __PAGE_OFFSET_BASE; | 46 | static const unsigned long vaddr_start = __PAGE_OFFSET_BASE; |
47 | static const unsigned long vaddr_end = VMEMMAP_START; | 47 | |
48 | #if defined(CONFIG_X86_ESPFIX64) | ||
49 | static const unsigned long vaddr_end = ESPFIX_BASE_ADDR; | ||
50 | #elif defined(CONFIG_EFI) | ||
51 | static const unsigned long vaddr_end = EFI_VA_START; | ||
52 | #else | ||
53 | static const unsigned long vaddr_end = __START_KERNEL_map; | ||
54 | #endif | ||
48 | 55 | ||
49 | /* Default values */ | 56 | /* Default values */ |
50 | unsigned long page_offset_base = __PAGE_OFFSET_BASE; | 57 | unsigned long page_offset_base = __PAGE_OFFSET_BASE; |
51 | EXPORT_SYMBOL(page_offset_base); | 58 | EXPORT_SYMBOL(page_offset_base); |
52 | unsigned long vmalloc_base = __VMALLOC_BASE; | 59 | unsigned long vmalloc_base = __VMALLOC_BASE; |
53 | EXPORT_SYMBOL(vmalloc_base); | 60 | EXPORT_SYMBOL(vmalloc_base); |
61 | unsigned long vmemmap_base = __VMEMMAP_BASE; | ||
62 | EXPORT_SYMBOL(vmemmap_base); | ||
54 | 63 | ||
55 | /* | 64 | /* |
56 | * Memory regions randomized by KASLR (except modules that use a separate logic | 65 | * Memory regions randomized by KASLR (except modules that use a separate logic |
@@ -63,6 +72,7 @@ static __initdata struct kaslr_memory_region { | |||
63 | } kaslr_regions[] = { | 72 | } kaslr_regions[] = { |
64 | { &page_offset_base, 64/* Maximum */ }, | 73 | { &page_offset_base, 64/* Maximum */ }, |
65 | { &vmalloc_base, VMALLOC_SIZE_TB }, | 74 | { &vmalloc_base, VMALLOC_SIZE_TB }, |
75 | { &vmemmap_base, 1 }, | ||
66 | }; | 76 | }; |
67 | 77 | ||
68 | /* Get size in bytes used by the memory region */ | 78 | /* Get size in bytes used by the memory region */ |
@@ -89,6 +99,18 @@ void __init kernel_randomize_memory(void) | |||
89 | struct rnd_state rand_state; | 99 | struct rnd_state rand_state; |
90 | unsigned long remain_entropy; | 100 | unsigned long remain_entropy; |
91 | 101 | ||
102 | /* | ||
103 | * All these BUILD_BUG_ON checks ensures the memory layout is | ||
104 | * consistent with the vaddr_start/vaddr_end variables. | ||
105 | */ | ||
106 | BUILD_BUG_ON(vaddr_start >= vaddr_end); | ||
107 | BUILD_BUG_ON(config_enabled(CONFIG_X86_ESPFIX64) && | ||
108 | vaddr_end >= EFI_VA_START); | ||
109 | BUILD_BUG_ON((config_enabled(CONFIG_X86_ESPFIX64) || | ||
110 | config_enabled(CONFIG_EFI)) && | ||
111 | vaddr_end >= __START_KERNEL_map); | ||
112 | BUILD_BUG_ON(vaddr_end > __START_KERNEL_map); | ||
113 | |||
92 | if (!kaslr_memory_enabled()) | 114 | if (!kaslr_memory_enabled()) |
93 | return; | 115 | return; |
94 | 116 | ||
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c index 9770e55e768f..1d97cea3b3a4 100644 --- a/arch/x86/pci/pcbios.c +++ b/arch/x86/pci/pcbios.c | |||
@@ -120,9 +120,12 @@ static unsigned long __init bios32_service(unsigned long service) | |||
120 | static struct { | 120 | static struct { |
121 | unsigned long address; | 121 | unsigned long address; |
122 | unsigned short segment; | 122 | unsigned short segment; |
123 | } pci_indirect = { 0, __KERNEL_CS }; | 123 | } pci_indirect __ro_after_init = { |
124 | .address = 0, | ||
125 | .segment = __KERNEL_CS, | ||
126 | }; | ||
124 | 127 | ||
125 | static int pci_bios_present; | 128 | static int pci_bios_present __ro_after_init; |
126 | 129 | ||
127 | static int __init check_pcibios(void) | 130 | static int __init check_pcibios(void) |
128 | { | 131 | { |