----- Original Message ----- > On Tue, Dec 06, 2011 at 01:39:35PM +0800, Amos Kong wrote: > > Only func 0 is registered to guest driver (we can > > only found func 0 in slot->funcs list of driver), > > the other functions could not be cleaned when > > hot-removing the whole slot. This patch adds > > device per function in ACPI DSDT tables. > > Notify only when func0 is added and removed. > > > > Have tested with linux/winxp/win7, hot-adding/hot-remving, > > single/multiple function device, they are all fine(all > > added devices can be removed). > > > > Changes from v2: > > update patch based on latest seabios tree > > > > Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx> > > Signed-off-by: Amos Kong <akong@xxxxxxxxxx> > > This includes some bits I wrote but this is not an ack > of the patch yet :) > > I find it surprising that this works: a function > has _EJ0 so would not guest expect that ejecting > a single one will only remove it, and not all functions? Removing single func is not supported by specific, and current code (qemu/kernel pci driver) process hot-remove with the whole slot. We could not hot-remove single func with/without this patch. Register _EJ0() for each func, then all the funcs will be record into the function list of the slot. Thanks, Amos > > --- > > > > src/ssdt-pcihp.dsl | 17 > > src/ssdt-pcihp.hex | 9225 > > ++++++++++++++++++++++++++++++++++++++++++++++++++-- > > 2 files changed, 8959 insertions(+), 283 deletions(-) > > > > diff --git a/src/ssdt-pcihp.dsl b/src/ssdt-pcihp.dsl > > index 4b435b8..2a3c326 100644 > > --- a/src/ssdt-pcihp.dsl > > +++ b/src/ssdt-pcihp.dsl > > @@ -17,14 +17,23 @@ DefinitionBlock ("ssdt-pcihp.aml", "SSDT", > > 0x01, "BXPC", "BXSSDTPCIHP", 0x1) > > // at runtime, if the slot is detected to not support > > hotplug. > > // Extract the offset of the address dword and the > > // _EJ0 name to allow this patching. > > -#define hotplug_slot(slot) \ > > - Device (S##slot) { \ > > +#define hotplug_func(slot, fn) \ > > + Device (S##slot##fn) { \ > > ACPI_EXTRACT_NAME_DWORD_CONST aml_adr_dword \ > > - Name (_ADR, 0x##slot##0000) \ > > + Name (_ADR, 0x##slot##000##fn) \ > > ACPI_EXTRACT_METHOD_STRING aml_ej0_name \ > > Method (_EJ0, 1) { Return(PCEJ(0x##slot)) } \ > > Name (_SUN, 0x##slot) \ > > } > > +#define hotplug_slot(slot) \ > > + hotplug_func(slot, 0) \ > > + hotplug_func(slot, 1) \ > > + hotplug_func(slot, 2) \ > > + hotplug_func(slot, 3) \ > > + hotplug_func(slot, 4) \ > > + hotplug_func(slot, 5) \ > > + hotplug_func(slot, 6) \ > > + hotplug_func(slot, 7) > > > > hotplug_slot(01) > > hotplug_slot(02) > > @@ -59,7 +68,7 @@ DefinitionBlock ("ssdt-pcihp.aml", "SSDT", 0x01, > > "BXPC", "BXSSDTPCIHP", 0x1) > > hotplug_slot(1f) > > > > #define gen_pci_hotplug(slot) \ > > - If (LEqual(Arg0, 0x##slot)) { Notify(S##slot, Arg1) } > > + If (LEqual(Arg0, 0x##slot)) { Notify(S##slot##0, Arg1) > > } > > > > Method(PCNT, 2) { > > gen_pci_hotplug(01) > > diff --git a/src/ssdt-pcihp.hex b/src/ssdt-pcihp.hex > > index b15ad5a..4c9b5df 100644 > > --- a/src/ssdt-pcihp.hex > > +++ b/src/ssdt-pcihp.hex > > @@ -1,80 +1,514 @@ > > static unsigned short aml_adr_dword[] = { > > -0x3e, > > -0x62, > > -0x88, > > -0xae, > > -0xd4, > > -0xfa, > > -0x120, ... -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html