aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/efi.c12
-rw-r--r--arch/x86/kernel/efi_64.c32
-rw-r--r--arch/x86/kernel/i8253.c2
-rw-r--r--arch/x86/kernel/reboot.c46
-rw-r--r--arch/x86/mm/ioremap.c4
-rw-r--r--arch/x86/mm/pageattr.c4
-rw-r--r--arch/x86/xen/enlighten.c4
-rw-r--r--drivers/acpi/wmi.c2
-rw-r--r--drivers/md/dm-raid1.c2
-rw-r--r--drivers/memstick/host/tifm_ms.c2
-rw-r--r--include/asm-x86/sigcontext.h66
-rw-r--r--kernel/timeconst.pl2
12 files changed, 134 insertions, 44 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 32dd62b36ff7..cbdf9bacc575 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -384,9 +384,6 @@ static void __init runtime_code_page_mkexec(void)
384 efi_memory_desc_t *md; 384 efi_memory_desc_t *md;
385 void *p; 385 void *p;
386 386
387 if (!(__supported_pte_mask & _PAGE_NX))
388 return;
389
390 /* Make EFI runtime service code area executable */ 387 /* Make EFI runtime service code area executable */
391 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 388 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
392 md = p; 389 md = p;
@@ -428,9 +425,6 @@ void __init efi_enter_virtual_mode(void)
428 else 425 else
429 va = efi_ioremap(md->phys_addr, size); 426 va = efi_ioremap(md->phys_addr, size);
430 427
431 if (md->attribute & EFI_MEMORY_WB)
432 set_memory_uc(md->virt_addr, size);
433
434 md->virt_addr = (u64) (unsigned long) va; 428 md->virt_addr = (u64) (unsigned long) va;
435 429
436 if (!va) { 430 if (!va) {
@@ -439,6 +433,9 @@ void __init efi_enter_virtual_mode(void)
439 continue; 433 continue;
440 } 434 }
441 435
436 if (!(md->attribute & EFI_MEMORY_WB))
437 set_memory_uc(md->virt_addr, size);
438
442 systab = (u64) (unsigned long) efi_phys.systab; 439 systab = (u64) (unsigned long) efi_phys.systab;
443 if (md->phys_addr <= systab && systab < end) { 440 if (md->phys_addr <= systab && systab < end) {
444 systab += md->virt_addr - md->phys_addr; 441 systab += md->virt_addr - md->phys_addr;
@@ -476,7 +473,8 @@ void __init efi_enter_virtual_mode(void)
476 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count; 473 efi.get_next_high_mono_count = virt_efi_get_next_high_mono_count;
477 efi.reset_system = virt_efi_reset_system; 474 efi.reset_system = virt_efi_reset_system;
478 efi.set_virtual_address_map = virt_efi_set_virtual_address_map; 475 efi.set_virtual_address_map = virt_efi_set_virtual_address_map;
479 runtime_code_page_mkexec(); 476 if (__supported_pte_mask & _PAGE_NX)
477 runtime_code_page_mkexec();
480 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size); 478 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
481 memmap.map = NULL; 479 memmap.map = NULL;
482} 480}
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 09d5c2330934..d143a1e76b30 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -35,6 +35,7 @@
35#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
36#include <asm/proto.h> 36#include <asm/proto.h>
37#include <asm/efi.h> 37#include <asm/efi.h>
38#include <asm/cacheflush.h>
38 39
39static pgd_t save_pgd __initdata; 40static pgd_t save_pgd __initdata;
40static unsigned long efi_flags __initdata; 41static unsigned long efi_flags __initdata;
@@ -43,22 +44,15 @@ static void __init early_mapping_set_exec(unsigned long start,
43 unsigned long end, 44 unsigned long end,
44 int executable) 45 int executable)
45{ 46{
46 pte_t *kpte; 47 unsigned long num_pages;
47 unsigned int level; 48
48 49 start &= PMD_MASK;
49 while (start < end) { 50 end = (end + PMD_SIZE - 1) & PMD_MASK;
50 kpte = lookup_address((unsigned long)__va(start), &level); 51 num_pages = (end - start) >> PAGE_SHIFT;
51 BUG_ON(!kpte); 52 if (executable)
52 if (executable) 53 set_memory_x((unsigned long)__va(start), num_pages);
53 set_pte(kpte, pte_mkexec(*kpte)); 54 else
54 else 55 set_memory_nx((unsigned long)__va(start), num_pages);
55 set_pte(kpte, __pte((pte_val(*kpte) | _PAGE_NX) & \
56 __supported_pte_mask));
57 if (level == PG_LEVEL_4K)
58 start = (start + PAGE_SIZE) & PAGE_MASK;
59 else
60 start = (start + PMD_SIZE) & PMD_MASK;
61 }
62} 56}
63 57
64static void __init early_runtime_code_mapping_set_exec(int executable) 58static void __init early_runtime_code_mapping_set_exec(int executable)
@@ -74,7 +68,7 @@ static void __init early_runtime_code_mapping_set_exec(int executable)
74 md = p; 68 md = p;
75 if (md->type == EFI_RUNTIME_SERVICES_CODE) { 69 if (md->type == EFI_RUNTIME_SERVICES_CODE) {
76 unsigned long end; 70 unsigned long end;
77 end = md->phys_addr + (md->num_pages << PAGE_SHIFT); 71 end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
78 early_mapping_set_exec(md->phys_addr, end, executable); 72 early_mapping_set_exec(md->phys_addr, end, executable);
79 } 73 }
80 } 74 }
@@ -84,8 +78,8 @@ void __init efi_call_phys_prelog(void)
84{ 78{
85 unsigned long vaddress; 79 unsigned long vaddress;
86 80
87 local_irq_save(efi_flags);
88 early_runtime_code_mapping_set_exec(1); 81 early_runtime_code_mapping_set_exec(1);
82 local_irq_save(efi_flags);
89 vaddress = (unsigned long)__va(0x0UL); 83 vaddress = (unsigned long)__va(0x0UL);
90 save_pgd = *pgd_offset_k(0x0UL); 84 save_pgd = *pgd_offset_k(0x0UL);
91 set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress)); 85 set_pgd(pgd_offset_k(0x0UL), *pgd_offset_k(vaddress));
@@ -98,9 +92,9 @@ void __init efi_call_phys_epilog(void)
98 * After the lock is released, the original page table is restored. 92 * After the lock is released, the original page table is restored.
99 */ 93 */
100 set_pgd(pgd_offset_k(0x0UL), save_pgd); 94 set_pgd(pgd_offset_k(0x0UL), save_pgd);
101 early_runtime_code_mapping_set_exec(0);
102 __flush_tlb_all(); 95 __flush_tlb_all();
103 local_irq_restore(efi_flags); 96 local_irq_restore(efi_flags);
97 early_runtime_code_mapping_set_exec(0);
104} 98}
105 99
106void __init efi_reserve_bootmem(void) 100void __init efi_reserve_bootmem(void)
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index ef62b07b2b48..8540abe86ade 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -95,7 +95,7 @@ static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
95 * registered. This mechanism replaces the previous #ifdef LOCAL_APIC - 95 * registered. This mechanism replaces the previous #ifdef LOCAL_APIC -
96 * !using_apic_timer decisions in do_timer_interrupt_hook() 96 * !using_apic_timer decisions in do_timer_interrupt_hook()
97 */ 97 */
98struct clock_event_device pit_clockevent = { 98static struct clock_event_device pit_clockevent = {
99 .name = "pit", 99 .name = "pit",
100 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 100 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
101 .set_mode = init_pit_timer, 101 .set_mode = init_pit_timer,
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 5818dc28167d..7fd6ac43e4a1 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -326,7 +326,7 @@ static inline void kb_wait(void)
326 } 326 }
327} 327}
328 328
329void machine_emergency_restart(void) 329static void native_machine_emergency_restart(void)
330{ 330{
331 int i; 331 int i;
332 332
@@ -376,7 +376,7 @@ void machine_emergency_restart(void)
376 } 376 }
377} 377}
378 378
379void machine_shutdown(void) 379static void native_machine_shutdown(void)
380{ 380{
381 /* Stop the cpus and apics */ 381 /* Stop the cpus and apics */
382#ifdef CONFIG_SMP 382#ifdef CONFIG_SMP
@@ -420,7 +420,7 @@ void machine_shutdown(void)
420#endif 420#endif
421} 421}
422 422
423void machine_restart(char *__unused) 423static void native_machine_restart(char *__unused)
424{ 424{
425 printk("machine restart\n"); 425 printk("machine restart\n");
426 426
@@ -429,11 +429,11 @@ void machine_restart(char *__unused)
429 machine_emergency_restart(); 429 machine_emergency_restart();
430} 430}
431 431
432void machine_halt(void) 432static void native_machine_halt(void)
433{ 433{
434} 434}
435 435
436void machine_power_off(void) 436static void native_machine_power_off(void)
437{ 437{
438 if (pm_power_off) { 438 if (pm_power_off) {
439 if (!reboot_force) 439 if (!reboot_force)
@@ -443,9 +443,35 @@ void machine_power_off(void)
443} 443}
444 444
445struct machine_ops machine_ops = { 445struct machine_ops machine_ops = {
446 .power_off = machine_power_off, 446 .power_off = native_machine_power_off,
447 .shutdown = machine_shutdown, 447 .shutdown = native_machine_shutdown,
448 .emergency_restart = machine_emergency_restart, 448 .emergency_restart = native_machine_emergency_restart,
449 .restart = machine_restart, 449 .restart = native_machine_restart,
450 .halt = machine_halt 450 .halt = native_machine_halt
451}; 451};
452
453void machine_power_off(void)
454{
455 machine_ops.power_off();
456}
457
458void machine_shutdown(void)
459{
460 machine_ops.shutdown();
461}
462
463void machine_emergency_restart(void)
464{
465 machine_ops.emergency_restart();
466}
467
468void machine_restart(char *cmd)
469{
470 machine_ops.restart(cmd);
471}
472
473void machine_halt(void)
474{
475 machine_ops.halt();
476}
477
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index a4897a85268a..9f42d7e9c158 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -265,7 +265,9 @@ static __initdata pte_t bm_pte[PAGE_SIZE/sizeof(pte_t)]
265 265
266static inline pmd_t * __init early_ioremap_pmd(unsigned long addr) 266static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
267{ 267{
268 pgd_t *pgd = &swapper_pg_dir[pgd_index(addr)]; 268 /* Don't assume we're using swapper_pg_dir at this point */
269 pgd_t *base = __va(read_cr3());
270 pgd_t *pgd = &base[pgd_index(addr)];
269 pud_t *pud = pud_offset(pgd, addr); 271 pud_t *pud = pud_offset(pgd, addr);
270 pmd_t *pmd = pmd_offset(pud, addr); 272 pmd_t *pmd = pmd_offset(pud, addr);
271 273
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 440210a2277d..bd61ed13f9cf 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -275,8 +275,8 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
275 break; 275 break;
276#ifdef CONFIG_X86_64 276#ifdef CONFIG_X86_64
277 case PG_LEVEL_1G: 277 case PG_LEVEL_1G:
278 psize = PMD_PAGE_SIZE; 278 psize = PUD_PAGE_SIZE;
279 pmask = PMD_PAGE_MASK; 279 pmask = PUD_PAGE_MASK;
280 break; 280 break;
281#endif 281#endif
282 default: 282 default:
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index de647bc6e74d..49e5358f481a 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -798,6 +798,10 @@ static __init void xen_pagetable_setup_start(pgd_t *base)
798 * added to the table can be prepared properly for Xen. 798 * added to the table can be prepared properly for Xen.
799 */ 799 */
800 xen_write_cr3(__pa(base)); 800 xen_write_cr3(__pa(base));
801
802 /* Unpin initial Xen pagetable */
803 pin_pagetable_pfn(MMUEXT_UNPIN_TABLE,
804 PFN_DOWN(__pa(xen_start_info->pt_base)));
801} 805}
802 806
803static __init void xen_pagetable_setup_done(pgd_t *base) 807static __init void xen_pagetable_setup_done(pgd_t *base)
diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c
index 457ed3d3f51c..efacc9f8bfe3 100644
--- a/drivers/acpi/wmi.c
+++ b/drivers/acpi/wmi.c
@@ -247,7 +247,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
247 block = &wblock->gblock; 247 block = &wblock->gblock;
248 handle = wblock->handle; 248 handle = wblock->handle;
249 249
250 if (!block->flags & ACPI_WMI_METHOD) 250 if (!(block->flags & ACPI_WMI_METHOD))
251 return AE_BAD_DATA; 251 return AE_BAD_DATA;
252 252
253 if (block->instance_count < instance) 253 if (block->instance_count < instance)
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index edc057f5cdcc..2928ef228101 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -124,7 +124,7 @@ enum dm_raid1_error {
124struct mirror { 124struct mirror {
125 struct mirror_set *ms; 125 struct mirror_set *ms;
126 atomic_t error_count; 126 atomic_t error_count;
127 uint32_t error_type; 127 unsigned long error_type;
128 struct dm_dev *dev; 128 struct dm_dev *dev;
129 sector_t offset; 129 sector_t offset;
130}; 130};
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index f55b71a4337d..4fb24215bd95 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -282,7 +282,7 @@ static int tifm_ms_issue_cmd(struct tifm_ms *host)
282 282
283 writel(TIFM_MS_SYS_LATCH 283 writel(TIFM_MS_SYS_LATCH
284 | readl(sock->addr + SOCK_MS_SYSTEM), 284 | readl(sock->addr + SOCK_MS_SYSTEM),
285 sock + SOCK_MS_SYSTEM); 285 sock->addr + SOCK_MS_SYSTEM);
286 writel(0, sock->addr + SOCK_MS_DATA); 286 writel(0, sock->addr + SOCK_MS_DATA);
287 dev_dbg(&sock->dev, "writing %x\n", 0); 287 dev_dbg(&sock->dev, "writing %x\n", 0);
288 288
diff --git a/include/asm-x86/sigcontext.h b/include/asm-x86/sigcontext.h
index 681deade5f00..d743947f4c77 100644
--- a/include/asm-x86/sigcontext.h
+++ b/include/asm-x86/sigcontext.h
@@ -58,6 +58,7 @@ struct _fpstate {
58 58
59#define X86_FXSR_MAGIC 0x0000 59#define X86_FXSR_MAGIC 0x0000
60 60
61#ifdef __KERNEL__
61struct sigcontext { 62struct sigcontext {
62 unsigned short gs, __gsh; 63 unsigned short gs, __gsh;
63 unsigned short fs, __fsh; 64 unsigned short fs, __fsh;
@@ -82,6 +83,35 @@ struct sigcontext {
82 unsigned long oldmask; 83 unsigned long oldmask;
83 unsigned long cr2; 84 unsigned long cr2;
84}; 85};
86#else /* __KERNEL__ */
87/*
88 * User-space might still rely on the old definition:
89 */
90struct sigcontext {
91 unsigned short gs, __gsh;
92 unsigned short fs, __fsh;
93 unsigned short es, __esh;
94 unsigned short ds, __dsh;
95 unsigned long edi;
96 unsigned long esi;
97 unsigned long ebp;
98 unsigned long esp;
99 unsigned long ebx;
100 unsigned long edx;
101 unsigned long ecx;
102 unsigned long eax;
103 unsigned long trapno;
104 unsigned long err;
105 unsigned long eip;
106 unsigned short cs, __csh;
107 unsigned long eflags;
108 unsigned long esp_at_signal;
109 unsigned short ss, __ssh;
110 struct _fpstate __user * fpstate;
111 unsigned long oldmask;
112 unsigned long cr2;
113};
114#endif /* !__KERNEL__ */
85 115
86#else /* __i386__ */ 116#else /* __i386__ */
87 117
@@ -102,6 +132,7 @@ struct _fpstate {
102 __u32 reserved2[24]; 132 __u32 reserved2[24];
103}; 133};
104 134
135#ifdef __KERNEL__
105struct sigcontext { 136struct sigcontext {
106 unsigned long r8; 137 unsigned long r8;
107 unsigned long r9; 138 unsigned long r9;
@@ -132,6 +163,41 @@ struct sigcontext {
132 struct _fpstate __user *fpstate; /* zero when no FPU context */ 163 struct _fpstate __user *fpstate; /* zero when no FPU context */
133 unsigned long reserved1[8]; 164 unsigned long reserved1[8];
134}; 165};
166#else /* __KERNEL__ */
167/*
168 * User-space might still rely on the old definition:
169 */
170struct sigcontext {
171 unsigned long r8;
172 unsigned long r9;
173 unsigned long r10;
174 unsigned long r11;
175 unsigned long r12;
176 unsigned long r13;
177 unsigned long r14;
178 unsigned long r15;
179 unsigned long rdi;
180 unsigned long rsi;
181 unsigned long rbp;
182 unsigned long rbx;
183 unsigned long rdx;
184 unsigned long rax;
185 unsigned long rcx;
186 unsigned long rsp;
187 unsigned long rip;
188 unsigned long eflags; /* RFLAGS */
189 unsigned short cs;
190 unsigned short gs;
191 unsigned short fs;
192 unsigned short __pad0;
193 unsigned long err;
194 unsigned long trapno;
195 unsigned long oldmask;
196 unsigned long cr2;
197 struct _fpstate __user *fpstate; /* zero when no FPU context */
198 unsigned long reserved1[8];
199};
200#endif /* !__KERNEL__ */
135 201
136#endif /* !__i386__ */ 202#endif /* !__i386__ */
137 203
diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
index 62b1287932ed..41468035473c 100644
--- a/kernel/timeconst.pl
+++ b/kernel/timeconst.pl
@@ -339,7 +339,7 @@ sub output($@)
339 print "\n"; 339 print "\n";
340 340
341 foreach $pfx ('HZ_TO_MSEC','MSEC_TO_HZ', 341 foreach $pfx ('HZ_TO_MSEC','MSEC_TO_HZ',
342 'USEC_TO_HZ','HZ_TO_USEC') { 342 'HZ_TO_USEC','USEC_TO_HZ') {
343 foreach $bit (32, 64) { 343 foreach $bit (32, 64) {
344 foreach $suf ('MUL', 'ADJ', 'SHR') { 344 foreach $suf ('MUL', 'ADJ', 'SHR') {
345 printf "#define %-23s %s\n", 345 printf "#define %-23s %s\n",