aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/firmware/hvmloader/acpi/static_tables.c2
-rw-r--r--tools/python/xen/xend/XendConstants.py6
-rw-r--r--tools/python/xen/xm/main.py2
-rw-r--r--xen/arch/x86/domctl.c13
-rw-r--r--xen/arch/x86/hvm/pmtimer.c22
-rw-r--r--xen/include/public/domctl.h1
6 files changed, 34 insertions, 12 deletions
diff --git a/tools/firmware/hvmloader/acpi/static_tables.c b/tools/firmware/hvmloader/acpi/static_tables.c
index ab544e15fd..e040c56187 100644
--- a/tools/firmware/hvmloader/acpi/static_tables.c
+++ b/tools/firmware/hvmloader/acpi/static_tables.c
@@ -69,7 +69,7 @@ struct acpi_20_fadt Fadt = {
.p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */
.iapc_boot_arch = ACPI_8042,
.flags = (ACPI_PROC_C1 | ACPI_SLP_BUTTON |
- ACPI_WBINVD | ACPI_PWR_BUTTON |
+ ACPI_WBINVD |
ACPI_FIX_RTC | ACPI_TMR_VAL_EXT),
.reset_reg = {
diff --git a/tools/python/xen/xend/XendConstants.py b/tools/python/xen/xend/XendConstants.py
index b1c2957a7a..6775795bdd 100644
--- a/tools/python/xen/xend/XendConstants.py
+++ b/tools/python/xen/xend/XendConstants.py
@@ -105,13 +105,15 @@ LAST_SHUTDOWN_REASON = 'xend/last_shutdown_reason'
TRIGGER_NMI = 0
TRIGGER_RESET = 1
TRIGGER_INIT = 2
-TRIGGER_S3RESUME = 3
+TRIGGER_POWER = 3
+TRIGGER_S3RESUME = 4
TRIGGER_TYPE = {
"nmi" : TRIGGER_NMI,
"reset" : TRIGGER_RESET,
"init" : TRIGGER_INIT,
- "s3resume": TRIGGER_S3RESUME
+ "s3resume": TRIGGER_S3RESUME,
+ "power": TRIGGER_POWER
}
#
diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py
index 8c7ba968e8..b3cfecb448 100644
--- a/tools/python/xen/xm/main.py
+++ b/tools/python/xen/xm/main.py
@@ -151,7 +151,7 @@ SUBCOMMAND_HELP = {
'Get/set credit scheduler parameters.'),
'sysrq' : ('<Domain> <letter>', 'Send a sysrq to a domain.'),
'debug-keys' : ('<Keys>', 'Send debug keys to Xen.'),
- 'trigger' : ('<Domain> <nmi|reset|init|s3resume> [<VCPU>]',
+ 'trigger' : ('<Domain> <nmi|reset|init|s3resume|power> [<VCPU>]',
'Send a trigger to a domain.'),
'vcpu-list' : ('[Domain, ...]',
'List the VCPUs for all/some domains.'),
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 7f4d7dbbea..1d748f6f15 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -587,6 +587,19 @@ long arch_do_domctl(
}
break;
+ case XEN_DOMCTL_SENDTRIGGER_POWER:
+ {
+ extern void hvm_acpi_power_button(struct domain *d);
+
+ ret = -EINVAL;
+ if ( is_hvm_domain(d) )
+ {
+ ret = 0;
+ hvm_acpi_power_button(d);
+ }
+ }
+ break;
+
default:
ret = -ENOSYS;
}
diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c
index 15bb3c3ef6..276538f028 100644
--- a/xen/arch/x86/hvm/pmtimer.c
+++ b/xen/arch/x86/hvm/pmtimer.c
@@ -29,18 +29,15 @@
/* The interesting bits of the PM1a_STS register */
#define TMR_STS (1 << 0)
-#define PWRBTN_STS (1 << 5)
-#define GBL_STS (1 << 8)
+#define GBL_STS (1 << 5)
+#define PWRBTN_STS (1 << 8)
/* The same in PM1a_EN */
#define TMR_EN (1 << 0)
-#define PWRBTN_EN (1 << 5)
-#define GBL_EN (1 << 8)
+#define GBL_EN (1 << 5)
+#define PWRBTN_EN (1 << 8)
-/* Mask of bits in PM1a_STS that can generate an SCI. Although the ACPI
- * spec lists other bits, the PIIX4, which we are emulating, only
- * supports these three. For now, we only use TMR_STS; in future we
- * will let qemu set the other bits */
+/* Mask of bits in PM1a_STS that can generate an SCI. */
#define SCI_MASK (TMR_STS|PWRBTN_STS|GBL_STS)
/* SCI IRQ number (must match SCI_INT number in ACPI FADT in hvmloader) */
@@ -61,6 +58,15 @@ static void pmt_update_sci(PMTState *s)
hvm_isa_irq_deassert(s->vcpu->domain, SCI_IRQ);
}
+void hvm_acpi_power_button(struct domain *d)
+{
+ PMTState *s = &d->arch.hvm_domain.pl_time.vpmt;
+ spin_lock(&s->lock);
+ s->pm.pm1a_sts |= PWRBTN_STS;
+ pmt_update_sci(s);
+ spin_unlock(&s->lock);
+}
+
/* Set the correct value in the timer, accounting for time elapsed
* since the last time we did that. */
static void pmt_update_time(PMTState *s)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 8574302bae..f7b1fc5ec7 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -433,6 +433,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
#define XEN_DOMCTL_SENDTRIGGER_NMI 0
#define XEN_DOMCTL_SENDTRIGGER_RESET 1
#define XEN_DOMCTL_SENDTRIGGER_INIT 2
+#define XEN_DOMCTL_SENDTRIGGER_POWER 3
struct xen_domctl_sendtrigger {
uint32_t trigger; /* IN */
uint32_t vcpu; /* IN */