- add rudimentary poweroff support for fully-virtualized domains via ACPI
PATCH 1/1 - add rudimentary poweroff support for fully-virtualized domains via ACPI
Add rudimentary ACPI support which allows a fully virtualized domain to perform a poweroff via the S5 state. This involves adding S5 information to the ASL file; adding ACPI I/O address processing to qemu and modifying the FADT to point to these specific I/O addresses. Note that this is a rudimentary implementation, which is expected to allow growth over time. Currently, only allow/detect writes to one of the PM registers, even though the S5 package specifies data for both. Currently, this is sufficient for the kernels tested. (Specifically, use of _PST, and _GST and other methods are unneccessary and not implemented.)
As with all ACPI changes, understanding what to do was more painful than the trivial amount of code required.
Prior to this change, some domains would simply spin forever in their kernel. With this change, the poweroff is signaled to qemu (just like other poweroff cases) and the domain is terminated as a poweroff request.
Signature · 5 lines
------------------------------------------------------------------------ Ben Thomas Virtual Iron Software [email protected] Tower 1, Floor 2 978-849-1214 900 Chelmsford Street Lowell, MA 01851
tools/firmware/acpi/acpi_dsdt.asl +10 -0
@@ -36,6 +36,16 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, Processor (CPU2, 0x02, 0x00000000, 0x00) {} Processor (CPU3, 0x03, 0x00000000, 0x00) {} } + +/* Poweroff support - ties in with qemu emulation */ + + Name (\_S5, Package (0x04) + { + 0x07, + 0x07, + 0x00, + 0x00 + }) Scope (\_SB) {
tools/firmware/acpi/acpi_dsdt.c +144 -145
305 lines not on this page · raw message
tools/firmware/acpi/acpi_fadt.h +2 -2
@@ -59,7 +59,7 @@#define ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID ACPI_SYSTEM_IO#define ACPI_PM1A_EVT_BLK_BIT_WIDTH 0x00#define ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00 -#define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000000000 +#define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000008000// // PM1B Event Register Block Generic Address Information
@@ -73,7 +73,7 @@// PM1A Control Register Block Generic Address Information // #define ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID ACPI_SYSTEM_IO -#define ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x10 +#define ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x08#define ACPI_PM1A_CNT_BLK_BIT_OFFSET 0x00#define ACPI_PM1A_CNT_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
tools/ioemu/hw/pc.c +3 -0
@@ -373,6 +373,8 @@ static int serial_io[MAX_SERIAL_PORTS] =static int serial_io[MAX_SERIAL_PORTS ] = {0x3f8 ,0x2f8 ,0x3e8 ,0x2e8 };static int serial_irq[MAX_SERIAL_PORTS ] = {4 ,3 ,4 ,3 }; +extern int acpi_init (unsigned int base); +#define NOBIOS 1/* PC hardware initialisation */
@@ -574,6 +576,7 @@ void pc_init(uint64_t ram_size, int vga_ floppy_controller =fdctrl_init (6 ,2 ,0 ,0x3f0 , fd_table);cmos_init (ram_size, boot_device, bs_table); +acpi_init (0x8000 );/* must be done after all PCI devices are instanciated */ /* XXX: should be done in the Bochs BIOS */
tools/ioemu/target-i386-dm/Makefile +2 -2
@@ -278,7 +278,7 @@ endif # Hardware support VL_OBJS+= ide.o ne2000.o pckbd.o vga.o dma.o VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259_stub.o pc.o port-e9.o -VL_OBJS+= cirrus_vga.o pcnet.o +VL_OBJS+= cirrus_vga.o pcnet.o acpi.o VL_OBJS+= $(SOUND_HW) $(AUDIODRV) mixeng.o ifeq ($(TARGET_ARCH), ppc)
@@ -318,7 +318,7 @@ endif endif $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a - $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS) -lpthread + $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS) -lpthread -Wl,-Map,qemu-dm.map -Wl,--cref vnc.o: vnc.c keyboard_rdesktop.c $(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) -c -o $@ $<
tools/ioemu/hw/acpi.c new file +178 -0
178 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel