diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-04-02 12:40:09 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-04-02 12:40:09 +0100 |
commit | ab438874b6a8ae955b337c36e7b3204e29b8d407 (patch) | |
tree | b977e8cf97cc40500f079af718751f226d3724af /xen/arch/x86/hvm/pmtimer.c | |
parent | 48fe42ec0b1cd6fe1fb26c27fb307e8bc5240fe0 (diff) | |
download | xen-ab438874b6a8ae955b337c36e7b3204e29b8d407.tar.gz xen-ab438874b6a8ae955b337c36e7b3204e29b8d407.tar.bz2 xen-ab438874b6a8ae955b337c36e7b3204e29b8d407.zip |
hvm: add ACPI power button for HVM
This patch adds the ACPI fixed hardware power button for HVM.
It enables a graceful shutdown of a guest OS by direction of Dom0.
(if a proper action for the power button is set inside the guest)
usage:
xm trigger <Domain> power
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Diffstat (limited to 'xen/arch/x86/hvm/pmtimer.c')
-rw-r--r-- | xen/arch/x86/hvm/pmtimer.c | 22 |
1 files changed, 14 insertions, 8 deletions
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) |