diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2006-12-04 09:40:40 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-12-04 09:40:40 -0500 |
commit | 29b08d2bae854f66d3cfd5f57aaf2e7c2c7fce32 (patch) | |
tree | 1a907c124f6a12ec4617a030e412a01be4c81b04 | |
parent | 36a2bd425d9b3ba2a40b0653e08d17702c78558e (diff) |
[S390] pfault code cleanup.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | arch/s390/kernel/machine_kexec.c | 8 | ||||
-rw-r--r-- | arch/s390/kernel/smp.c | 13 | ||||
-rw-r--r-- | arch/s390/kernel/traps.c | 25 | ||||
-rw-r--r-- | arch/s390/mm/fault.c | 28 | ||||
-rw-r--r-- | include/asm-s390/system.h | 10 |
5 files changed, 40 insertions, 44 deletions
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c index def5caf8f72f..f6d9bcc0f75b 100644 --- a/arch/s390/kernel/machine_kexec.c +++ b/arch/s390/kernel/machine_kexec.c | |||
@@ -49,18 +49,12 @@ void machine_shutdown(void) | |||
49 | printk(KERN_INFO "kexec: machine_shutdown called\n"); | 49 | printk(KERN_INFO "kexec: machine_shutdown called\n"); |
50 | } | 50 | } |
51 | 51 | ||
52 | extern void pfault_fini(void); | ||
53 | |||
54 | void machine_kexec(struct kimage *image) | 52 | void machine_kexec(struct kimage *image) |
55 | { | 53 | { |
56 | relocate_kernel_t data_mover; | 54 | relocate_kernel_t data_mover; |
57 | 55 | ||
58 | preempt_disable(); | ||
59 | #ifdef CONFIG_PFAULT | ||
60 | if (MACHINE_IS_VM) | ||
61 | pfault_fini(); | ||
62 | #endif | ||
63 | smp_send_stop(); | 56 | smp_send_stop(); |
57 | pfault_fini(); | ||
64 | s390_reset_system(); | 58 | s390_reset_system(); |
65 | 59 | ||
66 | data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page); | 60 | data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page); |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index b549a43ed08f..19090f7d4f51 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -460,8 +460,6 @@ __init smp_count_cpus(void) | |||
460 | */ | 460 | */ |
461 | extern void init_cpu_timer(void); | 461 | extern void init_cpu_timer(void); |
462 | extern void init_cpu_vtimer(void); | 462 | extern void init_cpu_vtimer(void); |
463 | extern int pfault_init(void); | ||
464 | extern void pfault_fini(void); | ||
465 | 463 | ||
466 | int __devinit start_secondary(void *cpuvoid) | 464 | int __devinit start_secondary(void *cpuvoid) |
467 | { | 465 | { |
@@ -473,11 +471,9 @@ int __devinit start_secondary(void *cpuvoid) | |||
473 | #ifdef CONFIG_VIRT_TIMER | 471 | #ifdef CONFIG_VIRT_TIMER |
474 | init_cpu_vtimer(); | 472 | init_cpu_vtimer(); |
475 | #endif | 473 | #endif |
476 | #ifdef CONFIG_PFAULT | ||
477 | /* Enable pfault pseudo page faults on this cpu. */ | 474 | /* Enable pfault pseudo page faults on this cpu. */ |
478 | if (MACHINE_IS_VM) | 475 | pfault_init(); |
479 | pfault_init(); | 476 | |
480 | #endif | ||
481 | /* Mark this cpu as online */ | 477 | /* Mark this cpu as online */ |
482 | cpu_set(smp_processor_id(), cpu_online_map); | 478 | cpu_set(smp_processor_id(), cpu_online_map); |
483 | /* Switch on interrupts */ | 479 | /* Switch on interrupts */ |
@@ -667,11 +663,8 @@ __cpu_disable(void) | |||
667 | } | 663 | } |
668 | cpu_clear(cpu, cpu_online_map); | 664 | cpu_clear(cpu, cpu_online_map); |
669 | 665 | ||
670 | #ifdef CONFIG_PFAULT | ||
671 | /* Disable pfault pseudo page faults on this cpu. */ | 666 | /* Disable pfault pseudo page faults on this cpu. */ |
672 | if (MACHINE_IS_VM) | 667 | pfault_fini(); |
673 | pfault_fini(); | ||
674 | #endif | ||
675 | 668 | ||
676 | memset(&cr_parms.orvals, 0, sizeof(cr_parms.orvals)); | 669 | memset(&cr_parms.orvals, 0, sizeof(cr_parms.orvals)); |
677 | memset(&cr_parms.andvals, 0xff, sizeof(cr_parms.andvals)); | 670 | memset(&cr_parms.andvals, 0xff, sizeof(cr_parms.andvals)); |
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index 92ecffbc8d82..475dbb884430 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c | |||
@@ -58,12 +58,6 @@ int sysctl_userprocess_debug = 0; | |||
58 | 58 | ||
59 | extern pgm_check_handler_t do_protection_exception; | 59 | extern pgm_check_handler_t do_protection_exception; |
60 | extern pgm_check_handler_t do_dat_exception; | 60 | extern pgm_check_handler_t do_dat_exception; |
61 | #ifdef CONFIG_PFAULT | ||
62 | extern int pfault_init(void); | ||
63 | extern void pfault_fini(void); | ||
64 | extern void pfault_interrupt(__u16 error_code); | ||
65 | static ext_int_info_t ext_int_pfault; | ||
66 | #endif | ||
67 | extern pgm_check_handler_t do_monitor_call; | 61 | extern pgm_check_handler_t do_monitor_call; |
68 | 62 | ||
69 | #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) | 63 | #define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) |
@@ -739,22 +733,5 @@ void __init trap_init(void) | |||
739 | pgm_check_table[0x1C] = &space_switch_exception; | 733 | pgm_check_table[0x1C] = &space_switch_exception; |
740 | pgm_check_table[0x1D] = &hfp_sqrt_exception; | 734 | pgm_check_table[0x1D] = &hfp_sqrt_exception; |
741 | pgm_check_table[0x40] = &do_monitor_call; | 735 | pgm_check_table[0x40] = &do_monitor_call; |
742 | 736 | pfault_irq_init(); | |
743 | if (MACHINE_IS_VM) { | ||
744 | #ifdef CONFIG_PFAULT | ||
745 | /* | ||
746 | * Try to get pfault pseudo page faults going. | ||
747 | */ | ||
748 | if (register_early_external_interrupt(0x2603, pfault_interrupt, | ||
749 | &ext_int_pfault) != 0) | ||
750 | panic("Couldn't request external interrupt 0x2603"); | ||
751 | |||
752 | if (pfault_init() == 0) | ||
753 | return; | ||
754 | |||
755 | /* Tough luck, no pfault. */ | ||
756 | unregister_early_external_interrupt(0x2603, pfault_interrupt, | ||
757 | &ext_int_pfault); | ||
758 | #endif | ||
759 | } | ||
760 | } | 737 | } |
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 1c323bbfda91..cd85e34d8703 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
32 | #include <asm/pgtable.h> | 32 | #include <asm/pgtable.h> |
33 | #include <asm/kdebug.h> | 33 | #include <asm/kdebug.h> |
34 | #include <asm/s390_ext.h> | ||
34 | 35 | ||
35 | #ifndef CONFIG_64BIT | 36 | #ifndef CONFIG_64BIT |
36 | #define __FAIL_ADDR_MASK 0x7ffff000 | 37 | #define __FAIL_ADDR_MASK 0x7ffff000 |
@@ -394,6 +395,7 @@ void do_dat_exception(struct pt_regs *regs, unsigned long error_code) | |||
394 | /* | 395 | /* |
395 | * 'pfault' pseudo page faults routines. | 396 | * 'pfault' pseudo page faults routines. |
396 | */ | 397 | */ |
398 | static ext_int_info_t ext_int_pfault; | ||
397 | static int pfault_disable = 0; | 399 | static int pfault_disable = 0; |
398 | 400 | ||
399 | static int __init nopfault(char *str) | 401 | static int __init nopfault(char *str) |
@@ -422,7 +424,7 @@ int pfault_init(void) | |||
422 | __PF_RES_FIELD }; | 424 | __PF_RES_FIELD }; |
423 | int rc; | 425 | int rc; |
424 | 426 | ||
425 | if (pfault_disable) | 427 | if (!MACHINE_IS_VM || pfault_disable) |
426 | return -1; | 428 | return -1; |
427 | asm volatile( | 429 | asm volatile( |
428 | " diag %1,%0,0x258\n" | 430 | " diag %1,%0,0x258\n" |
@@ -440,7 +442,7 @@ void pfault_fini(void) | |||
440 | pfault_refbk_t refbk = | 442 | pfault_refbk_t refbk = |
441 | { 0x258, 1, 5, 2, 0ULL, 0ULL, 0ULL, 0ULL }; | 443 | { 0x258, 1, 5, 2, 0ULL, 0ULL, 0ULL, 0ULL }; |
442 | 444 | ||
443 | if (pfault_disable) | 445 | if (!MACHINE_IS_VM || pfault_disable) |
444 | return; | 446 | return; |
445 | __ctl_clear_bit(0,9); | 447 | __ctl_clear_bit(0,9); |
446 | asm volatile( | 448 | asm volatile( |
@@ -500,5 +502,25 @@ pfault_interrupt(__u16 error_code) | |||
500 | set_tsk_need_resched(tsk); | 502 | set_tsk_need_resched(tsk); |
501 | } | 503 | } |
502 | } | 504 | } |
503 | #endif | ||
504 | 505 | ||
506 | void __init pfault_irq_init(void) | ||
507 | { | ||
508 | if (!MACHINE_IS_VM) | ||
509 | return; | ||
510 | |||
511 | /* | ||
512 | * Try to get pfault pseudo page faults going. | ||
513 | */ | ||
514 | if (register_early_external_interrupt(0x2603, pfault_interrupt, | ||
515 | &ext_int_pfault) != 0) | ||
516 | panic("Couldn't request external interrupt 0x2603"); | ||
517 | |||
518 | if (pfault_init() == 0) | ||
519 | return; | ||
520 | |||
521 | /* Tough luck, no pfault. */ | ||
522 | pfault_disable = 1; | ||
523 | unregister_early_external_interrupt(0x2603, pfault_interrupt, | ||
524 | &ext_int_pfault); | ||
525 | } | ||
526 | #endif | ||
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h index ccbafe4bf2cb..bd0b05ae87d2 100644 --- a/include/asm-s390/system.h +++ b/include/asm-s390/system.h | |||
@@ -115,6 +115,16 @@ extern void account_system_vtime(struct task_struct *); | |||
115 | #define account_vtime(x) do { /* empty */ } while (0) | 115 | #define account_vtime(x) do { /* empty */ } while (0) |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | #ifdef CONFIG_PFAULT | ||
119 | extern void pfault_irq_init(void); | ||
120 | extern int pfault_init(void); | ||
121 | extern void pfault_fini(void); | ||
122 | #else /* CONFIG_PFAULT */ | ||
123 | #define pfault_irq_init() do { } while (0) | ||
124 | #define pfault_init() ({-1;}) | ||
125 | #define pfault_fini() do { } while (0) | ||
126 | #endif /* CONFIG_PFAULT */ | ||
127 | |||
118 | #define finish_arch_switch(prev) do { \ | 128 | #define finish_arch_switch(prev) do { \ |
119 | set_fs(current->thread.mm_segment); \ | 129 | set_fs(current->thread.mm_segment); \ |
120 | account_vtime(prev); \ | 130 | account_vtime(prev); \ |