2 * Suspend support specific for s390.
4 * Copyright IBM Corp. 2009
6 * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com>
9 #include <linux/suspend.h>
10 #include <linux/reboot.h>
11 #include <linux/pfn.h>
13 #include <asm/sections.h>
14 #include <asm/system.h>
18 * References to section boundaries
20 extern const void __nosave_begin
, __nosave_end
;
23 * check if given pfn is in the 'nosave' or in the read only NSS section
25 int pfn_is_nosave(unsigned long pfn
)
27 unsigned long nosave_begin_pfn
= __pa(&__nosave_begin
) >> PAGE_SHIFT
;
28 unsigned long nosave_end_pfn
= PAGE_ALIGN(__pa(&__nosave_end
))
30 unsigned long eshared_pfn
= PFN_DOWN(__pa(&_eshared
)) - 1;
31 unsigned long stext_pfn
= PFN_DOWN(__pa(&_stext
));
33 if (pfn
>= nosave_begin_pfn
&& pfn
< nosave_end_pfn
)
35 if (pfn
>= stext_pfn
&& pfn
<= eshared_pfn
) {
36 if (ipl_info
.type
== IPL_TYPE_NSS
)
38 } else if ((tprot(pfn
* PAGE_SIZE
) && pfn
> 0))
43 void save_processor_state(void)
45 /* swsusp_arch_suspend() actually saves all cpu register contents.
46 * Machine checks must be disabled since swsusp_arch_suspend() stores
47 * register contents to their lowcore save areas. That's the same
48 * place where register contents on machine checks would be saved.
49 * To avoid register corruption disable machine checks.
50 * We must also disable machine checks in the new psw mask for
51 * program checks, since swsusp_arch_suspend() may generate program
52 * checks. Disabling machine checks for all other new psw masks is
56 /* Disable lowcore protection */
57 __ctl_clear_bit(0,28);
58 S390_lowcore
.external_new_psw
.mask
&= ~PSW_MASK_MCHECK
;
59 S390_lowcore
.svc_new_psw
.mask
&= ~PSW_MASK_MCHECK
;
60 S390_lowcore
.io_new_psw
.mask
&= ~PSW_MASK_MCHECK
;
61 S390_lowcore
.program_new_psw
.mask
&= ~PSW_MASK_MCHECK
;
64 void restore_processor_state(void)
66 S390_lowcore
.external_new_psw
.mask
|= PSW_MASK_MCHECK
;
67 S390_lowcore
.svc_new_psw
.mask
|= PSW_MASK_MCHECK
;
68 S390_lowcore
.io_new_psw
.mask
|= PSW_MASK_MCHECK
;
69 S390_lowcore
.program_new_psw
.mask
|= PSW_MASK_MCHECK
;
70 /* Enable lowcore protection */