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: "Peter Maydell" <peter.maydell@linaro.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Alexey Kardashevskiy" <aik@ozlabs.ru>,
	"David Gibson" <dgibson@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Laszlo Ersek" <lersek@redhat.com>,
	"Marcel Apfelbaum" <marcel@redhat.com>,
	"Alexander Graf" <agraf@suse.de>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Cornelia Huck" <cornelia.huck@de.ibm.com>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Paul Burton" <paul.burton@imgtec.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Scott Wood" <scottwood@freescale.com>,
	"Yongbok Kim" <yongbok.kim@imgtec.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>
Subject: Re: [Qemu-devel] [RFC v2 3/6] pci: Rename and change signatures of pci_bus_new() & related functions
Date: Thu, 20 Apr 2017 15:04:29 +1000	[thread overview]
Message-ID: <20170420050429.GD13992@umbus.fritz.box> (raw)
In-Reply-To: <20170419125001.GU25239@thinpad.lan.raisama.net>

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

On Wed, Apr 19, 2017 at 09:50:01AM -0300, Eduardo Habkost wrote:
> On Wed, Apr 19, 2017 at 09:41:42AM +0100, Peter Maydell wrote:
> > On 18 April 2017 at 23:17, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > > pci_bus_new*() and pci_register_bus() work only when the 'parent'
> > > argument is a PCI_HOST_BRIDGE object. Rename them to reflect that they
> > > are meant to initialize a bus that's in a PCI host bridge.
> > >
> > > The new function names are:
> > > * pci_host_bus_init() (replacing pci_bus_new())
> > > * pci_host_bus_init_inplace() (replacing pci_bus_new_inplace())
> > > * pci_host_bus_init_irqs() (replacing pci_register_bus())
> > 
> > This is moving these functions away from the convention that
> > we seem to mostly follow for buses (eg ISA, SCSI) of
> > foo_bus_new() to allocate and return a new bus, and
> > foo_bus_new_inplace() to initialize a bus that's inline in
> > some other struct.
> > 
> > I'm not sure this is a good idea unless we have a plan to
> > convert all the other QOM buses and document that this is
> > the right way to implement init for a bus.
> 
> The point of the rename is that those functions are doing more
> than just allocating a PCIBus. They do some initialization of
> PCIHostState as well. That's why non-root PCI buses can't be
> created by pci_bus_new*() today.

Hm, yeah.

So.. for what's now pci_register_bus() is it even worth keeping a
helper?  Could we just require that callers call the other init
function then call pci_bus_irqs().  That would be one less name to
come up with.

For the others, what about
	pci_common_root_bus_new()
	pci_common_root_bus_init_inplace()
?

> Maybe the answer here is to move the PCI_HOST_BRIDGE-specific
> code somewhere else, and make pci_bus_new*() more generic. This
> would allow us to reuse pci_bus_new*() when creating non-root PCI
> buses, later.

That might work even better.

-- 
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-20  5:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 22:17 [Qemu-devel] [RFC v2 0/6] pci: Refactor PCI root bus creation code Eduardo Habkost
2017-04-18 22:17 ` [Qemu-devel] [RFC v2 1/6] pci: Inline pci_host_bus_register() inside pci_bus_init() Eduardo Habkost
2017-04-19  0:22   ` David Gibson
2017-04-19 18:09   ` Marcel Apfelbaum
2017-04-18 22:17 ` [Qemu-devel] [RFC v2 2/6] pci: Move pci_bus_init() logic to pci_bus_new_inplace() Eduardo Habkost
2017-04-19  0:23   ` David Gibson
2017-04-19 18:31   ` Marcel Apfelbaum
2017-04-25 19:24     ` Eduardo Habkost
2017-04-18 22:17 ` [Qemu-devel] [RFC v2 3/6] pci: Rename and change signatures of pci_bus_new() & related functions Eduardo Habkost
2017-04-19  0:29   ` David Gibson
2017-04-19  1:42     ` Eduardo Habkost
2017-04-19 12:05       ` Cornelia Huck
2017-04-19 18:41         ` Marcel Apfelbaum
2017-04-19 21:19           ` Eduardo Habkost
2017-04-19  8:41   ` Peter Maydell
2017-04-19 12:50     ` Eduardo Habkost
2017-04-20  5:04       ` David Gibson [this message]
2017-04-18 22:17 ` [Qemu-devel] [RFC v2 4/6] pci: Manually simplify QOM casts at pci_host_bus_init*() calls Eduardo Habkost
2017-04-19  0:30   ` David Gibson
2017-04-18 22:17 ` [Qemu-devel] [RFC v2 5/6] pci: Set phb->bus inside pci_host_bus_init_inplace() Eduardo Habkost
2017-04-18 22:17 ` [Qemu-devel] [RFC v2 6/6] pci: Remove unnecessary PCIBus variables Eduardo Habkost
2017-04-19 12:20   ` Cornelia Huck

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=20170420050429.GD13992@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=aurelien@aurel32.net \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dgibson@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=lersek@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=paul.burton@imgtec.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=scottwood@freescale.com \
    --cc=yongbok.kim@imgtec.com \
    /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).