qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	Gavin Shan <shangw@linux.vnet.ibm.com>,
	"MichaelS.Tsirkin" <mst@redhat.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, Ram Pai <pair@us.ibm.com>,
	Blue Swirl <blauwirbel@gmail.com>,
	Stefan Weil <weil@mail.berlios.de>,
	Liu Ping Fan <kernelfans@gmail.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 3/3] convert pci-host to QOM
Date: Mon, 23 Jul 2012 21:27:13 +0800	[thread overview]
Message-ID: <20120723132713.GA7194@kernel> (raw)
In-Reply-To: <500D4A30.6050402@suse.de>

On Mon, Jul 23, 2012 at 02:57:20PM +0200, Andreas Färber wrote:
>Am 23.07.2012 14:35, schrieb Wanpeng Li:
>> From: Anthony Liguori <aliguori@us.ibm.com>
>> 
>> makes pci_host a proper QOM type.
>> 
>> Changelog:
>> * against Andreas pci_host branch
>> * make host bridge TypeInfos const
>> * use PCI_HOST_BRIDGE() where appropriate 
>> 
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> Signed-off-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
>> 
>> ---
>>  hw/i440fx.c   |    6 +++---
>>  hw/pc.c       |    2 +-
>>  hw/pci_host.c |   14 ++++++++++++++
>>  hw/pci_host.h |    2 ++
>>  hw/piix3.c    |    4 ++--
>>  5 files changed, 22 insertions(+), 6 deletions(-)
>> 
>> diff --git a/hw/i440fx.c b/hw/i440fx.c
>> index 720a25a..fdf040b 100644
>> --- a/hw/i440fx.c
>> +++ b/hw/i440fx.c
>> @@ -191,7 +191,7 @@ static const VMStateDescription vmstate_i440fx_pmc = {
>>  static int i440fx_realize(SysBusDevice *dev)
>>  {
>>      I440FXState *s = I440FX(dev);
>> -    PCIHostState *h = PCI_HOST(s);
>> +    PCIHostState *h = PCI_HOST_BRIDGE(s);
>>      int bios_size, isa_bios_size;
>>      char *filename;
>>      int ret;
>
>Either there's a miscommunication or a technical error: My branch surely
>is using PCI_HOST_BRIDGE(), so these PCI_HOST -> PCI_HOST_BRIDGE changes
>look bogus. Did you make sure each patch compiles?
The third patch against your pci-host branch which you hope to, the three 
patches can overall compile success, but not each patch compile success. 
Because PATCH 1/3 should take advantage of PCI_HOST_BRIDGE(), and
PATCH 2/3 also should take advantage of PATCH 1/3.

>
>> @@ -401,7 +401,7 @@ static void i440fx_pmc_class_init(ObjectClass *klass, void *data)
>>      dc->vmsd = &vmstate_i440fx_pmc;
>>  }
>>  
>> -static TypeInfo i440fx_pmc_info = {
>> +static const TypeInfo i440fx_pmc_info = {
>>      .name          = TYPE_I440FX_PMC,
>>      .parent        = TYPE_PCI_DEVICE,
>>      .instance_size = sizeof(I440FXPMCState),
>> @@ -418,7 +418,7 @@ static void i440fx_class_init(ObjectClass *klass, void *data)
>>      dc->no_user = 1;
>>  }
>>  
>> -static TypeInfo i440fx_info = {
>> +static const TypeInfo i440fx_info = {
>>      .name          = TYPE_I440FX,
>>      .parent        = TYPE_PCI_HOST_BRIDGE,
>>      .instance_size = sizeof(I440FXState),
>
>Patch 1/3 does not have const, patch 2/3 adds new TypeInfos without const.

Patch 2/3 doesn't add any new TypeInfos, where you see the new
TypeInfos you mentioned.

>

>So my guess is you've not rebased this on my pci-host branch [1] but

No, I rebase the third patch against your pci_host branch. Since your patch 

pci: Derive PCI host bridges from TYPE_PCI_HOST_BRIDGE
Some typedef'ed their state to PCIHostState. Use a proper struct,
and use PCIHostState and PCI_HOST_BRIDGE() where appropriate.

Signed-off-by: Andreas Färber <afaerber@suse.de>
 
want to use PCI_HOST_BRIDGE() where appropriate, so I add them to Patch
1/3 codes.

Regards,
Wanpeng Li
>onto something else? If they're not against master it's advisable to
>mark patches [PATCH treename xx/nn] btw, for clarity.
>
>For the new/changed TypeInfos please add const from the start.
>
>Regards,
>Andreas
>
>[1] http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/pci-host
>git://repo.or.cz/qemu/afaerber.git pci-host
>
>> diff --git a/hw/pc.c b/hw/pc.c
>> index d9a0443..f095109 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -1217,7 +1217,7 @@ static PCIBus *i440fx_init(I440FXPMCState **pi440fx_state, int *piix3_devfn,
>>      PCIHostState *h;
>>  
>>      s = I440FX(object_new(TYPE_I440FX));
>> -    h = PCI_HOST(s);
>> +    h = PCI_HOST_BRIDGE(s);
>>  
>>      /* FIXME make a properties */
>>      h->address_space = address_space_mem;
>> diff --git a/hw/pci_host.c b/hw/pci_host.c
>> index 3950e94..4e10042 100644
>> --- a/hw/pci_host.c
>> +++ b/hw/pci_host.c
>> @@ -165,11 +165,25 @@ const MemoryRegionOps pci_host_data_be_ops = {
>>      .endianness = DEVICE_BIG_ENDIAN,
>>  };
>>  
>> +void pci_host_set_mmio(PCIHostState *s, MemoryRegion *value)
>> +{
>> +    object_property_set_link(OBJECT(s), OBJECT(value), "mmio", NULL);
>> +}
>> +
>> +static void pci_host_initfn(Object *obj)
>> +{
>> +    PCIHostState *s = PCI_HOST_BRIDGE(obj);
>> +
>> +    object_property_add_link(obj, "mmio", "memory-region",
>> +                            (Object **)&s->address_space, NULL);
>> +}
>> +
>>  static const TypeInfo pci_host_type_info = {
>>      .name = TYPE_PCI_HOST_BRIDGE,
>>      .parent = TYPE_SYS_BUS_DEVICE,
>>      .abstract = true,
>>      .instance_size = sizeof(PCIHostState),
>> +    .instance_init = pci_host_initfn,
>>  };
>>  
>>  static void pci_host_register_types(void)
>> diff --git a/hw/pci_host.h b/hw/pci_host.h
>> index 4b9c300..9f28728 100644
>> --- a/hw/pci_host.h
>> +++ b/hw/pci_host.h
>> @@ -54,6 +54,8 @@ uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
>>  void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
>>  uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
>>  
>> +void pci_host_set_mmio(PCIHostState *s, MemoryRegion *value);
>> +
>>  extern const MemoryRegionOps pci_host_conf_le_ops;
>>  extern const MemoryRegionOps pci_host_conf_be_ops;
>>  extern const MemoryRegionOps pci_host_data_le_ops;
>> diff --git a/hw/piix3.c b/hw/piix3.c
>> index eca6ec8..3b69b15 100644
>> --- a/hw/piix3.c
>> +++ b/hw/piix3.c
>> @@ -204,7 +204,7 @@ static void piix3_class_init(ObjectClass *klass, void *data)
>>      k->class_id     = PCI_CLASS_BRIDGE_ISA;
>>  }
>>  
>> -static TypeInfo piix3_info = {
>> +static const TypeInfo piix3_info = {
>>      .name          = TYPE_PIIX3,
>>      .parent        = TYPE_PCI_DEVICE,
>>      .instance_size = sizeof(PIIX3State),
>> @@ -219,7 +219,7 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data)
>>      k->config_write = piix3_write_config_xen;
>>  };
>>  
>> -static TypeInfo piix3_xen_info = {
>> +static const TypeInfo piix3_xen_info = {
>>      .name          = "PIIX3-xen",
>>      .parent        = TYPE_PIIX3,
>>      .instance_size = sizeof(PIIX3State),
>> 
>
>
>-- 
>SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
>GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>
>

  reply	other threads:[~2012-07-23 13:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-23 12:35 [Qemu-devel] [PATCH v5 0/3] refactor PC machine, i440fx and piix3 to take advantage of QOM Wanpeng Li
2012-07-23 12:35 ` [Qemu-devel] [PATCH v5 1/3] eliminate piix_pci.c and module i440fx and piix3 Wanpeng Li
2012-07-23 12:35 ` [Qemu-devel] [PATCH v5 2/3] merge pc_piix.c to pc.c Wanpeng Li
2012-07-23 12:35 ` [Qemu-devel] [PATCH v5 3/3] convert pci-host to QOM Wanpeng Li
2012-07-23 12:57   ` Andreas Färber
2012-07-23 13:27     ` Wanpeng Li [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-11-08  5:36 [Qemu-devel] [PATCH v5 0/3] refactor PC machine, i440fx and piix3 to take advantage of QOM Wanpeng Li
2012-11-08  5:36 ` [Qemu-devel] [PATCH v5 3/3] convert pci-host to QOM Wanpeng Li
2012-11-15  0:55   ` Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120723132713.GA7194@kernel \
    --to=liwanp@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kernelfans@gmail.com \
    --cc=mst@redhat.com \
    --cc=pair@us.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=shangw@linux.vnet.ibm.com \
    --cc=weil@mail.berlios.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).