All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
Date: Wed, 3 Aug 2011 13:21:35 +0300	[thread overview]
Message-ID: <20110803102135.GB9497@redhat.com> (raw)
In-Reply-To: <20110803101315.GA4658@stefanha-thinkpad.localdomain>

On Wed, Aug 03, 2011 at 11:13:15AM +0100, Stefan Hajnoczi wrote:
> On Mon, Aug 01, 2011 at 01:10:38PM +0300, Michael S. Tsirkin wrote:
> > On Mon, Aug 01, 2011 at 04:51:02PM +1000, David Gibson wrote:
> > > qemu already almost supports PCI domains; that is, several entirely
> > > independent PCI host bridges on the same machine.  However, a bug in
> > > pci_bus_new_inplace() means that every host bridge gets assigned domain
> > > number zero and so can't be properly distinguished.  This patch fixes the
> > > bug, giving each new host bridge a new domain number.
> > > 
> > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > OK, but I'd like to see the whole picture.
> > How does the guest detect multiple domains,
> > and how does it access them?
> > 
> > > ---
> > >  hw/pci.c |    5 ++++-
> > >  1 files changed, 4 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/hw/pci.c b/hw/pci.c
> > > index 36db58b..2b4aecb 100644
> > > --- a/hw/pci.c
> > > +++ b/hw/pci.c
> > > @@ -262,6 +262,8 @@ int pci_find_domain(const PCIBus *bus)
> > >      return -1;
> > >  }
> > >  
> > > +static int pci_next_domain; /* = 0 */
> > > +
> > >  void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
> > >                           const char *name,
> > >                           MemoryRegion *address_space,
> > > @@ -274,7 +276,8 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
> > >  
> > >      /* host bridge */
> > >      QLIST_INIT(&bus->child);
> > > -    pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */
> > > +
> > > +    pci_host_bus_register(pci_next_domain++, bus);
> > 
> > What happens when that overflows?
> 
> In what scenario do we reach such a high number?  (I'm not saying this
> is harmless, just trying to understand if it should be an assert or
> error return.)
> 
> Stefan

Can bus ever get hot-plugged?


WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
Date: Wed, 3 Aug 2011 13:21:35 +0300	[thread overview]
Message-ID: <20110803102135.GB9497@redhat.com> (raw)
In-Reply-To: <20110803101315.GA4658@stefanha-thinkpad.localdomain>

On Wed, Aug 03, 2011 at 11:13:15AM +0100, Stefan Hajnoczi wrote:
> On Mon, Aug 01, 2011 at 01:10:38PM +0300, Michael S. Tsirkin wrote:
> > On Mon, Aug 01, 2011 at 04:51:02PM +1000, David Gibson wrote:
> > > qemu already almost supports PCI domains; that is, several entirely
> > > independent PCI host bridges on the same machine.  However, a bug in
> > > pci_bus_new_inplace() means that every host bridge gets assigned domain
> > > number zero and so can't be properly distinguished.  This patch fixes the
> > > bug, giving each new host bridge a new domain number.
> > > 
> > > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > OK, but I'd like to see the whole picture.
> > How does the guest detect multiple domains,
> > and how does it access them?
> > 
> > > ---
> > >  hw/pci.c |    5 ++++-
> > >  1 files changed, 4 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/hw/pci.c b/hw/pci.c
> > > index 36db58b..2b4aecb 100644
> > > --- a/hw/pci.c
> > > +++ b/hw/pci.c
> > > @@ -262,6 +262,8 @@ int pci_find_domain(const PCIBus *bus)
> > >      return -1;
> > >  }
> > >  
> > > +static int pci_next_domain; /* = 0 */
> > > +
> > >  void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
> > >                           const char *name,
> > >                           MemoryRegion *address_space,
> > > @@ -274,7 +276,8 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
> > >  
> > >      /* host bridge */
> > >      QLIST_INIT(&bus->child);
> > > -    pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */
> > > +
> > > +    pci_host_bus_register(pci_next_domain++, bus);
> > 
> > What happens when that overflows?
> 
> In what scenario do we reach such a high number?  (I'm not saying this
> is harmless, just trying to understand if it should be an assert or
> error return.)
> 
> Stefan

Can bus ever get hot-plugged?

  reply	other threads:[~2011-08-03 10:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-01  6:51 [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers David Gibson
2011-08-01  6:51 ` [Qemu-devel] " David Gibson
2011-08-01  8:31 ` [Qemu-trivial] " Isaku Yamahata
2011-08-01  8:31   ` Isaku Yamahata
2011-08-01 13:32   ` [Qemu-trivial] " David Gibson
2011-08-01 13:32     ` David Gibson
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
2011-08-01 10:10   ` [Qemu-devel] " Michael S. Tsirkin
2011-08-01 13:33   ` [Qemu-trivial] " David Gibson
2011-08-01 13:33     ` [Qemu-devel] " David Gibson
2011-08-01 14:03     ` Michael S. Tsirkin
2011-08-01 14:15       ` David Gibson
2011-08-03 13:28         ` Michael S. Tsirkin
2011-08-04  9:00           ` David Gibson
2011-08-04 19:14             ` Michael S. Tsirkin
2011-08-10  8:34             ` Michael S. Tsirkin
2011-08-11  6:38               ` David Gibson
2011-10-02 10:35                 ` Michael S. Tsirkin
2011-08-03 10:13   ` [Qemu-trivial] " Stefan Hajnoczi
2011-08-03 10:13     ` [Qemu-devel] " Stefan Hajnoczi
2011-08-03 10:21     ` Michael S. Tsirkin [this message]
2011-08-03 10:21       ` Michael S. Tsirkin
2011-08-10  3:05   ` David Gibson
2011-08-10  3:05     ` [Qemu-devel] " 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=20110803102135.GB9497@redhat.com \
    --to=mst@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.