From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgghE-0000FX-Bq for qemu-devel@nongnu.org; Mon, 18 Jun 2012 14:29:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgghC-0000l6-66 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 14:29:03 -0400 Date: Mon, 18 Jun 2012 21:28:54 +0300 From: "Michael S. Tsirkin" Message-ID: <20120618182854.GB29700@redhat.com> References: <1339343875-6958-1-git-send-email-afaerber@suse.de> <1339343875-6958-2-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1339343875-6958-2-git-send-email-afaerber@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/2] pci_host: Turn into SysBus-derived QOM type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Anthony Liguori , Wanpeng Li , qemu-devel@nongnu.org, Andreas =?iso-8859-1?Q?F=E4rber?= , "open list:PReP" , Anthony Liguori On Sun, Jun 10, 2012 at 05:57:54PM +0200, Andreas F=E4rber wrote: > From: Andreas F=E4rber >=20 > Allows us to access PCIHostState QOM-style with PCI_HOST() macro. >=20 > Update PReP Raven PCI to derive from this type. >=20 > Signed-off-by: Anthony Liguori > Signed-off-by: Wanpeng Li > Signed-off-by: Andreas F=E4rber > Reviewed-by: Anthony Liguori Question: this is really a pci host *bridge*. We are calling this PCIHost internally for brevity but QOM hierarchy is user-visible, right? > --- > hw/pci_host.c | 11 +++++++++++ > hw/pci_host.h | 3 +++ > hw/prep_pci.c | 4 ++-- > 3 files changed, 16 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/pci_host.c b/hw/pci_host.c > index 8041778..347bfa6 100644 > --- a/hw/pci_host.c > +++ b/hw/pci_host.c > @@ -165,4 +165,15 @@ const MemoryRegionOps pci_host_data_be_ops =3D { > .endianness =3D DEVICE_BIG_ENDIAN, > }; > =20 > +static const TypeInfo pci_host_type_info =3D { > + .name =3D TYPE_PCI_HOST, > + .parent =3D TYPE_SYS_BUS_DEVICE, > + .instance_size =3D sizeof(PCIHostState), > +}; > + > +static void pci_host_register_types(void) > +{ > + type_register_static(&pci_host_type_info); > +} > =20 > +type_init(pci_host_register_types) > diff --git a/hw/pci_host.h b/hw/pci_host.h > index 359e38f..fba9fde 100644 > --- a/hw/pci_host.h > +++ b/hw/pci_host.h > @@ -30,6 +30,9 @@ > =20 > #include "sysbus.h" > =20 > +#define TYPE_PCI_HOST "pci-host" > +#define PCI_HOST(obj) OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST) > + > struct PCIHostState { > SysBusDevice busdev; > MemoryRegion conf_mem; > diff --git a/hw/prep_pci.c b/hw/prep_pci.c > index 38dbff4..3e9f6b8 100644 > --- a/hw/prep_pci.c > +++ b/hw/prep_pci.c > @@ -183,9 +183,9 @@ static void raven_pcihost_class_init(ObjectClass *k= lass, void *data) > dc->no_user =3D 1; > } > =20 > -static TypeInfo raven_pcihost_info =3D { > +static const TypeInfo raven_pcihost_info =3D { > .name =3D "raven-pcihost", > - .parent =3D TYPE_SYS_BUS_DEVICE, > + .parent =3D TYPE_PCI_HOST, > .instance_size =3D sizeof(PREPPCIState), > .class_init =3D raven_pcihost_class_init, > }; > --=20 > 1.7.7