mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
xen / ACPI: notify xen when reduced hardware sleep is available
Use the acpi_os_prepare_extended_sleep() callback to notify xen to make use of the reduced hardware sleep functionality The xen hypervisor change underlying this is commit 62d1a69 ("ACPI: support v5 (reduced HW) sleep interface") on the master branch of git://xenbits.xen.org/xen.git. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Ben Guthro <benjamin.guthro@citrix.com> Acked-by: Konrad Wilk <konrad.wilk@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
d6b47b1224
commit
be6b25d15f
3 changed files with 38 additions and 18 deletions
|
@ -35,28 +35,43 @@
|
||||||
#include <asm/xen/hypercall.h>
|
#include <asm/xen/hypercall.h>
|
||||||
#include <asm/xen/hypervisor.h>
|
#include <asm/xen/hypervisor.h>
|
||||||
|
|
||||||
int xen_acpi_notify_hypervisor_state(u8 sleep_state,
|
static int xen_acpi_notify_hypervisor_state(u8 sleep_state,
|
||||||
u32 pm1a_cnt, u32 pm1b_cnt)
|
u32 val_a, u32 val_b,
|
||||||
|
bool extended)
|
||||||
{
|
{
|
||||||
|
unsigned int bits = extended ? 8 : 16;
|
||||||
|
|
||||||
struct xen_platform_op op = {
|
struct xen_platform_op op = {
|
||||||
.cmd = XENPF_enter_acpi_sleep,
|
.cmd = XENPF_enter_acpi_sleep,
|
||||||
.interface_version = XENPF_INTERFACE_VERSION,
|
.interface_version = XENPF_INTERFACE_VERSION,
|
||||||
.u = {
|
.u.enter_acpi_sleep = {
|
||||||
.enter_acpi_sleep = {
|
.val_a = (u16)val_a,
|
||||||
.pm1a_cnt_val = (u16)pm1a_cnt,
|
.val_b = (u16)val_b,
|
||||||
.pm1b_cnt_val = (u16)pm1b_cnt,
|
.sleep_state = sleep_state,
|
||||||
.sleep_state = sleep_state,
|
.flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((pm1a_cnt & 0xffff0000) || (pm1b_cnt & 0xffff0000)) {
|
if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
|
||||||
WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
|
"Using more than %u bits of sleep control values %#x/%#x!"
|
||||||
"Email xen-devel@lists.xensource.com Thank you.\n", \
|
"Email xen-devel@lists.xen.org - Thank you.\n", \
|
||||||
pm1a_cnt, pm1b_cnt);
|
bits, val_a, val_b))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
HYPERVISOR_dom0_op(&op);
|
HYPERVISOR_dom0_op(&op);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
|
||||||
|
u32 pm1a_cnt, u32 pm1b_cnt)
|
||||||
|
{
|
||||||
|
return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
|
||||||
|
pm1b_cnt, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
|
||||||
|
u32 val_a, u32 val_b)
|
||||||
|
{
|
||||||
|
return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
|
||||||
|
val_b, true);
|
||||||
|
}
|
||||||
|
|
|
@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xen_acpi_notify_hypervisor_state(u8 sleep_state,
|
int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
|
||||||
u32 pm1a_cnt, u32 pm1b_cnd);
|
u32 pm1a_cnt, u32 pm1b_cnd);
|
||||||
|
int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
|
||||||
|
u32 val_a, u32 val_b);
|
||||||
|
|
||||||
static inline int xen_acpi_suspend_lowlevel(void)
|
static inline int xen_acpi_suspend_lowlevel(void)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
|
||||||
{
|
{
|
||||||
if (xen_initial_domain()) {
|
if (xen_initial_domain()) {
|
||||||
acpi_os_set_prepare_sleep(
|
acpi_os_set_prepare_sleep(
|
||||||
&xen_acpi_notify_hypervisor_state);
|
&xen_acpi_notify_hypervisor_sleep);
|
||||||
|
acpi_os_set_prepare_extended_sleep(
|
||||||
|
&xen_acpi_notify_hypervisor_extended_sleep);
|
||||||
|
|
||||||
acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
|
acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
|
||||||
#define XENPF_enter_acpi_sleep 51
|
#define XENPF_enter_acpi_sleep 51
|
||||||
struct xenpf_enter_acpi_sleep {
|
struct xenpf_enter_acpi_sleep {
|
||||||
/* IN variables */
|
/* IN variables */
|
||||||
uint16_t pm1a_cnt_val; /* PM1a control value. */
|
uint16_t val_a; /* PM1a control / sleep type A. */
|
||||||
uint16_t pm1b_cnt_val; /* PM1b control value. */
|
uint16_t val_b; /* PM1b control / sleep type B. */
|
||||||
uint32_t sleep_state; /* Which state to enter (Sn). */
|
uint32_t sleep_state; /* Which state to enter (Sn). */
|
||||||
uint32_t flags; /* Must be zero. */
|
#define XENPF_ACPI_SLEEP_EXTENDED 0x00000001
|
||||||
|
uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
|
||||||
};
|
};
|
||||||
DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
|
DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue