From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [SeaBIOS] [SeaBIOS PATCH 2/2] hotplug: Add device per func in ACPI DSDT tables Date: Mon, 19 Sep 2011 12:57:33 +0300 Message-ID: <20110919095733.GO21417@redhat.com> References: <20110919065338.22802.48911.stgit@t> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: seabios@seabios.org, kvm@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, alex williamson To: Amos Kong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:4180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755087Ab1ISJ5k (ORCPT ); Mon, 19 Sep 2011 05:57:40 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Sep 19, 2011 at 03:27:38AM -0400, 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. > You can't unplug a single function. Guest surely knows that. > Have tested with linux/winxp/win7, hot-adding/hot-remving, > single/multiple function device, they are all fine. > What was not fine before? Have you looked at real HW that supports PCI hot plug DSDT? Does it looks the same? > new acpi-dst.hex(332K): > http://amos-kong.rhcloud.com/pub/acpi-dsdt.hex > > Signed-off-by: Amos Kong > --- > src/acpi-dsdt.dsl | 31 +++++++++++++++++++++++++------ > 1 files changed, 25 insertions(+), 6 deletions(-) > > diff --git a/src/acpi-dsdt.dsl b/src/acpi-dsdt.dsl > index 08412e2..d1426ec 100644 > --- a/src/acpi-dsdt.dsl > +++ b/src/acpi-dsdt.dsl > @@ -128,9 +128,9 @@ DefinitionBlock ( > PCRM, 32, > } > > -#define hotplug_slot(name, nr) \ > - Device (S##name) { \ > - Name (_ADR, nr##0000) \ > +#define hotplug_func(name, nr, adr, fn) \ > + Device (S##name##fn) { \ > + Name (_ADR, adr) \ > Method (_EJ0,1) { \ > Store(ShiftLeft(1, nr), B0EJ) \ > Return (0x0) \ > @@ -138,6 +138,16 @@ DefinitionBlock ( > Name (_SUN, name) \ > } > > +#define hotplug_slot(name, nr) \ > + hotplug_func(name, nr, nr##0000, 0) \ > + hotplug_func(name, nr, nr##0001, 1) \ > + hotplug_func(name, nr, nr##0002, 2) \ > + hotplug_func(name, nr, nr##0003, 3) \ > + hotplug_func(name, nr, nr##0004, 4) \ > + hotplug_func(name, nr, nr##0005, 5) \ > + hotplug_func(name, nr, nr##0006, 6) \ > + hotplug_func(name, nr, nr##0007, 7) > + > hotplug_slot(1, 0x0001) > hotplug_slot(2, 0x0002) > hotplug_slot(3, 0x0003) > @@ -842,13 +852,22 @@ DefinitionBlock ( > Return(0x01) > } > > -#define gen_pci_hotplug(nr) \ > +#define gen_pci_hotplug_func(nr, fn) \ > If (And(\_SB.PCI0.PCIU, ShiftLeft(1, nr))) { \ > - Notify(\_SB.PCI0.S##nr, 1) \ > + Notify(\_SB.PCI0.S##nr##fn, 1) \ > } \ > If (And(\_SB.PCI0.PCID, ShiftLeft(1, nr))) { \ > - Notify(\_SB.PCI0.S##nr, 3) \ > + Notify(\_SB.PCI0.S##nr##fn, 3) \ > } > +#define gen_pci_hotplug(nr) \ > + gen_pci_hotplug_func(nr, 0) \ > + gen_pci_hotplug_func(nr, 1) \ > + gen_pci_hotplug_func(nr, 2) \ > + gen_pci_hotplug_func(nr, 3) \ > + gen_pci_hotplug_func(nr, 4) \ > + gen_pci_hotplug_func(nr, 5) \ > + gen_pci_hotplug_func(nr, 6) \ > + gen_pci_hotplug_func(nr, 7) > > Method(_L01) { > gen_pci_hotplug(1) > -- > 1.7.6.1 > > _______________________________________________ > SeaBIOS mailing list > SeaBIOS@seabios.org > http://www.seabios.org/mailman/listinfo/seabios -- Gleb.