From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhDeW-0005tc-4h for qemu-devel@nongnu.org; Tue, 28 May 2013 02:45:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhDeS-0001qr-1H for qemu-devel@nongnu.org; Tue, 28 May 2013 02:45:00 -0400 Received: from [222.73.24.84] (port=35462 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhDeR-0001pO-EL for qemu-devel@nongnu.org; Tue, 28 May 2013 02:44:55 -0400 From: li guang In-Reply-To: <20130528064049.GC21270@redhat.com> References: <1369194397-608-1-git-send-email-lig.fnst@cn.fujitsu.com> <1369194397-608-4-git-send-email-lig.fnst@cn.fujitsu.com> <20130528064049.GC21270@redhat.com> Date: Tue, 28 May 2013 14:44:25 +0800 Message-ID: <1369723465.19028.67.camel@liguang.fnst.cn.fujitsu.com> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] [PATCH 3/4] ich9: add notifer for ec to generate sci List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Anthony Liguori , Stefan Berger , qemu-devel@nongnu.org, Bruce Rogers , Joel Schopp , Gerd Hoffmann , Paolo Bonzini , Andreas =?ISO-8859-1?Q?F=E4rber?= , Isaku Yamahata =E5=9C=A8 2013-05-28=E4=BA=8C=E7=9A=84 09:40 +0300=EF=BC=8CMichael S. Tsirk= in=E5=86=99=E9=81=93=EF=BC=9A > On Wed, May 22, 2013 at 11:46:36AM +0800, liguang wrote: > > Signed-off-by: liguang > > --- > > hw/acpi/ich9.c | 15 +++++++++++++++ > > include/hw/acpi/ich9.h | 1 + > > 2 files changed, 16 insertions(+), 0 deletions(-) > >=20 > > diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c > > index 582dbec..2ecde32 100644 > > --- a/hw/acpi/ich9.c > > +++ b/hw/acpi/ich9.c > > @@ -33,6 +33,7 @@ > > #include "exec/address-spaces.h" > > =20 > > #include "hw/i386/ich9.h" > > +#include "hw/acpi/ec.h" > > =20 > > //#define DEBUG > > =20 > > @@ -43,6 +44,8 @@ do { printf("%s "fmt, __func__, ## __VA_ARGS__); } wh= ile (0) > > #define ICH9_DEBUG(fmt, ...) do { } while (0) > > #endif > > =20 > > +#define GPE_EC_SCI_STATUS (0x1 << (16 + 1)) > > + > > static void pm_update_sci(ICH9LPCPMRegs *pm) > > { > > int sci_level, pm1a_sts; > > @@ -202,6 +205,15 @@ static void pm_powerdown_req(Notifier *n, void *op= aque) > > acpi_pm1_evt_power_down(&pm->acpi_regs); > > } > > =20 > > +static void pm_ec_sci_req(Notifier *n, void *opaque) > > +{ > > + ICH9LPCPMRegs *pm =3D container_of(n, ICH9LPCPMRegs, ec_sci_notifi= er); > > + ACPIGPE *gpe =3D &pm->acpi_regs.gpe; > > + > > + *gpe->sts |=3D GPE_EC_SCI_STATUS; > > + pm_update_sci(pm); > > +} > > + > > void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > > qemu_irq sci_irq) > > { > > @@ -227,4 +239,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs= *pm, > > qemu_register_reset(pm_reset, pm); > > pm->powerdown_notifier.notify =3D pm_powerdown_req; > > qemu_register_powerdown_notifier(&pm->powerdown_notifier); > > + > > + pm->ec_sci_notifier.notify =3D pm_ec_sci_req; > > + qemu_register_ec_sci_notifier(&pm->ec_sci_notifier); > > } >=20 > So an EC is using ICH9 to send SCI to guest, > but ICH9 should not worry about EC that's connected to it. > So it should be something like > qemu_register_sci_notifier > and not make ich9 depend on ec. OK, let me think about it. Thanks! >=20 > > diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h > > index b1fe71f..f358deb 100644 > > --- a/include/hw/acpi/ich9.h > > +++ b/include/hw/acpi/ich9.h > > @@ -42,6 +42,7 @@ typedef struct ICH9LPCPMRegs { > > =20 > > uint32_t pm_io_base; > > Notifier powerdown_notifier; > > + Notifier ec_sci_notifier; > > } ICH9LPCPMRegs; > > =20 > > void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, > > --=20 > > 1.7.2.5