aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-25 20:47:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-25 20:47:04 -0400
commit7c8d891c2c7714965db1685289787b0c526f9c42 (patch)
tree63f4bb25df1a3b9798d318e8c2c28b959709f182 /arch/s390/kernel
parent62d00867514ae1c81ab5e809e189ca159536daee (diff)
parent54eaae3028e6b09de0bd2232a8176fc0d0a2397a (diff)
Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6: [S390] cmpxchg: implement cmpxchg64() [S390] xchg/cmpxchg: move to own header file [S390] ccwgroup_driver: remove duplicate members [S390] ccw_bus_type: make it static [S390] ccw_driver: remove duplicate members [S390] qdio: prevent handling of buffers if count is zero [S390] setup: register bss section as resource [S390] setup: simplify setup_resources() [S390] wire up sys_syncfs [S390] wire up sys_clock_adjtime [S390] wire up sys_open_by_handle_at [S390] wire up sys_name_to_handle_at [S390] oprofile: disable hw sampling for CONFIG_32BIT [S390] early: limit savesys cmd string handling [S390] early: Fix possible overlapping data buffer
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/compat_wrapper.S27
-rw-r--r--arch/s390/kernel/early.c22
-rw-r--r--arch/s390/kernel/setup.c88
-rw-r--r--arch/s390/kernel/syscalls.S4
4 files changed, 86 insertions, 55 deletions
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 8e60fb23b90d..1dc96ea08fa8 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1877,3 +1877,30 @@ sys_prlimit64_wrapper:
1877 llgtr %r4,%r4 # const struct rlimit64 __user * 1877 llgtr %r4,%r4 # const struct rlimit64 __user *
1878 llgtr %r5,%r5 # struct rlimit64 __user * 1878 llgtr %r5,%r5 # struct rlimit64 __user *
1879 jg sys_prlimit64 # branch to system call 1879 jg sys_prlimit64 # branch to system call
1880
1881 .globl sys_name_to_handle_at_wrapper
1882sys_name_to_handle_at_wrapper:
1883 lgfr %r2,%r2 # int
1884 llgtr %r3,%r3 # const char __user *
1885 llgtr %r4,%r4 # struct file_handle __user *
1886 llgtr %r5,%r5 # int __user *
1887 lgfr %r6,%r6 # int
1888 jg sys_name_to_handle_at
1889
1890 .globl compat_sys_open_by_handle_at_wrapper
1891compat_sys_open_by_handle_at_wrapper:
1892 lgfr %r2,%r2 # int
1893 llgtr %r3,%r3 # struct file_handle __user *
1894 lgfr %r4,%r4 # int
1895 jg compat_sys_open_by_handle_at
1896
1897 .globl compat_sys_clock_adjtime_wrapper
1898compat_sys_clock_adjtime_wrapper:
1899 lgfr %r2,%r2 # clockid_t (int)
1900 llgtr %r3,%r3 # struct compat_timex __user *
1901 jg compat_sys_clock_adjtime
1902
1903 .globl sys_syncfs_wrapper
1904sys_syncfs_wrapper:
1905 lgfr %r2,%r2 # int
1906 jg sys_syncfs
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 3b7e7dddc324..068f8465c4ee 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -94,6 +94,7 @@ static noinline __init void create_kernel_nss(void)
94 unsigned int sinitrd_pfn, einitrd_pfn; 94 unsigned int sinitrd_pfn, einitrd_pfn;
95#endif 95#endif
96 int response; 96 int response;
97 int hlen;
97 size_t len; 98 size_t len;
98 char *savesys_ptr; 99 char *savesys_ptr;
99 char defsys_cmd[DEFSYS_CMD_SIZE]; 100 char defsys_cmd[DEFSYS_CMD_SIZE];
@@ -124,24 +125,27 @@ static noinline __init void create_kernel_nss(void)
124 end_pfn = PFN_UP(__pa(&_end)); 125 end_pfn = PFN_UP(__pa(&_end));
125 min_size = end_pfn << 2; 126 min_size = end_pfn << 2;
126 127
127 sprintf(defsys_cmd, "DEFSYS %s 00000-%.5X EW %.5X-%.5X SR %.5X-%.5X", 128 hlen = snprintf(defsys_cmd, DEFSYS_CMD_SIZE,
128 kernel_nss_name, stext_pfn - 1, stext_pfn, eshared_pfn - 1, 129 "DEFSYS %s 00000-%.5X EW %.5X-%.5X SR %.5X-%.5X",
129 eshared_pfn, end_pfn); 130 kernel_nss_name, stext_pfn - 1, stext_pfn,
131 eshared_pfn - 1, eshared_pfn, end_pfn);
130 132
131#ifdef CONFIG_BLK_DEV_INITRD 133#ifdef CONFIG_BLK_DEV_INITRD
132 if (INITRD_START && INITRD_SIZE) { 134 if (INITRD_START && INITRD_SIZE) {
133 sinitrd_pfn = PFN_DOWN(__pa(INITRD_START)); 135 sinitrd_pfn = PFN_DOWN(__pa(INITRD_START));
134 einitrd_pfn = PFN_UP(__pa(INITRD_START + INITRD_SIZE)); 136 einitrd_pfn = PFN_UP(__pa(INITRD_START + INITRD_SIZE));
135 min_size = einitrd_pfn << 2; 137 min_size = einitrd_pfn << 2;
136 sprintf(defsys_cmd, "%s EW %.5X-%.5X", defsys_cmd, 138 hlen += snprintf(defsys_cmd + hlen, DEFSYS_CMD_SIZE - hlen,
137 sinitrd_pfn, einitrd_pfn); 139 " EW %.5X-%.5X", sinitrd_pfn, einitrd_pfn);
138 } 140 }
139#endif 141#endif
140 142
141 sprintf(defsys_cmd, "%s EW MINSIZE=%.7iK PARMREGS=0-13", 143 snprintf(defsys_cmd + hlen, DEFSYS_CMD_SIZE - hlen,
142 defsys_cmd, min_size); 144 " EW MINSIZE=%.7iK PARMREGS=0-13", min_size);
143 sprintf(savesys_cmd, "SAVESYS %s \n IPL %s", 145 defsys_cmd[DEFSYS_CMD_SIZE - 1] = '\0';
144 kernel_nss_name, kernel_nss_name); 146 snprintf(savesys_cmd, SAVESYS_CMD_SIZE, "SAVESYS %s \n IPL %s",
147 kernel_nss_name, kernel_nss_name);
148 savesys_cmd[SAVESYS_CMD_SIZE - 1] = '\0';
145 149
146 __cpcmd(defsys_cmd, NULL, 0, &response); 150 __cpcmd(defsys_cmd, NULL, 0, &response);
147 151
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 6f6350826c81..ed183c2c6168 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -102,16 +102,6 @@ EXPORT_SYMBOL(lowcore_ptr);
102 102
103#include <asm/setup.h> 103#include <asm/setup.h>
104 104
105static struct resource code_resource = {
106 .name = "Kernel code",
107 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
108};
109
110static struct resource data_resource = {
111 .name = "Kernel data",
112 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
113};
114
115/* 105/*
116 * condev= and conmode= setup parameter. 106 * condev= and conmode= setup parameter.
117 */ 107 */
@@ -436,21 +426,43 @@ setup_lowcore(void)
436 lowcore_ptr[0] = lc; 426 lowcore_ptr[0] = lc;
437} 427}
438 428
439static void __init 429static struct resource code_resource = {
440setup_resources(void) 430 .name = "Kernel code",
431 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
432};
433
434static struct resource data_resource = {
435 .name = "Kernel data",
436 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
437};
438
439static struct resource bss_resource = {
440 .name = "Kernel bss",
441 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
442};
443
444static struct resource __initdata *standard_resources[] = {
445 &code_resource,
446 &data_resource,
447 &bss_resource,
448};
449
450static void __init setup_resources(void)
441{ 451{
442 struct resource *res, *sub_res; 452 struct resource *res, *std_res, *sub_res;
443 int i; 453 int i, j;
444 454
445 code_resource.start = (unsigned long) &_text; 455 code_resource.start = (unsigned long) &_text;
446 code_resource.end = (unsigned long) &_etext - 1; 456 code_resource.end = (unsigned long) &_etext - 1;
447 data_resource.start = (unsigned long) &_etext; 457 data_resource.start = (unsigned long) &_etext;
448 data_resource.end = (unsigned long) &_edata - 1; 458 data_resource.end = (unsigned long) &_edata - 1;
459 bss_resource.start = (unsigned long) &__bss_start;
460 bss_resource.end = (unsigned long) &__bss_stop - 1;
449 461
450 for (i = 0; i < MEMORY_CHUNKS; i++) { 462 for (i = 0; i < MEMORY_CHUNKS; i++) {
451 if (!memory_chunk[i].size) 463 if (!memory_chunk[i].size)
452 continue; 464 continue;
453 res = alloc_bootmem_low(sizeof(struct resource)); 465 res = alloc_bootmem_low(sizeof(*res));
454 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 466 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
455 switch (memory_chunk[i].type) { 467 switch (memory_chunk[i].type) {
456 case CHUNK_READ_WRITE: 468 case CHUNK_READ_WRITE:
@@ -464,40 +476,24 @@ setup_resources(void)
464 res->name = "reserved"; 476 res->name = "reserved";
465 } 477 }
466 res->start = memory_chunk[i].addr; 478 res->start = memory_chunk[i].addr;
467 res->end = memory_chunk[i].addr + memory_chunk[i].size - 1; 479 res->end = res->start + memory_chunk[i].size - 1;
468 request_resource(&iomem_resource, res); 480 request_resource(&iomem_resource, res);
469 481
470 if (code_resource.start >= res->start && 482 for (j = 0; j < ARRAY_SIZE(standard_resources); j++) {
471 code_resource.start <= res->end && 483 std_res = standard_resources[j];
472 code_resource.end > res->end) { 484 if (std_res->start < res->start ||
473 sub_res = alloc_bootmem_low(sizeof(struct resource)); 485 std_res->start > res->end)
474 memcpy(sub_res, &code_resource, 486 continue;
475 sizeof(struct resource)); 487 if (std_res->end > res->end) {
476 sub_res->end = res->end; 488 sub_res = alloc_bootmem_low(sizeof(*sub_res));
477 code_resource.start = res->end + 1; 489 *sub_res = *std_res;
478 request_resource(res, sub_res); 490 sub_res->end = res->end;
479 } 491 std_res->start = res->end + 1;
480 492 request_resource(res, sub_res);
481 if (code_resource.start >= res->start && 493 } else {
482 code_resource.start <= res->end && 494 request_resource(res, std_res);
483 code_resource.end <= res->end) 495 }
484 request_resource(res, &code_resource);
485
486 if (data_resource.start >= res->start &&
487 data_resource.start <= res->end &&
488 data_resource.end > res->end) {
489 sub_res = alloc_bootmem_low(sizeof(struct resource));
490 memcpy(sub_res, &data_resource,
491 sizeof(struct resource));
492 sub_res->end = res->end;
493 data_resource.start = res->end + 1;
494 request_resource(res, sub_res);
495 } 496 }
496
497 if (data_resource.start >= res->start &&
498 data_resource.start <= res->end &&
499 data_resource.end <= res->end)
500 request_resource(res, &data_resource);
501 } 497 }
502} 498}
503 499
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index a8fee1b14395..9c65fd4ddce0 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -343,3 +343,7 @@ SYSCALL(sys_perf_event_open,sys_perf_event_open,sys_perf_event_open_wrapper)
343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper) 343SYSCALL(sys_fanotify_init,sys_fanotify_init,sys_fanotify_init_wrapper)
344SYSCALL(sys_fanotify_mark,sys_fanotify_mark,sys_fanotify_mark_wrapper) 344SYSCALL(sys_fanotify_mark,sys_fanotify_mark,sys_fanotify_mark_wrapper)
345SYSCALL(sys_prlimit64,sys_prlimit64,sys_prlimit64_wrapper) 345SYSCALL(sys_prlimit64,sys_prlimit64,sys_prlimit64_wrapper)
346SYSCALL(sys_name_to_handle_at,sys_name_to_handle_at,sys_name_to_handle_at_wrapper) /* 335 */
347SYSCALL(sys_open_by_handle_at,sys_open_by_handle_at,compat_sys_open_by_handle_at_wrapper)
348SYSCALL(sys_clock_adjtime,sys_clock_adjtime,compat_sys_clock_adjtime_wrapper)
349SYSCALL(sys_syncfs,sys_syncfs,sys_syncfs_wrapper)