qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, aik@ozlabs.ru,
	David Gibson <dgibson@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Laszlo Ersek <lersek@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>
Subject: Re: [Qemu-devel] [RFC 2/7] pci: Change pci_bus_init() 'parent' parameter to PCIHostState
Date: Tue, 18 Apr 2017 13:51:02 +1000	[thread overview]
Message-ID: <20170418035101.GJ12235@umbus.fritz.box> (raw)
In-Reply-To: <20170417215916.12431-3-ehabkost@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2922 bytes --]

On Mon, Apr 17, 2017 at 06:59:11PM -0300, Eduardo Habkost wrote:
> pci_bus_init() already requires 'parent' to be a PCI_HOST_BRIDGE object,
> so change the parameter type to reflect that.
> 
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Marcel Apfelbaum <marcel@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

I had to do some looking to convince myself this wouldn't break P2P
bridges.

I wonder if we should rename pci_bus_init() / pci_bus_new() to make it
clearer that they're about creating a whole new PCI domain, and not
for a new bus within an existing domain.

> ---
>  hw/pci/pci.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 25118fb91d..d9535c0bdc 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -362,7 +362,7 @@ const char *pci_root_bus_path(PCIDevice *dev)
>      return rootbus->qbus.name;
>  }
>  
> -static void pci_bus_init(PCIBus *bus, DeviceState *parent,
> +static void pci_bus_init(PCIBus *bus, PCIHostState *phb,
>                           MemoryRegion *address_space_mem,
>                           MemoryRegion *address_space_io,
>                           uint8_t devfn_min)
> @@ -375,7 +375,7 @@ static void pci_bus_init(PCIBus *bus, DeviceState *parent,
>      /* host bridge */
>      QLIST_INIT(&bus->child);
>  
> -    pci_host_bus_register(PCI_HOST_BRIDGE(host));
> +    pci_host_bus_register(phb);
>  }
>  
>  bool pci_bus_is_express(PCIBus *bus)
> @@ -394,8 +394,9 @@ void pci_bus_new_inplace(PCIBus *bus, size_t bus_size, DeviceState *parent,
>                           MemoryRegion *address_space_io,
>                           uint8_t devfn_min, const char *typename)
>  {
> +    PCIHostState *phb = PCI_HOST_BRIDGE(parent);
>      qbus_create_inplace(bus, bus_size, typename, parent, name);
> -    pci_bus_init(bus, parent, address_space_mem, address_space_io, devfn_min);
> +    pci_bus_init(bus, phb, address_space_mem, address_space_io, devfn_min);
>  }
>  
>  PCIBus *pci_bus_new(DeviceState *parent, const char *name,
> @@ -403,10 +404,11 @@ PCIBus *pci_bus_new(DeviceState *parent, const char *name,
>                      MemoryRegion *address_space_io,
>                      uint8_t devfn_min, const char *typename)
>  {
> +    PCIHostState *phb = PCI_HOST_BRIDGE(parent);
>      PCIBus *bus;
>  
>      bus = PCI_BUS(qbus_create(typename, parent, name));
> -    pci_bus_init(bus, parent, address_space_mem, address_space_io, devfn_min);
> +    pci_bus_init(bus, phb, address_space_mem, address_space_io, devfn_min);
>      return bus;
>  }
>  

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-04-18  4:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17 21:59 [Qemu-devel] [RFC 0/7] pci: Type-safety and phb->bus initialization cleanup Eduardo Habkost
2017-04-17 21:59 ` [Qemu-devel] [RFC 1/7] pci: Change pci_host_bus_register() parameter to PCIHostState Eduardo Habkost
2017-04-18  3:46   ` David Gibson
2017-04-18 13:01   ` Marcel Apfelbaum
2017-04-17 21:59 ` [Qemu-devel] [RFC 2/7] pci: Change pci_bus_init() 'parent' " Eduardo Habkost
2017-04-18  3:51   ` David Gibson [this message]
2017-04-18 11:48     ` Eduardo Habkost
2017-04-18 13:22       ` Marcel Apfelbaum
2017-04-17 21:59 ` [Qemu-devel] [RFC 3/7] pci: Change pci_bus_new*() " Eduardo Habkost
2017-04-18  3:52   ` David Gibson
2017-04-18 13:27   ` Marcel Apfelbaum
2017-04-18 13:30     ` Eduardo Habkost
2017-04-18 13:36       ` Marcel Apfelbaum
2017-04-26 16:16   ` Michael S. Tsirkin
2017-04-26 17:49     ` Eduardo Habkost
2017-04-17 21:59 ` [Qemu-devel] [RFC 4/7] pci: Change pci_register_bus() 'parent' " Eduardo Habkost
2017-04-18  3:53   ` David Gibson
2017-04-18 10:41   ` Cornelia Huck
2017-04-18 13:37   ` Marcel Apfelbaum
2017-04-26 16:17   ` Michael S. Tsirkin
2017-04-17 21:59 ` [Qemu-devel] [RFC 5/7] pci: Set phb->bus inside pci_register_bus() Eduardo Habkost
2017-04-18  3:55   ` David Gibson
2017-04-18 10:42   ` Cornelia Huck
2017-04-18 13:43   ` Marcel Apfelbaum
2017-04-18 13:53     ` Eduardo Habkost
2017-04-17 21:59 ` [Qemu-devel] [RFC 6/7] pci: Set phb->bus inside pci_bus_new() Eduardo Habkost
2017-04-18  3:56   ` David Gibson
2017-04-17 21:59 ` [Qemu-devel] [RFC 7/7] pci: Set phb->bus inside pci_bus_new_inplace() Eduardo Habkost
2017-04-18  3:56   ` David Gibson

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=20170418035101.GJ12235@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=dgibson@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).