diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/ia64/kernel | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/ia64/kernel')
38 files changed, 728 insertions, 334 deletions
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index 335eb07480f..bfb4d01e0e5 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <asm/iosapic.h> | 50 | #include <asm/iosapic.h> |
51 | #include <asm/machvec.h> | 51 | #include <asm/machvec.h> |
52 | #include <asm/page.h> | 52 | #include <asm/page.h> |
53 | #include <asm/system.h> | ||
53 | #include <asm/numa.h> | 54 | #include <asm/numa.h> |
54 | #include <asm/sal.h> | 55 | #include <asm/sal.h> |
55 | #include <asm/cyclone.h> | 56 | #include <asm/cyclone.h> |
@@ -348,11 +349,11 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, | |||
348 | 349 | ||
349 | iosapic_override_isa_irq(p->source_irq, p->global_irq, | 350 | iosapic_override_isa_irq(p->source_irq, p->global_irq, |
350 | ((p->inti_flags & ACPI_MADT_POLARITY_MASK) == | 351 | ((p->inti_flags & ACPI_MADT_POLARITY_MASK) == |
351 | ACPI_MADT_POLARITY_ACTIVE_LOW) ? | 352 | ACPI_MADT_POLARITY_ACTIVE_HIGH) ? |
352 | IOSAPIC_POL_LOW : IOSAPIC_POL_HIGH, | 353 | IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, |
353 | ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) == | 354 | ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) == |
354 | ACPI_MADT_TRIGGER_LEVEL) ? | 355 | ACPI_MADT_TRIGGER_EDGE) ? |
355 | IOSAPIC_LEVEL : IOSAPIC_EDGE); | 356 | IOSAPIC_EDGE : IOSAPIC_LEVEL); |
356 | return 0; | 357 | return 0; |
357 | } | 358 | } |
358 | 359 | ||
@@ -422,30 +423,28 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) | |||
422 | #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) | 423 | #define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) |
423 | 424 | ||
424 | static int __initdata srat_num_cpus; /* number of cpus */ | 425 | static int __initdata srat_num_cpus; /* number of cpus */ |
425 | static u32 pxm_flag[PXM_FLAG_LEN]; | 426 | static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; |
426 | #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) | 427 | #define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) |
427 | #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) | 428 | #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) |
428 | static struct acpi_table_slit __initdata *slit_table; | 429 | static struct acpi_table_slit __initdata *slit_table; |
429 | cpumask_t early_cpu_possible_map = CPU_MASK_NONE; | 430 | cpumask_t early_cpu_possible_map = CPU_MASK_NONE; |
430 | 431 | ||
431 | static int __init | 432 | static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa) |
432 | get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa) | ||
433 | { | 433 | { |
434 | int pxm; | 434 | int pxm; |
435 | 435 | ||
436 | pxm = pa->proximity_domain_lo; | 436 | pxm = pa->proximity_domain_lo; |
437 | if (ia64_platform_is("sn2") || acpi_srat_revision >= 2) | 437 | if (ia64_platform_is("sn2")) |
438 | pxm += pa->proximity_domain_hi[0] << 8; | 438 | pxm += pa->proximity_domain_hi[0] << 8; |
439 | return pxm; | 439 | return pxm; |
440 | } | 440 | } |
441 | 441 | ||
442 | static int __init | 442 | static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma) |
443 | get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma) | ||
444 | { | 443 | { |
445 | int pxm; | 444 | int pxm; |
446 | 445 | ||
447 | pxm = ma->proximity_domain; | 446 | pxm = ma->proximity_domain; |
448 | if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1) | 447 | if (!ia64_platform_is("sn2")) |
449 | pxm &= 0xff; | 448 | pxm &= 0xff; |
450 | 449 | ||
451 | return pxm; | 450 | return pxm; |
@@ -497,7 +496,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) | |||
497 | srat_num_cpus++; | 496 | srat_num_cpus++; |
498 | } | 497 | } |
499 | 498 | ||
500 | int __init | 499 | void __init |
501 | acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) | 500 | acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) |
502 | { | 501 | { |
503 | unsigned long paddr, size; | 502 | unsigned long paddr, size; |
@@ -512,7 +511,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) | |||
512 | 511 | ||
513 | /* Ignore disabled entries */ | 512 | /* Ignore disabled entries */ |
514 | if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) | 513 | if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) |
515 | return -1; | 514 | return; |
516 | 515 | ||
517 | /* record this node in proximity bitmap */ | 516 | /* record this node in proximity bitmap */ |
518 | pxm_bit_set(pxm); | 517 | pxm_bit_set(pxm); |
@@ -531,7 +530,6 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) | |||
531 | p->size = size; | 530 | p->size = size; |
532 | p->nid = pxm; | 531 | p->nid = pxm; |
533 | num_node_memblks++; | 532 | num_node_memblks++; |
534 | return 0; | ||
535 | } | 533 | } |
536 | 534 | ||
537 | void __init acpi_numa_arch_fixup(void) | 535 | void __init acpi_numa_arch_fixup(void) |
@@ -633,7 +631,6 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity) | |||
633 | ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : | 631 | ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : |
634 | IOSAPIC_LEVEL); | 632 | IOSAPIC_LEVEL); |
635 | } | 633 | } |
636 | EXPORT_SYMBOL_GPL(acpi_register_gsi); | ||
637 | 634 | ||
638 | void acpi_unregister_gsi(u32 gsi) | 635 | void acpi_unregister_gsi(u32 gsi) |
639 | { | 636 | { |
@@ -645,7 +642,6 @@ void acpi_unregister_gsi(u32 gsi) | |||
645 | 642 | ||
646 | iosapic_unregister_intr(gsi); | 643 | iosapic_unregister_intr(gsi); |
647 | } | 644 | } |
648 | EXPORT_SYMBOL_GPL(acpi_unregister_gsi); | ||
649 | 645 | ||
650 | static int __init acpi_parse_fadt(struct acpi_table_header *table) | 646 | static int __init acpi_parse_fadt(struct acpi_table_header *table) |
651 | { | 647 | { |
@@ -842,11 +838,11 @@ static __init int setup_additional_cpus(char *s) | |||
842 | early_param("additional_cpus", setup_additional_cpus); | 838 | early_param("additional_cpus", setup_additional_cpus); |
843 | 839 | ||
844 | /* | 840 | /* |
845 | * cpu_possible_mask should be static, it cannot change as CPUs | 841 | * cpu_possible_map should be static, it cannot change as CPUs |
846 | * are onlined, or offlined. The reason is per-cpu data-structures | 842 | * are onlined, or offlined. The reason is per-cpu data-structures |
847 | * are allocated by some modules at init time, and dont expect to | 843 | * are allocated by some modules at init time, and dont expect to |
848 | * do this dynamically on cpu arrival/departure. | 844 | * do this dynamically on cpu arrival/departure. |
849 | * cpu_present_mask on the other hand can change dynamically. | 845 | * cpu_present_map on the other hand can change dynamically. |
850 | * In case when cpu_hotplug is not compiled, then we resort to current | 846 | * In case when cpu_hotplug is not compiled, then we resort to current |
851 | * behaviour, which is cpu_possible == cpu_present. | 847 | * behaviour, which is cpu_possible == cpu_present. |
852 | * - Ashok Raj | 848 | * - Ashok Raj |
@@ -924,7 +920,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu) | |||
924 | 920 | ||
925 | acpi_map_cpu2node(handle, cpu, physid); | 921 | acpi_map_cpu2node(handle, cpu, physid); |
926 | 922 | ||
927 | set_cpu_present(cpu, true); | 923 | cpu_set(cpu, cpu_present_map); |
928 | ia64_cpu_to_sapicid[cpu] = physid; | 924 | ia64_cpu_to_sapicid[cpu] = physid; |
929 | 925 | ||
930 | acpi_processor_set_pdc(handle); | 926 | acpi_processor_set_pdc(handle); |
@@ -943,7 +939,7 @@ EXPORT_SYMBOL(acpi_map_lsapic); | |||
943 | int acpi_unmap_lsapic(int cpu) | 939 | int acpi_unmap_lsapic(int cpu) |
944 | { | 940 | { |
945 | ia64_cpu_to_sapicid[cpu] = -1; | 941 | ia64_cpu_to_sapicid[cpu] = -1; |
946 | set_cpu_present(cpu, false); | 942 | cpu_clear(cpu, cpu_present_map); |
947 | 943 | ||
948 | #ifdef CONFIG_ACPI_NUMA | 944 | #ifdef CONFIG_ACPI_NUMA |
949 | /* NUMA specific cleanup's */ | 945 | /* NUMA specific cleanup's */ |
@@ -956,8 +952,8 @@ EXPORT_SYMBOL(acpi_unmap_lsapic); | |||
956 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ | 952 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
957 | 953 | ||
958 | #ifdef CONFIG_ACPI_NUMA | 954 | #ifdef CONFIG_ACPI_NUMA |
959 | static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth, | 955 | static acpi_status __devinit |
960 | void *context, void **ret) | 956 | acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) |
961 | { | 957 | { |
962 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 958 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
963 | union acpi_object *obj; | 959 | union acpi_object *obj; |
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c index a48bd9a9927..af565016904 100644 --- a/arch/ia64/kernel/asm-offsets.c +++ b/arch/ia64/kernel/asm-offsets.c | |||
@@ -269,8 +269,8 @@ void foo(void) | |||
269 | BLANK(); | 269 | BLANK(); |
270 | 270 | ||
271 | /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */ | 271 | /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */ |
272 | DEFINE(IA64_GTOD_SEQ_OFFSET, | 272 | DEFINE(IA64_GTOD_LOCK_OFFSET, |
273 | offsetof (struct fsyscall_gtod_data_t, seq)); | 273 | offsetof (struct fsyscall_gtod_data_t, lock)); |
274 | DEFINE(IA64_GTOD_WALL_TIME_OFFSET, | 274 | DEFINE(IA64_GTOD_WALL_TIME_OFFSET, |
275 | offsetof (struct fsyscall_gtod_data_t, wall_time)); | 275 | offsetof (struct fsyscall_gtod_data_t, wall_time)); |
276 | DEFINE(IA64_GTOD_MONO_TIME_OFFSET, | 276 | DEFINE(IA64_GTOD_MONO_TIME_OFFSET, |
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c index 7f791623820..f2c1600da09 100644 --- a/arch/ia64/kernel/dma-mapping.c +++ b/arch/ia64/kernel/dma-mapping.c | |||
@@ -1,5 +1,4 @@ | |||
1 | #include <linux/dma-mapping.h> | 1 | #include <linux/dma-mapping.h> |
2 | #include <linux/export.h> | ||
3 | 2 | ||
4 | /* Set this to 1 if there is a HW IOMMU in the system */ | 3 | /* Set this to 1 if there is a HW IOMMU in the system */ |
5 | int iommu_detected __read_mostly; | 4 | int iommu_detected __read_mostly; |
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c index f034563aeae..c38d22e5e90 100644 --- a/arch/ia64/kernel/efi.c +++ b/arch/ia64/kernel/efi.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include <asm/pgtable.h> | 39 | #include <asm/pgtable.h> |
40 | #include <asm/processor.h> | 40 | #include <asm/processor.h> |
41 | #include <asm/mca.h> | 41 | #include <asm/mca.h> |
42 | #include <asm/setup.h> | ||
43 | #include <asm/tlbflush.h> | 42 | #include <asm/tlbflush.h> |
44 | 43 | ||
45 | #define EFI_DEBUG 0 | 44 | #define EFI_DEBUG 0 |
@@ -870,7 +869,7 @@ kern_mem_attribute (unsigned long phys_addr, unsigned long size) | |||
870 | EXPORT_SYMBOL(kern_mem_attribute); | 869 | EXPORT_SYMBOL(kern_mem_attribute); |
871 | 870 | ||
872 | int | 871 | int |
873 | valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size) | 872 | valid_phys_addr_range (unsigned long phys_addr, unsigned long size) |
874 | { | 873 | { |
875 | u64 attr; | 874 | u64 attr; |
876 | 875 | ||
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index 6bfd8429ee0..198c753d100 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -61,13 +61,14 @@ ENTRY(ia64_execve) | |||
61 | * Allocate 8 input registers since ptrace() may clobber them | 61 | * Allocate 8 input registers since ptrace() may clobber them |
62 | */ | 62 | */ |
63 | .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) | 63 | .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) |
64 | alloc loc1=ar.pfs,8,2,3,0 | 64 | alloc loc1=ar.pfs,8,2,4,0 |
65 | mov loc0=rp | 65 | mov loc0=rp |
66 | .body | 66 | .body |
67 | mov out0=in0 // filename | 67 | mov out0=in0 // filename |
68 | ;; // stop bit between alloc and call | 68 | ;; // stop bit between alloc and call |
69 | mov out1=in1 // argv | 69 | mov out1=in1 // argv |
70 | mov out2=in2 // envp | 70 | mov out2=in2 // envp |
71 | add out3=16,sp // regs | ||
71 | br.call.sptk.many rp=sys_execve | 72 | br.call.sptk.many rp=sys_execve |
72 | .ret0: | 73 | .ret0: |
73 | cmp4.ge p6,p7=r8,r0 | 74 | cmp4.ge p6,p7=r8,r0 |
@@ -75,6 +76,7 @@ ENTRY(ia64_execve) | |||
75 | sxt4 r8=r8 // return 64-bit result | 76 | sxt4 r8=r8 // return 64-bit result |
76 | ;; | 77 | ;; |
77 | stf.spill [sp]=f0 | 78 | stf.spill [sp]=f0 |
79 | (p6) cmp.ne pKStk,pUStk=r0,r0 // a successful execve() lands us in user-mode... | ||
78 | mov rp=loc0 | 80 | mov rp=loc0 |
79 | (p6) mov ar.pfs=r0 // clear ar.pfs on success | 81 | (p6) mov ar.pfs=r0 // clear ar.pfs on success |
80 | (p7) br.ret.sptk.many rp | 82 | (p7) br.ret.sptk.many rp |
@@ -116,12 +118,13 @@ GLOBAL_ENTRY(sys_clone2) | |||
116 | mov loc1=r16 // save ar.pfs across do_fork | 118 | mov loc1=r16 // save ar.pfs across do_fork |
117 | .body | 119 | .body |
118 | mov out1=in1 | 120 | mov out1=in1 |
119 | mov out2=in2 | 121 | mov out3=in2 |
120 | tbit.nz p6,p0=in0,CLONE_SETTLS_BIT | 122 | tbit.nz p6,p0=in0,CLONE_SETTLS_BIT |
121 | mov out3=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID | 123 | mov out4=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID |
122 | ;; | 124 | ;; |
123 | (p6) st8 [r2]=in5 // store TLS in r16 for copy_thread() | 125 | (p6) st8 [r2]=in5 // store TLS in r16 for copy_thread() |
124 | mov out4=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID | 126 | mov out5=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID |
127 | adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s | ||
125 | mov out0=in0 // out0 = clone_flags | 128 | mov out0=in0 // out0 = clone_flags |
126 | br.call.sptk.many rp=do_fork | 129 | br.call.sptk.many rp=do_fork |
127 | .ret1: .restore sp | 130 | .ret1: .restore sp |
@@ -147,12 +150,13 @@ GLOBAL_ENTRY(sys_clone) | |||
147 | mov loc1=r16 // save ar.pfs across do_fork | 150 | mov loc1=r16 // save ar.pfs across do_fork |
148 | .body | 151 | .body |
149 | mov out1=in1 | 152 | mov out1=in1 |
150 | mov out2=16 // stacksize (compensates for 16-byte scratch area) | 153 | mov out3=16 // stacksize (compensates for 16-byte scratch area) |
151 | tbit.nz p6,p0=in0,CLONE_SETTLS_BIT | 154 | tbit.nz p6,p0=in0,CLONE_SETTLS_BIT |
152 | mov out3=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID | 155 | mov out4=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID |
153 | ;; | 156 | ;; |
154 | (p6) st8 [r2]=in4 // store TLS in r13 (tp) | 157 | (p6) st8 [r2]=in4 // store TLS in r13 (tp) |
155 | mov out4=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID | 158 | mov out5=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID |
159 | adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = ®s | ||
156 | mov out0=in0 // out0 = clone_flags | 160 | mov out0=in0 // out0 = clone_flags |
157 | br.call.sptk.many rp=do_fork | 161 | br.call.sptk.many rp=do_fork |
158 | .ret2: .restore sp | 162 | .ret2: .restore sp |
@@ -480,6 +484,19 @@ GLOBAL_ENTRY(prefetch_stack) | |||
480 | br.ret.sptk.many rp | 484 | br.ret.sptk.many rp |
481 | END(prefetch_stack) | 485 | END(prefetch_stack) |
482 | 486 | ||
487 | GLOBAL_ENTRY(kernel_execve) | ||
488 | rum psr.ac | ||
489 | mov r15=__NR_execve // put syscall number in place | ||
490 | break __BREAK_SYSCALL | ||
491 | br.ret.sptk.many rp | ||
492 | END(kernel_execve) | ||
493 | |||
494 | GLOBAL_ENTRY(clone) | ||
495 | mov r15=__NR_clone // put syscall number in place | ||
496 | break __BREAK_SYSCALL | ||
497 | br.ret.sptk.many rp | ||
498 | END(clone) | ||
499 | |||
483 | /* | 500 | /* |
484 | * Invoke a system call, but do some tracing before and after the call. | 501 | * Invoke a system call, but do some tracing before and after the call. |
485 | * We MUST preserve the current register frame throughout this routine | 502 | * We MUST preserve the current register frame throughout this routine |
@@ -583,27 +600,6 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel) | |||
583 | .ret4: br.cond.sptk ia64_leave_kernel | 600 | .ret4: br.cond.sptk ia64_leave_kernel |
584 | END(ia64_strace_leave_kernel) | 601 | END(ia64_strace_leave_kernel) |
585 | 602 | ||
586 | ENTRY(call_payload) | ||
587 | .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(0) | ||
588 | /* call the kernel_thread payload; fn is in r4, arg - in r5 */ | ||
589 | alloc loc1=ar.pfs,0,3,1,0 | ||
590 | mov loc0=rp | ||
591 | mov loc2=gp | ||
592 | mov out0=r5 // arg | ||
593 | ld8 r14 = [r4], 8 // fn.address | ||
594 | ;; | ||
595 | mov b6 = r14 | ||
596 | ld8 gp = [r4] // fn.gp | ||
597 | ;; | ||
598 | br.call.sptk.many rp=b6 // fn(arg) | ||
599 | .ret12: mov gp=loc2 | ||
600 | mov rp=loc0 | ||
601 | mov ar.pfs=loc1 | ||
602 | /* ... and if it has returned, we are going to userland */ | ||
603 | cmp.ne pKStk,pUStk=r0,r0 | ||
604 | br.ret.sptk.many rp | ||
605 | END(call_payload) | ||
606 | |||
607 | GLOBAL_ENTRY(ia64_ret_from_clone) | 603 | GLOBAL_ENTRY(ia64_ret_from_clone) |
608 | PT_REGS_UNWIND_INFO(0) | 604 | PT_REGS_UNWIND_INFO(0) |
609 | { /* | 605 | { /* |
@@ -620,7 +616,6 @@ GLOBAL_ENTRY(ia64_ret_from_clone) | |||
620 | br.call.sptk.many rp=ia64_invoke_schedule_tail | 616 | br.call.sptk.many rp=ia64_invoke_schedule_tail |
621 | } | 617 | } |
622 | .ret8: | 618 | .ret8: |
623 | (pKStk) br.call.sptk.many rp=call_payload | ||
624 | adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 | 619 | adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 |
625 | ;; | 620 | ;; |
626 | ld4 r2=[r2] | 621 | ld4 r2=[r2] |
@@ -1782,10 +1777,6 @@ sys_call_table: | |||
1782 | data8 sys_syncfs | 1777 | data8 sys_syncfs |
1783 | data8 sys_setns // 1330 | 1778 | data8 sys_setns // 1330 |
1784 | data8 sys_sendmmsg | 1779 | data8 sys_sendmmsg |
1785 | data8 sys_process_vm_readv | ||
1786 | data8 sys_process_vm_writev | ||
1787 | data8 sys_accept4 | ||
1788 | data8 sys_finit_module // 1335 | ||
1789 | 1780 | ||
1790 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1781 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
1791 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ | 1782 | #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ |
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c index 2d67317a1ec..c539c689493 100644 --- a/arch/ia64/kernel/err_inject.c +++ b/arch/ia64/kernel/err_inject.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * Copyright (C) 2006, Intel Corp. All rights reserved. | 24 | * Copyright (C) 2006, Intel Corp. All rights reserved. |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include <linux/device.h> | 27 | #include <linux/sysdev.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
30 | #include <linux/cpu.h> | 30 | #include <linux/cpu.h> |
@@ -35,10 +35,10 @@ | |||
35 | #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; | 35 | #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; |
36 | 36 | ||
37 | #define define_one_ro(name) \ | 37 | #define define_one_ro(name) \ |
38 | static DEVICE_ATTR(name, 0444, show_##name, NULL) | 38 | static SYSDEV_ATTR(name, 0444, show_##name, NULL) |
39 | 39 | ||
40 | #define define_one_rw(name) \ | 40 | #define define_one_rw(name) \ |
41 | static DEVICE_ATTR(name, 0644, show_##name, store_##name) | 41 | static SYSDEV_ATTR(name, 0644, show_##name, store_##name) |
42 | 42 | ||
43 | static u64 call_start[NR_CPUS]; | 43 | static u64 call_start[NR_CPUS]; |
44 | static u64 phys_addr[NR_CPUS]; | 44 | static u64 phys_addr[NR_CPUS]; |
@@ -55,7 +55,7 @@ static u64 resources[NR_CPUS]; | |||
55 | 55 | ||
56 | #define show(name) \ | 56 | #define show(name) \ |
57 | static ssize_t \ | 57 | static ssize_t \ |
58 | show_##name(struct device *dev, struct device_attribute *attr, \ | 58 | show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ |
59 | char *buf) \ | 59 | char *buf) \ |
60 | { \ | 60 | { \ |
61 | u32 cpu=dev->id; \ | 61 | u32 cpu=dev->id; \ |
@@ -64,7 +64,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \ | |||
64 | 64 | ||
65 | #define store(name) \ | 65 | #define store(name) \ |
66 | static ssize_t \ | 66 | static ssize_t \ |
67 | store_##name(struct device *dev, struct device_attribute *attr, \ | 67 | store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ |
68 | const char *buf, size_t size) \ | 68 | const char *buf, size_t size) \ |
69 | { \ | 69 | { \ |
70 | unsigned int cpu=dev->id; \ | 70 | unsigned int cpu=dev->id; \ |
@@ -78,7 +78,7 @@ show(call_start) | |||
78 | * processor. The cpu number in driver is only used for storing data. | 78 | * processor. The cpu number in driver is only used for storing data. |
79 | */ | 79 | */ |
80 | static ssize_t | 80 | static ssize_t |
81 | store_call_start(struct device *dev, struct device_attribute *attr, | 81 | store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, |
82 | const char *buf, size_t size) | 82 | const char *buf, size_t size) |
83 | { | 83 | { |
84 | unsigned int cpu=dev->id; | 84 | unsigned int cpu=dev->id; |
@@ -127,7 +127,7 @@ show(err_type_info) | |||
127 | store(err_type_info) | 127 | store(err_type_info) |
128 | 128 | ||
129 | static ssize_t | 129 | static ssize_t |
130 | show_virtual_to_phys(struct device *dev, struct device_attribute *attr, | 130 | show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, |
131 | char *buf) | 131 | char *buf) |
132 | { | 132 | { |
133 | unsigned int cpu=dev->id; | 133 | unsigned int cpu=dev->id; |
@@ -135,7 +135,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr, | |||
135 | } | 135 | } |
136 | 136 | ||
137 | static ssize_t | 137 | static ssize_t |
138 | store_virtual_to_phys(struct device *dev, struct device_attribute *attr, | 138 | store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, |
139 | const char *buf, size_t size) | 139 | const char *buf, size_t size) |
140 | { | 140 | { |
141 | unsigned int cpu=dev->id; | 141 | unsigned int cpu=dev->id; |
@@ -159,8 +159,8 @@ show(err_struct_info) | |||
159 | store(err_struct_info) | 159 | store(err_struct_info) |
160 | 160 | ||
161 | static ssize_t | 161 | static ssize_t |
162 | show_err_data_buffer(struct device *dev, | 162 | show_err_data_buffer(struct sys_device *dev, |
163 | struct device_attribute *attr, char *buf) | 163 | struct sysdev_attribute *attr, char *buf) |
164 | { | 164 | { |
165 | unsigned int cpu=dev->id; | 165 | unsigned int cpu=dev->id; |
166 | 166 | ||
@@ -171,8 +171,8 @@ show_err_data_buffer(struct device *dev, | |||
171 | } | 171 | } |
172 | 172 | ||
173 | static ssize_t | 173 | static ssize_t |
174 | store_err_data_buffer(struct device *dev, | 174 | store_err_data_buffer(struct sys_device *dev, |
175 | struct device_attribute *attr, | 175 | struct sysdev_attribute *attr, |
176 | const char *buf, size_t size) | 176 | const char *buf, size_t size) |
177 | { | 177 | { |
178 | unsigned int cpu=dev->id; | 178 | unsigned int cpu=dev->id; |
@@ -209,14 +209,14 @@ define_one_ro(capabilities); | |||
209 | define_one_ro(resources); | 209 | define_one_ro(resources); |
210 | 210 | ||
211 | static struct attribute *default_attrs[] = { | 211 | static struct attribute *default_attrs[] = { |
212 | &dev_attr_call_start.attr, | 212 | &attr_call_start.attr, |
213 | &dev_attr_virtual_to_phys.attr, | 213 | &attr_virtual_to_phys.attr, |
214 | &dev_attr_err_type_info.attr, | 214 | &attr_err_type_info.attr, |
215 | &dev_attr_err_struct_info.attr, | 215 | &attr_err_struct_info.attr, |
216 | &dev_attr_err_data_buffer.attr, | 216 | &attr_err_data_buffer.attr, |
217 | &dev_attr_status.attr, | 217 | &attr_status.attr, |
218 | &dev_attr_capabilities.attr, | 218 | &attr_capabilities.attr, |
219 | &dev_attr_resources.attr, | 219 | &attr_resources.attr, |
220 | NULL | 220 | NULL |
221 | }; | 221 | }; |
222 | 222 | ||
@@ -225,12 +225,12 @@ static struct attribute_group err_inject_attr_group = { | |||
225 | .name = "err_inject" | 225 | .name = "err_inject" |
226 | }; | 226 | }; |
227 | /* Add/Remove err_inject interface for CPU device */ | 227 | /* Add/Remove err_inject interface for CPU device */ |
228 | static int __cpuinit err_inject_add_dev(struct device * sys_dev) | 228 | static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev) |
229 | { | 229 | { |
230 | return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); | 230 | return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); |
231 | } | 231 | } |
232 | 232 | ||
233 | static int __cpuinit err_inject_remove_dev(struct device * sys_dev) | 233 | static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev) |
234 | { | 234 | { |
235 | sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); | 235 | sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); |
236 | return 0; | 236 | return 0; |
@@ -239,9 +239,9 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb, | |||
239 | unsigned long action, void *hcpu) | 239 | unsigned long action, void *hcpu) |
240 | { | 240 | { |
241 | unsigned int cpu = (unsigned long)hcpu; | 241 | unsigned int cpu = (unsigned long)hcpu; |
242 | struct device *sys_dev; | 242 | struct sys_device *sys_dev; |
243 | 243 | ||
244 | sys_dev = get_cpu_device(cpu); | 244 | sys_dev = get_cpu_sysdev(cpu); |
245 | switch (action) { | 245 | switch (action) { |
246 | case CPU_ONLINE: | 246 | case CPU_ONLINE: |
247 | case CPU_ONLINE_FROZEN: | 247 | case CPU_ONLINE_FROZEN: |
@@ -283,13 +283,13 @@ static void __exit | |||
283 | err_inject_exit(void) | 283 | err_inject_exit(void) |
284 | { | 284 | { |
285 | int i; | 285 | int i; |
286 | struct device *sys_dev; | 286 | struct sys_device *sys_dev; |
287 | 287 | ||
288 | #ifdef ERR_INJ_DEBUG | 288 | #ifdef ERR_INJ_DEBUG |
289 | printk(KERN_INFO "Exit error injection driver.\n"); | 289 | printk(KERN_INFO "Exit error injection driver.\n"); |
290 | #endif | 290 | #endif |
291 | for_each_online_cpu(i) { | 291 | for_each_online_cpu(i) { |
292 | sys_dev = get_cpu_device(i); | 292 | sys_dev = get_cpu_sysdev(i); |
293 | sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); | 293 | sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); |
294 | } | 294 | } |
295 | unregister_hotcpu_notifier(&err_inject_cpu_notifier); | 295 | unregister_hotcpu_notifier(&err_inject_cpu_notifier); |
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index e662f178b99..331d42bda77 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/thread_info.h> | 21 | #include <asm/thread_info.h> |
22 | #include <asm/sal.h> | 22 | #include <asm/sal.h> |
23 | #include <asm/signal.h> | 23 | #include <asm/signal.h> |
24 | #include <asm/system.h> | ||
24 | #include <asm/unistd.h> | 25 | #include <asm/unistd.h> |
25 | 26 | ||
26 | #include "entry.h" | 27 | #include "entry.h" |
@@ -173,7 +174,7 @@ ENTRY(fsys_set_tid_address) | |||
173 | FSYS_RETURN | 174 | FSYS_RETURN |
174 | END(fsys_set_tid_address) | 175 | END(fsys_set_tid_address) |
175 | 176 | ||
176 | #if IA64_GTOD_SEQ_OFFSET !=0 | 177 | #if IA64_GTOD_LOCK_OFFSET !=0 |
177 | #error fsys_gettimeofday incompatible with changes to struct fsyscall_gtod_data_t | 178 | #error fsys_gettimeofday incompatible with changes to struct fsyscall_gtod_data_t |
178 | #endif | 179 | #endif |
179 | #if IA64_ITC_JITTER_OFFSET !=0 | 180 | #if IA64_ITC_JITTER_OFFSET !=0 |
@@ -372,6 +373,175 @@ ENTRY(fsys_clock_gettime) | |||
372 | END(fsys_clock_gettime) | 373 | END(fsys_clock_gettime) |
373 | 374 | ||
374 | /* | 375 | /* |
376 | * long fsys_rt_sigprocmask (int how, sigset_t *set, sigset_t *oset, size_t sigsetsize). | ||
377 | */ | ||
378 | #if _NSIG_WORDS != 1 | ||
379 | # error Sorry, fsys_rt_sigprocmask() needs to be updated for _NSIG_WORDS != 1. | ||
380 | #endif | ||
381 | ENTRY(fsys_rt_sigprocmask) | ||
382 | .prologue | ||
383 | .altrp b6 | ||
384 | .body | ||
385 | |||
386 | add r2=IA64_TASK_BLOCKED_OFFSET,r16 | ||
387 | add r9=TI_FLAGS+IA64_TASK_SIZE,r16 | ||
388 | cmp4.ltu p6,p0=SIG_SETMASK,r32 | ||
389 | |||
390 | cmp.ne p15,p0=r0,r34 // oset != NULL? | ||
391 | tnat.nz p8,p0=r34 | ||
392 | add r31=IA64_TASK_SIGHAND_OFFSET,r16 | ||
393 | ;; | ||
394 | ld8 r3=[r2] // read/prefetch current->blocked | ||
395 | ld4 r9=[r9] | ||
396 | tnat.nz.or p6,p0=r35 | ||
397 | |||
398 | cmp.ne.or p6,p0=_NSIG_WORDS*8,r35 | ||
399 | tnat.nz.or p6,p0=r32 | ||
400 | (p6) br.spnt.few .fail_einval // fail with EINVAL | ||
401 | ;; | ||
402 | #ifdef CONFIG_SMP | ||
403 | ld8 r31=[r31] // r31 <- current->sighand | ||
404 | #endif | ||
405 | and r9=TIF_ALLWORK_MASK,r9 | ||
406 | tnat.nz.or p8,p0=r33 | ||
407 | ;; | ||
408 | cmp.ne p7,p0=0,r9 | ||
409 | cmp.eq p6,p0=r0,r33 // set == NULL? | ||
410 | add r31=IA64_SIGHAND_SIGLOCK_OFFSET,r31 // r31 <- current->sighand->siglock | ||
411 | (p8) br.spnt.few .fail_efault // fail with EFAULT | ||
412 | (p7) br.spnt.many fsys_fallback_syscall // got pending kernel work... | ||
413 | (p6) br.dpnt.many .store_mask // -> short-circuit to just reading the signal mask | ||
414 | |||
415 | /* Argh, we actually have to do some work and _update_ the signal mask: */ | ||
416 | |||
417 | EX(.fail_efault, probe.r.fault r33, 3) // verify user has read-access to *set | ||
418 | EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set | ||
419 | mov r17=(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1)) | ||
420 | ;; | ||
421 | |||
422 | RSM_PSR_I(p0, r18, r19) // mask interrupt delivery | ||
423 | andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP | ||
424 | mov r8=EINVAL // default to EINVAL | ||
425 | |||
426 | #ifdef CONFIG_SMP | ||
427 | // __ticket_spin_trylock(r31) | ||
428 | ld4 r17=[r31] | ||
429 | ;; | ||
430 | mov.m ar.ccv=r17 | ||
431 | extr.u r9=r17,17,15 | ||
432 | adds r19=1,r17 | ||
433 | extr.u r18=r17,0,15 | ||
434 | ;; | ||
435 | cmp.eq p6,p7=r9,r18 | ||
436 | ;; | ||
437 | (p6) cmpxchg4.acq r9=[r31],r19,ar.ccv | ||
438 | (p6) dep.z r20=r19,1,15 // next serving ticket for unlock | ||
439 | (p7) br.cond.spnt.many .lock_contention | ||
440 | ;; | ||
441 | cmp4.eq p0,p7=r9,r17 | ||
442 | adds r31=2,r31 | ||
443 | (p7) br.cond.spnt.many .lock_contention | ||
444 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock | ||
445 | ;; | ||
446 | #else | ||
447 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock | ||
448 | #endif | ||
449 | add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 | ||
450 | add r19=IA64_TASK_SIGNAL_OFFSET,r16 | ||
451 | cmp4.eq p6,p0=SIG_BLOCK,r32 | ||
452 | ;; | ||
453 | ld8 r19=[r19] // r19 <- current->signal | ||
454 | cmp4.eq p7,p0=SIG_UNBLOCK,r32 | ||
455 | cmp4.eq p8,p0=SIG_SETMASK,r32 | ||
456 | ;; | ||
457 | ld8 r18=[r18] // r18 <- current->pending.signal | ||
458 | .pred.rel.mutex p6,p7,p8 | ||
459 | (p6) or r14=r3,r14 // SIG_BLOCK | ||
460 | (p7) andcm r14=r3,r14 // SIG_UNBLOCK | ||
461 | |||
462 | (p8) mov r14=r14 // SIG_SETMASK | ||
463 | (p6) mov r8=0 // clear error code | ||
464 | // recalc_sigpending() | ||
465 | add r17=IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,r19 | ||
466 | |||
467 | add r19=IA64_SIGNAL_SHARED_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r19 | ||
468 | ;; | ||
469 | ld4 r17=[r17] // r17 <- current->signal->group_stop_count | ||
470 | (p7) mov r8=0 // clear error code | ||
471 | |||
472 | ld8 r19=[r19] // r19 <- current->signal->shared_pending | ||
473 | ;; | ||
474 | cmp4.gt p6,p7=r17,r0 // p6/p7 <- (current->signal->group_stop_count > 0)? | ||
475 | (p8) mov r8=0 // clear error code | ||
476 | |||
477 | or r18=r18,r19 // r18 <- current->pending | current->signal->shared_pending | ||
478 | ;; | ||
479 | // r18 <- (current->pending | current->signal->shared_pending) & ~current->blocked: | ||
480 | andcm r18=r18,r14 | ||
481 | add r9=TI_FLAGS+IA64_TASK_SIZE,r16 | ||
482 | ;; | ||
483 | |||
484 | (p7) cmp.ne.or.andcm p6,p7=r18,r0 // p6/p7 <- signal pending | ||
485 | mov r19=0 // i must not leak kernel bits... | ||
486 | (p6) br.cond.dpnt.many .sig_pending | ||
487 | ;; | ||
488 | |||
489 | 1: ld4 r17=[r9] // r17 <- current->thread_info->flags | ||
490 | ;; | ||
491 | mov ar.ccv=r17 | ||
492 | and r18=~_TIF_SIGPENDING,r17 // r18 <- r17 & ~(1 << TIF_SIGPENDING) | ||
493 | ;; | ||
494 | |||
495 | st8 [r2]=r14 // update current->blocked with new mask | ||
496 | cmpxchg4.acq r8=[r9],r18,ar.ccv // current->thread_info->flags <- r18 | ||
497 | ;; | ||
498 | cmp.ne p6,p0=r17,r8 // update failed? | ||
499 | (p6) br.cond.spnt.few 1b // yes -> retry | ||
500 | |||
501 | #ifdef CONFIG_SMP | ||
502 | // __ticket_spin_unlock(r31) | ||
503 | st2.rel [r31]=r20 | ||
504 | mov r20=0 // i must not leak kernel bits... | ||
505 | #endif | ||
506 | SSM_PSR_I(p0, p9, r31) | ||
507 | ;; | ||
508 | |||
509 | srlz.d // ensure psr.i is set again | ||
510 | mov r18=0 // i must not leak kernel bits... | ||
511 | |||
512 | .store_mask: | ||
513 | EX(.fail_efault, (p15) probe.w.fault r34, 3) // verify user has write-access to *oset | ||
514 | EX(.fail_efault, (p15) st8 [r34]=r3) | ||
515 | mov r2=0 // i must not leak kernel bits... | ||
516 | mov r3=0 // i must not leak kernel bits... | ||
517 | mov r8=0 // return 0 | ||
518 | mov r9=0 // i must not leak kernel bits... | ||
519 | mov r14=0 // i must not leak kernel bits... | ||
520 | mov r17=0 // i must not leak kernel bits... | ||
521 | mov r31=0 // i must not leak kernel bits... | ||
522 | FSYS_RETURN | ||
523 | |||
524 | .sig_pending: | ||
525 | #ifdef CONFIG_SMP | ||
526 | // __ticket_spin_unlock(r31) | ||
527 | st2.rel [r31]=r20 // release the lock | ||
528 | #endif | ||
529 | SSM_PSR_I(p0, p9, r17) | ||
530 | ;; | ||
531 | srlz.d | ||
532 | br.sptk.many fsys_fallback_syscall // with signal pending, do the heavy-weight syscall | ||
533 | |||
534 | #ifdef CONFIG_SMP | ||
535 | .lock_contention: | ||
536 | /* Rather than spinning here, fall back on doing a heavy-weight syscall. */ | ||
537 | SSM_PSR_I(p0, p9, r17) | ||
538 | ;; | ||
539 | srlz.d | ||
540 | br.sptk.many fsys_fallback_syscall | ||
541 | #endif | ||
542 | END(fsys_rt_sigprocmask) | ||
543 | |||
544 | /* | ||
375 | * fsys_getcpu doesn't use the third parameter in this implementation. It reads | 545 | * fsys_getcpu doesn't use the third parameter in this implementation. It reads |
376 | * current_thread_info()->cpu and corresponding node in cpu_to_node_map. | 546 | * current_thread_info()->cpu and corresponding node in cpu_to_node_map. |
377 | */ | 547 | */ |
@@ -390,15 +560,11 @@ ENTRY(fsys_getcpu) | |||
390 | ;; | 560 | ;; |
391 | tnat.nz p7,p0 = r33 // I guard against NaT argument | 561 | tnat.nz p7,p0 = r33 // I guard against NaT argument |
392 | (p7) br.cond.spnt.few .fail_einval // B | 562 | (p7) br.cond.spnt.few .fail_einval // B |
393 | ;; | ||
394 | cmp.ne p6,p0=r32,r0 | ||
395 | cmp.ne p7,p0=r33,r0 | ||
396 | ;; | ||
397 | #ifdef CONFIG_NUMA | 563 | #ifdef CONFIG_NUMA |
398 | movl r17=cpu_to_node_map | 564 | movl r17=cpu_to_node_map |
399 | ;; | 565 | ;; |
400 | EX(.fail_efault, (p6) probe.w.fault r32, 3) // M This takes 5 cycles | 566 | EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles |
401 | EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles | 567 | EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles |
402 | shladd r18=r3,1,r17 | 568 | shladd r18=r3,1,r17 |
403 | ;; | 569 | ;; |
404 | ld2 r20=[r18] // r20 = cpu_to_node_map[cpu] | 570 | ld2 r20=[r18] // r20 = cpu_to_node_map[cpu] |
@@ -408,20 +574,20 @@ EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles | |||
408 | (p8) br.spnt.many fsys_fallback_syscall | 574 | (p8) br.spnt.many fsys_fallback_syscall |
409 | ;; | 575 | ;; |
410 | ;; | 576 | ;; |
411 | EX(.fail_efault, (p6) st4 [r32] = r3) | 577 | EX(.fail_efault, st4 [r32] = r3) |
412 | EX(.fail_efault, (p7) st2 [r33] = r20) | 578 | EX(.fail_efault, st2 [r33] = r20) |
413 | mov r8=0 | 579 | mov r8=0 |
414 | ;; | 580 | ;; |
415 | #else | 581 | #else |
416 | EX(.fail_efault, (p6) probe.w.fault r32, 3) // M This takes 5 cycles | 582 | EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles |
417 | EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles | 583 | EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles |
418 | and r2 = TIF_ALLWORK_MASK,r2 | 584 | and r2 = TIF_ALLWORK_MASK,r2 |
419 | ;; | 585 | ;; |
420 | cmp.ne p8,p0=0,r2 | 586 | cmp.ne p8,p0=0,r2 |
421 | (p8) br.spnt.many fsys_fallback_syscall | 587 | (p8) br.spnt.many fsys_fallback_syscall |
422 | ;; | 588 | ;; |
423 | EX(.fail_efault, (p6) st4 [r32] = r3) | 589 | EX(.fail_efault, st4 [r32] = r3) |
424 | EX(.fail_efault, (p7) st2 [r33] = r0) | 590 | EX(.fail_efault, st2 [r33] = r0) |
425 | mov r8=0 | 591 | mov r8=0 |
426 | ;; | 592 | ;; |
427 | #endif | 593 | #endif |
@@ -751,7 +917,7 @@ paravirt_fsyscall_table: | |||
751 | data8 0 // sigaltstack | 917 | data8 0 // sigaltstack |
752 | data8 0 // rt_sigaction | 918 | data8 0 // rt_sigaction |
753 | data8 0 // rt_sigpending | 919 | data8 0 // rt_sigpending |
754 | data8 0 // rt_sigprocmask | 920 | data8 fsys_rt_sigprocmask // rt_sigprocmask |
755 | data8 0 // rt_sigqueueinfo // 1180 | 921 | data8 0 // rt_sigqueueinfo // 1180 |
756 | data8 0 // rt_sigreturn | 922 | data8 0 // rt_sigreturn |
757 | data8 0 // rt_sigsuspend | 923 | data8 0 // rt_sigsuspend |
diff --git a/arch/ia64/kernel/fsyscall_gtod_data.h b/arch/ia64/kernel/fsyscall_gtod_data.h index 146b15b5fec..57d2ee6c83e 100644 --- a/arch/ia64/kernel/fsyscall_gtod_data.h +++ b/arch/ia64/kernel/fsyscall_gtod_data.h | |||
@@ -6,7 +6,7 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | struct fsyscall_gtod_data_t { | 8 | struct fsyscall_gtod_data_t { |
9 | seqcount_t seq; | 9 | seqlock_t lock; |
10 | struct timespec wall_time; | 10 | struct timespec wall_time; |
11 | struct timespec monotonic_time; | 11 | struct timespec monotonic_time; |
12 | cycle_t clk_mask; | 12 | cycle_t clk_mask; |
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S index b5f8bdd8618..245d3e1ec7e 100644 --- a/arch/ia64/kernel/gate.S +++ b/arch/ia64/kernel/gate.S | |||
@@ -11,9 +11,8 @@ | |||
11 | #include <asm/errno.h> | 11 | #include <asm/errno.h> |
12 | #include <asm/asm-offsets.h> | 12 | #include <asm/asm-offsets.h> |
13 | #include <asm/sigcontext.h> | 13 | #include <asm/sigcontext.h> |
14 | #include <asm/system.h> | ||
14 | #include <asm/unistd.h> | 15 | #include <asm/unistd.h> |
15 | #include <asm/kregs.h> | ||
16 | #include <asm/page.h> | ||
17 | #include "paravirt_inst.h" | 16 | #include "paravirt_inst.h" |
18 | 17 | ||
19 | /* | 18 | /* |
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S index e518f7902af..d32b0855110 100644 --- a/arch/ia64/kernel/gate.lds.S +++ b/arch/ia64/kernel/gate.lds.S | |||
@@ -5,7 +5,8 @@ | |||
5 | * its layout. | 5 | * its layout. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <asm/page.h> | 8 | |
9 | #include <asm/system.h> | ||
9 | #include "paravirt_patchlist.h" | 10 | #include "paravirt_patchlist.h" |
10 | 11 | ||
11 | SECTIONS | 12 | SECTIONS |
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S index 4738ff7bd66..17a9fba3893 100644 --- a/arch/ia64/kernel/head.S +++ b/arch/ia64/kernel/head.S | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/pgtable.h> | 30 | #include <asm/pgtable.h> |
31 | #include <asm/processor.h> | 31 | #include <asm/processor.h> |
32 | #include <asm/ptrace.h> | 32 | #include <asm/ptrace.h> |
33 | #include <asm/system.h> | ||
33 | #include <asm/mca_asm.h> | 34 | #include <asm/mca_asm.h> |
34 | #include <linux/init.h> | 35 | #include <linux/init.h> |
35 | #include <linux/linkage.h> | 36 | #include <linux/linkage.h> |
@@ -1093,6 +1094,19 @@ GLOBAL_ENTRY(cycle_to_cputime) | |||
1093 | END(cycle_to_cputime) | 1094 | END(cycle_to_cputime) |
1094 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | 1095 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |
1095 | 1096 | ||
1097 | GLOBAL_ENTRY(start_kernel_thread) | ||
1098 | .prologue | ||
1099 | .save rp, r0 // this is the end of the call-chain | ||
1100 | .body | ||
1101 | alloc r2 = ar.pfs, 0, 0, 2, 0 | ||
1102 | mov out0 = r9 | ||
1103 | mov out1 = r11;; | ||
1104 | br.call.sptk.many rp = kernel_thread_helper;; | ||
1105 | mov out0 = r8 | ||
1106 | br.call.sptk.many rp = sys_exit;; | ||
1107 | 1: br.sptk.few 1b // not reached | ||
1108 | END(start_kernel_thread) | ||
1109 | |||
1096 | #ifdef CONFIG_IA64_BRL_EMU | 1110 | #ifdef CONFIG_IA64_BRL_EMU |
1097 | 1111 | ||
1098 | /* | 1112 | /* |
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c index 5b7791dd396..7f4a0ed2415 100644 --- a/arch/ia64/kernel/ia64_ksyms.c +++ b/arch/ia64/kernel/ia64_ksyms.c | |||
@@ -12,7 +12,7 @@ EXPORT_SYMBOL(memset); | |||
12 | EXPORT_SYMBOL(memcpy); | 12 | EXPORT_SYMBOL(memcpy); |
13 | EXPORT_SYMBOL(strlen); | 13 | EXPORT_SYMBOL(strlen); |
14 | 14 | ||
15 | #include <asm/pgtable.h> | 15 | #include<asm/pgtable.h> |
16 | EXPORT_SYMBOL_GPL(empty_zero_page); | 16 | EXPORT_SYMBOL_GPL(empty_zero_page); |
17 | 17 | ||
18 | #include <asm/checksum.h> | 18 | #include <asm/checksum.h> |
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c index ee33c3aaa2f..b0f9afebb14 100644 --- a/arch/ia64/kernel/iosapic.c +++ b/arch/ia64/kernel/iosapic.c | |||
@@ -98,6 +98,7 @@ | |||
98 | #include <asm/machvec.h> | 98 | #include <asm/machvec.h> |
99 | #include <asm/processor.h> | 99 | #include <asm/processor.h> |
100 | #include <asm/ptrace.h> | 100 | #include <asm/ptrace.h> |
101 | #include <asm/system.h> | ||
101 | 102 | ||
102 | #undef DEBUG_INTERRUPT_ROUTING | 103 | #undef DEBUG_INTERRUPT_ROUTING |
103 | 104 | ||
@@ -147,7 +148,7 @@ static struct iosapic_intr_info { | |||
147 | unsigned char trigger : 1; /* trigger mode (see iosapic.h) */ | 148 | unsigned char trigger : 1; /* trigger mode (see iosapic.h) */ |
148 | } iosapic_intr_info[NR_IRQS]; | 149 | } iosapic_intr_info[NR_IRQS]; |
149 | 150 | ||
150 | static unsigned char pcat_compat; /* 8259 compatibility flag */ | 151 | static unsigned char pcat_compat __devinitdata; /* 8259 compatibility flag */ |
151 | 152 | ||
152 | static inline void | 153 | static inline void |
153 | iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val) | 154 | iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val) |
@@ -914,8 +915,10 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi, | |||
914 | /* | 915 | /* |
915 | * ACPI calls this when it finds an entry for a legacy ISA IRQ override. | 916 | * ACPI calls this when it finds an entry for a legacy ISA IRQ override. |
916 | */ | 917 | */ |
917 | void iosapic_override_isa_irq(unsigned int isa_irq, unsigned int gsi, | 918 | void __devinit |
918 | unsigned long polarity, unsigned long trigger) | 919 | iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, |
920 | unsigned long polarity, | ||
921 | unsigned long trigger) | ||
919 | { | 922 | { |
920 | int vector, irq; | 923 | int vector, irq; |
921 | unsigned int dest = cpu_physical_id(smp_processor_id()); | 924 | unsigned int dest = cpu_physical_id(smp_processor_id()); |
@@ -1010,7 +1013,8 @@ iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver) | |||
1010 | return 0; | 1013 | return 0; |
1011 | } | 1014 | } |
1012 | 1015 | ||
1013 | int iosapic_init(unsigned long phys_addr, unsigned int gsi_base) | 1016 | int __devinit |
1017 | iosapic_init (unsigned long phys_addr, unsigned int gsi_base) | ||
1014 | { | 1018 | { |
1015 | int num_rte, err, index; | 1019 | int num_rte, err, index; |
1016 | unsigned int isa_irq, ver; | 1020 | unsigned int isa_irq, ver; |
@@ -1067,7 +1071,9 @@ int iosapic_init(unsigned long phys_addr, unsigned int gsi_base) | |||
1067 | return 0; | 1071 | return 0; |
1068 | } | 1072 | } |
1069 | 1073 | ||
1070 | int iosapic_remove(unsigned int gsi_base) | 1074 | #ifdef CONFIG_HOTPLUG |
1075 | int | ||
1076 | iosapic_remove (unsigned int gsi_base) | ||
1071 | { | 1077 | { |
1072 | int index, err = 0; | 1078 | int index, err = 0; |
1073 | unsigned long flags; | 1079 | unsigned long flags; |
@@ -1093,9 +1099,11 @@ int iosapic_remove(unsigned int gsi_base) | |||
1093 | spin_unlock_irqrestore(&iosapic_lock, flags); | 1099 | spin_unlock_irqrestore(&iosapic_lock, flags); |
1094 | return err; | 1100 | return err; |
1095 | } | 1101 | } |
1102 | #endif /* CONFIG_HOTPLUG */ | ||
1096 | 1103 | ||
1097 | #ifdef CONFIG_NUMA | 1104 | #ifdef CONFIG_NUMA |
1098 | void map_iosapic_to_node(unsigned int gsi_base, int node) | 1105 | void __devinit |
1106 | map_iosapic_to_node(unsigned int gsi_base, int node) | ||
1099 | { | 1107 | { |
1100 | int index; | 1108 | int index; |
1101 | 1109 | ||
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c index 1034884b77d..782c3a357f2 100644 --- a/arch/ia64/kernel/irq_ia64.c +++ b/arch/ia64/kernel/irq_ia64.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/ioport.h> | 23 | #include <linux/ioport.h> |
24 | #include <linux/kernel_stat.h> | 24 | #include <linux/kernel_stat.h> |
25 | #include <linux/ptrace.h> | 25 | #include <linux/ptrace.h> |
26 | #include <linux/random.h> /* for rand_initialize_irq() */ | ||
26 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
27 | #include <linux/smp.h> | 28 | #include <linux/smp.h> |
28 | #include <linux/threads.h> | 29 | #include <linux/threads.h> |
@@ -38,6 +39,7 @@ | |||
38 | #include <asm/hw_irq.h> | 39 | #include <asm/hw_irq.h> |
39 | #include <asm/machvec.h> | 40 | #include <asm/machvec.h> |
40 | #include <asm/pgtable.h> | 41 | #include <asm/pgtable.h> |
42 | #include <asm/system.h> | ||
41 | #include <asm/tlbflush.h> | 43 | #include <asm/tlbflush.h> |
42 | 44 | ||
43 | #ifdef CONFIG_PERFMON | 45 | #ifdef CONFIG_PERFMON |
@@ -116,7 +118,7 @@ static inline int find_unassigned_vector(cpumask_t domain) | |||
116 | cpumask_t mask; | 118 | cpumask_t mask; |
117 | int pos, vector; | 119 | int pos, vector; |
118 | 120 | ||
119 | cpumask_and(&mask, &domain, cpu_online_mask); | 121 | cpus_and(mask, domain, cpu_online_map); |
120 | if (cpus_empty(mask)) | 122 | if (cpus_empty(mask)) |
121 | return -EINVAL; | 123 | return -EINVAL; |
122 | 124 | ||
@@ -139,7 +141,7 @@ static int __bind_irq_vector(int irq, int vector, cpumask_t domain) | |||
139 | BUG_ON((unsigned)irq >= NR_IRQS); | 141 | BUG_ON((unsigned)irq >= NR_IRQS); |
140 | BUG_ON((unsigned)vector >= IA64_NUM_VECTORS); | 142 | BUG_ON((unsigned)vector >= IA64_NUM_VECTORS); |
141 | 143 | ||
142 | cpumask_and(&mask, &domain, cpu_online_mask); | 144 | cpus_and(mask, domain, cpu_online_map); |
143 | if (cpus_empty(mask)) | 145 | if (cpus_empty(mask)) |
144 | return -EINVAL; | 146 | return -EINVAL; |
145 | if ((cfg->vector == vector) && cpus_equal(cfg->domain, domain)) | 147 | if ((cfg->vector == vector) && cpus_equal(cfg->domain, domain)) |
@@ -177,7 +179,7 @@ static void __clear_irq_vector(int irq) | |||
177 | BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED); | 179 | BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED); |
178 | vector = cfg->vector; | 180 | vector = cfg->vector; |
179 | domain = cfg->domain; | 181 | domain = cfg->domain; |
180 | cpumask_and(&mask, &cfg->domain, cpu_online_mask); | 182 | cpus_and(mask, cfg->domain, cpu_online_map); |
181 | for_each_cpu_mask(cpu, mask) | 183 | for_each_cpu_mask(cpu, mask) |
182 | per_cpu(vector_irq, cpu)[vector] = -1; | 184 | per_cpu(vector_irq, cpu)[vector] = -1; |
183 | cfg->vector = IRQ_VECTOR_UNASSIGNED; | 185 | cfg->vector = IRQ_VECTOR_UNASSIGNED; |
@@ -320,7 +322,7 @@ void irq_complete_move(unsigned irq) | |||
320 | if (unlikely(cpu_isset(smp_processor_id(), cfg->old_domain))) | 322 | if (unlikely(cpu_isset(smp_processor_id(), cfg->old_domain))) |
321 | return; | 323 | return; |
322 | 324 | ||
323 | cpumask_and(&cleanup_mask, &cfg->old_domain, cpu_online_mask); | 325 | cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map); |
324 | cfg->move_cleanup_count = cpus_weight(cleanup_mask); | 326 | cfg->move_cleanup_count = cpus_weight(cleanup_mask); |
325 | for_each_cpu_mask(i, cleanup_mask) | 327 | for_each_cpu_mask(i, cleanup_mask) |
326 | platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0); | 328 | platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0); |
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S index fa25689fc45..d93e396bf59 100644 --- a/arch/ia64/kernel/ivt.S +++ b/arch/ia64/kernel/ivt.S | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <asm/pgtable.h> | 54 | #include <asm/pgtable.h> |
55 | #include <asm/processor.h> | 55 | #include <asm/processor.h> |
56 | #include <asm/ptrace.h> | 56 | #include <asm/ptrace.h> |
57 | #include <asm/system.h> | ||
57 | #include <asm/thread_info.h> | 58 | #include <asm/thread_info.h> |
58 | #include <asm/unistd.h> | 59 | #include <asm/unistd.h> |
59 | #include <asm/errno.h> | 60 | #include <asm/errno.h> |
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c index 5151a649c96..3d3aeef4694 100644 --- a/arch/ia64/kernel/machine_kexec.c +++ b/arch/ia64/kernel/machine_kexec.c | |||
@@ -27,11 +27,11 @@ | |||
27 | #include <asm/sal.h> | 27 | #include <asm/sal.h> |
28 | #include <asm/mca.h> | 28 | #include <asm/mca.h> |
29 | 29 | ||
30 | typedef void (*relocate_new_kernel_t)( | 30 | typedef NORET_TYPE void (*relocate_new_kernel_t)( |
31 | unsigned long indirection_page, | 31 | unsigned long indirection_page, |
32 | unsigned long start_address, | 32 | unsigned long start_address, |
33 | struct ia64_boot_param *boot_param, | 33 | struct ia64_boot_param *boot_param, |
34 | unsigned long pal_addr) __noreturn; | 34 | unsigned long pal_addr) ATTRIB_NORET; |
35 | 35 | ||
36 | struct kimage *ia64_kimage; | 36 | struct kimage *ia64_kimage; |
37 | 37 | ||
@@ -85,13 +85,12 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg) | |||
85 | struct kimage *image = arg; | 85 | struct kimage *image = arg; |
86 | relocate_new_kernel_t rnk; | 86 | relocate_new_kernel_t rnk; |
87 | void *pal_addr = efi_get_pal_addr(); | 87 | void *pal_addr = efi_get_pal_addr(); |
88 | unsigned long code_addr; | 88 | unsigned long code_addr = (unsigned long)page_address(image->control_code_page); |
89 | int ii; | 89 | int ii; |
90 | u64 fp, gp; | 90 | u64 fp, gp; |
91 | ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump; | 91 | ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump; |
92 | 92 | ||
93 | BUG_ON(!image); | 93 | BUG_ON(!image); |
94 | code_addr = (unsigned long)page_address(image->control_code_page); | ||
95 | if (image->type == KEXEC_TYPE_CRASH) { | 94 | if (image->type == KEXEC_TYPE_CRASH) { |
96 | crash_save_this_cpu(); | 95 | crash_save_this_cpu(); |
97 | current->thread.ksp = (__u64)info->sw - 16; | 96 | current->thread.ksp = (__u64)info->sw - 16; |
@@ -158,7 +157,7 @@ void arch_crash_save_vmcoreinfo(void) | |||
158 | #endif | 157 | #endif |
159 | #ifdef CONFIG_PGTABLE_3 | 158 | #ifdef CONFIG_PGTABLE_3 |
160 | VMCOREINFO_CONFIG(PGTABLE_3); | 159 | VMCOREINFO_CONFIG(PGTABLE_3); |
161 | #elif defined(CONFIG_PGTABLE_4) | 160 | #elif CONFIG_PGTABLE_4 |
162 | VMCOREINFO_CONFIG(PGTABLE_4); | 161 | VMCOREINFO_CONFIG(PGTABLE_4); |
163 | #endif | 162 | #endif |
164 | } | 163 | } |
diff --git a/arch/ia64/kernel/machvec.c b/arch/ia64/kernel/machvec.c index f5a1e5246b3..d41a40ef80c 100644 --- a/arch/ia64/kernel/machvec.c +++ b/arch/ia64/kernel/machvec.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/module.h> | 1 | #include <linux/module.h> |
2 | #include <linux/dma-mapping.h> | 2 | #include <linux/dma-mapping.h> |
3 | #include <asm/machvec.h> | 3 | #include <asm/machvec.h> |
4 | #include <asm/system.h> | ||
4 | 5 | ||
5 | #ifdef CONFIG_IA64_GENERIC | 6 | #ifdef CONFIG_IA64_GENERIC |
6 | 7 | ||
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 65bf9cd3904..84fb405eee8 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c | |||
@@ -92,6 +92,7 @@ | |||
92 | #include <asm/meminit.h> | 92 | #include <asm/meminit.h> |
93 | #include <asm/page.h> | 93 | #include <asm/page.h> |
94 | #include <asm/ptrace.h> | 94 | #include <asm/ptrace.h> |
95 | #include <asm/system.h> | ||
95 | #include <asm/sal.h> | 96 | #include <asm/sal.h> |
96 | #include <asm/mca.h> | 97 | #include <asm/mca.h> |
97 | #include <asm/kexec.h> | 98 | #include <asm/kexec.h> |
@@ -1446,8 +1447,6 @@ out: | |||
1446 | /* Get the CMC error record and log it */ | 1447 | /* Get the CMC error record and log it */ |
1447 | ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC); | 1448 | ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC); |
1448 | 1449 | ||
1449 | local_irq_disable(); | ||
1450 | |||
1451 | return IRQ_HANDLED; | 1450 | return IRQ_HANDLED; |
1452 | } | 1451 | } |
1453 | 1452 | ||
@@ -1514,8 +1513,7 @@ static void | |||
1514 | ia64_mca_cmc_poll (unsigned long dummy) | 1513 | ia64_mca_cmc_poll (unsigned long dummy) |
1515 | { | 1514 | { |
1516 | /* Trigger a CMC interrupt cascade */ | 1515 | /* Trigger a CMC interrupt cascade */ |
1517 | platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CMCP_VECTOR, | 1516 | platform_send_ipi(first_cpu(cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0); |
1518 | IA64_IPI_DM_INT, 0); | ||
1519 | } | 1517 | } |
1520 | 1518 | ||
1521 | /* | 1519 | /* |
@@ -1591,8 +1589,7 @@ static void | |||
1591 | ia64_mca_cpe_poll (unsigned long dummy) | 1589 | ia64_mca_cpe_poll (unsigned long dummy) |
1592 | { | 1590 | { |
1593 | /* Trigger a CPE interrupt cascade */ | 1591 | /* Trigger a CPE interrupt cascade */ |
1594 | platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CPEP_VECTOR, | 1592 | platform_send_ipi(first_cpu(cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0); |
1595 | IA64_IPI_DM_INT, 0); | ||
1596 | } | 1593 | } |
1597 | 1594 | ||
1598 | #endif /* CONFIG_ACPI */ | 1595 | #endif /* CONFIG_ACPI */ |
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c index 9392e021c93..09b4d6828c4 100644 --- a/arch/ia64/kernel/mca_drv.c +++ b/arch/ia64/kernel/mca_drv.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <asm/machvec.h> | 28 | #include <asm/machvec.h> |
29 | #include <asm/page.h> | 29 | #include <asm/page.h> |
30 | #include <asm/ptrace.h> | 30 | #include <asm/ptrace.h> |
31 | #include <asm/system.h> | ||
31 | #include <asm/sal.h> | 32 | #include <asm/sal.h> |
32 | #include <asm/mca.h> | 33 | #include <asm/mca.h> |
33 | 34 | ||
@@ -158,8 +159,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr) | |||
158 | ia64_mlogbuf_dump(); | 159 | ia64_mlogbuf_dump(); |
159 | printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " | 160 | printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " |
160 | "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", | 161 | "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", |
161 | raw_smp_processor_id(), current->pid, | 162 | raw_smp_processor_id(), current->pid, current_uid(), |
162 | from_kuid(&init_user_ns, current_uid()), | ||
163 | iip, ipsr, paddr, current->comm); | 163 | iip, ipsr, paddr, current->comm); |
164 | 164 | ||
165 | spin_lock(&mca_bh_lock); | 165 | spin_lock(&mca_bh_lock); |
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c index fb2f1e62287..94e0db72d4a 100644 --- a/arch/ia64/kernel/msi_ia64.c +++ b/arch/ia64/kernel/msi_ia64.c | |||
@@ -57,7 +57,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc) | |||
57 | return irq; | 57 | return irq; |
58 | 58 | ||
59 | irq_set_msi_desc(irq, desc); | 59 | irq_set_msi_desc(irq, desc); |
60 | cpumask_and(&mask, &(irq_to_domain(irq)), cpu_online_mask); | 60 | cpus_and(mask, irq_to_domain(irq), cpu_online_map); |
61 | dest_phys_id = cpu_physical_id(first_cpu(mask)); | 61 | dest_phys_id = cpu_physical_id(first_cpu(mask)); |
62 | vector = irq_to_vector(irq); | 62 | vector = irq_to_vector(irq); |
63 | 63 | ||
@@ -179,7 +179,7 @@ msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) | |||
179 | unsigned dest; | 179 | unsigned dest; |
180 | cpumask_t mask; | 180 | cpumask_t mask; |
181 | 181 | ||
182 | cpumask_and(&mask, &(irq_to_domain(irq)), cpu_online_mask); | 182 | cpus_and(mask, irq_to_domain(irq), cpu_online_map); |
183 | dest = cpu_physical_id(first_cpu(mask)); | 183 | dest = cpu_physical_id(first_cpu(mask)); |
184 | 184 | ||
185 | msg->address_hi = 0; | 185 | msg->address_hi = 0; |
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c index 1b22f6de293..100868216c5 100644 --- a/arch/ia64/kernel/paravirt.c +++ b/arch/ia64/kernel/paravirt.c | |||
@@ -634,8 +634,8 @@ struct pv_irq_ops pv_irq_ops = { | |||
634 | * pv_time_ops | 634 | * pv_time_ops |
635 | * time operations | 635 | * time operations |
636 | */ | 636 | */ |
637 | struct static_key paravirt_steal_enabled; | 637 | struct jump_label_key paravirt_steal_enabled; |
638 | struct static_key paravirt_steal_rq_enabled; | 638 | struct jump_label_key paravirt_steal_rq_enabled; |
639 | 639 | ||
640 | static int | 640 | static int |
641 | ia64_native_do_steal_accounting(unsigned long *new_itm) | 641 | ia64_native_do_steal_accounting(unsigned long *new_itm) |
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c index 1cf09179371..68a1311db80 100644 --- a/arch/ia64/kernel/patch.c +++ b/arch/ia64/kernel/patch.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <asm/patch.h> | 11 | #include <asm/patch.h> |
12 | #include <asm/processor.h> | 12 | #include <asm/processor.h> |
13 | #include <asm/sections.h> | 13 | #include <asm/sections.h> |
14 | #include <asm/system.h> | ||
14 | #include <asm/unistd.h> | 15 | #include <asm/unistd.h> |
15 | 16 | ||
16 | /* | 17 | /* |
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c index 1ddcfe5ef35..eb117572005 100644 --- a/arch/ia64/kernel/pci-dma.c +++ b/arch/ia64/kernel/pci-dma.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/machvec.h> | 12 | #include <asm/machvec.h> |
13 | #include <linux/dma-mapping.h> | 13 | #include <linux/dma-mapping.h> |
14 | 14 | ||
15 | #include <asm/system.h> | ||
15 | 16 | ||
16 | #ifdef CONFIG_INTEL_IOMMU | 17 | #ifdef CONFIG_INTEL_IOMMU |
17 | 18 | ||
@@ -32,6 +33,7 @@ int force_iommu __read_mostly; | |||
32 | #endif | 33 | #endif |
33 | 34 | ||
34 | int iommu_pass_through; | 35 | int iommu_pass_through; |
36 | int iommu_group_mf; | ||
35 | 37 | ||
36 | /* Dummy device used for NULL arguments (normally ISA). Better would | 38 | /* Dummy device used for NULL arguments (normally ISA). Better would |
37 | be probably a smaller DMA mask, but this is bug-to-bug compatible | 39 | be probably a smaller DMA mask, but this is bug-to-bug compatible |
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c index 939260aeac9..d9485d952ed 100644 --- a/arch/ia64/kernel/pci-swiotlb.c +++ b/arch/ia64/kernel/pci-swiotlb.c | |||
@@ -15,24 +15,16 @@ int swiotlb __read_mostly; | |||
15 | EXPORT_SYMBOL(swiotlb); | 15 | EXPORT_SYMBOL(swiotlb); |
16 | 16 | ||
17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, | 17 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, |
18 | dma_addr_t *dma_handle, gfp_t gfp, | 18 | dma_addr_t *dma_handle, gfp_t gfp) |
19 | struct dma_attrs *attrs) | ||
20 | { | 19 | { |
21 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) | 20 | if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) |
22 | gfp |= GFP_DMA; | 21 | gfp |= GFP_DMA; |
23 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); | 22 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); |
24 | } | 23 | } |
25 | 24 | ||
26 | static void ia64_swiotlb_free_coherent(struct device *dev, size_t size, | ||
27 | void *vaddr, dma_addr_t dma_addr, | ||
28 | struct dma_attrs *attrs) | ||
29 | { | ||
30 | swiotlb_free_coherent(dev, size, vaddr, dma_addr); | ||
31 | } | ||
32 | |||
33 | struct dma_map_ops swiotlb_dma_ops = { | 25 | struct dma_map_ops swiotlb_dma_ops = { |
34 | .alloc = ia64_swiotlb_alloc_coherent, | 26 | .alloc_coherent = ia64_swiotlb_alloc_coherent, |
35 | .free = ia64_swiotlb_free_coherent, | 27 | .free_coherent = swiotlb_free_coherent, |
36 | .map_page = swiotlb_map_page, | 28 | .map_page = swiotlb_map_page, |
37 | .unmap_page = swiotlb_unmap_page, | 29 | .unmap_page = swiotlb_unmap_page, |
38 | .map_sg = swiotlb_map_sg_attrs, | 30 | .map_sg = swiotlb_map_sg_attrs, |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index ea39eba61ef..89accc626b8 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <asm/perfmon.h> | 49 | #include <asm/perfmon.h> |
50 | #include <asm/processor.h> | 50 | #include <asm/processor.h> |
51 | #include <asm/signal.h> | 51 | #include <asm/signal.h> |
52 | #include <asm/system.h> | ||
52 | #include <asm/uaccess.h> | 53 | #include <asm/uaccess.h> |
53 | #include <asm/delay.h> | 54 | #include <asm/delay.h> |
54 | 55 | ||
@@ -604,6 +605,18 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f) | |||
604 | spin_unlock(&(x)->ctx_lock); | 605 | spin_unlock(&(x)->ctx_lock); |
605 | } | 606 | } |
606 | 607 | ||
608 | static inline unsigned int | ||
609 | pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct) | ||
610 | { | ||
611 | return do_munmap(mm, addr, len); | ||
612 | } | ||
613 | |||
614 | static inline unsigned long | ||
615 | pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) | ||
616 | { | ||
617 | return get_unmapped_area(file, addr, len, pgoff, flags); | ||
618 | } | ||
619 | |||
607 | /* forward declaration */ | 620 | /* forward declaration */ |
608 | static const struct dentry_operations pfmfs_dentry_operations; | 621 | static const struct dentry_operations pfmfs_dentry_operations; |
609 | 622 | ||
@@ -1446,9 +1459,8 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu) | |||
1446 | * a PROTECT_CTX() section. | 1459 | * a PROTECT_CTX() section. |
1447 | */ | 1460 | */ |
1448 | static int | 1461 | static int |
1449 | pfm_remove_smpl_mapping(void *vaddr, unsigned long size) | 1462 | pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) |
1450 | { | 1463 | { |
1451 | struct task_struct *task = current; | ||
1452 | int r; | 1464 | int r; |
1453 | 1465 | ||
1454 | /* sanity checks */ | 1466 | /* sanity checks */ |
@@ -1462,8 +1474,13 @@ pfm_remove_smpl_mapping(void *vaddr, unsigned long size) | |||
1462 | /* | 1474 | /* |
1463 | * does the actual unmapping | 1475 | * does the actual unmapping |
1464 | */ | 1476 | */ |
1465 | r = vm_munmap((unsigned long)vaddr, size); | 1477 | down_write(&task->mm->mmap_sem); |
1478 | |||
1479 | DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size)); | ||
1480 | |||
1481 | r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0); | ||
1466 | 1482 | ||
1483 | up_write(&task->mm->mmap_sem); | ||
1467 | if (r !=0) { | 1484 | if (r !=0) { |
1468 | printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); | 1485 | printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); |
1469 | } | 1486 | } |
@@ -1929,7 +1946,7 @@ pfm_flush(struct file *filp, fl_owner_t id) | |||
1929 | * because some VM function reenables interrupts. | 1946 | * because some VM function reenables interrupts. |
1930 | * | 1947 | * |
1931 | */ | 1948 | */ |
1932 | if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size); | 1949 | if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); |
1933 | 1950 | ||
1934 | return 0; | 1951 | return 0; |
1935 | } | 1952 | } |
@@ -2211,7 +2228,7 @@ pfm_alloc_file(pfm_context_t *ctx) | |||
2211 | /* | 2228 | /* |
2212 | * allocate a new dcache entry | 2229 | * allocate a new dcache entry |
2213 | */ | 2230 | */ |
2214 | path.dentry = d_alloc(pfmfs_mnt->mnt_root, &this); | 2231 | path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this); |
2215 | if (!path.dentry) { | 2232 | if (!path.dentry) { |
2216 | iput(inode); | 2233 | iput(inode); |
2217 | return ERR_PTR(-ENOMEM); | 2234 | return ERR_PTR(-ENOMEM); |
@@ -2306,8 +2323,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2306 | * partially initialize the vma for the sampling buffer | 2323 | * partially initialize the vma for the sampling buffer |
2307 | */ | 2324 | */ |
2308 | vma->vm_mm = mm; | 2325 | vma->vm_mm = mm; |
2309 | vma->vm_file = get_file(filp); | 2326 | vma->vm_file = filp; |
2310 | vma->vm_flags = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP; | 2327 | vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED; |
2311 | vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ | 2328 | vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ |
2312 | 2329 | ||
2313 | /* | 2330 | /* |
@@ -2327,8 +2344,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2327 | down_write(&task->mm->mmap_sem); | 2344 | down_write(&task->mm->mmap_sem); |
2328 | 2345 | ||
2329 | /* find some free area in address space, must have mmap sem held */ | 2346 | /* find some free area in address space, must have mmap sem held */ |
2330 | vma->vm_start = get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS); | 2347 | vma->vm_start = pfm_get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS, 0); |
2331 | if (IS_ERR_VALUE(vma->vm_start)) { | 2348 | if (vma->vm_start == 0UL) { |
2332 | DPRINT(("Cannot find unmapped area for size %ld\n", size)); | 2349 | DPRINT(("Cannot find unmapped area for size %ld\n", size)); |
2333 | up_write(&task->mm->mmap_sem); | 2350 | up_write(&task->mm->mmap_sem); |
2334 | goto error; | 2351 | goto error; |
@@ -2345,12 +2362,15 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
2345 | goto error; | 2362 | goto error; |
2346 | } | 2363 | } |
2347 | 2364 | ||
2365 | get_file(filp); | ||
2366 | |||
2348 | /* | 2367 | /* |
2349 | * now insert the vma in the vm list for the process, must be | 2368 | * now insert the vma in the vm list for the process, must be |
2350 | * done with mmap lock held | 2369 | * done with mmap lock held |
2351 | */ | 2370 | */ |
2352 | insert_vm_struct(mm, vma); | 2371 | insert_vm_struct(mm, vma); |
2353 | 2372 | ||
2373 | mm->total_vm += size >> PAGE_SHIFT; | ||
2354 | vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, | 2374 | vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, |
2355 | vma_pages(vma)); | 2375 | vma_pages(vma)); |
2356 | up_write(&task->mm->mmap_sem); | 2376 | up_write(&task->mm->mmap_sem); |
@@ -2378,8 +2398,8 @@ static int | |||
2378 | pfm_bad_permissions(struct task_struct *task) | 2398 | pfm_bad_permissions(struct task_struct *task) |
2379 | { | 2399 | { |
2380 | const struct cred *tcred; | 2400 | const struct cred *tcred; |
2381 | kuid_t uid = current_uid(); | 2401 | uid_t uid = current_uid(); |
2382 | kgid_t gid = current_gid(); | 2402 | gid_t gid = current_gid(); |
2383 | int ret; | 2403 | int ret; |
2384 | 2404 | ||
2385 | rcu_read_lock(); | 2405 | rcu_read_lock(); |
@@ -2387,20 +2407,20 @@ pfm_bad_permissions(struct task_struct *task) | |||
2387 | 2407 | ||
2388 | /* inspired by ptrace_attach() */ | 2408 | /* inspired by ptrace_attach() */ |
2389 | DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", | 2409 | DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", |
2390 | from_kuid(&init_user_ns, uid), | 2410 | uid, |
2391 | from_kgid(&init_user_ns, gid), | 2411 | gid, |
2392 | from_kuid(&init_user_ns, tcred->euid), | 2412 | tcred->euid, |
2393 | from_kuid(&init_user_ns, tcred->suid), | 2413 | tcred->suid, |
2394 | from_kuid(&init_user_ns, tcred->uid), | 2414 | tcred->uid, |
2395 | from_kgid(&init_user_ns, tcred->egid), | 2415 | tcred->egid, |
2396 | from_kgid(&init_user_ns, tcred->sgid))); | 2416 | tcred->sgid)); |
2397 | 2417 | ||
2398 | ret = ((!uid_eq(uid, tcred->euid)) | 2418 | ret = ((uid != tcred->euid) |
2399 | || (!uid_eq(uid, tcred->suid)) | 2419 | || (uid != tcred->suid) |
2400 | || (!uid_eq(uid, tcred->uid)) | 2420 | || (uid != tcred->uid) |
2401 | || (!gid_eq(gid, tcred->egid)) | 2421 | || (gid != tcred->egid) |
2402 | || (!gid_eq(gid, tcred->sgid)) | 2422 | || (gid != tcred->sgid) |
2403 | || (!gid_eq(gid, tcred->gid))) && !capable(CAP_SYS_PTRACE); | 2423 | || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE); |
2404 | 2424 | ||
2405 | rcu_read_unlock(); | 2425 | rcu_read_unlock(); |
2406 | return ret; | 2426 | return ret; |
@@ -4780,7 +4800,7 @@ recheck: | |||
4780 | asmlinkage long | 4800 | asmlinkage long |
4781 | sys_perfmonctl (int fd, int cmd, void __user *arg, int count) | 4801 | sys_perfmonctl (int fd, int cmd, void __user *arg, int count) |
4782 | { | 4802 | { |
4783 | struct fd f = {NULL, 0}; | 4803 | struct file *file = NULL; |
4784 | pfm_context_t *ctx = NULL; | 4804 | pfm_context_t *ctx = NULL; |
4785 | unsigned long flags = 0UL; | 4805 | unsigned long flags = 0UL; |
4786 | void *args_k = NULL; | 4806 | void *args_k = NULL; |
@@ -4877,17 +4897,17 @@ restart_args: | |||
4877 | 4897 | ||
4878 | ret = -EBADF; | 4898 | ret = -EBADF; |
4879 | 4899 | ||
4880 | f = fdget(fd); | 4900 | file = fget(fd); |
4881 | if (unlikely(f.file == NULL)) { | 4901 | if (unlikely(file == NULL)) { |
4882 | DPRINT(("invalid fd %d\n", fd)); | 4902 | DPRINT(("invalid fd %d\n", fd)); |
4883 | goto error_args; | 4903 | goto error_args; |
4884 | } | 4904 | } |
4885 | if (unlikely(PFM_IS_FILE(f.file) == 0)) { | 4905 | if (unlikely(PFM_IS_FILE(file) == 0)) { |
4886 | DPRINT(("fd %d not related to perfmon\n", fd)); | 4906 | DPRINT(("fd %d not related to perfmon\n", fd)); |
4887 | goto error_args; | 4907 | goto error_args; |
4888 | } | 4908 | } |
4889 | 4909 | ||
4890 | ctx = f.file->private_data; | 4910 | ctx = file->private_data; |
4891 | if (unlikely(ctx == NULL)) { | 4911 | if (unlikely(ctx == NULL)) { |
4892 | DPRINT(("no context for fd %d\n", fd)); | 4912 | DPRINT(("no context for fd %d\n", fd)); |
4893 | goto error_args; | 4913 | goto error_args; |
@@ -4917,8 +4937,8 @@ abort_locked: | |||
4917 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; | 4937 | if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; |
4918 | 4938 | ||
4919 | error_args: | 4939 | error_args: |
4920 | if (f.file) | 4940 | if (file) |
4921 | fdput(f); | 4941 | fput(file); |
4922 | 4942 | ||
4923 | kfree(args_k); | 4943 | kfree(args_k); |
4924 | 4944 | ||
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 31360cbbd5f..6d33c5cc94f 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/kdebug.h> | 29 | #include <linux/kdebug.h> |
30 | #include <linux/utsname.h> | 30 | #include <linux/utsname.h> |
31 | #include <linux/tracehook.h> | 31 | #include <linux/tracehook.h> |
32 | #include <linux/rcupdate.h> | ||
33 | 32 | ||
34 | #include <asm/cpu.h> | 33 | #include <asm/cpu.h> |
35 | #include <asm/delay.h> | 34 | #include <asm/delay.h> |
@@ -39,7 +38,6 @@ | |||
39 | #include <asm/pgalloc.h> | 38 | #include <asm/pgalloc.h> |
40 | #include <asm/processor.h> | 39 | #include <asm/processor.h> |
41 | #include <asm/sal.h> | 40 | #include <asm/sal.h> |
42 | #include <asm/switch_to.h> | ||
43 | #include <asm/tlbflush.h> | 41 | #include <asm/tlbflush.h> |
44 | #include <asm/uaccess.h> | 42 | #include <asm/uaccess.h> |
45 | #include <asm/unwind.h> | 43 | #include <asm/unwind.h> |
@@ -197,9 +195,11 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall) | |||
197 | ia64_do_signal(scr, in_syscall); | 195 | ia64_do_signal(scr, in_syscall); |
198 | } | 196 | } |
199 | 197 | ||
200 | if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { | 198 | if (test_thread_flag(TIF_NOTIFY_RESUME)) { |
201 | local_irq_enable(); /* force interrupt enable */ | 199 | clear_thread_flag(TIF_NOTIFY_RESUME); |
202 | tracehook_notify_resume(&scr->pt); | 200 | tracehook_notify_resume(&scr->pt); |
201 | if (current->replacement_session_keyring) | ||
202 | key_replace_session_keyring(); | ||
203 | } | 203 | } |
204 | 204 | ||
205 | /* copy user rbs to kernel rbs */ | 205 | /* copy user rbs to kernel rbs */ |
@@ -272,6 +272,26 @@ static inline void play_dead(void) | |||
272 | } | 272 | } |
273 | #endif /* CONFIG_HOTPLUG_CPU */ | 273 | #endif /* CONFIG_HOTPLUG_CPU */ |
274 | 274 | ||
275 | static void do_nothing(void *unused) | ||
276 | { | ||
277 | } | ||
278 | |||
279 | /* | ||
280 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of | ||
281 | * pm_idle and update to new pm_idle value. Required while changing pm_idle | ||
282 | * handler on SMP systems. | ||
283 | * | ||
284 | * Caller must have changed pm_idle to the new value before the call. Old | ||
285 | * pm_idle value will not be used by any CPU after the return of this function. | ||
286 | */ | ||
287 | void cpu_idle_wait(void) | ||
288 | { | ||
289 | smp_mb(); | ||
290 | /* kick all the CPUs so that they exit out of pm_idle */ | ||
291 | smp_call_function(do_nothing, NULL, 1); | ||
292 | } | ||
293 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
294 | |||
275 | void __attribute__((noreturn)) | 295 | void __attribute__((noreturn)) |
276 | cpu_idle (void) | 296 | cpu_idle (void) |
277 | { | 297 | { |
@@ -280,7 +300,6 @@ cpu_idle (void) | |||
280 | 300 | ||
281 | /* endless idle loop with no priority at all */ | 301 | /* endless idle loop with no priority at all */ |
282 | while (1) { | 302 | while (1) { |
283 | rcu_idle_enter(); | ||
284 | if (can_do_pal_halt) { | 303 | if (can_do_pal_halt) { |
285 | current_thread_info()->status &= ~TS_POLLING; | 304 | current_thread_info()->status &= ~TS_POLLING; |
286 | /* | 305 | /* |
@@ -311,8 +330,9 @@ cpu_idle (void) | |||
311 | normal_xtp(); | 330 | normal_xtp(); |
312 | #endif | 331 | #endif |
313 | } | 332 | } |
314 | rcu_idle_exit(); | 333 | preempt_enable_no_resched(); |
315 | schedule_preempt_disabled(); | 334 | schedule(); |
335 | preempt_disable(); | ||
316 | check_pgt_cache(); | 336 | check_pgt_cache(); |
317 | if (cpu_is_offline(cpu)) | 337 | if (cpu_is_offline(cpu)) |
318 | play_dead(); | 338 | play_dead(); |
@@ -393,24 +413,72 @@ ia64_load_extra (struct task_struct *task) | |||
393 | int | 413 | int |
394 | copy_thread(unsigned long clone_flags, | 414 | copy_thread(unsigned long clone_flags, |
395 | unsigned long user_stack_base, unsigned long user_stack_size, | 415 | unsigned long user_stack_base, unsigned long user_stack_size, |
396 | struct task_struct *p) | 416 | struct task_struct *p, struct pt_regs *regs) |
397 | { | 417 | { |
398 | extern char ia64_ret_from_clone; | 418 | extern char ia64_ret_from_clone; |
399 | struct switch_stack *child_stack, *stack; | 419 | struct switch_stack *child_stack, *stack; |
400 | unsigned long rbs, child_rbs, rbs_size; | 420 | unsigned long rbs, child_rbs, rbs_size; |
401 | struct pt_regs *child_ptregs; | 421 | struct pt_regs *child_ptregs; |
402 | struct pt_regs *regs = current_pt_regs(); | ||
403 | int retval = 0; | 422 | int retval = 0; |
404 | 423 | ||
424 | #ifdef CONFIG_SMP | ||
425 | /* | ||
426 | * For SMP idle threads, fork_by_hand() calls do_fork with | ||
427 | * NULL regs. | ||
428 | */ | ||
429 | if (!regs) | ||
430 | return 0; | ||
431 | #endif | ||
432 | |||
433 | stack = ((struct switch_stack *) regs) - 1; | ||
434 | |||
405 | child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1; | 435 | child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1; |
406 | child_stack = (struct switch_stack *) child_ptregs - 1; | 436 | child_stack = (struct switch_stack *) child_ptregs - 1; |
407 | 437 | ||
438 | /* copy parent's switch_stack & pt_regs to child: */ | ||
439 | memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack)); | ||
440 | |||
408 | rbs = (unsigned long) current + IA64_RBS_OFFSET; | 441 | rbs = (unsigned long) current + IA64_RBS_OFFSET; |
409 | child_rbs = (unsigned long) p + IA64_RBS_OFFSET; | 442 | child_rbs = (unsigned long) p + IA64_RBS_OFFSET; |
443 | rbs_size = stack->ar_bspstore - rbs; | ||
444 | |||
445 | /* copy the parent's register backing store to the child: */ | ||
446 | memcpy((void *) child_rbs, (void *) rbs, rbs_size); | ||
447 | |||
448 | if (likely(user_mode(child_ptregs))) { | ||
449 | if (clone_flags & CLONE_SETTLS) | ||
450 | child_ptregs->r13 = regs->r16; /* see sys_clone2() in entry.S */ | ||
451 | if (user_stack_base) { | ||
452 | child_ptregs->r12 = user_stack_base + user_stack_size - 16; | ||
453 | child_ptregs->ar_bspstore = user_stack_base; | ||
454 | child_ptregs->ar_rnat = 0; | ||
455 | child_ptregs->loadrs = 0; | ||
456 | } | ||
457 | } else { | ||
458 | /* | ||
459 | * Note: we simply preserve the relative position of | ||
460 | * the stack pointer here. There is no need to | ||
461 | * allocate a scratch area here, since that will have | ||
462 | * been taken care of by the caller of sys_clone() | ||
463 | * already. | ||
464 | */ | ||
465 | child_ptregs->r12 = (unsigned long) child_ptregs - 16; /* kernel sp */ | ||
466 | child_ptregs->r13 = (unsigned long) p; /* set `current' pointer */ | ||
467 | } | ||
468 | child_stack->ar_bspstore = child_rbs + rbs_size; | ||
469 | child_stack->b0 = (unsigned long) &ia64_ret_from_clone; | ||
410 | 470 | ||
411 | /* copy parts of thread_struct: */ | 471 | /* copy parts of thread_struct: */ |
412 | p->thread.ksp = (unsigned long) child_stack - 16; | 472 | p->thread.ksp = (unsigned long) child_stack - 16; |
413 | 473 | ||
474 | /* stop some PSR bits from being inherited. | ||
475 | * the psr.up/psr.pp bits must be cleared on fork but inherited on execve() | ||
476 | * therefore we must specify them explicitly here and not include them in | ||
477 | * IA64_PSR_BITS_TO_CLEAR. | ||
478 | */ | ||
479 | child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET) | ||
480 | & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP)); | ||
481 | |||
414 | /* | 482 | /* |
415 | * NOTE: The calling convention considers all floating point | 483 | * NOTE: The calling convention considers all floating point |
416 | * registers in the high partition (fph) to be scratch. Since | 484 | * registers in the high partition (fph) to be scratch. Since |
@@ -432,66 +500,8 @@ copy_thread(unsigned long clone_flags, | |||
432 | # define THREAD_FLAGS_TO_SET 0 | 500 | # define THREAD_FLAGS_TO_SET 0 |
433 | p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR) | 501 | p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR) |
434 | | THREAD_FLAGS_TO_SET); | 502 | | THREAD_FLAGS_TO_SET); |
435 | |||
436 | ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */ | 503 | ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */ |
437 | 504 | ||
438 | if (unlikely(p->flags & PF_KTHREAD)) { | ||
439 | if (unlikely(!user_stack_base)) { | ||
440 | /* fork_idle() called us */ | ||
441 | return 0; | ||
442 | } | ||
443 | memset(child_stack, 0, sizeof(*child_ptregs) + sizeof(*child_stack)); | ||
444 | child_stack->r4 = user_stack_base; /* payload */ | ||
445 | child_stack->r5 = user_stack_size; /* argument */ | ||
446 | /* | ||
447 | * Preserve PSR bits, except for bits 32-34 and 37-45, | ||
448 | * which we can't read. | ||
449 | */ | ||
450 | child_ptregs->cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN; | ||
451 | /* mark as valid, empty frame */ | ||
452 | child_ptregs->cr_ifs = 1UL << 63; | ||
453 | child_stack->ar_fpsr = child_ptregs->ar_fpsr | ||
454 | = ia64_getreg(_IA64_REG_AR_FPSR); | ||
455 | child_stack->pr = (1 << PRED_KERNEL_STACK); | ||
456 | child_stack->ar_bspstore = child_rbs; | ||
457 | child_stack->b0 = (unsigned long) &ia64_ret_from_clone; | ||
458 | |||
459 | /* stop some PSR bits from being inherited. | ||
460 | * the psr.up/psr.pp bits must be cleared on fork but inherited on execve() | ||
461 | * therefore we must specify them explicitly here and not include them in | ||
462 | * IA64_PSR_BITS_TO_CLEAR. | ||
463 | */ | ||
464 | child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET) | ||
465 | & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP)); | ||
466 | |||
467 | return 0; | ||
468 | } | ||
469 | stack = ((struct switch_stack *) regs) - 1; | ||
470 | /* copy parent's switch_stack & pt_regs to child: */ | ||
471 | memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack)); | ||
472 | |||
473 | /* copy the parent's register backing store to the child: */ | ||
474 | rbs_size = stack->ar_bspstore - rbs; | ||
475 | memcpy((void *) child_rbs, (void *) rbs, rbs_size); | ||
476 | if (clone_flags & CLONE_SETTLS) | ||
477 | child_ptregs->r13 = regs->r16; /* see sys_clone2() in entry.S */ | ||
478 | if (user_stack_base) { | ||
479 | child_ptregs->r12 = user_stack_base + user_stack_size - 16; | ||
480 | child_ptregs->ar_bspstore = user_stack_base; | ||
481 | child_ptregs->ar_rnat = 0; | ||
482 | child_ptregs->loadrs = 0; | ||
483 | } | ||
484 | child_stack->ar_bspstore = child_rbs + rbs_size; | ||
485 | child_stack->b0 = (unsigned long) &ia64_ret_from_clone; | ||
486 | |||
487 | /* stop some PSR bits from being inherited. | ||
488 | * the psr.up/psr.pp bits must be cleared on fork but inherited on execve() | ||
489 | * therefore we must specify them explicitly here and not include them in | ||
490 | * IA64_PSR_BITS_TO_CLEAR. | ||
491 | */ | ||
492 | child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET) | ||
493 | & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP)); | ||
494 | |||
495 | #ifdef CONFIG_PERFMON | 505 | #ifdef CONFIG_PERFMON |
496 | if (current->thread.pfm_context) | 506 | if (current->thread.pfm_context) |
497 | pfm_inherit(p, child_ptregs); | 507 | pfm_inherit(p, child_ptregs); |
@@ -618,6 +628,57 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst) | |||
618 | return 1; /* f0-f31 are always valid so we always return 1 */ | 628 | return 1; /* f0-f31 are always valid so we always return 1 */ |
619 | } | 629 | } |
620 | 630 | ||
631 | long | ||
632 | sys_execve (const char __user *filename, | ||
633 | const char __user *const __user *argv, | ||
634 | const char __user *const __user *envp, | ||
635 | struct pt_regs *regs) | ||
636 | { | ||
637 | char *fname; | ||
638 | int error; | ||
639 | |||
640 | fname = getname(filename); | ||
641 | error = PTR_ERR(fname); | ||
642 | if (IS_ERR(fname)) | ||
643 | goto out; | ||
644 | error = do_execve(fname, argv, envp, regs); | ||
645 | putname(fname); | ||
646 | out: | ||
647 | return error; | ||
648 | } | ||
649 | |||
650 | pid_t | ||
651 | kernel_thread (int (*fn)(void *), void *arg, unsigned long flags) | ||
652 | { | ||
653 | extern void start_kernel_thread (void); | ||
654 | unsigned long *helper_fptr = (unsigned long *) &start_kernel_thread; | ||
655 | struct { | ||
656 | struct switch_stack sw; | ||
657 | struct pt_regs pt; | ||
658 | } regs; | ||
659 | |||
660 | memset(®s, 0, sizeof(regs)); | ||
661 | regs.pt.cr_iip = helper_fptr[0]; /* set entry point (IP) */ | ||
662 | regs.pt.r1 = helper_fptr[1]; /* set GP */ | ||
663 | regs.pt.r9 = (unsigned long) fn; /* 1st argument */ | ||
664 | regs.pt.r11 = (unsigned long) arg; /* 2nd argument */ | ||
665 | /* Preserve PSR bits, except for bits 32-34 and 37-45, which we can't read. */ | ||
666 | regs.pt.cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN; | ||
667 | regs.pt.cr_ifs = 1UL << 63; /* mark as valid, empty frame */ | ||
668 | regs.sw.ar_fpsr = regs.pt.ar_fpsr = ia64_getreg(_IA64_REG_AR_FPSR); | ||
669 | regs.sw.ar_bspstore = (unsigned long) current + IA64_RBS_OFFSET; | ||
670 | regs.sw.pr = (1 << PRED_KERNEL_STACK); | ||
671 | return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s.pt, 0, NULL, NULL); | ||
672 | } | ||
673 | EXPORT_SYMBOL(kernel_thread); | ||
674 | |||
675 | /* This gets called from kernel_thread() via ia64_invoke_thread_helper(). */ | ||
676 | int | ||
677 | kernel_thread_helper (int (*fn)(void *), void *arg) | ||
678 | { | ||
679 | return (*fn)(arg); | ||
680 | } | ||
681 | |||
621 | /* | 682 | /* |
622 | * Flush thread state. This is called when a thread does an execve(). | 683 | * Flush thread state. This is called when a thread does an execve(). |
623 | */ | 684 | */ |
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 4265ff64219..8848f43d819 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
27 | #include <asm/ptrace_offsets.h> | 27 | #include <asm/ptrace_offsets.h> |
28 | #include <asm/rse.h> | 28 | #include <asm/rse.h> |
29 | #include <asm/system.h> | ||
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
30 | #include <asm/unwind.h> | 31 | #include <asm/unwind.h> |
31 | #ifdef CONFIG_PERFMON | 32 | #ifdef CONFIG_PERFMON |
@@ -1245,8 +1246,15 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3, | |||
1245 | if (test_thread_flag(TIF_RESTORE_RSE)) | 1246 | if (test_thread_flag(TIF_RESTORE_RSE)) |
1246 | ia64_sync_krbs(); | 1247 | ia64_sync_krbs(); |
1247 | 1248 | ||
1249 | if (unlikely(current->audit_context)) { | ||
1250 | long syscall; | ||
1251 | int arch; | ||
1248 | 1252 | ||
1249 | audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3); | 1253 | syscall = regs.r15; |
1254 | arch = AUDIT_ARCH_IA64; | ||
1255 | |||
1256 | audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3); | ||
1257 | } | ||
1250 | 1258 | ||
1251 | return 0; | 1259 | return 0; |
1252 | } | 1260 | } |
@@ -1260,7 +1268,14 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3, | |||
1260 | { | 1268 | { |
1261 | int step; | 1269 | int step; |
1262 | 1270 | ||
1263 | audit_syscall_exit(®s); | 1271 | if (unlikely(current->audit_context)) { |
1272 | int success = AUDITSC_RESULT(regs.r10); | ||
1273 | long result = regs.r8; | ||
1274 | |||
1275 | if (success != AUDITSC_SUCCESS) | ||
1276 | result = -result; | ||
1277 | audit_syscall_exit(success, result); | ||
1278 | } | ||
1264 | 1279 | ||
1265 | step = test_thread_flag(TIF_SINGLESTEP); | 1280 | step = test_thread_flag(TIF_SINGLESTEP); |
1266 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) | 1281 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) |
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index aaefd9b94f2..5e2c72498c5 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <asm/sections.h> | 59 | #include <asm/sections.h> |
60 | #include <asm/setup.h> | 60 | #include <asm/setup.h> |
61 | #include <asm/smp.h> | 61 | #include <asm/smp.h> |
62 | #include <asm/system.h> | ||
62 | #include <asm/tlbflush.h> | 63 | #include <asm/tlbflush.h> |
63 | #include <asm/unistd.h> | 64 | #include <asm/unistd.h> |
64 | #include <asm/hpsim.h> | 65 | #include <asm/hpsim.h> |
@@ -219,23 +220,6 @@ sort_regions (struct rsvd_region *rsvd_region, int max) | |||
219 | } | 220 | } |
220 | } | 221 | } |
221 | 222 | ||
222 | /* merge overlaps */ | ||
223 | static int __init | ||
224 | merge_regions (struct rsvd_region *rsvd_region, int max) | ||
225 | { | ||
226 | int i; | ||
227 | for (i = 1; i < max; ++i) { | ||
228 | if (rsvd_region[i].start >= rsvd_region[i-1].end) | ||
229 | continue; | ||
230 | if (rsvd_region[i].end > rsvd_region[i-1].end) | ||
231 | rsvd_region[i-1].end = rsvd_region[i].end; | ||
232 | --max; | ||
233 | memmove(&rsvd_region[i], &rsvd_region[i+1], | ||
234 | (max - i) * sizeof(struct rsvd_region)); | ||
235 | } | ||
236 | return max; | ||
237 | } | ||
238 | |||
239 | /* | 223 | /* |
240 | * Request address space for all standard resources | 224 | * Request address space for all standard resources |
241 | */ | 225 | */ |
@@ -286,7 +270,6 @@ static void __init setup_crashkernel(unsigned long total, int *n) | |||
286 | if (ret == 0 && size > 0) { | 270 | if (ret == 0 && size > 0) { |
287 | if (!base) { | 271 | if (!base) { |
288 | sort_regions(rsvd_region, *n); | 272 | sort_regions(rsvd_region, *n); |
289 | *n = merge_regions(rsvd_region, *n); | ||
290 | base = kdump_find_rsvd_region(size, | 273 | base = kdump_find_rsvd_region(size, |
291 | rsvd_region, *n); | 274 | rsvd_region, *n); |
292 | } | 275 | } |
@@ -390,7 +373,6 @@ reserve_memory (void) | |||
390 | BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n); | 373 | BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n); |
391 | 374 | ||
392 | sort_regions(rsvd_region, num_rsvd_regions); | 375 | sort_regions(rsvd_region, num_rsvd_regions); |
393 | num_rsvd_regions = merge_regions(rsvd_region, num_rsvd_regions); | ||
394 | } | 376 | } |
395 | 377 | ||
396 | 378 | ||
@@ -485,7 +467,7 @@ mark_bsp_online (void) | |||
485 | { | 467 | { |
486 | #ifdef CONFIG_SMP | 468 | #ifdef CONFIG_SMP |
487 | /* If we register an early console, allow CPU 0 to printk */ | 469 | /* If we register an early console, allow CPU 0 to printk */ |
488 | set_cpu_online(smp_processor_id(), true); | 470 | cpu_set(smp_processor_id(), cpu_online_map); |
489 | #endif | 471 | #endif |
490 | } | 472 | } |
491 | 473 | ||
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 680b73786be..7bdafc8788b 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #define DEBUG_SIG 0 | 31 | #define DEBUG_SIG 0 |
32 | #define STACK_ALIGN 16 /* minimal alignment for stack pointer */ | 32 | #define STACK_ALIGN 16 /* minimal alignment for stack pointer */ |
33 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
33 | 34 | ||
34 | #if _NSIG_WORDS > 1 | 35 | #if _NSIG_WORDS > 1 |
35 | # define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) | 36 | # define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) |
@@ -199,7 +200,14 @@ ia64_rt_sigreturn (struct sigscratch *scr) | |||
199 | if (GET_SIGSET(&set, &sc->sc_mask)) | 200 | if (GET_SIGSET(&set, &sc->sc_mask)) |
200 | goto give_sigsegv; | 201 | goto give_sigsegv; |
201 | 202 | ||
202 | set_current_blocked(&set); | 203 | sigdelsetmask(&set, ~_BLOCKABLE); |
204 | |||
205 | spin_lock_irq(¤t->sighand->siglock); | ||
206 | { | ||
207 | current->blocked = set; | ||
208 | recalc_sigpending(); | ||
209 | } | ||
210 | spin_unlock_irq(¤t->sighand->siglock); | ||
203 | 211 | ||
204 | if (restore_sigcontext(sc, scr)) | 212 | if (restore_sigcontext(sc, scr)) |
205 | goto give_sigsegv; | 213 | goto give_sigsegv; |
@@ -220,7 +228,7 @@ ia64_rt_sigreturn (struct sigscratch *scr) | |||
220 | si.si_errno = 0; | 228 | si.si_errno = 0; |
221 | si.si_code = SI_KERNEL; | 229 | si.si_code = SI_KERNEL; |
222 | si.si_pid = task_pid_vnr(current); | 230 | si.si_pid = task_pid_vnr(current); |
223 | si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); | 231 | si.si_uid = current_uid(); |
224 | si.si_addr = sc; | 232 | si.si_addr = sc; |
225 | force_sig_info(SIGSEGV, &si, current); | 233 | force_sig_info(SIGSEGV, &si, current); |
226 | return retval; | 234 | return retval; |
@@ -317,7 +325,7 @@ force_sigsegv_info (int sig, void __user *addr) | |||
317 | si.si_errno = 0; | 325 | si.si_errno = 0; |
318 | si.si_code = SI_KERNEL; | 326 | si.si_code = SI_KERNEL; |
319 | si.si_pid = task_pid_vnr(current); | 327 | si.si_pid = task_pid_vnr(current); |
320 | si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); | 328 | si.si_uid = current_uid(); |
321 | si.si_addr = addr; | 329 | si.si_addr = addr; |
322 | force_sig_info(SIGSEGV, &si, current); | 330 | force_sig_info(SIGSEGV, &si, current); |
323 | return 0; | 331 | return 0; |
@@ -413,13 +421,23 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set, | |||
413 | } | 421 | } |
414 | 422 | ||
415 | static long | 423 | static long |
416 | handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 424 | handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *oldset, |
417 | struct sigscratch *scr) | 425 | struct sigscratch *scr) |
418 | { | 426 | { |
419 | if (!setup_frame(sig, ka, info, sigmask_to_save(), scr)) | 427 | if (!setup_frame(sig, ka, info, oldset, scr)) |
420 | return 0; | 428 | return 0; |
421 | 429 | ||
422 | signal_delivered(sig, info, ka, &scr->pt, | 430 | spin_lock_irq(¤t->sighand->siglock); |
431 | sigorsets(¤t->blocked, ¤t->blocked, &ka->sa.sa_mask); | ||
432 | if (!(ka->sa.sa_flags & SA_NODEFER)) | ||
433 | sigaddset(¤t->blocked, sig); | ||
434 | recalc_sigpending(); | ||
435 | spin_unlock_irq(¤t->sighand->siglock); | ||
436 | |||
437 | /* | ||
438 | * Let tracing know that we've done the handler setup. | ||
439 | */ | ||
440 | tracehook_signal_handler(sig, info, ka, &scr->pt, | ||
423 | test_thread_flag(TIF_SINGLESTEP)); | 441 | test_thread_flag(TIF_SINGLESTEP)); |
424 | 442 | ||
425 | return 1; | 443 | return 1; |
@@ -433,11 +451,25 @@ void | |||
433 | ia64_do_signal (struct sigscratch *scr, long in_syscall) | 451 | ia64_do_signal (struct sigscratch *scr, long in_syscall) |
434 | { | 452 | { |
435 | struct k_sigaction ka; | 453 | struct k_sigaction ka; |
454 | sigset_t *oldset; | ||
436 | siginfo_t info; | 455 | siginfo_t info; |
437 | long restart = in_syscall; | 456 | long restart = in_syscall; |
438 | long errno = scr->pt.r8; | 457 | long errno = scr->pt.r8; |
439 | 458 | ||
440 | /* | 459 | /* |
460 | * In the ia64_leave_kernel code path, we want the common case to go fast, which | ||
461 | * is why we may in certain cases get here from kernel mode. Just return without | ||
462 | * doing anything if so. | ||
463 | */ | ||
464 | if (!user_mode(&scr->pt)) | ||
465 | return; | ||
466 | |||
467 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) | ||
468 | oldset = ¤t->saved_sigmask; | ||
469 | else | ||
470 | oldset = ¤t->blocked; | ||
471 | |||
472 | /* | ||
441 | * This only loops in the rare cases of handle_signal() failing, in which case we | 473 | * This only loops in the rare cases of handle_signal() failing, in which case we |
442 | * need to push through a forced SIGSEGV. | 474 | * need to push through a forced SIGSEGV. |
443 | */ | 475 | */ |
@@ -486,8 +518,16 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
486 | * Whee! Actually deliver the signal. If the delivery failed, we need to | 518 | * Whee! Actually deliver the signal. If the delivery failed, we need to |
487 | * continue to iterate in this loop so we can deliver the SIGSEGV... | 519 | * continue to iterate in this loop so we can deliver the SIGSEGV... |
488 | */ | 520 | */ |
489 | if (handle_signal(signr, &ka, &info, scr)) | 521 | if (handle_signal(signr, &ka, &info, oldset, scr)) { |
522 | /* | ||
523 | * A signal was successfully delivered; the saved | ||
524 | * sigmask will have been stored in the signal frame, | ||
525 | * and will be restored by sigreturn, so we can simply | ||
526 | * clear the TS_RESTORE_SIGMASK flag. | ||
527 | */ | ||
528 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
490 | return; | 529 | return; |
530 | } | ||
491 | } | 531 | } |
492 | 532 | ||
493 | /* Did we come from a system call? */ | 533 | /* Did we come from a system call? */ |
@@ -509,5 +549,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) | |||
509 | 549 | ||
510 | /* if there's no signal to deliver, we just put the saved sigmask | 550 | /* if there's no signal to deliver, we just put the saved sigmask |
511 | * back */ | 551 | * back */ |
512 | restore_saved_sigmask(); | 552 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { |
553 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
554 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
555 | } | ||
513 | } | 556 | } |
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c index 9fcd4e63048..0bd537b4ea6 100644 --- a/arch/ia64/kernel/smp.c +++ b/arch/ia64/kernel/smp.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <asm/processor.h> | 44 | #include <asm/processor.h> |
45 | #include <asm/ptrace.h> | 45 | #include <asm/ptrace.h> |
46 | #include <asm/sal.h> | 46 | #include <asm/sal.h> |
47 | #include <asm/system.h> | ||
47 | #include <asm/tlbflush.h> | 48 | #include <asm/tlbflush.h> |
48 | #include <asm/unistd.h> | 49 | #include <asm/unistd.h> |
49 | #include <asm/mca.h> | 50 | #include <asm/mca.h> |
@@ -76,7 +77,7 @@ stop_this_cpu(void) | |||
76 | /* | 77 | /* |
77 | * Remove this CPU: | 78 | * Remove this CPU: |
78 | */ | 79 | */ |
79 | set_cpu_online(smp_processor_id(), false); | 80 | cpu_clear(smp_processor_id(), cpu_online_map); |
80 | max_xtp(); | 81 | max_xtp(); |
81 | local_irq_disable(); | 82 | local_irq_disable(); |
82 | cpu_halt(); | 83 | cpu_halt(); |
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 500f1e4d9f9..55909798667 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c | |||
@@ -55,6 +55,7 @@ | |||
55 | #include <asm/processor.h> | 55 | #include <asm/processor.h> |
56 | #include <asm/ptrace.h> | 56 | #include <asm/ptrace.h> |
57 | #include <asm/sal.h> | 57 | #include <asm/sal.h> |
58 | #include <asm/system.h> | ||
58 | #include <asm/tlbflush.h> | 59 | #include <asm/tlbflush.h> |
59 | #include <asm/unistd.h> | 60 | #include <asm/unistd.h> |
60 | #include <asm/sn/arch.h> | 61 | #include <asm/sn/arch.h> |
@@ -75,6 +76,13 @@ | |||
75 | #endif | 76 | #endif |
76 | 77 | ||
77 | /* | 78 | /* |
79 | * Store all idle threads, this can be reused instead of creating | ||
80 | * a new thread. Also avoids complicated thread destroy functionality | ||
81 | * for idle threads. | ||
82 | */ | ||
83 | struct task_struct *idle_thread_array[NR_CPUS]; | ||
84 | |||
85 | /* | ||
78 | * Global array allocated for NR_CPUS at boot time | 86 | * Global array allocated for NR_CPUS at boot time |
79 | */ | 87 | */ |
80 | struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; | 88 | struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; |
@@ -87,7 +95,13 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0]; | |||
87 | 95 | ||
88 | #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); | 96 | #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); |
89 | 97 | ||
98 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) | ||
99 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) | ||
100 | |||
90 | #else | 101 | #else |
102 | |||
103 | #define get_idle_for_cpu(x) (NULL) | ||
104 | #define set_idle_for_cpu(x,p) | ||
91 | #define set_brendez_area(x) | 105 | #define set_brendez_area(x) |
92 | #endif | 106 | #endif |
93 | 107 | ||
@@ -347,7 +361,8 @@ ia64_sync_itc (unsigned int master) | |||
347 | /* | 361 | /* |
348 | * Ideally sets up per-cpu profiling hooks. Doesn't do much now... | 362 | * Ideally sets up per-cpu profiling hooks. Doesn't do much now... |
349 | */ | 363 | */ |
350 | static inline void smp_setup_percpu_timer(void) | 364 | static inline void __devinit |
365 | smp_setup_percpu_timer (void) | ||
351 | { | 366 | { |
352 | } | 367 | } |
353 | 368 | ||
@@ -381,13 +396,15 @@ smp_callin (void) | |||
381 | set_numa_node(cpu_to_node_map[cpuid]); | 396 | set_numa_node(cpu_to_node_map[cpuid]); |
382 | set_numa_mem(local_memory_node(cpu_to_node_map[cpuid])); | 397 | set_numa_mem(local_memory_node(cpu_to_node_map[cpuid])); |
383 | 398 | ||
399 | ipi_call_lock_irq(); | ||
384 | spin_lock(&vector_lock); | 400 | spin_lock(&vector_lock); |
385 | /* Setup the per cpu irq handling data structures */ | 401 | /* Setup the per cpu irq handling data structures */ |
386 | __setup_vector_irq(cpuid); | 402 | __setup_vector_irq(cpuid); |
387 | notify_cpu_starting(cpuid); | 403 | notify_cpu_starting(cpuid); |
388 | set_cpu_online(cpuid, true); | 404 | cpu_set(cpuid, cpu_online_map); |
389 | per_cpu(cpu_state, cpuid) = CPU_ONLINE; | 405 | per_cpu(cpu_state, cpuid) = CPU_ONLINE; |
390 | spin_unlock(&vector_lock); | 406 | spin_unlock(&vector_lock); |
407 | ipi_call_unlock_irq(); | ||
391 | 408 | ||
392 | smp_setup_percpu_timer(); | 409 | smp_setup_percpu_timer(); |
393 | 410 | ||
@@ -459,12 +476,59 @@ start_secondary (void *unused) | |||
459 | return 0; | 476 | return 0; |
460 | } | 477 | } |
461 | 478 | ||
479 | struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) | ||
480 | { | ||
481 | return NULL; | ||
482 | } | ||
483 | |||
484 | struct create_idle { | ||
485 | struct work_struct work; | ||
486 | struct task_struct *idle; | ||
487 | struct completion done; | ||
488 | int cpu; | ||
489 | }; | ||
490 | |||
491 | void __cpuinit | ||
492 | do_fork_idle(struct work_struct *work) | ||
493 | { | ||
494 | struct create_idle *c_idle = | ||
495 | container_of(work, struct create_idle, work); | ||
496 | |||
497 | c_idle->idle = fork_idle(c_idle->cpu); | ||
498 | complete(&c_idle->done); | ||
499 | } | ||
500 | |||
462 | static int __cpuinit | 501 | static int __cpuinit |
463 | do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) | 502 | do_boot_cpu (int sapicid, int cpu) |
464 | { | 503 | { |
465 | int timeout; | 504 | int timeout; |
505 | struct create_idle c_idle = { | ||
506 | .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle), | ||
507 | .cpu = cpu, | ||
508 | .done = COMPLETION_INITIALIZER(c_idle.done), | ||
509 | }; | ||
510 | |||
511 | /* | ||
512 | * We can't use kernel_thread since we must avoid to | ||
513 | * reschedule the child. | ||
514 | */ | ||
515 | c_idle.idle = get_idle_for_cpu(cpu); | ||
516 | if (c_idle.idle) { | ||
517 | init_idle(c_idle.idle, cpu); | ||
518 | goto do_rest; | ||
519 | } | ||
520 | |||
521 | schedule_work(&c_idle.work); | ||
522 | wait_for_completion(&c_idle.done); | ||
523 | |||
524 | if (IS_ERR(c_idle.idle)) | ||
525 | panic("failed fork for CPU %d", cpu); | ||
526 | |||
527 | set_idle_for_cpu(cpu, c_idle.idle); | ||
528 | |||
529 | do_rest: | ||
530 | task_for_booting_cpu = c_idle.idle; | ||
466 | 531 | ||
467 | task_for_booting_cpu = idle; | ||
468 | Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); | 532 | Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); |
469 | 533 | ||
470 | set_brendez_area(cpu); | 534 | set_brendez_area(cpu); |
@@ -484,7 +548,7 @@ do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) | |||
484 | if (!cpu_isset(cpu, cpu_callin_map)) { | 548 | if (!cpu_isset(cpu, cpu_callin_map)) { |
485 | printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid); | 549 | printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid); |
486 | ia64_cpu_to_sapicid[cpu] = -1; | 550 | ia64_cpu_to_sapicid[cpu] = -1; |
487 | set_cpu_online(cpu, false); /* was set in smp_callin() */ | 551 | cpu_clear(cpu, cpu_online_map); /* was set in smp_callin() */ |
488 | return -EINVAL; | 552 | return -EINVAL; |
489 | } | 553 | } |
490 | return 0; | 554 | return 0; |
@@ -514,7 +578,8 @@ smp_build_cpu_map (void) | |||
514 | } | 578 | } |
515 | 579 | ||
516 | ia64_cpu_to_sapicid[0] = boot_cpu_id; | 580 | ia64_cpu_to_sapicid[0] = boot_cpu_id; |
517 | init_cpu_present(cpumask_of(0)); | 581 | cpus_clear(cpu_present_map); |
582 | set_cpu_present(0, true); | ||
518 | set_cpu_possible(0, true); | 583 | set_cpu_possible(0, true); |
519 | for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) { | 584 | for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) { |
520 | sapicid = smp_boot_data.cpu_phys_id[i]; | 585 | sapicid = smp_boot_data.cpu_phys_id[i]; |
@@ -541,6 +606,10 @@ smp_prepare_cpus (unsigned int max_cpus) | |||
541 | 606 | ||
542 | smp_setup_percpu_timer(); | 607 | smp_setup_percpu_timer(); |
543 | 608 | ||
609 | /* | ||
610 | * We have the boot CPU online for sure. | ||
611 | */ | ||
612 | cpu_set(0, cpu_online_map); | ||
544 | cpu_set(0, cpu_callin_map); | 613 | cpu_set(0, cpu_callin_map); |
545 | 614 | ||
546 | local_cpu_data->loops_per_jiffy = loops_per_jiffy; | 615 | local_cpu_data->loops_per_jiffy = loops_per_jiffy; |
@@ -562,9 +631,9 @@ smp_prepare_cpus (unsigned int max_cpus) | |||
562 | } | 631 | } |
563 | } | 632 | } |
564 | 633 | ||
565 | void smp_prepare_boot_cpu(void) | 634 | void __devinit smp_prepare_boot_cpu(void) |
566 | { | 635 | { |
567 | set_cpu_online(smp_processor_id(), true); | 636 | cpu_set(smp_processor_id(), cpu_online_map); |
568 | cpu_set(smp_processor_id(), cpu_callin_map); | 637 | cpu_set(smp_processor_id(), cpu_callin_map); |
569 | set_numa_node(cpu_to_node_map[smp_processor_id()]); | 638 | set_numa_node(cpu_to_node_map[smp_processor_id()]); |
570 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; | 639 | per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; |
@@ -621,7 +690,7 @@ int migrate_platform_irqs(unsigned int cpu) | |||
621 | /* | 690 | /* |
622 | * Now re-target the CPEI to a different processor | 691 | * Now re-target the CPEI to a different processor |
623 | */ | 692 | */ |
624 | new_cpei_cpu = cpumask_any(cpu_online_mask); | 693 | new_cpei_cpu = any_online_cpu(cpu_online_map); |
625 | mask = cpumask_of(new_cpei_cpu); | 694 | mask = cpumask_of(new_cpei_cpu); |
626 | set_cpei_target_cpu(new_cpei_cpu); | 695 | set_cpei_target_cpu(new_cpei_cpu); |
627 | data = irq_get_irq_data(ia64_cpe_irq); | 696 | data = irq_get_irq_data(ia64_cpe_irq); |
@@ -663,10 +732,10 @@ int __cpu_disable(void) | |||
663 | return -EBUSY; | 732 | return -EBUSY; |
664 | } | 733 | } |
665 | 734 | ||
666 | set_cpu_online(cpu, false); | 735 | cpu_clear(cpu, cpu_online_map); |
667 | 736 | ||
668 | if (migrate_platform_irqs(cpu)) { | 737 | if (migrate_platform_irqs(cpu)) { |
669 | set_cpu_online(cpu, true); | 738 | cpu_set(cpu, cpu_online_map); |
670 | return -EBUSY; | 739 | return -EBUSY; |
671 | } | 740 | } |
672 | 741 | ||
@@ -712,7 +781,8 @@ smp_cpus_done (unsigned int dummy) | |||
712 | (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100); | 781 | (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100); |
713 | } | 782 | } |
714 | 783 | ||
715 | static inline void set_cpu_sibling_map(int cpu) | 784 | static inline void __devinit |
785 | set_cpu_sibling_map(int cpu) | ||
716 | { | 786 | { |
717 | int i; | 787 | int i; |
718 | 788 | ||
@@ -729,7 +799,7 @@ static inline void set_cpu_sibling_map(int cpu) | |||
729 | } | 799 | } |
730 | 800 | ||
731 | int __cpuinit | 801 | int __cpuinit |
732 | __cpu_up(unsigned int cpu, struct task_struct *tidle) | 802 | __cpu_up (unsigned int cpu) |
733 | { | 803 | { |
734 | int ret; | 804 | int ret; |
735 | int sapicid; | 805 | int sapicid; |
@@ -747,7 +817,7 @@ __cpu_up(unsigned int cpu, struct task_struct *tidle) | |||
747 | 817 | ||
748 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 818 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
749 | /* Processor goes to start_secondary(), sets online flag */ | 819 | /* Processor goes to start_secondary(), sets online flag */ |
750 | ret = do_boot_cpu(sapicid, cpu, tidle); | 820 | ret = do_boot_cpu(sapicid, cpu); |
751 | if (ret < 0) | 821 | if (ret < 0) |
752 | return ret; | 822 | return ret; |
753 | 823 | ||
@@ -791,7 +861,8 @@ init_smp_config(void) | |||
791 | * identify_siblings(cpu) gets called from identify_cpu. This populates the | 861 | * identify_siblings(cpu) gets called from identify_cpu. This populates the |
792 | * information related to logical execution units in per_cpu_data structure. | 862 | * information related to logical execution units in per_cpu_data structure. |
793 | */ | 863 | */ |
794 | void identify_siblings(struct cpuinfo_ia64 *c) | 864 | void __devinit |
865 | identify_siblings(struct cpuinfo_ia64 *c) | ||
795 | { | 866 | { |
796 | long status; | 867 | long status; |
797 | u16 pltid; | 868 | u16 pltid; |
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index d9439ef2f66..609d50056a6 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c | |||
@@ -171,9 +171,22 @@ asmlinkage unsigned long | |||
171 | ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, | 171 | ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, |
172 | unsigned long new_addr) | 172 | unsigned long new_addr) |
173 | { | 173 | { |
174 | addr = sys_mremap(addr, old_len, new_len, flags, new_addr); | 174 | extern unsigned long do_mremap (unsigned long addr, |
175 | if (!IS_ERR((void *) addr)) | 175 | unsigned long old_len, |
176 | force_successful_syscall_return(); | 176 | unsigned long new_len, |
177 | unsigned long flags, | ||
178 | unsigned long new_addr); | ||
179 | |||
180 | down_write(¤t->mm->mmap_sem); | ||
181 | { | ||
182 | addr = do_mremap(addr, old_len, new_len, flags, new_addr); | ||
183 | } | ||
184 | up_write(¤t->mm->mmap_sem); | ||
185 | |||
186 | if (IS_ERR((void *) addr)) | ||
187 | return addr; | ||
188 | |||
189 | force_successful_syscall_return(); | ||
177 | return addr; | 190 | return addr; |
178 | } | 191 | } |
179 | 192 | ||
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 88a794536bc..43920de425f 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/efi.h> | 20 | #include <linux/efi.h> |
21 | #include <linux/timex.h> | 21 | #include <linux/timex.h> |
22 | #include <linux/timekeeper_internal.h> | 22 | #include <linux/clocksource.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | 24 | ||
25 | #include <asm/machvec.h> | 25 | #include <asm/machvec.h> |
@@ -29,12 +29,15 @@ | |||
29 | #include <asm/ptrace.h> | 29 | #include <asm/ptrace.h> |
30 | #include <asm/sal.h> | 30 | #include <asm/sal.h> |
31 | #include <asm/sections.h> | 31 | #include <asm/sections.h> |
32 | #include <asm/system.h> | ||
32 | 33 | ||
33 | #include "fsyscall_gtod_data.h" | 34 | #include "fsyscall_gtod_data.h" |
34 | 35 | ||
35 | static cycle_t itc_get_cycles(struct clocksource *cs); | 36 | static cycle_t itc_get_cycles(struct clocksource *cs); |
36 | 37 | ||
37 | struct fsyscall_gtod_data_t fsyscall_gtod_data; | 38 | struct fsyscall_gtod_data_t fsyscall_gtod_data = { |
39 | .lock = __SEQLOCK_UNLOCKED(fsyscall_gtod_data.lock), | ||
40 | }; | ||
38 | 41 | ||
39 | struct itc_jitter_data_t itc_jitter_data; | 42 | struct itc_jitter_data_t itc_jitter_data; |
40 | 43 | ||
@@ -83,29 +86,32 @@ static struct clocksource *itc_clocksource; | |||
83 | 86 | ||
84 | extern cputime_t cycle_to_cputime(u64 cyc); | 87 | extern cputime_t cycle_to_cputime(u64 cyc); |
85 | 88 | ||
86 | void vtime_account_user(struct task_struct *tsk) | ||
87 | { | ||
88 | cputime_t delta_utime; | ||
89 | struct thread_info *ti = task_thread_info(tsk); | ||
90 | |||
91 | if (ti->ac_utime) { | ||
92 | delta_utime = cycle_to_cputime(ti->ac_utime); | ||
93 | account_user_time(tsk, delta_utime, delta_utime); | ||
94 | ti->ac_utime = 0; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | /* | 89 | /* |
99 | * Called from the context switch with interrupts disabled, to charge all | 90 | * Called from the context switch with interrupts disabled, to charge all |
100 | * accumulated times to the current process, and to prepare accounting on | 91 | * accumulated times to the current process, and to prepare accounting on |
101 | * the next process. | 92 | * the next process. |
102 | */ | 93 | */ |
103 | void arch_vtime_task_switch(struct task_struct *prev) | 94 | void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next) |
104 | { | 95 | { |
105 | struct thread_info *pi = task_thread_info(prev); | 96 | struct thread_info *pi = task_thread_info(prev); |
106 | struct thread_info *ni = task_thread_info(current); | 97 | struct thread_info *ni = task_thread_info(next); |
98 | cputime_t delta_stime, delta_utime; | ||
99 | __u64 now; | ||
100 | |||
101 | now = ia64_get_itc(); | ||
102 | |||
103 | delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp)); | ||
104 | if (idle_task(smp_processor_id()) != prev) | ||
105 | account_system_time(prev, 0, delta_stime, delta_stime); | ||
106 | else | ||
107 | account_idle_time(delta_stime); | ||
107 | 108 | ||
108 | pi->ac_stamp = ni->ac_stamp; | 109 | if (pi->ac_utime) { |
110 | delta_utime = cycle_to_cputime(pi->ac_utime); | ||
111 | account_user_time(prev, delta_utime, delta_utime); | ||
112 | } | ||
113 | |||
114 | pi->ac_stamp = ni->ac_stamp = now; | ||
109 | ni->ac_stime = ni->ac_utime = 0; | 115 | ni->ac_stime = ni->ac_utime = 0; |
110 | } | 116 | } |
111 | 117 | ||
@@ -113,33 +119,44 @@ void arch_vtime_task_switch(struct task_struct *prev) | |||
113 | * Account time for a transition between system, hard irq or soft irq state. | 119 | * Account time for a transition between system, hard irq or soft irq state. |
114 | * Note that this function is called with interrupts enabled. | 120 | * Note that this function is called with interrupts enabled. |
115 | */ | 121 | */ |
116 | static cputime_t vtime_delta(struct task_struct *tsk) | 122 | void account_system_vtime(struct task_struct *tsk) |
117 | { | 123 | { |
118 | struct thread_info *ti = task_thread_info(tsk); | 124 | struct thread_info *ti = task_thread_info(tsk); |
125 | unsigned long flags; | ||
119 | cputime_t delta_stime; | 126 | cputime_t delta_stime; |
120 | __u64 now; | 127 | __u64 now; |
121 | 128 | ||
122 | WARN_ON_ONCE(!irqs_disabled()); | 129 | local_irq_save(flags); |
123 | 130 | ||
124 | now = ia64_get_itc(); | 131 | now = ia64_get_itc(); |
125 | 132 | ||
126 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); | 133 | delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); |
134 | if (irq_count() || idle_task(smp_processor_id()) != tsk) | ||
135 | account_system_time(tsk, 0, delta_stime, delta_stime); | ||
136 | else | ||
137 | account_idle_time(delta_stime); | ||
127 | ti->ac_stime = 0; | 138 | ti->ac_stime = 0; |
139 | |||
128 | ti->ac_stamp = now; | 140 | ti->ac_stamp = now; |
129 | 141 | ||
130 | return delta_stime; | 142 | local_irq_restore(flags); |
131 | } | 143 | } |
144 | EXPORT_SYMBOL_GPL(account_system_vtime); | ||
132 | 145 | ||
133 | void vtime_account_system(struct task_struct *tsk) | 146 | /* |
147 | * Called from the timer interrupt handler to charge accumulated user time | ||
148 | * to the current process. Must be called with interrupts disabled. | ||
149 | */ | ||
150 | void account_process_tick(struct task_struct *p, int user_tick) | ||
134 | { | 151 | { |
135 | cputime_t delta = vtime_delta(tsk); | 152 | struct thread_info *ti = task_thread_info(p); |
136 | 153 | cputime_t delta_utime; | |
137 | account_system_time(tsk, 0, delta, delta); | ||
138 | } | ||
139 | 154 | ||
140 | void vtime_account_idle(struct task_struct *tsk) | 155 | if (ti->ac_utime) { |
141 | { | 156 | delta_utime = cycle_to_cputime(ti->ac_utime); |
142 | account_idle_time(vtime_delta(tsk)); | 157 | account_user_time(p, delta_utime, delta_utime); |
158 | ti->ac_utime = 0; | ||
159 | } | ||
143 | } | 160 | } |
144 | 161 | ||
145 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ | 162 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING */ |
@@ -243,7 +260,8 @@ static int __init nojitter_setup(char *str) | |||
243 | __setup("nojitter", nojitter_setup); | 260 | __setup("nojitter", nojitter_setup); |
244 | 261 | ||
245 | 262 | ||
246 | void ia64_init_itm(void) | 263 | void __devinit |
264 | ia64_init_itm (void) | ||
247 | { | 265 | { |
248 | unsigned long platform_base_freq, itc_freq; | 266 | unsigned long platform_base_freq, itc_freq; |
249 | struct pal_freq_ratio itc_ratio, proc_ratio; | 267 | struct pal_freq_ratio itc_ratio, proc_ratio; |
@@ -439,10 +457,12 @@ void update_vsyscall_tz(void) | |||
439 | { | 457 | { |
440 | } | 458 | } |
441 | 459 | ||
442 | void update_vsyscall_old(struct timespec *wall, struct timespec *wtm, | 460 | void update_vsyscall(struct timespec *wall, struct timespec *wtm, |
443 | struct clocksource *c, u32 mult) | 461 | struct clocksource *c, u32 mult) |
444 | { | 462 | { |
445 | write_seqcount_begin(&fsyscall_gtod_data.seq); | 463 | unsigned long flags; |
464 | |||
465 | write_seqlock_irqsave(&fsyscall_gtod_data.lock, flags); | ||
446 | 466 | ||
447 | /* copy fsyscall clock data */ | 467 | /* copy fsyscall clock data */ |
448 | fsyscall_gtod_data.clk_mask = c->mask; | 468 | fsyscall_gtod_data.clk_mask = c->mask; |
@@ -465,6 +485,6 @@ void update_vsyscall_old(struct timespec *wall, struct timespec *wtm, | |||
465 | fsyscall_gtod_data.monotonic_time.tv_sec++; | 485 | fsyscall_gtod_data.monotonic_time.tv_sec++; |
466 | } | 486 | } |
467 | 487 | ||
468 | write_seqcount_end(&fsyscall_gtod_data.seq); | 488 | write_sequnlock_irqrestore(&fsyscall_gtod_data.lock, flags); |
469 | } | 489 | } |
470 | 490 | ||
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index dc00b2c1b42..0e0e0cc9e39 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/bootmem.h> | 22 | #include <linux/bootmem.h> |
23 | #include <linux/nodemask.h> | 23 | #include <linux/nodemask.h> |
24 | #include <linux/notifier.h> | 24 | #include <linux/notifier.h> |
25 | #include <linux/export.h> | ||
26 | #include <asm/mmzone.h> | 25 | #include <asm/mmzone.h> |
27 | #include <asm/numa.h> | 26 | #include <asm/numa.h> |
28 | #include <asm/cpu.h> | 27 | #include <asm/cpu.h> |
@@ -220,8 +219,7 @@ static ssize_t show_shared_cpu_map(struct cache_info *this_leaf, char *buf) | |||
220 | ssize_t len; | 219 | ssize_t len; |
221 | cpumask_t shared_cpu_map; | 220 | cpumask_t shared_cpu_map; |
222 | 221 | ||
223 | cpumask_and(&shared_cpu_map, | 222 | cpus_and(shared_cpu_map, this_leaf->shared_cpu_map, cpu_online_map); |
224 | &this_leaf->shared_cpu_map, cpu_online_mask); | ||
225 | len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map); | 223 | len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map); |
226 | len += sprintf(buf+len, "\n"); | 224 | len += sprintf(buf+len, "\n"); |
227 | return len; | 225 | return len; |
@@ -275,7 +273,7 @@ static struct attribute * cache_default_attrs[] = { | |||
275 | #define to_object(k) container_of(k, struct cache_info, kobj) | 273 | #define to_object(k) container_of(k, struct cache_info, kobj) |
276 | #define to_attr(a) container_of(a, struct cache_attr, attr) | 274 | #define to_attr(a) container_of(a, struct cache_attr, attr) |
277 | 275 | ||
278 | static ssize_t ia64_cache_show(struct kobject * kobj, struct attribute * attr, char * buf) | 276 | static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char * buf) |
279 | { | 277 | { |
280 | struct cache_attr *fattr = to_attr(attr); | 278 | struct cache_attr *fattr = to_attr(attr); |
281 | struct cache_info *this_leaf = to_object(kobj); | 279 | struct cache_info *this_leaf = to_object(kobj); |
@@ -286,7 +284,7 @@ static ssize_t ia64_cache_show(struct kobject * kobj, struct attribute * attr, c | |||
286 | } | 284 | } |
287 | 285 | ||
288 | static const struct sysfs_ops cache_sysfs_ops = { | 286 | static const struct sysfs_ops cache_sysfs_ops = { |
289 | .show = ia64_cache_show | 287 | .show = cache_show |
290 | }; | 288 | }; |
291 | 289 | ||
292 | static struct kobj_type cache_ktype = { | 290 | static struct kobj_type cache_ktype = { |
@@ -351,7 +349,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu) | |||
351 | } | 349 | } |
352 | 350 | ||
353 | /* Add cache interface for CPU device */ | 351 | /* Add cache interface for CPU device */ |
354 | static int __cpuinit cache_add_dev(struct device * sys_dev) | 352 | static int __cpuinit cache_add_dev(struct sys_device * sys_dev) |
355 | { | 353 | { |
356 | unsigned int cpu = sys_dev->id; | 354 | unsigned int cpu = sys_dev->id; |
357 | unsigned long i, j; | 355 | unsigned long i, j; |
@@ -401,7 +399,7 @@ static int __cpuinit cache_add_dev(struct device * sys_dev) | |||
401 | } | 399 | } |
402 | 400 | ||
403 | /* Remove cache interface for CPU device */ | 401 | /* Remove cache interface for CPU device */ |
404 | static int __cpuinit cache_remove_dev(struct device * sys_dev) | 402 | static int __cpuinit cache_remove_dev(struct sys_device * sys_dev) |
405 | { | 403 | { |
406 | unsigned int cpu = sys_dev->id; | 404 | unsigned int cpu = sys_dev->id; |
407 | unsigned long i; | 405 | unsigned long i; |
@@ -429,9 +427,9 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb, | |||
429 | unsigned long action, void *hcpu) | 427 | unsigned long action, void *hcpu) |
430 | { | 428 | { |
431 | unsigned int cpu = (unsigned long)hcpu; | 429 | unsigned int cpu = (unsigned long)hcpu; |
432 | struct device *sys_dev; | 430 | struct sys_device *sys_dev; |
433 | 431 | ||
434 | sys_dev = get_cpu_device(cpu); | 432 | sys_dev = get_cpu_sysdev(cpu); |
435 | switch (action) { | 433 | switch (action) { |
436 | case CPU_ONLINE: | 434 | case CPU_ONLINE: |
437 | case CPU_ONLINE_FROZEN: | 435 | case CPU_ONLINE_FROZEN: |
@@ -455,7 +453,7 @@ static int __init cache_sysfs_init(void) | |||
455 | int i; | 453 | int i; |
456 | 454 | ||
457 | for_each_online_cpu(i) { | 455 | for_each_online_cpu(i) { |
458 | struct device *sys_dev = get_cpu_device((unsigned int)i); | 456 | struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); |
459 | cache_add_dev(sys_dev); | 457 | cache_add_dev(sys_dev); |
460 | } | 458 | } |
461 | 459 | ||
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index bd42b76000d..fd80e70018a 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <asm/intrinsics.h> | 22 | #include <asm/intrinsics.h> |
23 | #include <asm/processor.h> | 23 | #include <asm/processor.h> |
24 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
25 | #include <asm/setup.h> | ||
26 | 25 | ||
27 | fpswa_interface_t *fpswa_interface; | 26 | fpswa_interface_t *fpswa_interface; |
28 | EXPORT_SYMBOL(fpswa_interface); | 27 | EXPORT_SYMBOL(fpswa_interface); |
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index a96bcf83a73..6a867dc45c0 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/gfp.h> | 23 | #include <linux/gfp.h> |
24 | #include <asm/page.h> | 24 | #include <asm/page.h> |
25 | #include <asm/pal.h> | 25 | #include <asm/pal.h> |
26 | #include <asm/system.h> | ||
26 | #include <asm/pgtable.h> | 27 | #include <asm/pgtable.h> |
27 | #include <linux/atomic.h> | 28 | #include <linux/atomic.h> |
28 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c index 8f66195999e..fed6afa2e8a 100644 --- a/arch/ia64/kernel/unwind.c +++ b/arch/ia64/kernel/unwind.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <asm/ptrace_offsets.h> | 41 | #include <asm/ptrace_offsets.h> |
42 | #include <asm/rse.h> | 42 | #include <asm/rse.h> |
43 | #include <asm/sections.h> | 43 | #include <asm/sections.h> |
44 | #include <asm/system.h> | ||
44 | #include <asm/uaccess.h> | 45 | #include <asm/uaccess.h> |
45 | 46 | ||
46 | #include "entry.h" | 47 | #include "entry.h" |
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index 0ccb28fab27..53c0ba004e9 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | #include <asm/cache.h> | 2 | #include <asm/cache.h> |
3 | #include <asm/ptrace.h> | 3 | #include <asm/ptrace.h> |
4 | #include <asm/system.h> | ||
4 | #include <asm/pgtable.h> | 5 | #include <asm/pgtable.h> |
5 | 6 | ||
6 | #include <asm-generic/vmlinux.lds.h> | 7 | #include <asm-generic/vmlinux.lds.h> |