From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sdm12-00018W-Ae for qemu-devel@nongnu.org; Sun, 10 Jun 2012 13:33:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sdm0z-0001TR-43 for qemu-devel@nongnu.org; Sun, 10 Jun 2012 13:33:27 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:48064) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sdm0y-0001Sa-VG for qemu-devel@nongnu.org; Sun, 10 Jun 2012 13:33:25 -0400 Received: by obbwd20 with SMTP id wd20so5952749obb.4 for ; Sun, 10 Jun 2012 10:33:22 -0700 (PDT) Message-ID: <4FD4DA60.1070701@codemonkey.ws> Date: Sun, 10 Jun 2012 12:33:20 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1339343875-6958-1-git-send-email-afaerber@suse.de> <1339343875-6958-2-git-send-email-afaerber@suse.de> In-Reply-To: <1339343875-6958-2-git-send-email-afaerber@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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: =?ISO-8859-1?Q?Andreas_F=E4rber?= Cc: Anthony Liguori , Wanpeng Li , "Michael S. Tsirkin" , qemu-devel@nongnu.org, =?ISO-8859-1?Q?Andreas_F=E4rber?= , PReP On 06/10/2012 10:57 AM, Andreas Färber wrote: > From: Andreas Färber > > Allows us to access PCIHostState QOM-style with PCI_HOST() macro. > > Update PReP Raven PCI to derive from this type. > > Signed-off-by: Anthony Liguori > Signed-off-by: Wanpeng Li > Signed-off-by: Andreas Färber > Reviewed-by: Anthony Liguori > --- > hw/pci_host.c | 11 +++++++++++ > hw/pci_host.h | 3 +++ > hw/prep_pci.c | 4 ++-- > 3 files changed, 16 insertions(+), 2 deletions(-) > > 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 = { > .endianness = DEVICE_BIG_ENDIAN, > }; > > +static const TypeInfo pci_host_type_info = { > + .name = TYPE_PCI_HOST, > + .parent = TYPE_SYS_BUS_DEVICE, > + .instance_size = sizeof(PCIHostState), > +}; Any reason why PCIHost can't have TYPE_DEVICE as the the parent? Regards, Anthony Liguori > + > +static void pci_host_register_types(void) > +{ > + type_register_static(&pci_host_type_info); > +} > > +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 @@ > > #include "sysbus.h" > > +#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 *klass, void *data) > dc->no_user = 1; > } > > -static TypeInfo raven_pcihost_info = { > +static const TypeInfo raven_pcihost_info = { > .name = "raven-pcihost", > - .parent = TYPE_SYS_BUS_DEVICE, > + .parent = TYPE_PCI_HOST, > .instance_size = sizeof(PREPPCIState), > .class_init = raven_pcihost_class_init, > };