diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 06:48:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-10 06:48:33 -0400 |
commit | e1b28147f684af67bfac989756c27c19859d3d4e (patch) | |
tree | 11b09d6801b94acf4511b06fb36933e3a163329a /arch/s390/kernel | |
parent | ba7067651083bdcc37223d8879478cbc51cca923 (diff) | |
parent | ab08ff34b44f752b664ebb312d2e110cf37a7f5e (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull second s390 update from Martin Schwidefsky:
"The big thing in this pull request is the UAPI patch from David, and
worth mentioning is the page table dumper. The rest are small
improvements and bug fixes."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/entry: fix svc number for TIF_SYSCALL system call restart
s390/mm,vmem: fix vmem_add_mem()/vmem_remove_range()
s390/vmalloc: have separate modules area
s390/zcrypt: remove duplicated include from zcrypt_pcixcc.c
s390/css_chars: remove superfluous ifdef
s390/chsc: make headers usable
s390/mm: let kernel text section always begin at 1MB
s390/mm: fix mapping of read-only kernel text section
s390/mm: add page table dumper
s390: add support to start the kernel in 64 bit mode.
s390/mm,pageattr: remove superfluous EXPORT_SYMBOLs
s390/mm,pageattr: add more page table walk sanity checks
s390/mm: fix pmd_huge() usage for kernel mapping
s390/dcssblk: cleanup device attribute usage
s390/mm: use pfmf instruction to initialize storage keys
s390/facilities: cleanup PFMF and HPAGE machine facility detection
UAPI: (Scripted) Disintegrate arch/s390/include/asm
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r-- | arch/s390/kernel/early.c | 17 | ||||
-rw-r--r-- | arch/s390/kernel/entry64.S | 2 | ||||
-rw-r--r-- | arch/s390/kernel/head.S | 101 | ||||
-rw-r--r-- | arch/s390/kernel/head31.S | 3 | ||||
-rw-r--r-- | arch/s390/kernel/head64.S | 3 | ||||
-rw-r--r-- | arch/s390/kernel/module.c | 11 | ||||
-rw-r--r-- | arch/s390/kernel/setup.c | 51 |
7 files changed, 134 insertions, 54 deletions
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index 00d114445068..1f0eee9e7daa 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
@@ -283,14 +283,6 @@ static noinline __init void setup_facility_list(void) | |||
283 | ARRAY_SIZE(S390_lowcore.stfle_fac_list)); | 283 | ARRAY_SIZE(S390_lowcore.stfle_fac_list)); |
284 | } | 284 | } |
285 | 285 | ||
286 | static noinline __init void setup_hpage(void) | ||
287 | { | ||
288 | if (!test_facility(2) || !test_facility(8)) | ||
289 | return; | ||
290 | S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE; | ||
291 | __ctl_set_bit(0, 23); | ||
292 | } | ||
293 | |||
294 | static __init void detect_mvpg(void) | 286 | static __init void detect_mvpg(void) |
295 | { | 287 | { |
296 | #ifndef CONFIG_64BIT | 288 | #ifndef CONFIG_64BIT |
@@ -378,10 +370,14 @@ static __init void detect_diag44(void) | |||
378 | static __init void detect_machine_facilities(void) | 370 | static __init void detect_machine_facilities(void) |
379 | { | 371 | { |
380 | #ifdef CONFIG_64BIT | 372 | #ifdef CONFIG_64BIT |
373 | if (test_facility(8)) { | ||
374 | S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT1; | ||
375 | __ctl_set_bit(0, 23); | ||
376 | } | ||
377 | if (test_facility(78)) | ||
378 | S390_lowcore.machine_flags |= MACHINE_FLAG_EDAT2; | ||
381 | if (test_facility(3)) | 379 | if (test_facility(3)) |
382 | S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; | 380 | S390_lowcore.machine_flags |= MACHINE_FLAG_IDTE; |
383 | if (test_facility(8)) | ||
384 | S390_lowcore.machine_flags |= MACHINE_FLAG_PFMF; | ||
385 | if (test_facility(27)) | 381 | if (test_facility(27)) |
386 | S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; | 382 | S390_lowcore.machine_flags |= MACHINE_FLAG_MVCOS; |
387 | if (test_facility(40)) | 383 | if (test_facility(40)) |
@@ -484,7 +480,6 @@ void __init startup_init(void) | |||
484 | detect_diag9c(); | 480 | detect_diag9c(); |
485 | detect_diag44(); | 481 | detect_diag44(); |
486 | detect_machine_facilities(); | 482 | detect_machine_facilities(); |
487 | setup_hpage(); | ||
488 | setup_topology(); | 483 | setup_topology(); |
489 | sclp_facilities_detect(); | 484 | sclp_facilities_detect(); |
490 | detect_memory_layout(memory_chunk); | 485 | detect_memory_layout(memory_chunk); |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index f9761f806c9e..07d8de353984 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -295,7 +295,7 @@ sysc_sigpending: | |||
295 | jno sysc_return | 295 | jno sysc_return |
296 | lmg %r2,%r7,__PT_R2(%r11) # load svc arguments | 296 | lmg %r2,%r7,__PT_R2(%r11) # load svc arguments |
297 | lghi %r8,0 # svc 0 returns -ENOSYS | 297 | lghi %r8,0 # svc 0 returns -ENOSYS |
298 | lh %r1,__PT_INT_CODE+2(%r11) # load new svc number | 298 | llgh %r1,__PT_INT_CODE+2(%r11) # load new svc number |
299 | cghi %r1,NR_syscalls | 299 | cghi %r1,NR_syscalls |
300 | jnl sysc_nr_ok # invalid svc number -> do svc 0 | 300 | jnl sysc_nr_ok # invalid svc number -> do svc 0 |
301 | slag %r8,%r1,2 | 301 | slag %r8,%r1,2 |
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S index 805b6686b641..984726cbce16 100644 --- a/arch/s390/kernel/head.S +++ b/arch/s390/kernel/head.S | |||
@@ -52,7 +52,7 @@ __HEAD | |||
52 | .long 0x02000370,0x60000050 # the channel program the PSW | 52 | .long 0x02000370,0x60000050 # the channel program the PSW |
53 | .long 0x020003c0,0x60000050 # at location 0 is loaded. | 53 | .long 0x020003c0,0x60000050 # at location 0 is loaded. |
54 | .long 0x02000410,0x60000050 # Initial processing starts | 54 | .long 0x02000410,0x60000050 # Initial processing starts |
55 | .long 0x02000460,0x60000050 # at 0xf0 = iplstart. | 55 | .long 0x02000460,0x60000050 # at 0x200 = iplstart. |
56 | .long 0x020004b0,0x60000050 | 56 | .long 0x020004b0,0x60000050 |
57 | .long 0x02000500,0x60000050 | 57 | .long 0x02000500,0x60000050 |
58 | .long 0x02000550,0x60000050 | 58 | .long 0x02000550,0x60000050 |
@@ -62,11 +62,54 @@ __HEAD | |||
62 | .long 0x02000690,0x60000050 | 62 | .long 0x02000690,0x60000050 |
63 | .long 0x020006e0,0x20000050 | 63 | .long 0x020006e0,0x20000050 |
64 | 64 | ||
65 | .org 0xf0 | 65 | .org 0x200 |
66 | # | ||
67 | # subroutine to set architecture mode | ||
68 | # | ||
69 | .Lsetmode: | ||
70 | #ifdef CONFIG_64BIT | ||
71 | mvi __LC_AR_MODE_ID,1 # set esame flag | ||
72 | slr %r0,%r0 # set cpuid to zero | ||
73 | lhi %r1,2 # mode 2 = esame (dump) | ||
74 | sigp %r1,%r0,0x12 # switch to esame mode | ||
75 | bras %r13,0f | ||
76 | .fill 16,4,0x0 | ||
77 | 0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs | ||
78 | sam31 # switch to 31 bit addressing mode | ||
79 | #else | ||
80 | mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) | ||
81 | #endif | ||
82 | br %r14 | ||
83 | |||
84 | # | ||
85 | # subroutine to wait for end I/O | ||
86 | # | ||
87 | .Lirqwait: | ||
88 | #ifdef CONFIG_64BIT | ||
89 | mvc 0x1f0(16),.Lnewpsw # set up IO interrupt psw | ||
90 | lpsw .Lwaitpsw | ||
91 | .Lioint: | ||
92 | br %r14 | ||
93 | .align 8 | ||
94 | .Lnewpsw: | ||
95 | .quad 0x0000000080000000,.Lioint | ||
96 | #else | ||
97 | mvc 0x78(8),.Lnewpsw # set up IO interrupt psw | ||
98 | lpsw .Lwaitpsw | ||
99 | .Lioint: | ||
100 | br %r14 | ||
101 | .align 8 | ||
102 | .Lnewpsw: | ||
103 | .long 0x00080000,0x80000000+.Lioint | ||
104 | #endif | ||
105 | .Lwaitpsw: | ||
106 | .long 0x020a0000,0x80000000+.Lioint | ||
107 | |||
66 | # | 108 | # |
67 | # subroutine for loading cards from the reader | 109 | # subroutine for loading cards from the reader |
68 | # | 110 | # |
69 | .Lloader: | 111 | .Lloader: |
112 | la %r4,0(%r14) | ||
70 | la %r3,.Lorb # r2 = address of orb into r2 | 113 | la %r3,.Lorb # r2 = address of orb into r2 |
71 | la %r5,.Lirb # r4 = address of irb | 114 | la %r5,.Lirb # r4 = address of irb |
72 | la %r6,.Lccws | 115 | la %r6,.Lccws |
@@ -83,9 +126,7 @@ __HEAD | |||
83 | ssch 0(%r3) # load chunk of 1600 bytes | 126 | ssch 0(%r3) # load chunk of 1600 bytes |
84 | bnz .Llderr | 127 | bnz .Llderr |
85 | .Lwait4irq: | 128 | .Lwait4irq: |
86 | mvc 0x78(8),.Lnewpsw # set up IO interrupt psw | 129 | bas %r14,.Lirqwait |
87 | lpsw .Lwaitpsw | ||
88 | .Lioint: | ||
89 | c %r1,0xb8 # compare subchannel number | 130 | c %r1,0xb8 # compare subchannel number |
90 | bne .Lwait4irq | 131 | bne .Lwait4irq |
91 | tsch 0(%r5) | 132 | tsch 0(%r5) |
@@ -104,7 +145,7 @@ __HEAD | |||
104 | sr %r0,%r3 # #ccws*80-residual=#bytes read | 145 | sr %r0,%r3 # #ccws*80-residual=#bytes read |
105 | ar %r2,%r0 | 146 | ar %r2,%r0 |
106 | 147 | ||
107 | br %r14 # r2 contains the total size | 148 | br %r4 # r2 contains the total size |
108 | 149 | ||
109 | .Lcont: | 150 | .Lcont: |
110 | ahi %r2,0x640 # add 0x640 to total size | 151 | ahi %r2,0x640 # add 0x640 to total size |
@@ -128,10 +169,6 @@ __HEAD | |||
128 | .Lloadp:.long 0,0 | 169 | .Lloadp:.long 0,0 |
129 | .align 8 | 170 | .align 8 |
130 | .Lcrash:.long 0x000a0000,0x00000000 | 171 | .Lcrash:.long 0x000a0000,0x00000000 |
131 | .Lnewpsw: | ||
132 | .long 0x00080000,0x80000000+.Lioint | ||
133 | .Lwaitpsw: | ||
134 | .long 0x020a0000,0x80000000+.Lioint | ||
135 | 172 | ||
136 | .align 8 | 173 | .align 8 |
137 | .Lccws: .rept 19 | 174 | .Lccws: .rept 19 |
@@ -140,6 +177,7 @@ __HEAD | |||
140 | .long 0x02200050,0x00000000 | 177 | .long 0x02200050,0x00000000 |
141 | 178 | ||
142 | iplstart: | 179 | iplstart: |
180 | bas %r14,.Lsetmode # Immediately switch to 64 bit mode | ||
143 | lh %r1,0xb8 # test if subchannel number | 181 | lh %r1,0xb8 # test if subchannel number |
144 | bct %r1,.Lnoload # is valid | 182 | bct %r1,.Lnoload # is valid |
145 | l %r1,0xb8 # load ipl subchannel number | 183 | l %r1,0xb8 # load ipl subchannel number |
@@ -209,8 +247,8 @@ iplstart: | |||
209 | # | 247 | # |
210 | # reset files in VM reader | 248 | # reset files in VM reader |
211 | # | 249 | # |
212 | stidp __LC_SAVE_AREA_SYNC # store cpuid | 250 | stidp .Lcpuid # store cpuid |
213 | tm __LC_SAVE_AREA_SYNC,0xff# running VM ? | 251 | tm .Lcpuid,0xff # running VM ? |
214 | bno .Lnoreset | 252 | bno .Lnoreset |
215 | la %r2,.Lreset | 253 | la %r2,.Lreset |
216 | lhi %r3,26 | 254 | lhi %r3,26 |
@@ -222,23 +260,14 @@ iplstart: | |||
222 | tm 31(%r5),0xff # bits is set in the schib | 260 | tm 31(%r5),0xff # bits is set in the schib |
223 | bz .Lnoreset | 261 | bz .Lnoreset |
224 | .Lwaitforirq: | 262 | .Lwaitforirq: |
225 | mvc 0x78(8),.Lrdrnewpsw # set up IO interrupt psw | 263 | bas %r14,.Lirqwait # wait for IO interrupt |
226 | .Lwaitrdrirq: | ||
227 | lpsw .Lrdrwaitpsw | ||
228 | .Lrdrint: | ||
229 | c %r1,0xb8 # compare subchannel number | 264 | c %r1,0xb8 # compare subchannel number |
230 | bne .Lwaitrdrirq | 265 | bne .Lwaitforirq |
231 | la %r5,.Lirb | 266 | la %r5,.Lirb |
232 | tsch 0(%r5) | 267 | tsch 0(%r5) |
233 | .Lnoreset: | 268 | .Lnoreset: |
234 | b .Lnoload | 269 | b .Lnoload |
235 | 270 | ||
236 | .align 8 | ||
237 | .Lrdrnewpsw: | ||
238 | .long 0x00080000,0x80000000+.Lrdrint | ||
239 | .Lrdrwaitpsw: | ||
240 | .long 0x020a0000,0x80000000+.Lrdrint | ||
241 | |||
242 | # | 271 | # |
243 | # everything loaded, go for it | 272 | # everything loaded, go for it |
244 | # | 273 | # |
@@ -254,6 +283,8 @@ iplstart: | |||
254 | .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" | 283 | .byte 0xc8,0xd6,0xd3,0xc4 # "change rdr all keep nohold" |
255 | .L_eof: .long 0xc5d6c600 /* C'EOF' */ | 284 | .L_eof: .long 0xc5d6c600 /* C'EOF' */ |
256 | .L_hdr: .long 0xc8c4d900 /* C'HDR' */ | 285 | .L_hdr: .long 0xc8c4d900 /* C'HDR' */ |
286 | .align 8 | ||
287 | .Lcpuid:.fill 8,1,0 | ||
257 | 288 | ||
258 | # | 289 | # |
259 | # SALIPL loader support. Based on a patch by Rob van der Heij. | 290 | # SALIPL loader support. Based on a patch by Rob van der Heij. |
@@ -263,6 +294,7 @@ iplstart: | |||
263 | .org 0x800 | 294 | .org 0x800 |
264 | ENTRY(start) | 295 | ENTRY(start) |
265 | stm %r0,%r15,0x07b0 # store registers | 296 | stm %r0,%r15,0x07b0 # store registers |
297 | bas %r14,.Lsetmode # Immediately switch to 64 bit mode | ||
266 | basr %r12,%r0 | 298 | basr %r12,%r0 |
267 | .base: | 299 | .base: |
268 | l %r11,.parm | 300 | l %r11,.parm |
@@ -343,6 +375,18 @@ ENTRY(startup) | |||
343 | ENTRY(startup_kdump) | 375 | ENTRY(startup_kdump) |
344 | j .Lep_startup_kdump | 376 | j .Lep_startup_kdump |
345 | .Lep_startup_normal: | 377 | .Lep_startup_normal: |
378 | #ifdef CONFIG_64BIT | ||
379 | mvi __LC_AR_MODE_ID,1 # set esame flag | ||
380 | slr %r0,%r0 # set cpuid to zero | ||
381 | lhi %r1,2 # mode 2 = esame (dump) | ||
382 | sigp %r1,%r0,0x12 # switch to esame mode | ||
383 | bras %r13,0f | ||
384 | .fill 16,4,0x0 | ||
385 | 0: lmh %r0,%r15,0(%r13) # clear high-order half of gprs | ||
386 | sam31 # switch to 31 bit addressing mode | ||
387 | #else | ||
388 | mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) | ||
389 | #endif | ||
346 | basr %r13,0 # get base | 390 | basr %r13,0 # get base |
347 | .LPG0: | 391 | .LPG0: |
348 | xc 0x200(256),0x200 # partially clear lowcore | 392 | xc 0x200(256),0x200 # partially clear lowcore |
@@ -410,22 +454,17 @@ ENTRY(startup_kdump) | |||
410 | #endif | 454 | #endif |
411 | 455 | ||
412 | #ifdef CONFIG_64BIT | 456 | #ifdef CONFIG_64BIT |
413 | mvi __LC_AR_MODE_ID,1 # set esame flag | 457 | /* Continue with 64bit startup code in head64.S */ |
414 | slr %r0,%r0 # set cpuid to zero | ||
415 | lhi %r1,2 # mode 2 = esame (dump) | ||
416 | sigp %r1,%r0,0x12 # switch to esame mode | ||
417 | sam64 # switch to 64 bit mode | 458 | sam64 # switch to 64 bit mode |
418 | larl %r13,4f | ||
419 | lmh %r0,%r15,0(%r13) # clear high-order half | ||
420 | jg startup_continue | 459 | jg startup_continue |
421 | 4: .fill 16,4,0x0 | ||
422 | #else | 460 | #else |
423 | mvi __LC_AR_MODE_ID,0 # set ESA flag (mode 0) | 461 | /* Continue with 31bit startup code in head31.S */ |
424 | l %r13,4f-.LPG0(%r13) | 462 | l %r13,4f-.LPG0(%r13) |
425 | b 0(%r13) | 463 | b 0(%r13) |
426 | .align 8 | 464 | .align 8 |
427 | 4: .long startup_continue | 465 | 4: .long startup_continue |
428 | #endif | 466 | #endif |
467 | |||
429 | .align 8 | 468 | .align 8 |
430 | 5: .long 0x7fffffff,0xffffffff | 469 | 5: .long 0x7fffffff,0xffffffff |
431 | 470 | ||
diff --git a/arch/s390/kernel/head31.S b/arch/s390/kernel/head31.S index a1372ae24ae1..9a99856df1c9 100644 --- a/arch/s390/kernel/head31.S +++ b/arch/s390/kernel/head31.S | |||
@@ -78,10 +78,7 @@ ENTRY(startup_continue) | |||
78 | 78 | ||
79 | ENTRY(_ehead) | 79 | ENTRY(_ehead) |
80 | 80 | ||
81 | #ifdef CONFIG_SHARED_KERNEL | ||
82 | .org 0x100000 - 0x11000 # head.o ends at 0x11000 | 81 | .org 0x100000 - 0x11000 # head.o ends at 0x11000 |
83 | #endif | ||
84 | |||
85 | # | 82 | # |
86 | # startup-code, running in absolute addressing mode | 83 | # startup-code, running in absolute addressing mode |
87 | # | 84 | # |
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S index c108af28bbe8..b9e25ae2579c 100644 --- a/arch/s390/kernel/head64.S +++ b/arch/s390/kernel/head64.S | |||
@@ -76,10 +76,7 @@ ENTRY(startup_continue) | |||
76 | 76 | ||
77 | ENTRY(_ehead) | 77 | ENTRY(_ehead) |
78 | 78 | ||
79 | #ifdef CONFIG_SHARED_KERNEL | ||
80 | .org 0x100000 - 0x11000 # head.o ends at 0x11000 | 79 | .org 0x100000 - 0x11000 # head.o ends at 0x11000 |
81 | #endif | ||
82 | |||
83 | # | 80 | # |
84 | # startup-code, running in absolute addressing mode | 81 | # startup-code, running in absolute addressing mode |
85 | # | 82 | # |
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c index 46412b1d7e1e..4610deafd953 100644 --- a/arch/s390/kernel/module.c +++ b/arch/s390/kernel/module.c | |||
@@ -44,6 +44,17 @@ | |||
44 | #define PLT_ENTRY_SIZE 20 | 44 | #define PLT_ENTRY_SIZE 20 |
45 | #endif /* CONFIG_64BIT */ | 45 | #endif /* CONFIG_64BIT */ |
46 | 46 | ||
47 | #ifdef CONFIG_64BIT | ||
48 | void *module_alloc(unsigned long size) | ||
49 | { | ||
50 | if (PAGE_ALIGN(size) > MODULES_LEN) | ||
51 | return NULL; | ||
52 | return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, | ||
53 | GFP_KERNEL, PAGE_KERNEL, -1, | ||
54 | __builtin_return_address(0)); | ||
55 | } | ||
56 | #endif | ||
57 | |||
47 | /* Free memory returned from module_alloc */ | 58 | /* Free memory returned from module_alloc */ |
48 | void module_free(struct module *mod, void *module_region) | 59 | void module_free(struct module *mod, void *module_region) |
49 | { | 60 | { |
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index afa9fdba200e..b1f2be9aaaad 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
@@ -105,6 +105,11 @@ EXPORT_SYMBOL(VMALLOC_END); | |||
105 | struct page *vmemmap; | 105 | struct page *vmemmap; |
106 | EXPORT_SYMBOL(vmemmap); | 106 | EXPORT_SYMBOL(vmemmap); |
107 | 107 | ||
108 | #ifdef CONFIG_64BIT | ||
109 | unsigned long MODULES_VADDR; | ||
110 | unsigned long MODULES_END; | ||
111 | #endif | ||
112 | |||
108 | /* An array with a pointer to the lowcore of every CPU. */ | 113 | /* An array with a pointer to the lowcore of every CPU. */ |
109 | struct _lowcore *lowcore_ptr[NR_CPUS]; | 114 | struct _lowcore *lowcore_ptr[NR_CPUS]; |
110 | EXPORT_SYMBOL(lowcore_ptr); | 115 | EXPORT_SYMBOL(lowcore_ptr); |
@@ -544,19 +549,23 @@ static void __init setup_memory_end(void) | |||
544 | 549 | ||
545 | /* Choose kernel address space layout: 2, 3, or 4 levels. */ | 550 | /* Choose kernel address space layout: 2, 3, or 4 levels. */ |
546 | #ifdef CONFIG_64BIT | 551 | #ifdef CONFIG_64BIT |
547 | vmalloc_size = VMALLOC_END ?: 128UL << 30; | 552 | vmalloc_size = VMALLOC_END ?: (128UL << 30) - MODULES_LEN; |
548 | tmp = (memory_end ?: real_memory_size) / PAGE_SIZE; | 553 | tmp = (memory_end ?: real_memory_size) / PAGE_SIZE; |
549 | tmp = tmp * (sizeof(struct page) + PAGE_SIZE) + vmalloc_size; | 554 | tmp = tmp * (sizeof(struct page) + PAGE_SIZE) + vmalloc_size; |
550 | if (tmp <= (1UL << 42)) | 555 | if (tmp <= (1UL << 42)) |
551 | vmax = 1UL << 42; /* 3-level kernel page table */ | 556 | vmax = 1UL << 42; /* 3-level kernel page table */ |
552 | else | 557 | else |
553 | vmax = 1UL << 53; /* 4-level kernel page table */ | 558 | vmax = 1UL << 53; /* 4-level kernel page table */ |
559 | /* module area is at the end of the kernel address space. */ | ||
560 | MODULES_END = vmax; | ||
561 | MODULES_VADDR = MODULES_END - MODULES_LEN; | ||
562 | VMALLOC_END = MODULES_VADDR; | ||
554 | #else | 563 | #else |
555 | vmalloc_size = VMALLOC_END ?: 96UL << 20; | 564 | vmalloc_size = VMALLOC_END ?: 96UL << 20; |
556 | vmax = 1UL << 31; /* 2-level kernel page table */ | 565 | vmax = 1UL << 31; /* 2-level kernel page table */ |
557 | #endif | ||
558 | /* vmalloc area is at the end of the kernel address space. */ | 566 | /* vmalloc area is at the end of the kernel address space. */ |
559 | VMALLOC_END = vmax; | 567 | VMALLOC_END = vmax; |
568 | #endif | ||
560 | VMALLOC_START = vmax - vmalloc_size; | 569 | VMALLOC_START = vmax - vmalloc_size; |
561 | 570 | ||
562 | /* Split remaining virtual space between 1:1 mapping & vmemmap array */ | 571 | /* Split remaining virtual space between 1:1 mapping & vmemmap array */ |
@@ -768,6 +777,40 @@ static void __init reserve_crashkernel(void) | |||
768 | #endif | 777 | #endif |
769 | } | 778 | } |
770 | 779 | ||
780 | static void __init init_storage_keys(unsigned long start, unsigned long end) | ||
781 | { | ||
782 | unsigned long boundary, function, size; | ||
783 | |||
784 | while (start < end) { | ||
785 | if (MACHINE_HAS_EDAT2) { | ||
786 | /* set storage keys for a 2GB frame */ | ||
787 | function = 0x22000 | PAGE_DEFAULT_KEY; | ||
788 | size = 1UL << 31; | ||
789 | boundary = (start + size) & ~(size - 1); | ||
790 | if (boundary <= end) { | ||
791 | do { | ||
792 | start = pfmf(function, start); | ||
793 | } while (start < boundary); | ||
794 | continue; | ||
795 | } | ||
796 | } | ||
797 | if (MACHINE_HAS_EDAT1) { | ||
798 | /* set storage keys for a 1MB frame */ | ||
799 | function = 0x21000 | PAGE_DEFAULT_KEY; | ||
800 | size = 1UL << 20; | ||
801 | boundary = (start + size) & ~(size - 1); | ||
802 | if (boundary <= end) { | ||
803 | do { | ||
804 | start = pfmf(function, start); | ||
805 | } while (start < boundary); | ||
806 | continue; | ||
807 | } | ||
808 | } | ||
809 | page_set_storage_key(start, PAGE_DEFAULT_KEY, 0); | ||
810 | start += PAGE_SIZE; | ||
811 | } | ||
812 | } | ||
813 | |||
771 | static void __init setup_memory(void) | 814 | static void __init setup_memory(void) |
772 | { | 815 | { |
773 | unsigned long bootmap_size; | 816 | unsigned long bootmap_size; |
@@ -846,9 +889,7 @@ static void __init setup_memory(void) | |||
846 | memblock_add_node(PFN_PHYS(start_chunk), | 889 | memblock_add_node(PFN_PHYS(start_chunk), |
847 | PFN_PHYS(end_chunk - start_chunk), 0); | 890 | PFN_PHYS(end_chunk - start_chunk), 0); |
848 | pfn = max(start_chunk, start_pfn); | 891 | pfn = max(start_chunk, start_pfn); |
849 | for (; pfn < end_chunk; pfn++) | 892 | init_storage_keys(PFN_PHYS(pfn), PFN_PHYS(end_chunk)); |
850 | page_set_storage_key(PFN_PHYS(pfn), | ||
851 | PAGE_DEFAULT_KEY, 0); | ||
852 | } | 893 | } |
853 | 894 | ||
854 | psw_set_key(PAGE_DEFAULT_KEY); | 895 | psw_set_key(PAGE_DEFAULT_KEY); |