aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ppc64/kernel')
-rw-r--r--arch/ppc64/kernel/HvLpEvent.c2
-rw-r--r--arch/ppc64/kernel/nvram.c17
-rw-r--r--arch/ppc64/kernel/pSeries_hvCall.S8
-rw-r--r--arch/ppc64/kernel/prom.c4
-rw-r--r--arch/ppc64/kernel/prom_init.c115
-rw-r--r--arch/ppc64/kernel/ptrace.c5
-rw-r--r--arch/ppc64/kernel/ptrace32.c5
-rw-r--r--arch/ppc64/kernel/signal32.c4
-rw-r--r--arch/ppc64/kernel/smp.c12
-rw-r--r--arch/ppc64/kernel/time.c12
-rw-r--r--arch/ppc64/kernel/vdso32/Makefile2
-rw-r--r--arch/ppc64/kernel/vdso32/note.S25
-rw-r--r--arch/ppc64/kernel/vdso32/vdso32.lds.S3
-rw-r--r--arch/ppc64/kernel/vdso64/Makefile2
-rw-r--r--arch/ppc64/kernel/vdso64/note.S1
-rw-r--r--arch/ppc64/kernel/vdso64/vdso64.lds.S5
16 files changed, 190 insertions, 32 deletions
diff --git a/arch/ppc64/kernel/HvLpEvent.c b/arch/ppc64/kernel/HvLpEvent.c
index 9802beefa217..f8f19637f73f 100644
--- a/arch/ppc64/kernel/HvLpEvent.c
+++ b/arch/ppc64/kernel/HvLpEvent.c
@@ -45,7 +45,7 @@ int HvLpEvent_unregisterHandler( HvLpEvent_Type eventType )
45 /* We now sleep until all other CPUs have scheduled. This ensures that 45 /* We now sleep until all other CPUs have scheduled. This ensures that
46 * the deletion is seen by all other CPUs, and that the deleted handler 46 * the deletion is seen by all other CPUs, and that the deleted handler
47 * isn't still running on another CPU when we return. */ 47 * isn't still running on another CPU when we return. */
48 synchronize_kernel(); 48 synchronize_rcu();
49 } 49 }
50 } 50 }
51 return rc; 51 return rc;
diff --git a/arch/ppc64/kernel/nvram.c b/arch/ppc64/kernel/nvram.c
index b9069c2d1933..4e71781a4414 100644
--- a/arch/ppc64/kernel/nvram.c
+++ b/arch/ppc64/kernel/nvram.c
@@ -339,9 +339,9 @@ static int nvram_remove_os_partition(void)
339static int nvram_create_os_partition(void) 339static int nvram_create_os_partition(void)
340{ 340{
341 struct list_head * p; 341 struct list_head * p;
342 struct nvram_partition * part; 342 struct nvram_partition *part = NULL;
343 struct nvram_partition * new_part = NULL; 343 struct nvram_partition *new_part = NULL;
344 struct nvram_partition * free_part = NULL; 344 struct nvram_partition *free_part = NULL;
345 int seq_init[2] = { 0, 0 }; 345 int seq_init[2] = { 0, 0 };
346 loff_t tmp_index; 346 loff_t tmp_index;
347 long size = 0; 347 long size = 0;
@@ -364,13 +364,11 @@ static int nvram_create_os_partition(void)
364 free_part = part; 364 free_part = part;
365 } 365 }
366 } 366 }
367 if (!size) { 367 if (!size)
368 return -ENOSPC; 368 return -ENOSPC;
369 }
370 369
371 /* Create our OS partition */ 370 /* Create our OS partition */
372 new_part = (struct nvram_partition *) 371 new_part = kmalloc(sizeof(*new_part), GFP_KERNEL);
373 kmalloc(sizeof(struct nvram_partition), GFP_KERNEL);
374 if (!new_part) { 372 if (!new_part) {
375 printk(KERN_ERR "nvram_create_os_partition: kmalloc failed\n"); 373 printk(KERN_ERR "nvram_create_os_partition: kmalloc failed\n");
376 return -ENOMEM; 374 return -ENOMEM;
@@ -379,7 +377,7 @@ static int nvram_create_os_partition(void)
379 new_part->index = free_part->index; 377 new_part->index = free_part->index;
380 new_part->header.signature = NVRAM_SIG_OS; 378 new_part->header.signature = NVRAM_SIG_OS;
381 new_part->header.length = size; 379 new_part->header.length = size;
382 sprintf(new_part->header.name, "ppc64,linux"); 380 strcpy(new_part->header.name, "ppc64,linux");
383 new_part->header.checksum = nvram_checksum(&new_part->header); 381 new_part->header.checksum = nvram_checksum(&new_part->header);
384 382
385 rc = nvram_write_header(new_part); 383 rc = nvram_write_header(new_part);
@@ -394,7 +392,8 @@ static int nvram_create_os_partition(void)
394 tmp_index = new_part->index + NVRAM_HEADER_LEN; 392 tmp_index = new_part->index + NVRAM_HEADER_LEN;
395 rc = ppc_md.nvram_write((char *)&seq_init, sizeof(seq_init), &tmp_index); 393 rc = ppc_md.nvram_write((char *)&seq_init, sizeof(seq_init), &tmp_index);
396 if (rc <= 0) { 394 if (rc <= 0) {
397 printk(KERN_ERR "nvram_create_os_partition: nvram_write failed (%d)\n", rc); 395 printk(KERN_ERR "nvram_create_os_partition: nvram_write "
396 "failed (%d)\n", rc);
398 return rc; 397 return rc;
399 } 398 }
400 399
diff --git a/arch/ppc64/kernel/pSeries_hvCall.S b/arch/ppc64/kernel/pSeries_hvCall.S
index 0715d3038019..176e8da76466 100644
--- a/arch/ppc64/kernel/pSeries_hvCall.S
+++ b/arch/ppc64/kernel/pSeries_hvCall.S
@@ -28,6 +28,8 @@
28 unsigned long *out3); R10 28 unsigned long *out3); R10
29 */ 29 */
30_GLOBAL(plpar_hcall) 30_GLOBAL(plpar_hcall)
31 HMT_MEDIUM
32
31 mfcr r0 33 mfcr r0
32 34
33 std r8,STK_PARM(r8)(r1) /* Save out ptrs */ 35 std r8,STK_PARM(r8)(r1) /* Save out ptrs */
@@ -53,6 +55,8 @@ _GLOBAL(plpar_hcall)
53 55
54/* Simple interface with no output values (other than status) */ 56/* Simple interface with no output values (other than status) */
55_GLOBAL(plpar_hcall_norets) 57_GLOBAL(plpar_hcall_norets)
58 HMT_MEDIUM
59
56 mfcr r0 60 mfcr r0
57 stw r0,8(r1) 61 stw r0,8(r1)
58 62
@@ -75,6 +79,8 @@ _GLOBAL(plpar_hcall_norets)
75 unsigned long *out1); 120(R1) 79 unsigned long *out1); 120(R1)
76 */ 80 */
77_GLOBAL(plpar_hcall_8arg_2ret) 81_GLOBAL(plpar_hcall_8arg_2ret)
82 HMT_MEDIUM
83
78 mfcr r0 84 mfcr r0
79 ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ 85 ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */
80 stw r0,8(r1) 86 stw r0,8(r1)
@@ -99,6 +105,8 @@ _GLOBAL(plpar_hcall_8arg_2ret)
99 unsigned long *out4); 112(R1) 105 unsigned long *out4); 112(R1)
100 */ 106 */
101_GLOBAL(plpar_hcall_4out) 107_GLOBAL(plpar_hcall_4out)
108 HMT_MEDIUM
109
102 mfcr r0 110 mfcr r0
103 stw r0,8(r1) 111 stw r0,8(r1)
104 112
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index 45a4ad08fbc2..fe2946c58314 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -321,6 +321,10 @@ static int __devinit finish_node_interrupts(struct device_node *np,
321 char *name = get_property(ic->parent, "name", NULL); 321 char *name = get_property(ic->parent, "name", NULL);
322 if (name && !strcmp(name, "u3")) 322 if (name && !strcmp(name, "u3"))
323 np->intrs[intrcount].line += 128; 323 np->intrs[intrcount].line += 128;
324 else if (!(name && !strcmp(name, "mac-io")))
325 /* ignore other cascaded controllers, such as
326 the k2-sata-root */
327 break;
324 } 328 }
325 np->intrs[intrcount].sense = 1; 329 np->intrs[intrcount].sense = 1;
326 if (n > 1) 330 if (n > 1)
diff --git a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
index 8dffa9ae2623..35ec42de962e 100644
--- a/arch/ppc64/kernel/prom_init.c
+++ b/arch/ppc64/kernel/prom_init.c
@@ -493,6 +493,113 @@ static void __init early_cmdline_parse(void)
493} 493}
494 494
495/* 495/*
496 * To tell the firmware what our capabilities are, we have to pass
497 * it a fake 32-bit ELF header containing a couple of PT_NOTE sections
498 * that contain structures that contain the actual values.
499 */
500static struct fake_elf {
501 Elf32_Ehdr elfhdr;
502 Elf32_Phdr phdr[2];
503 struct chrpnote {
504 u32 namesz;
505 u32 descsz;
506 u32 type;
507 char name[8]; /* "PowerPC" */
508 struct chrpdesc {
509 u32 real_mode;
510 u32 real_base;
511 u32 real_size;
512 u32 virt_base;
513 u32 virt_size;
514 u32 load_base;
515 } chrpdesc;
516 } chrpnote;
517 struct rpanote {
518 u32 namesz;
519 u32 descsz;
520 u32 type;
521 char name[24]; /* "IBM,RPA-Client-Config" */
522 struct rpadesc {
523 u32 lpar_affinity;
524 u32 min_rmo_size;
525 u32 min_rmo_percent;
526 u32 max_pft_size;
527 u32 splpar;
528 u32 min_load;
529 u32 new_mem_def;
530 u32 ignore_me;
531 } rpadesc;
532 } rpanote;
533} fake_elf = {
534 .elfhdr = {
535 .e_ident = { 0x7f, 'E', 'L', 'F',
536 ELFCLASS32, ELFDATA2MSB, EV_CURRENT },
537 .e_type = ET_EXEC, /* yeah right */
538 .e_machine = EM_PPC,
539 .e_version = EV_CURRENT,
540 .e_phoff = offsetof(struct fake_elf, phdr),
541 .e_phentsize = sizeof(Elf32_Phdr),
542 .e_phnum = 2
543 },
544 .phdr = {
545 [0] = {
546 .p_type = PT_NOTE,
547 .p_offset = offsetof(struct fake_elf, chrpnote),
548 .p_filesz = sizeof(struct chrpnote)
549 }, [1] = {
550 .p_type = PT_NOTE,
551 .p_offset = offsetof(struct fake_elf, rpanote),
552 .p_filesz = sizeof(struct rpanote)
553 }
554 },
555 .chrpnote = {
556 .namesz = sizeof("PowerPC"),
557 .descsz = sizeof(struct chrpdesc),
558 .type = 0x1275,
559 .name = "PowerPC",
560 .chrpdesc = {
561 .real_mode = ~0U, /* ~0 means "don't care" */
562 .real_base = ~0U,
563 .real_size = ~0U,
564 .virt_base = ~0U,
565 .virt_size = ~0U,
566 .load_base = ~0U
567 },
568 },
569 .rpanote = {
570 .namesz = sizeof("IBM,RPA-Client-Config"),
571 .descsz = sizeof(struct rpadesc),
572 .type = 0x12759999,
573 .name = "IBM,RPA-Client-Config",
574 .rpadesc = {
575 .lpar_affinity = 0,
576 .min_rmo_size = 64, /* in megabytes */
577 .min_rmo_percent = 0,
578 .max_pft_size = 48, /* 2^48 bytes max PFT size */
579 .splpar = 1,
580 .min_load = ~0U,
581 .new_mem_def = 0
582 }
583 }
584};
585
586static void __init prom_send_capabilities(void)
587{
588 unsigned long offset = reloc_offset();
589 ihandle elfloader;
590 int ret;
591
592 elfloader = call_prom("open", 1, 1, ADDR("/packages/elf-loader"));
593 if (elfloader == 0) {
594 prom_printf("couldn't open /packages/elf-loader\n");
595 return;
596 }
597 ret = call_prom("call-method", 3, 1, ADDR("process-elf-header"),
598 elfloader, ADDR(&fake_elf));
599 call_prom("close", 1, 0, elfloader);
600}
601
602/*
496 * Memory allocation strategy... our layout is normally: 603 * Memory allocation strategy... our layout is normally:
497 * 604 *
498 * at 14Mb or more we vmlinux, then a gap and initrd. In some rare cases, initrd 605 * at 14Mb or more we vmlinux, then a gap and initrd. In some rare cases, initrd
@@ -1448,6 +1555,12 @@ static void __init scan_dt_build_strings(phandle node, unsigned long *mem_start,
1448 } 1555 }
1449} 1556}
1450 1557
1558/*
1559 * The Open Firmware 1275 specification states properties must be 31 bytes or
1560 * less, however not all firmwares obey this. Make it 64 bytes to be safe.
1561 */
1562#define MAX_PROPERTY_NAME 64
1563
1451static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start, 1564static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
1452 unsigned long *mem_end) 1565 unsigned long *mem_end)
1453{ 1566{
@@ -1457,7 +1570,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
1457 unsigned long soff; 1570 unsigned long soff;
1458 unsigned char *valp; 1571 unsigned char *valp;
1459 unsigned long offset = reloc_offset(); 1572 unsigned long offset = reloc_offset();
1460 char pname[32]; 1573 char pname[MAX_PROPERTY_NAME];
1461 char *path; 1574 char *path;
1462 1575
1463 path = RELOC(prom_scratch); 1576 path = RELOC(prom_scratch);
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c
index 3c76333ec3a9..9f8c6087ae56 100644
--- a/arch/ppc64/kernel/ptrace.c
+++ b/arch/ppc64/kernel/ptrace.c
@@ -28,6 +28,7 @@
28#include <linux/security.h> 28#include <linux/security.h>
29#include <linux/audit.h> 29#include <linux/audit.h>
30#include <linux/seccomp.h> 30#include <linux/seccomp.h>
31#include <linux/signal.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/page.h> 34#include <asm/page.h>
@@ -162,7 +163,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
162 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 163 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
163 case PTRACE_CONT: { /* restart after signal. */ 164 case PTRACE_CONT: { /* restart after signal. */
164 ret = -EIO; 165 ret = -EIO;
165 if ((unsigned long) data > _NSIG) 166 if (!valid_signal(data))
166 break; 167 break;
167 if (request == PTRACE_SYSCALL) 168 if (request == PTRACE_SYSCALL)
168 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 169 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
@@ -194,7 +195,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
194 195
195 case PTRACE_SINGLESTEP: { /* set the trap flag. */ 196 case PTRACE_SINGLESTEP: { /* set the trap flag. */
196 ret = -EIO; 197 ret = -EIO;
197 if ((unsigned long) data > _NSIG) 198 if (!valid_signal(data))
198 break; 199 break;
199 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 200 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
200 set_single_step(child); 201 set_single_step(child);
diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c
index ee81b1b776cc..16436426c7e2 100644
--- a/arch/ppc64/kernel/ptrace32.c
+++ b/arch/ppc64/kernel/ptrace32.c
@@ -26,6 +26,7 @@
26#include <linux/ptrace.h> 26#include <linux/ptrace.h>
27#include <linux/user.h> 27#include <linux/user.h>
28#include <linux/security.h> 28#include <linux/security.h>
29#include <linux/signal.h>
29 30
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31#include <asm/page.h> 32#include <asm/page.h>
@@ -293,7 +294,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
293 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ 294 case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
294 case PTRACE_CONT: { /* restart after signal. */ 295 case PTRACE_CONT: { /* restart after signal. */
295 ret = -EIO; 296 ret = -EIO;
296 if ((unsigned long) data > _NSIG) 297 if (!valid_signal(data))
297 break; 298 break;
298 if (request == PTRACE_SYSCALL) 299 if (request == PTRACE_SYSCALL)
299 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 300 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
@@ -325,7 +326,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
325 326
326 case PTRACE_SINGLESTEP: { /* set the trap flag. */ 327 case PTRACE_SINGLESTEP: { /* set the trap flag. */
327 ret = -EIO; 328 ret = -EIO;
328 if ((unsigned long) data > _NSIG) 329 if (!valid_signal(data))
329 break; 330 break;
330 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 331 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
331 set_single_step(child); 332 set_single_step(child);
diff --git a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
index b0e167db6af9..3c2fa5c284c0 100644
--- a/arch/ppc64/kernel/signal32.c
+++ b/arch/ppc64/kernel/signal32.c
@@ -657,7 +657,7 @@ static int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
657 657
658 /* Save user registers on the stack */ 658 /* Save user registers on the stack */
659 frame = &rt_sf->uc.uc_mcontext; 659 frame = &rt_sf->uc.uc_mcontext;
660 if (put_user(regs->gpr[1], (unsigned long __user *)newsp)) 660 if (put_user(regs->gpr[1], (u32 __user *)newsp))
661 goto badframe; 661 goto badframe;
662 662
663 if (vdso32_rt_sigtramp && current->thread.vdso_base) { 663 if (vdso32_rt_sigtramp && current->thread.vdso_base) {
@@ -842,7 +842,7 @@ static int handle_signal32(unsigned long sig, struct k_sigaction *ka,
842 regs->link = (unsigned long) frame->mctx.tramp; 842 regs->link = (unsigned long) frame->mctx.tramp;
843 } 843 }
844 844
845 if (put_user(regs->gpr[1], (unsigned long __user *)newsp)) 845 if (put_user(regs->gpr[1], (u32 __user *)newsp))
846 goto badframe; 846 goto badframe;
847 regs->gpr[1] = (unsigned long) newsp; 847 regs->gpr[1] = (unsigned long) newsp;
848 regs->gpr[3] = sig; 848 regs->gpr[3] = sig;
diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
index 1c92da3e4525..3b906cd94037 100644
--- a/arch/ppc64/kernel/smp.c
+++ b/arch/ppc64/kernel/smp.c
@@ -125,7 +125,7 @@ void __devinit smp_generic_kick_cpu(int nr)
125 * the processor will continue on to secondary_start 125 * the processor will continue on to secondary_start
126 */ 126 */
127 paca[nr].cpu_start = 1; 127 paca[nr].cpu_start = 1;
128 mb(); 128 smp_mb();
129} 129}
130 130
131#endif /* CONFIG_PPC_MULTIPLATFORM */ 131#endif /* CONFIG_PPC_MULTIPLATFORM */
@@ -256,7 +256,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
256 } 256 }
257 257
258 call_data = &data; 258 call_data = &data;
259 wmb(); 259 smp_wmb();
260 /* Send a message to all other CPUs and wait for them to respond */ 260 /* Send a message to all other CPUs and wait for them to respond */
261 smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_CALL_FUNCTION); 261 smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_CALL_FUNCTION);
262 262
@@ -431,7 +431,7 @@ int generic_cpu_enable(unsigned int cpu)
431 431
432 /* get the target out of it's holding state */ 432 /* get the target out of it's holding state */
433 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 433 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
434 wmb(); 434 smp_wmb();
435 435
436 while (!cpu_online(cpu)) 436 while (!cpu_online(cpu))
437 cpu_relax(); 437 cpu_relax();
@@ -447,7 +447,7 @@ void generic_cpu_die(unsigned int cpu)
447 int i; 447 int i;
448 448
449 for (i = 0; i < 100; i++) { 449 for (i = 0; i < 100; i++) {
450 rmb(); 450 smp_rmb();
451 if (per_cpu(cpu_state, cpu) == CPU_DEAD) 451 if (per_cpu(cpu_state, cpu) == CPU_DEAD)
452 return; 452 return;
453 msleep(100); 453 msleep(100);
@@ -463,7 +463,7 @@ void generic_mach_cpu_die(void)
463 cpu = smp_processor_id(); 463 cpu = smp_processor_id();
464 printk(KERN_DEBUG "CPU%d offline\n", cpu); 464 printk(KERN_DEBUG "CPU%d offline\n", cpu);
465 __get_cpu_var(cpu_state) = CPU_DEAD; 465 __get_cpu_var(cpu_state) = CPU_DEAD;
466 wmb(); 466 smp_wmb();
467 while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE) 467 while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
468 cpu_relax(); 468 cpu_relax();
469 469
@@ -515,7 +515,7 @@ int __devinit __cpu_up(unsigned int cpu)
515 * be written out to main store before we release 515 * be written out to main store before we release
516 * the processor. 516 * the processor.
517 */ 517 */
518 mb(); 518 smp_mb();
519 519
520 /* wake up cpus */ 520 /* wake up cpus */
521 DBG("smp: kicking cpu %d\n", cpu); 521 DBG("smp: kicking cpu %d\n", cpu);
diff --git a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
index 77ded5a363b6..772a465b49f9 100644
--- a/arch/ppc64/kernel/time.c
+++ b/arch/ppc64/kernel/time.c
@@ -221,15 +221,15 @@ static __inline__ void timer_recalc_offset(unsigned long cur_tb)
221 temp_varp->tb_to_xs = do_gtod.varp->tb_to_xs; 221 temp_varp->tb_to_xs = do_gtod.varp->tb_to_xs;
222 temp_varp->tb_orig_stamp = new_tb_orig_stamp; 222 temp_varp->tb_orig_stamp = new_tb_orig_stamp;
223 temp_varp->stamp_xsec = new_stamp_xsec; 223 temp_varp->stamp_xsec = new_stamp_xsec;
224 mb(); 224 smp_mb();
225 do_gtod.varp = temp_varp; 225 do_gtod.varp = temp_varp;
226 do_gtod.var_idx = temp_idx; 226 do_gtod.var_idx = temp_idx;
227 227
228 ++(systemcfg->tb_update_count); 228 ++(systemcfg->tb_update_count);
229 wmb(); 229 smp_wmb();
230 systemcfg->tb_orig_stamp = new_tb_orig_stamp; 230 systemcfg->tb_orig_stamp = new_tb_orig_stamp;
231 systemcfg->stamp_xsec = new_stamp_xsec; 231 systemcfg->stamp_xsec = new_stamp_xsec;
232 wmb(); 232 smp_wmb();
233 ++(systemcfg->tb_update_count); 233 ++(systemcfg->tb_update_count);
234} 234}
235 235
@@ -648,7 +648,7 @@ void ppc_adjtimex(void)
648 temp_varp->tb_to_xs = new_tb_to_xs; 648 temp_varp->tb_to_xs = new_tb_to_xs;
649 temp_varp->stamp_xsec = new_stamp_xsec; 649 temp_varp->stamp_xsec = new_stamp_xsec;
650 temp_varp->tb_orig_stamp = do_gtod.varp->tb_orig_stamp; 650 temp_varp->tb_orig_stamp = do_gtod.varp->tb_orig_stamp;
651 mb(); 651 smp_mb();
652 do_gtod.varp = temp_varp; 652 do_gtod.varp = temp_varp;
653 do_gtod.var_idx = temp_idx; 653 do_gtod.var_idx = temp_idx;
654 654
@@ -662,10 +662,10 @@ void ppc_adjtimex(void)
662 * loops back and reads them again until this criteria is met. 662 * loops back and reads them again until this criteria is met.
663 */ 663 */
664 ++(systemcfg->tb_update_count); 664 ++(systemcfg->tb_update_count);
665 wmb(); 665 smp_wmb();
666 systemcfg->tb_to_xs = new_tb_to_xs; 666 systemcfg->tb_to_xs = new_tb_to_xs;
667 systemcfg->stamp_xsec = new_stamp_xsec; 667 systemcfg->stamp_xsec = new_stamp_xsec;
668 wmb(); 668 smp_wmb();
669 ++(systemcfg->tb_update_count); 669 ++(systemcfg->tb_update_count);
670 670
671 write_sequnlock_irqrestore( &xtime_lock, flags ); 671 write_sequnlock_irqrestore( &xtime_lock, flags );
diff --git a/arch/ppc64/kernel/vdso32/Makefile b/arch/ppc64/kernel/vdso32/Makefile
index ede2f7e477c2..0b1b0df973eb 100644
--- a/arch/ppc64/kernel/vdso32/Makefile
+++ b/arch/ppc64/kernel/vdso32/Makefile
@@ -1,7 +1,7 @@
1 1
2# List of files in the vdso, has to be asm only for now 2# List of files in the vdso, has to be asm only for now
3 3
4obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o 4obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o
5 5
6# Build rules 6# Build rules
7 7
diff --git a/arch/ppc64/kernel/vdso32/note.S b/arch/ppc64/kernel/vdso32/note.S
new file mode 100644
index 000000000000..d4b5be4f3d5f
--- /dev/null
+++ b/arch/ppc64/kernel/vdso32/note.S
@@ -0,0 +1,25 @@
1/*
2 * This supplies .note.* sections to go into the PT_NOTE inside the vDSO text.
3 * Here we can supply some information useful to userland.
4 */
5
6#include <linux/uts.h>
7#include <linux/version.h>
8
9#define ASM_ELF_NOTE_BEGIN(name, flags, vendor, type) \
10 .section name, flags; \
11 .balign 4; \
12 .long 1f - 0f; /* name length */ \
13 .long 3f - 2f; /* data length */ \
14 .long type; /* note type */ \
150: .asciz vendor; /* vendor name */ \
161: .balign 4; \
172:
18
19#define ASM_ELF_NOTE_END \
203: .balign 4; /* pad out section */ \
21 .previous
22
23 ASM_ELF_NOTE_BEGIN(".note.kernel-version", "a", UTS_SYSNAME, 0)
24 .long LINUX_VERSION_CODE
25 ASM_ELF_NOTE_END
diff --git a/arch/ppc64/kernel/vdso32/vdso32.lds.S b/arch/ppc64/kernel/vdso32/vdso32.lds.S
index cca27bd03a57..11290c902ba3 100644
--- a/arch/ppc64/kernel/vdso32/vdso32.lds.S
+++ b/arch/ppc64/kernel/vdso32/vdso32.lds.S
@@ -20,6 +20,8 @@ SECTIONS
20 .gnu.version_d : { *(.gnu.version_d) } 20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) } 21 .gnu.version_r : { *(.gnu.version_r) }
22 22
23 .note : { *(.note.*) } :text :note
24
23 . = ALIGN (16); 25 . = ALIGN (16);
24 .text : 26 .text :
25 { 27 {
@@ -87,6 +89,7 @@ SECTIONS
87PHDRS 89PHDRS
88{ 90{
89 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 91 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
92 note PT_NOTE FLAGS(4); /* PF_R */
90 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 93 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
91 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ 94 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
92} 95}
diff --git a/arch/ppc64/kernel/vdso64/Makefile b/arch/ppc64/kernel/vdso64/Makefile
index bd3f70b1a384..ab39988452cc 100644
--- a/arch/ppc64/kernel/vdso64/Makefile
+++ b/arch/ppc64/kernel/vdso64/Makefile
@@ -1,6 +1,6 @@
1# List of files in the vdso, has to be asm only for now 1# List of files in the vdso, has to be asm only for now
2 2
3obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o 3obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o
4 4
5# Build rules 5# Build rules
6 6
diff --git a/arch/ppc64/kernel/vdso64/note.S b/arch/ppc64/kernel/vdso64/note.S
new file mode 100644
index 000000000000..dc2a509f7e8a
--- /dev/null
+++ b/arch/ppc64/kernel/vdso64/note.S
@@ -0,0 +1 @@
#include "../vdso32/note.S"
diff --git a/arch/ppc64/kernel/vdso64/vdso64.lds.S b/arch/ppc64/kernel/vdso64/vdso64.lds.S
index 942c815c7bc7..9cb28181da80 100644
--- a/arch/ppc64/kernel/vdso64/vdso64.lds.S
+++ b/arch/ppc64/kernel/vdso64/vdso64.lds.S
@@ -18,12 +18,14 @@ SECTIONS
18 .gnu.version_d : { *(.gnu.version_d) } 18 .gnu.version_d : { *(.gnu.version_d) }
19 .gnu.version_r : { *(.gnu.version_r) } 19 .gnu.version_r : { *(.gnu.version_r) }
20 20
21 .note : { *(.note.*) } :text :note
22
21 . = ALIGN (16); 23 . = ALIGN (16);
22 .text : 24 .text :
23 { 25 {
24 *(.text .stub .text.* .gnu.linkonce.t.*) 26 *(.text .stub .text.* .gnu.linkonce.t.*)
25 *(.sfpr .glink) 27 *(.sfpr .glink)
26 } 28 } :text
27 PROVIDE (__etext = .); 29 PROVIDE (__etext = .);
28 PROVIDE (_etext = .); 30 PROVIDE (_etext = .);
29 PROVIDE (etext = .); 31 PROVIDE (etext = .);
@@ -88,6 +90,7 @@ SECTIONS
88PHDRS 90PHDRS
89{ 91{
90 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ 92 text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
93 note PT_NOTE FLAGS(4); /* PF_R */
91 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 94 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
92 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ 95 eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
93} 96}