mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
s390: remove broken hibernate / power management support
Hibernation is known to be broken for many years on s390. Given that there aren't any real use cases, remove the code instead of spending time to fix and maintain it. Without hibernate support it doesn't make too much sense to keep power management support; therefore remove it completely. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
1b648dfd54
commit
394216275c
@ -102,7 +102,6 @@ config S390
|
||||
select ARCH_INLINE_WRITE_UNLOCK_IRQ
|
||||
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
|
||||
select ARCH_KEEP_MEMBLOCK
|
||||
select ARCH_SAVE_PAGE_KEYS if HIBERNATION
|
||||
select ARCH_STACKWALK
|
||||
select ARCH_SUPPORTS_ATOMIC_RMW
|
||||
select ARCH_SUPPORTS_NUMA_BALANCING
|
||||
@ -810,15 +809,6 @@ config SECCOMP
|
||||
|
||||
If unsure, say Y.
|
||||
|
||||
menu "Power Management"
|
||||
|
||||
config ARCH_HIBERNATION_POSSIBLE
|
||||
def_bool y
|
||||
|
||||
source "kernel/power/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
config CCW
|
||||
def_bool y
|
||||
|
||||
|
@ -54,7 +54,6 @@ CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE)
|
||||
|
||||
obj-$(CONFIG_MODULES) += module.o
|
||||
obj-$(CONFIG_SCHED_TOPOLOGY) += topology.o
|
||||
obj-$(CONFIG_HIBERNATION) += suspend.o swsusp.o
|
||||
obj-$(CONFIG_AUDIT) += audit.o
|
||||
compat-obj-$(CONFIG_AUDIT) += compat_audit.o
|
||||
obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/debug_locks.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <asm/cio.h>
|
||||
#include <asm/setup.h>
|
||||
#include <asm/pgtable.h>
|
||||
@ -38,36 +37,6 @@ extern const unsigned long long relocate_kernel_len;
|
||||
|
||||
#ifdef CONFIG_CRASH_DUMP
|
||||
|
||||
/*
|
||||
* PM notifier callback for kdump
|
||||
*/
|
||||
static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
|
||||
void *ptr)
|
||||
{
|
||||
switch (action) {
|
||||
case PM_SUSPEND_PREPARE:
|
||||
case PM_HIBERNATION_PREPARE:
|
||||
if (kexec_crash_image)
|
||||
arch_kexec_unprotect_crashkres();
|
||||
break;
|
||||
case PM_POST_SUSPEND:
|
||||
case PM_POST_HIBERNATION:
|
||||
if (kexec_crash_image)
|
||||
arch_kexec_protect_crashkres();
|
||||
break;
|
||||
default:
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int __init machine_kdump_pm_init(void)
|
||||
{
|
||||
pm_notifier(machine_kdump_pm_cb, 0);
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(machine_kdump_pm_init);
|
||||
|
||||
/*
|
||||
* Reset the system, copy boot CPU registers to absolute zero,
|
||||
* and jump to the kdump image
|
||||
|
@ -1,240 +0,0 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Suspend support specific for s390.
|
||||
*
|
||||
* Copyright IBM Corp. 2009
|
||||
*
|
||||
* Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com>
|
||||
*/
|
||||
|
||||
#include <linux/pfn.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/pci.h>
|
||||
#include <asm/ctl_reg.h>
|
||||
#include <asm/ipl.h>
|
||||
#include <asm/cio.h>
|
||||
#include <asm/sections.h>
|
||||
#include "entry.h"
|
||||
|
||||
/*
|
||||
* The restore of the saved pages in an hibernation image will set
|
||||
* the change and referenced bits in the storage key for each page.
|
||||
* Overindication of the referenced bits after an hibernation cycle
|
||||
* does not cause any harm but the overindication of the change bits
|
||||
* would cause trouble.
|
||||
* Use the ARCH_SAVE_PAGE_KEYS hooks to save the storage key of each
|
||||
* page to the most significant byte of the associated page frame
|
||||
* number in the hibernation image.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Key storage is allocated as a linked list of pages.
|
||||
* The size of the keys array is (PAGE_SIZE - sizeof(long))
|
||||
*/
|
||||
struct page_key_data {
|
||||
struct page_key_data *next;
|
||||
unsigned char data[];
|
||||
};
|
||||
|
||||
#define PAGE_KEY_DATA_SIZE (PAGE_SIZE - sizeof(struct page_key_data *))
|
||||
|
||||
static struct page_key_data *page_key_data;
|
||||
static struct page_key_data *page_key_rp, *page_key_wp;
|
||||
static unsigned long page_key_rx, page_key_wx;
|
||||
unsigned long suspend_zero_pages;
|
||||
|
||||
/*
|
||||
* For each page in the hibernation image one additional byte is
|
||||
* stored in the most significant byte of the page frame number.
|
||||
* On suspend no additional memory is required but on resume the
|
||||
* keys need to be memorized until the page data has been restored.
|
||||
* Only then can the storage keys be set to their old state.
|
||||
*/
|
||||
unsigned long page_key_additional_pages(unsigned long pages)
|
||||
{
|
||||
return DIV_ROUND_UP(pages, PAGE_KEY_DATA_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Free page_key_data list of arrays.
|
||||
*/
|
||||
void page_key_free(void)
|
||||
{
|
||||
struct page_key_data *pkd;
|
||||
|
||||
while (page_key_data) {
|
||||
pkd = page_key_data;
|
||||
page_key_data = pkd->next;
|
||||
free_page((unsigned long) pkd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate page_key_data list of arrays with enough room to store
|
||||
* one byte for each page in the hibernation image.
|
||||
*/
|
||||
int page_key_alloc(unsigned long pages)
|
||||
{
|
||||
struct page_key_data *pk;
|
||||
unsigned long size;
|
||||
|
||||
size = DIV_ROUND_UP(pages, PAGE_KEY_DATA_SIZE);
|
||||
while (size--) {
|
||||
pk = (struct page_key_data *) get_zeroed_page(GFP_KERNEL);
|
||||
if (!pk) {
|
||||
page_key_free();
|
||||
return -ENOMEM;
|
||||
}
|
||||
pk->next = page_key_data;
|
||||
page_key_data = pk;
|
||||
}
|
||||
page_key_rp = page_key_wp = page_key_data;
|
||||
page_key_rx = page_key_wx = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the storage key into the upper 8 bits of the page frame number.
|
||||
*/
|
||||
void page_key_read(unsigned long *pfn)
|
||||
{
|
||||
struct page *page;
|
||||
unsigned long addr;
|
||||
unsigned char key;
|
||||
|
||||
page = pfn_to_page(*pfn);
|
||||
addr = (unsigned long) page_address(page);
|
||||
key = (unsigned char) page_get_storage_key(addr) & 0x7f;
|
||||
if (arch_test_page_nodat(page))
|
||||
key |= 0x80;
|
||||
*(unsigned char *) pfn = key;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the storage key from the upper 8 bits of the page frame number
|
||||
* and store it in the page_key_data list of arrays.
|
||||
*/
|
||||
void page_key_memorize(unsigned long *pfn)
|
||||
{
|
||||
page_key_wp->data[page_key_wx] = *(unsigned char *) pfn;
|
||||
*(unsigned char *) pfn = 0;
|
||||
if (++page_key_wx < PAGE_KEY_DATA_SIZE)
|
||||
return;
|
||||
page_key_wp = page_key_wp->next;
|
||||
page_key_wx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the next key from the page_key_data list of arrays and set the
|
||||
* storage key of the page referred by @address. If @address refers to
|
||||
* a "safe" page the swsusp_arch_resume code will transfer the storage
|
||||
* key from the buffer page to the original page.
|
||||
*/
|
||||
void page_key_write(void *address)
|
||||
{
|
||||
struct page *page;
|
||||
unsigned char key;
|
||||
|
||||
key = page_key_rp->data[page_key_rx];
|
||||
page_set_storage_key((unsigned long) address, key & 0x7f, 0);
|
||||
page = virt_to_page(address);
|
||||
if (key & 0x80)
|
||||
arch_set_page_nodat(page, 0);
|
||||
else
|
||||
arch_set_page_dat(page, 0);
|
||||
if (++page_key_rx >= PAGE_KEY_DATA_SIZE)
|
||||
return;
|
||||
page_key_rp = page_key_rp->next;
|
||||
page_key_rx = 0;
|
||||
}
|
||||
|
||||
int pfn_is_nosave(unsigned long pfn)
|
||||
{
|
||||
unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
|
||||
unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end));
|
||||
unsigned long end_rodata_pfn = PFN_DOWN(__pa(__end_rodata)) - 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)
|
||||
return 1;
|
||||
/* Skip memory holes and read-only pages (DCSS, ...). */
|
||||
if (pfn >= stext_pfn && pfn <= end_rodata_pfn)
|
||||
return 0;
|
||||
if (tprot(PFN_PHYS(pfn)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* PM notifier callback for suspend
|
||||
*/
|
||||
static int suspend_pm_cb(struct notifier_block *nb, unsigned long action,
|
||||
void *ptr)
|
||||
{
|
||||
switch (action) {
|
||||
case PM_SUSPEND_PREPARE:
|
||||
case PM_HIBERNATION_PREPARE:
|
||||
suspend_zero_pages = __get_free_pages(GFP_KERNEL, LC_ORDER);
|
||||
if (!suspend_zero_pages)
|
||||
return NOTIFY_BAD;
|
||||
break;
|
||||
case PM_POST_SUSPEND:
|
||||
case PM_POST_HIBERNATION:
|
||||
free_pages(suspend_zero_pages, LC_ORDER);
|
||||
break;
|
||||
default:
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int __init suspend_pm_init(void)
|
||||
{
|
||||
pm_notifier(suspend_pm_cb, 0);
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(suspend_pm_init);
|
||||
|
||||
void save_processor_state(void)
|
||||
{
|
||||
/* swsusp_arch_suspend() actually saves all cpu register contents.
|
||||
* Machine checks must be disabled since swsusp_arch_suspend() stores
|
||||
* register contents to their lowcore save areas. That's the same
|
||||
* place where register contents on machine checks would be saved.
|
||||
* To avoid register corruption disable machine checks.
|
||||
* We must also disable machine checks in the new psw mask for
|
||||
* program checks, since swsusp_arch_suspend() may generate program
|
||||
* checks. Disabling machine checks for all other new psw masks is
|
||||
* just paranoia.
|
||||
*/
|
||||
local_mcck_disable();
|
||||
/* Disable lowcore protection */
|
||||
__ctl_clear_bit(0,28);
|
||||
S390_lowcore.external_new_psw.mask &= ~PSW_MASK_MCHECK;
|
||||
S390_lowcore.svc_new_psw.mask &= ~PSW_MASK_MCHECK;
|
||||
S390_lowcore.io_new_psw.mask &= ~PSW_MASK_MCHECK;
|
||||
S390_lowcore.program_new_psw.mask &= ~PSW_MASK_MCHECK;
|
||||
}
|
||||
|
||||
void restore_processor_state(void)
|
||||
{
|
||||
S390_lowcore.external_new_psw.mask |= PSW_MASK_MCHECK;
|
||||
S390_lowcore.svc_new_psw.mask |= PSW_MASK_MCHECK;
|
||||
S390_lowcore.io_new_psw.mask |= PSW_MASK_MCHECK;
|
||||
S390_lowcore.program_new_psw.mask |= PSW_MASK_MCHECK;
|
||||
/* Enable lowcore protection */
|
||||
__ctl_set_bit(0,28);
|
||||
local_mcck_enable();
|
||||
}
|
||||
|
||||
/* Called at the end of swsusp_arch_resume */
|
||||
void s390_early_resume(void)
|
||||
{
|
||||
lgr_info_log();
|
||||
channel_subsystem_reinit();
|
||||
zpci_rescan();
|
||||
}
|
@ -1,276 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* S390 64-bit swsusp implementation
|
||||
*
|
||||
* Copyright IBM Corp. 2009
|
||||
*
|
||||
* Author(s): Hans-Joachim Picht <hans@linux.vnet.ibm.com>
|
||||
* Michael Holzheu <holzheu@linux.vnet.ibm.com>
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/ptrace.h>
|
||||
#include <asm/thread_info.h>
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/nospec-insn.h>
|
||||
#include <asm/sigp.h>
|
||||
|
||||
/*
|
||||
* Save register context in absolute 0 lowcore and call swsusp_save() to
|
||||
* create in-memory kernel image. The context is saved in the designated
|
||||
* "store status" memory locations (see POP).
|
||||
* We return from this function twice. The first time during the suspend to
|
||||
* disk process. The second time via the swsusp_arch_resume() function
|
||||
* (see below) in the resume process.
|
||||
* This function runs with disabled interrupts.
|
||||
*/
|
||||
GEN_BR_THUNK %r14
|
||||
|
||||
.section .text
|
||||
ENTRY(swsusp_arch_suspend)
|
||||
lg %r1,__LC_NODAT_STACK
|
||||
stmg %r6,%r15,__SF_GPRS(%r1)
|
||||
aghi %r1,-STACK_FRAME_OVERHEAD
|
||||
stg %r15,__SF_BACKCHAIN(%r1)
|
||||
lgr %r15,%r1
|
||||
|
||||
/* Store FPU registers */
|
||||
brasl %r14,save_fpu_regs
|
||||
|
||||
/* Deactivate DAT */
|
||||
stnsm __SF_EMPTY(%r15),0xfb
|
||||
|
||||
/* Store prefix register on stack */
|
||||
stpx __SF_EMPTY(%r15)
|
||||
|
||||
/* Save prefix register contents for lowcore copy */
|
||||
llgf %r10,__SF_EMPTY(%r15)
|
||||
|
||||
/* Get pointer to save area */
|
||||
lghi %r1,0x1000
|
||||
|
||||
/* Save CPU address */
|
||||
stap __LC_EXT_CPU_ADDR(%r0)
|
||||
|
||||
/* Store registers */
|
||||
mvc 0x318(4,%r1),__SF_EMPTY(%r15) /* move prefix to lowcore */
|
||||
stam %a0,%a15,0x340(%r1) /* store access registers */
|
||||
stctg %c0,%c15,0x380(%r1) /* store control registers */
|
||||
stmg %r0,%r15,0x280(%r1) /* store general registers */
|
||||
|
||||
stpt 0x328(%r1) /* store timer */
|
||||
stck __SF_EMPTY(%r15) /* store clock */
|
||||
stckc 0x330(%r1) /* store clock comparator */
|
||||
|
||||
/* Update cputime accounting before going to sleep */
|
||||
lg %r0,__LC_LAST_UPDATE_TIMER
|
||||
slg %r0,0x328(%r1)
|
||||
alg %r0,__LC_SYSTEM_TIMER
|
||||
stg %r0,__LC_SYSTEM_TIMER
|
||||
mvc __LC_LAST_UPDATE_TIMER(8),0x328(%r1)
|
||||
lg %r0,__LC_LAST_UPDATE_CLOCK
|
||||
slg %r0,__SF_EMPTY(%r15)
|
||||
alg %r0,__LC_STEAL_TIMER
|
||||
stg %r0,__LC_STEAL_TIMER
|
||||
mvc __LC_LAST_UPDATE_CLOCK(8),__SF_EMPTY(%r15)
|
||||
|
||||
/* Activate DAT */
|
||||
stosm __SF_EMPTY(%r15),0x04
|
||||
|
||||
/* Set prefix page to zero */
|
||||
xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15)
|
||||
spx __SF_EMPTY(%r15)
|
||||
|
||||
/* Save absolute zero pages */
|
||||
larl %r2,suspend_zero_pages
|
||||
lg %r2,0(%r2)
|
||||
lghi %r4,0
|
||||
lghi %r3,2*PAGE_SIZE
|
||||
lghi %r5,2*PAGE_SIZE
|
||||
1: mvcle %r2,%r4,0
|
||||
jo 1b
|
||||
|
||||
/* Copy lowcore to absolute zero lowcore */
|
||||
lghi %r2,0
|
||||
lgr %r4,%r10
|
||||
lghi %r3,2*PAGE_SIZE
|
||||
lghi %r5,2*PAGE_SIZE
|
||||
1: mvcle %r2,%r4,0
|
||||
jo 1b
|
||||
|
||||
/* Save image */
|
||||
brasl %r14,swsusp_save
|
||||
|
||||
/* Restore prefix register and return */
|
||||
lghi %r1,0x1000
|
||||
spx 0x318(%r1)
|
||||
lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15)
|
||||
lghi %r2,0
|
||||
BR_EX %r14
|
||||
ENDPROC(swsusp_arch_suspend)
|
||||
|
||||
/*
|
||||
* Restore saved memory image to correct place and restore register context.
|
||||
* Then we return to the function that called swsusp_arch_suspend().
|
||||
* swsusp_arch_resume() runs with disabled interrupts.
|
||||
*/
|
||||
ENTRY(swsusp_arch_resume)
|
||||
stmg %r6,%r15,__SF_GPRS(%r15)
|
||||
lgr %r1,%r15
|
||||
aghi %r15,-STACK_FRAME_OVERHEAD
|
||||
stg %r1,__SF_BACKCHAIN(%r15)
|
||||
|
||||
/* Make all free pages stable */
|
||||
lghi %r2,1
|
||||
brasl %r14,arch_set_page_states
|
||||
|
||||
/* Set prefix page to zero */
|
||||
xc __SF_EMPTY(4,%r15),__SF_EMPTY(%r15)
|
||||
spx __SF_EMPTY(%r15)
|
||||
|
||||
/* Deactivate DAT */
|
||||
stnsm __SF_EMPTY(%r15),0xfb
|
||||
|
||||
/* Restore saved image */
|
||||
larl %r1,restore_pblist
|
||||
lg %r1,0(%r1)
|
||||
ltgr %r1,%r1
|
||||
jz 2f
|
||||
0:
|
||||
lg %r2,8(%r1)
|
||||
lg %r4,0(%r1)
|
||||
iske %r0,%r4
|
||||
lghi %r3,PAGE_SIZE
|
||||
lghi %r5,PAGE_SIZE
|
||||
1:
|
||||
mvcle %r2,%r4,0
|
||||
jo 1b
|
||||
lg %r2,8(%r1)
|
||||
sske %r0,%r2
|
||||
lg %r1,16(%r1)
|
||||
ltgr %r1,%r1
|
||||
jnz 0b
|
||||
2:
|
||||
ptlb /* flush tlb */
|
||||
|
||||
/* Reset System */
|
||||
larl %r1,.Lnew_pgm_check_psw
|
||||
epsw %r2,%r3
|
||||
stm %r2,%r3,0(%r1)
|
||||
mvc __LC_PGM_NEW_PSW(16,%r0),0(%r1)
|
||||
larl %r1,__swsusp_reset_dma
|
||||
lg %r1,0(%r1)
|
||||
BASR_EX %r14,%r1
|
||||
larl %r1,smp_cpu_mt_shift
|
||||
icm %r1,15,0(%r1)
|
||||
jz smt_done
|
||||
llgfr %r1,%r1
|
||||
smt_loop:
|
||||
sigp %r1,%r0,SIGP_SET_MULTI_THREADING
|
||||
brc 8,smt_done /* accepted */
|
||||
brc 2,smt_loop /* busy, try again */
|
||||
smt_done:
|
||||
larl %r1,.Lnew_pgm_check_psw
|
||||
lpswe 0(%r1)
|
||||
pgm_check_entry:
|
||||
|
||||
/* Switch to original suspend CPU */
|
||||
larl %r1,.Lresume_cpu /* Resume CPU address: r2 */
|
||||
stap 0(%r1)
|
||||
llgh %r2,0(%r1)
|
||||
llgh %r1,__LC_EXT_CPU_ADDR(%r0) /* Suspend CPU address: r1 */
|
||||
cgr %r1,%r2
|
||||
je restore_registers /* r1 = r2 -> nothing to do */
|
||||
larl %r4,.Lrestart_suspend_psw /* Set new restart PSW */
|
||||
mvc __LC_RST_NEW_PSW(16,%r0),0(%r4)
|
||||
3:
|
||||
sigp %r9,%r1,SIGP_INITIAL_CPU_RESET /* sigp initial cpu reset */
|
||||
brc 8,4f /* accepted */
|
||||
brc 2,3b /* busy, try again */
|
||||
|
||||
/* Suspend CPU not available -> panic */
|
||||
larl %r15,init_thread_union+THREAD_SIZE-STACK_FRAME_OVERHEAD
|
||||
larl %r2,.Lpanic_string
|
||||
brasl %r14,sclp_early_printk_force
|
||||
larl %r3,.Ldisabled_wait_31
|
||||
lpsw 0(%r3)
|
||||
4:
|
||||
/* Switch to suspend CPU */
|
||||
sigp %r9,%r1,SIGP_RESTART /* sigp restart to suspend CPU */
|
||||
brc 2,4b /* busy, try again */
|
||||
5:
|
||||
sigp %r9,%r2,SIGP_STOP /* sigp stop to current resume CPU */
|
||||
brc 2,5b /* busy, try again */
|
||||
6: j 6b
|
||||
|
||||
restart_suspend:
|
||||
larl %r1,.Lresume_cpu
|
||||
llgh %r2,0(%r1)
|
||||
7:
|
||||
sigp %r9,%r2,SIGP_SENSE /* sigp sense, wait for resume CPU */
|
||||
brc 8,7b /* accepted, status 0, still running */
|
||||
brc 2,7b /* busy, try again */
|
||||
tmll %r9,0x40 /* Test if resume CPU is stopped */
|
||||
jz 7b
|
||||
|
||||
restore_registers:
|
||||
/* Restore registers */
|
||||
lghi %r13,0x1000 /* %r1 = pointer to save area */
|
||||
|
||||
/* Ignore time spent in suspended state. */
|
||||
llgf %r1,0x318(%r13)
|
||||
stck __LC_LAST_UPDATE_CLOCK(%r1)
|
||||
spt 0x328(%r13) /* reprogram timer */
|
||||
//sckc 0x330(%r13) /* set clock comparator */
|
||||
|
||||
lctlg %c0,%c15,0x380(%r13) /* load control registers */
|
||||
lam %a0,%a15,0x340(%r13) /* load access registers */
|
||||
|
||||
/* Load old stack */
|
||||
lg %r15,0x2f8(%r13)
|
||||
|
||||
/* Save prefix register */
|
||||
mvc __SF_EMPTY(4,%r15),0x318(%r13)
|
||||
|
||||
/* Restore absolute zero pages */
|
||||
lghi %r2,0
|
||||
larl %r4,suspend_zero_pages
|
||||
lg %r4,0(%r4)
|
||||
lghi %r3,2*PAGE_SIZE
|
||||
lghi %r5,2*PAGE_SIZE
|
||||
1: mvcle %r2,%r4,0
|
||||
jo 1b
|
||||
|
||||
/* Restore prefix register */
|
||||
spx __SF_EMPTY(%r15)
|
||||
|
||||
/* Activate DAT */
|
||||
stosm __SF_EMPTY(%r15),0x04
|
||||
|
||||
/* Make all free pages unstable */
|
||||
lghi %r2,0
|
||||
brasl %r14,arch_set_page_states
|
||||
|
||||
/* Call arch specific early resume code */
|
||||
brasl %r14,s390_early_resume
|
||||
|
||||
/* Return 0 */
|
||||
lmg %r6,%r15,STACK_FRAME_OVERHEAD + __SF_GPRS(%r15)
|
||||
lghi %r2,0
|
||||
BR_EX %r14
|
||||
ENDPROC(swsusp_arch_resume)
|
||||
|
||||
.section .data..nosave,"aw",@progbits
|
||||
.align 8
|
||||
.Ldisabled_wait_31:
|
||||
.long 0x000a0000,0x00000000
|
||||
.Lpanic_string:
|
||||
.asciz "Resume not possible because suspend CPU is no longer available\n"
|
||||
.align 8
|
||||
.Lrestart_suspend_psw:
|
||||
.quad 0x0000000180000000,restart_suspend
|
||||
.Lnew_pgm_check_psw:
|
||||
.quad 0,pgm_check_entry
|
||||
.Lresume_cpu:
|
||||
.byte 0,0
|
@ -19,7 +19,6 @@
|
||||
#include <linux/swap.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/oom.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#include <asm/pgalloc.h>
|
||||
@ -49,7 +48,6 @@ static volatile long cmm_pages_target;
|
||||
static volatile long cmm_timed_pages_target;
|
||||
static long cmm_timeout_pages;
|
||||
static long cmm_timeout_seconds;
|
||||
static int cmm_suspended;
|
||||
|
||||
static struct cmm_page_array *cmm_page_list;
|
||||
static struct cmm_page_array *cmm_timed_page_list;
|
||||
@ -151,9 +149,9 @@ static int cmm_thread(void *dummy)
|
||||
|
||||
while (1) {
|
||||
rc = wait_event_interruptible(cmm_thread_wait,
|
||||
(!cmm_suspended && (cmm_pages != cmm_pages_target ||
|
||||
cmm_timed_pages != cmm_timed_pages_target)) ||
|
||||
kthread_should_stop());
|
||||
cmm_pages != cmm_pages_target ||
|
||||
cmm_timed_pages != cmm_timed_pages_target ||
|
||||
kthread_should_stop());
|
||||
if (kthread_should_stop() || rc == -ERESTARTSYS) {
|
||||
cmm_pages_target = cmm_pages;
|
||||
cmm_timed_pages_target = cmm_timed_pages;
|
||||
@ -390,38 +388,6 @@ static void cmm_smsg_target(const char *from, char *msg)
|
||||
|
||||
static struct ctl_table_header *cmm_sysctl_header;
|
||||
|
||||
static int cmm_suspend(void)
|
||||
{
|
||||
cmm_suspended = 1;
|
||||
cmm_free_pages(cmm_pages, &cmm_pages, &cmm_page_list);
|
||||
cmm_free_pages(cmm_timed_pages, &cmm_timed_pages, &cmm_timed_page_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmm_resume(void)
|
||||
{
|
||||
cmm_suspended = 0;
|
||||
cmm_kick_thread();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmm_power_event(struct notifier_block *this,
|
||||
unsigned long event, void *ptr)
|
||||
{
|
||||
switch (event) {
|
||||
case PM_POST_HIBERNATION:
|
||||
return cmm_resume();
|
||||
case PM_HIBERNATION_PREPARE:
|
||||
return cmm_suspend();
|
||||
default:
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
}
|
||||
|
||||
static struct notifier_block cmm_power_notifier = {
|
||||
.notifier_call = cmm_power_event,
|
||||
};
|
||||
|
||||
static int __init cmm_init(void)
|
||||
{
|
||||
int rc = -ENOMEM;
|
||||
@ -446,16 +412,11 @@ static int __init cmm_init(void)
|
||||
rc = register_oom_notifier(&cmm_oom_nb);
|
||||
if (rc < 0)
|
||||
goto out_oom_notify;
|
||||
rc = register_pm_notifier(&cmm_power_notifier);
|
||||
if (rc)
|
||||
goto out_pm;
|
||||
cmm_thread_ptr = kthread_run(cmm_thread, NULL, "cmmthread");
|
||||
if (!IS_ERR(cmm_thread_ptr))
|
||||
return 0;
|
||||
|
||||
rc = PTR_ERR(cmm_thread_ptr);
|
||||
unregister_pm_notifier(&cmm_power_notifier);
|
||||
out_pm:
|
||||
unregister_oom_notifier(&cmm_oom_nb);
|
||||
out_oom_notify:
|
||||
#ifdef CONFIG_CMM_IUCV
|
||||
@ -475,7 +436,6 @@ static void __exit cmm_exit(void)
|
||||
#ifdef CONFIG_CMM_IUCV
|
||||
smsg_unregister_callback(SMSG_PREFIX, cmm_smsg_target);
|
||||
#endif
|
||||
unregister_pm_notifier(&cmm_power_notifier);
|
||||
unregister_oom_notifier(&cmm_oom_nb);
|
||||
kthread_stop(cmm_thread_ptr);
|
||||
del_timer_sync(&cmm_timer);
|
||||
|
@ -367,20 +367,4 @@ void __kernel_map_pages(struct page *page, int numpages, int enable)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HIBERNATION
|
||||
bool kernel_page_present(struct page *page)
|
||||
{
|
||||
unsigned long addr;
|
||||
int cc;
|
||||
|
||||
addr = page_to_phys(page);
|
||||
asm volatile(
|
||||
" lra %1,0(%1)\n"
|
||||
" ipm %0\n"
|
||||
" srl %0,28"
|
||||
: "=d" (cc), "+a" (addr) : : "cc");
|
||||
return cc == 0;
|
||||
}
|
||||
#endif /* CONFIG_HIBERNATION */
|
||||
|
||||
#endif /* CONFIG_DEBUG_PAGEALLOC */
|
||||
|
@ -607,49 +607,6 @@ void pcibios_disable_device(struct pci_dev *pdev)
|
||||
zpci_debug_exit_device(zdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_HIBERNATE_CALLBACKS
|
||||
static int zpci_restore(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
struct zpci_dev *zdev = to_zpci(pdev);
|
||||
int ret = 0;
|
||||
|
||||
if (zdev->state != ZPCI_FN_STATE_ONLINE)
|
||||
goto out;
|
||||
|
||||
ret = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
zpci_map_resources(pdev);
|
||||
zpci_register_ioat(zdev, 0, zdev->start_dma, zdev->end_dma,
|
||||
(u64) zdev->dma_table);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int zpci_freeze(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
struct zpci_dev *zdev = to_zpci(pdev);
|
||||
|
||||
if (zdev->state != ZPCI_FN_STATE_ONLINE)
|
||||
return 0;
|
||||
|
||||
zpci_unregister_ioat(zdev, 0);
|
||||
zpci_unmap_resources(pdev);
|
||||
return clp_disable_fh(zdev);
|
||||
}
|
||||
|
||||
struct dev_pm_ops pcibios_pm_ops = {
|
||||
.thaw_noirq = zpci_restore,
|
||||
.freeze_noirq = zpci_freeze,
|
||||
.restore_noirq = zpci_restore,
|
||||
.poweroff_noirq = zpci_freeze,
|
||||
};
|
||||
#endif /* CONFIG_HIBERNATE_CALLBACKS */
|
||||
|
||||
static int zpci_alloc_domain(struct zpci_dev *zdev)
|
||||
{
|
||||
if (zpci_unique_uid) {
|
||||
|
Loading…
Reference in New Issue
Block a user