diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-02-15 14:13:17 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-02-15 14:13:17 +0000 |
commit | 3bbf83843ccc4547c839c4cfe05cb70e3dc92a49 (patch) | |
tree | aa67fdee6d43f1daaa9f4aa3f95636e335528d67 /tools/firmware | |
parent | 1546fd3f23cfb591cf02ef7da72d6e7e908e3504 (diff) | |
download | xen-3bbf83843ccc4547c839c4cfe05cb70e3dc92a49.tar.gz xen-3bbf83843ccc4547c839c4cfe05cb70e3dc92a49.tar.bz2 xen-3bbf83843ccc4547c839c4cfe05cb70e3dc92a49.zip |
Enable HVM guest VT-d device hotplug via a simple ACPI hotplug device model.
** Currently only 2 virtual hotplug pci slots(6~7) are created so more
than 2 vtd dev can't be hotplugged, but we can easily extend it in
future.
Three new commands are added:
"xm pci-list domid" show the current assigned vtd device, like:
VSlt domain bus slot func
0x6 0x0 0x02 0x00 0x0
"xm pci-detach" hot remove the specified vtd device by the virtual
slot, like:
xm pci-detach EdwinHVMDomainVtd 6
"xm pci-attach DomainID dom bus dev func [vslot]" hot add a new vtd
device in the vslot. If no vslot specified, a free slot will be picked
up. e.g. to insert '0000:03:00.0':
xm pci-attach EdwinHVMDomainVtd 0 3 0 0
** guest pci hotplug
linux: pls. use 2.6.X and enable ACPI PCI hotplug ( Bus options=> PCI
hotplug => ACPI PCI hotplug driver )
windows: 2000/xp/2003/vista are all okay
Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
Diffstat (limited to 'tools/firmware')
-rw-r--r-- | tools/firmware/hvmloader/acpi/dsdt.asl | 117 | ||||
-rw-r--r-- | tools/firmware/hvmloader/acpi/dsdt.c | 68 | ||||
-rw-r--r-- | tools/firmware/hvmloader/acpi/static_tables.c | 2 |
3 files changed, 180 insertions, 7 deletions
diff --git a/tools/firmware/hvmloader/acpi/dsdt.asl b/tools/firmware/hvmloader/acpi/dsdt.asl index 72d1b03a89..697a70f924 100644 --- a/tools/firmware/hvmloader/acpi/dsdt.asl +++ b/tools/firmware/hvmloader/acpi/dsdt.asl @@ -86,7 +86,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0) Name (_UID, 0x00) Name (_ADR, 0x00) Name (_BBN, 0x00) - + Method (_CRS, 0, NotSerialized) { Name (PRT0, ResourceTemplate () @@ -720,6 +720,121 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0) }) } } + + /****************************************************************** + * Each PCI hotplug slot needs at least two methods to handle + * the ACPI event: + * _EJ0: eject a device + * _STA: return a device's status, e.g. enabled or removed + * Other methods are optional: + * _PS0/3: put them here for debug purpose + * + * Eject button would generate a general-purpose event, then the + * control method for this event uses Notify() to inform OSPM which + * action happened and on which device. + * + * Pls. refer "6.3 Device Insertion, Removal, and Status Objects" + * in ACPI spec 3.0b for details. + * + * QEMU provides a simple hotplug controller with some I/O to + * handle the hotplug action and status, which is beyond the ACPI + * scope. + */ + + Device (S1F0) + { + Name (_ADR, 0x00060000) /* Dev 6, Func 0 */ + Name (_SUN, 0x00000001) + + Method (_PS0, 0) + { + Store (0x80, \_GPE.DPT2) + } + + Method (_PS3, 0) + { + Store (0x83, \_GPE.DPT2) + } + + Method (_EJ0, 1) + { + Store (0x88, \_GPE.DPT2) + Store (0x1, \_GPE.PHP1) /* eject php slot 1*/ + } + + Method (_STA, 0) + { + Store (0x89, \_GPE.DPT2) + Return ( \_GPE.PHP1 ) /* IN status as the _STA */ + } + } + + Device (S2F0) + { + Name (_ADR, 0x00070000) /* Dev 7, Func 0 */ + Name (_SUN, 0x00000002) + + Method (_PS0, 0) + { + Store (0x90, \_GPE.DPT2) + } + + Method (_PS3, 0) + { + Store (0x93, \_GPE.DPT2) + } + + Method (_EJ0, 1) + { + Store (0x98, \_GPE.DPT2) + Store (0x1, \_GPE.PHP2) /* eject php slot 1*/ + } + + Method (_STA, 0) + { + Store (0x99, \_GPE.DPT2) + Return ( \_GPE.PHP2 ) /* IN status as the _STA */ + } + } + } + } + + Scope (\_GPE) + { + OperationRegion (PHP, SystemIO, 0x10c0, 0x03) + Field (PHP, ByteAcc, NoLock, Preserve) + { + PSTA, 8, /* hotplug controller status reg */ + PHP1, 8, /* hotplug slot 1 control reg */ + PHP2, 8 /* hotplug slot 2 control reg */ + } + OperationRegion (DG1, SystemIO, 0xb044, 0x04) + Field (DG1, ByteAcc, NoLock, Preserve) + { + DPT1, 8, + DPT2, 8 + } + Method (_L03, 0, NotSerialized) + { + /* detect slot and event(remove/add) */ + Name (SLT, 0x0) + Name (EVT, 0x0) + Store (PSTA, Local1) + ShiftRight (Local1, 0x4, SLT) + And (Local1, 0xf, EVT) + + /* debug */ + Store (SLT, DPT1) + Store (EVT, DPT2) + + If ( LEqual(SLT, 0x1) ) + { + Notify (\_SB.PCI0.S1F0, EVT) + } + ElseIf ( LEqual(SLT, 0x2) ) + { + Notify (\_SB.PCI0.S2F0, EVT) + } } } } diff --git a/tools/firmware/hvmloader/acpi/dsdt.c b/tools/firmware/hvmloader/acpi/dsdt.c index 385ab10d36..4ddc866f3a 100644 --- a/tools/firmware/hvmloader/acpi/dsdt.c +++ b/tools/firmware/hvmloader/acpi/dsdt.c @@ -5,15 +5,15 @@ * Copyright (C) 2000 - 2006 Intel Corporation * Supports ACPI Specification Revision 3.0a * - * Compilation of "dsdt.asl" - Fri Feb 15 12:48:58 2008 + * Compilation of "dsdt.asl" - Fri Feb 15 14:07:57 2008 * * C source code output * */ unsigned char AmlCode[] = { - 0x44,0x53,0x44,0x54,0x9C,0x0E,0x00,0x00, /* 00000000 "DSDT...." */ - 0x02,0xD5,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */ + 0x44,0x53,0x44,0x54,0x5A,0x10,0x00,0x00, /* 00000000 "DSDTZ..." */ + 0x02,0xCC,0x58,0x65,0x6E,0x00,0x00,0x00, /* 00000008 "..Xen..." */ 0x48,0x56,0x4D,0x00,0x00,0x00,0x00,0x00, /* 00000010 "HVM....." */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ 0x07,0x07,0x06,0x20,0x08,0x50,0x4D,0x42, /* 00000020 "... .PMB" */ @@ -29,7 +29,7 @@ unsigned char AmlCode[] = 0x07,0x0A,0x07,0x00,0x00,0x08,0x50,0x49, /* 00000070 "......PI" */ 0x43,0x44,0x00,0x14,0x0C,0x5F,0x50,0x49, /* 00000078 "CD..._PI" */ 0x43,0x01,0x70,0x68,0x50,0x49,0x43,0x44, /* 00000080 "C.phPICD" */ - 0x10,0x43,0xE1,0x5F,0x53,0x42,0x5F,0x5B, /* 00000088 ".C._SB_[" */ + 0x10,0x42,0xF1,0x5F,0x53,0x42,0x5F,0x5B, /* 00000088 ".B._SB_[" */ 0x80,0x42,0x49,0x4F,0x53,0x00,0x0C,0x00, /* 00000090 ".BIOS..." */ 0xA0,0x0E,0x00,0x0A,0x10,0x5B,0x81,0x21, /* 00000098 ".....[.!" */ 0x42,0x49,0x4F,0x53,0x01,0x55,0x41,0x52, /* 000000A0 "BIOS.UAR" */ @@ -45,7 +45,7 @@ unsigned char AmlCode[] = 0x00,0xFF,0xFF,0x09,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ 0x00,0x00,0x00,0x0A,0x00,0x00,0x00,0x00, /* 00000100 "........" */ - 0x00,0x79,0x00,0x5B,0x82,0x4F,0xD8,0x50, /* 00000108 ".y.[.O.P" */ + 0x00,0x79,0x00,0x5B,0x82,0x4E,0xE8,0x50, /* 00000108 ".y.[.N.P" */ 0x43,0x49,0x30,0x08,0x5F,0x48,0x49,0x44, /* 00000110 "CI0._HID" */ 0x0C,0x41,0xD0,0x0A,0x03,0x08,0x5F,0x55, /* 00000118 ".A...._U" */ 0x49,0x44,0x00,0x08,0x5F,0x41,0x44,0x52, /* 00000120 "ID.._ADR" */ @@ -479,6 +479,62 @@ unsigned char AmlCode[] = 0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F, /* 00000E80 "TA....._" */ 0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47, /* 00000E88 "CRS....G" */ 0x01,0x78,0x03,0x78,0x03,0x08,0x08,0x22, /* 00000E90 ".x.x..."" */ - 0x80,0x00,0x79,0x00, + 0x80,0x00,0x79,0x00,0x5B,0x82,0x4D,0x07, /* 00000E98 "..y.[.M." */ + 0x53,0x31,0x46,0x30,0x08,0x5F,0x41,0x44, /* 00000EA0 "S1F0._AD" */ + 0x52,0x0C,0x00,0x00,0x06,0x00,0x08,0x5F, /* 00000EA8 "R......_" */ + 0x53,0x55,0x4E,0x01,0x14,0x13,0x5F,0x50, /* 00000EB0 "SUN..._P" */ + 0x53,0x30,0x00,0x70,0x0A,0x80,0x5C,0x2E, /* 00000EB8 "S0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000EC0 "_GPEDPT2" */ + 0x14,0x13,0x5F,0x50,0x53,0x33,0x00,0x70, /* 00000EC8 ".._PS3.p" */ + 0x0A,0x83,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00000ED0 "..\._GPE" */ + 0x44,0x50,0x54,0x32,0x14,0x1F,0x5F,0x45, /* 00000ED8 "DPT2.._E" */ + 0x4A,0x30,0x01,0x70,0x0A,0x88,0x5C,0x2E, /* 00000EE0 "J0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000EE8 "_GPEDPT2" */ + 0x70,0x01,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00000EF0 "p.\._GPE" */ + 0x50,0x48,0x50,0x31,0x14,0x1E,0x5F,0x53, /* 00000EF8 "PHP1.._S" */ + 0x54,0x41,0x00,0x70,0x0A,0x89,0x5C,0x2E, /* 00000F00 "TA.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000F08 "_GPEDPT2" */ + 0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,0x50, /* 00000F10 ".\._GPEP" */ + 0x48,0x50,0x31,0x5B,0x82,0x4E,0x07,0x53, /* 00000F18 "HP1[.N.S" */ + 0x32,0x46,0x30,0x08,0x5F,0x41,0x44,0x52, /* 00000F20 "2F0._ADR" */ + 0x0C,0x00,0x00,0x07,0x00,0x08,0x5F,0x53, /* 00000F28 "......_S" */ + 0x55,0x4E,0x0A,0x02,0x14,0x13,0x5F,0x50, /* 00000F30 "UN...._P" */ + 0x53,0x30,0x00,0x70,0x0A,0x90,0x5C,0x2E, /* 00000F38 "S0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000F40 "_GPEDPT2" */ + 0x14,0x13,0x5F,0x50,0x53,0x33,0x00,0x70, /* 00000F48 ".._PS3.p" */ + 0x0A,0x93,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00000F50 "..\._GPE" */ + 0x44,0x50,0x54,0x32,0x14,0x1F,0x5F,0x45, /* 00000F58 "DPT2.._E" */ + 0x4A,0x30,0x01,0x70,0x0A,0x98,0x5C,0x2E, /* 00000F60 "J0.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000F68 "_GPEDPT2" */ + 0x70,0x01,0x5C,0x2E,0x5F,0x47,0x50,0x45, /* 00000F70 "p.\._GPE" */ + 0x50,0x48,0x50,0x32,0x14,0x1E,0x5F,0x53, /* 00000F78 "PHP2.._S" */ + 0x54,0x41,0x00,0x70,0x0A,0x99,0x5C,0x2E, /* 00000F80 "TA.p..\." */ + 0x5F,0x47,0x50,0x45,0x44,0x50,0x54,0x32, /* 00000F88 "_GPEDPT2" */ + 0xA4,0x5C,0x2E,0x5F,0x47,0x50,0x45,0x50, /* 00000F90 ".\._GPEP" */ + 0x48,0x50,0x32,0x10,0x4E,0x0B,0x5F,0x47, /* 00000F98 "HP2.N._G" */ + 0x50,0x45,0x5B,0x80,0x50,0x48,0x50,0x5F, /* 00000FA0 "PE[.PHP_" */ + 0x01,0x0B,0xC0,0x10,0x0A,0x03,0x5B,0x81, /* 00000FA8 "......[." */ + 0x15,0x50,0x48,0x50,0x5F,0x01,0x50,0x53, /* 00000FB0 ".PHP_.PS" */ + 0x54,0x41,0x08,0x50,0x48,0x50,0x31,0x08, /* 00000FB8 "TA.PHP1." */ + 0x50,0x48,0x50,0x32,0x08,0x5B,0x80,0x44, /* 00000FC0 "PHP2.[.D" */ + 0x47,0x31,0x5F,0x01,0x0B,0x44,0xB0,0x0A, /* 00000FC8 "G1_..D.." */ + 0x04,0x5B,0x81,0x10,0x44,0x47,0x31,0x5F, /* 00000FD0 ".[..DG1_" */ + 0x01,0x44,0x50,0x54,0x31,0x08,0x44,0x50, /* 00000FD8 ".DPT1.DP" */ + 0x54,0x32,0x08,0x14,0x46,0x07,0x5F,0x4C, /* 00000FE0 "T2..F._L" */ + 0x30,0x33,0x00,0x08,0x53,0x4C,0x54,0x5F, /* 00000FE8 "03..SLT_" */ + 0x00,0x08,0x45,0x56,0x54,0x5F,0x00,0x70, /* 00000FF0 "..EVT_.p" */ + 0x50,0x53,0x54,0x41,0x61,0x7A,0x61,0x0A, /* 00000FF8 "PSTAaza." */ + 0x04,0x53,0x4C,0x54,0x5F,0x7B,0x61,0x0A, /* 00001000 ".SLT_{a." */ + 0x0F,0x45,0x56,0x54,0x5F,0x70,0x53,0x4C, /* 00001008 ".EVT_pSL" */ + 0x54,0x5F,0x44,0x50,0x54,0x31,0x70,0x45, /* 00001010 "T_DPT1pE" */ + 0x56,0x54,0x5F,0x44,0x50,0x54,0x32,0xA0, /* 00001018 "VT_DPT2." */ + 0x1B,0x93,0x53,0x4C,0x54,0x5F,0x01,0x86, /* 00001020 "..SLT_.." */ + 0x5C,0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50, /* 00001028 "\/._SB_P" */ + 0x43,0x49,0x30,0x53,0x31,0x46,0x30,0x45, /* 00001030 "CI0S1F0E" */ + 0x56,0x54,0x5F,0xA1,0x1E,0xA0,0x1C,0x93, /* 00001038 "VT_....." */ + 0x53,0x4C,0x54,0x5F,0x0A,0x02,0x86,0x5C, /* 00001040 "SLT_...\" */ + 0x2F,0x03,0x5F,0x53,0x42,0x5F,0x50,0x43, /* 00001048 "/._SB_PC" */ + 0x49,0x30,0x53,0x32,0x46,0x30,0x45,0x56, /* 00001050 "I0S2F0EV" */ + 0x54,0x5F, }; int DsdtLen=sizeof(AmlCode); diff --git a/tools/firmware/hvmloader/acpi/static_tables.c b/tools/firmware/hvmloader/acpi/static_tables.c index 96d7f0c331..8a93218c14 100644 --- a/tools/firmware/hvmloader/acpi/static_tables.c +++ b/tools/firmware/hvmloader/acpi/static_tables.c @@ -59,9 +59,11 @@ struct acpi_20_fadt Fadt = { .pm1a_evt_blk = ACPI_PM1A_EVT_BLK_ADDRESS, .pm1a_cnt_blk = ACPI_PM1A_CNT_BLK_ADDRESS, .pm_tmr_blk = ACPI_PM_TMR_BLK_ADDRESS, + .gpe0_blk = ACPI_GPE0_BLK_ADDRESS, .pm1_evt_len = ACPI_PM1A_EVT_BLK_BIT_WIDTH / 8, .pm1_cnt_len = ACPI_PM1A_CNT_BLK_BIT_WIDTH / 8, .pm_tmr_len = ACPI_PM_TMR_BLK_BIT_WIDTH / 8, + .gpe0_blk_len = ACPI_GPE0_BLK_LEN, .p_lvl2_lat = 0x0fff, /* >100, means we do not support C2 state */ .p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */ |