Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Support for suspend and resume on s390 |
| 3 | * |
| 4 | * Copyright IBM Corp. 2009 |
| 5 | * |
| 6 | * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com> |
| 7 | * |
| 8 | */ |
| 9 | |
Heiko Carstens | c63b196 | 2009-07-24 12:39:50 +0200 | [diff] [blame] | 10 | #include <asm/system.h> |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 11 | |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 12 | void save_processor_state(void) |
| 13 | { |
Heiko Carstens | c63b196 | 2009-07-24 12:39:50 +0200 | [diff] [blame] | 14 | /* swsusp_arch_suspend() actually saves all cpu register contents. |
| 15 | * Machine checks must be disabled since swsusp_arch_suspend() stores |
| 16 | * register contents to their lowcore save areas. That's the same |
| 17 | * place where register contents on machine checks would be saved. |
| 18 | * To avoid register corruption disable machine checks. |
| 19 | * We must also disable machine checks in the new psw mask for |
| 20 | * program checks, since swsusp_arch_suspend() may generate program |
| 21 | * checks. Disabling machine checks for all other new psw masks is |
| 22 | * just paranoia. |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 23 | */ |
Heiko Carstens | c63b196 | 2009-07-24 12:39:50 +0200 | [diff] [blame] | 24 | local_mcck_disable(); |
| 25 | /* Disable lowcore protection */ |
| 26 | __ctl_clear_bit(0,28); |
| 27 | S390_lowcore.external_new_psw.mask &= ~PSW_MASK_MCHECK; |
| 28 | S390_lowcore.svc_new_psw.mask &= ~PSW_MASK_MCHECK; |
| 29 | S390_lowcore.io_new_psw.mask &= ~PSW_MASK_MCHECK; |
| 30 | S390_lowcore.program_new_psw.mask &= ~PSW_MASK_MCHECK; |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 31 | } |
| 32 | |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 33 | void restore_processor_state(void) |
| 34 | { |
Heiko Carstens | c63b196 | 2009-07-24 12:39:50 +0200 | [diff] [blame] | 35 | S390_lowcore.external_new_psw.mask |= PSW_MASK_MCHECK; |
| 36 | S390_lowcore.svc_new_psw.mask |= PSW_MASK_MCHECK; |
| 37 | S390_lowcore.io_new_psw.mask |= PSW_MASK_MCHECK; |
| 38 | S390_lowcore.program_new_psw.mask |= PSW_MASK_MCHECK; |
| 39 | /* Enable lowcore protection */ |
| 40 | __ctl_set_bit(0,28); |
| 41 | local_mcck_enable(); |
Hans-Joachim Picht | 155af2f | 2009-06-16 10:30:52 +0200 | [diff] [blame] | 42 | } |