Commit 2573a575 authored by Heiko Carstens's avatar Heiko Carstens Committed by Martin Schwidefsky

[S390] hibernate: make sure pfn_is_nosave handles lowcore pages

pfn_is_nosave doesn't return the correct value for the second lowcore
page if lowcore protection is enabled. Make sure it always returns
the correct value.

While at it simplify the whole thing.
NSS special handling is done by the tprot check like it already works
for DCSS as well. So remove the extra code for NSS.
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 3fd26a77
...@@ -195,6 +195,8 @@ union save_area { ...@@ -195,6 +195,8 @@ union save_area {
#define LC_ORDER 1 #define LC_ORDER 1
#endif #endif
#define LC_PAGES (1UL << LC_ORDER)
struct _lowcore struct _lowcore
{ {
#ifndef __s390x__ #ifndef __s390x__
......
...@@ -6,36 +6,26 @@ ...@@ -6,36 +6,26 @@
* Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com> * Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com>
*/ */
#include <linux/suspend.h>
#include <linux/reboot.h>
#include <linux/pfn.h> #include <linux/pfn.h>
#include <linux/mm.h>
#include <asm/sections.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/ipl.h>
/* /*
* References to section boundaries * References to section boundaries
*/ */
extern const void __nosave_begin, __nosave_end; extern const void __nosave_begin, __nosave_end;
/*
* check if given pfn is in the 'nosave' or in the read only NSS section
*/
int pfn_is_nosave(unsigned long pfn) int pfn_is_nosave(unsigned long pfn)
{ {
unsigned long nosave_begin_pfn = __pa(&__nosave_begin) >> PAGE_SHIFT; unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
unsigned long nosave_end_pfn = PAGE_ALIGN(__pa(&__nosave_end)) unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end));
>> PAGE_SHIFT;
unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1;
unsigned long stext_pfn = PFN_DOWN(__pa(&_stext));
/* Always save lowcore pages (LC protection might be enabled). */
if (pfn <= LC_PAGES)
return 0;
if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn) if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn)
return 1; return 1;
if (pfn >= stext_pfn && pfn <= eshared_pfn) { /* Skip memory holes and read-only pages (NSS, DCSS, ...). */
if (ipl_info.type == IPL_TYPE_NSS) if (tprot(PFN_PHYS(pfn)))
return 1;
} else if ((tprot(pfn * PAGE_SIZE) && pfn > 0))
return 1; return 1;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment