/** * pseries_suspend_begin - First phase of hibernation * * Check to ensure we are in a valid state to hibernate * * Return value: * 0 on success / other on failure
**/ staticint pseries_suspend_begin(u64 stream_id)
{ long vasi_state, rc; unsignedlong retbuf[PLPAR_HCALL_BUFSIZE];
/* Make sure the state is valid */
rc = plpar_hcall(H_VASI_STATE, retbuf, stream_id);
vasi_state = retbuf[0];
if (rc) {
pr_err("pseries_suspend_begin: vasi_state returned %ld\n",rc); return rc;
} elseif (vasi_state == H_VASI_ENABLED) { return -EAGAIN;
} elseif (vasi_state != H_VASI_SUSPENDING) {
pr_err("pseries_suspend_begin: vasi_state returned state %ld\n",
vasi_state); return -EIO;
} return 0;
}
/** * pseries_suspend_enter - Final phase of hibernation * * Return value: * 0 on success / other on failure
**/ staticint pseries_suspend_enter(suspend_state_t state)
{ return rtas_ibm_suspend_me(NULL);
}
/** * store_hibernate - Initiate partition hibernation * @dev: subsys root device * @attr: device attribute struct * @buf: buffer * @count: buffer size * * Write the stream ID received from the HMC to this file * to trigger hibernating the partition * * Return value: * number of bytes printed to buffer / other on failure
**/ static ssize_t store_hibernate(struct device *dev, struct device_attribute *attr, constchar *buf, size_t count)
{
u64 stream_id; int rc;
if (!capable(CAP_SYS_ADMIN)) return -EPERM;
stream_id = simple_strtoul(buf, NULL, 16);
do {
rc = pseries_suspend_begin(stream_id); if (rc == -EAGAIN)
ssleep(1);
} while (rc == -EAGAIN);
if (!rc)
rc = pm_suspend(PM_SUSPEND_MEM);
if (!rc) {
rc = count;
post_mobility_fixup();
}
return rc;
}
#define USER_DT_UPDATE 0 #define KERN_DT_UPDATE 1
/** * show_hibernate - Report device tree update responsibilty * @dev: subsys root device * @attr: device attribute struct * @buf: buffer * * Report whether a device tree update is performed by the kernel after a * resume, or if drmgr must coordinate the update from user space. * * Return value: * 0 if drmgr is to initiate update, and 1 otherwise
**/ static ssize_t show_hibernate(struct device *dev, struct device_attribute *attr, char *buf)
{ return sprintf(buf, "%d\n", KERN_DT_UPDATE);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.