* [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
@ 2011-08-01 6:51 David Gibson
2011-08-01 8:31 ` [Qemu-trivial] [Qemu-devel] " Isaku Yamahata
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
0 siblings, 2 replies; 8+ messages in thread
From: David Gibson @ 2011-08-01 6:51 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial
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>
---
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);
vmstate_register(NULL, -1, &vmstate_pcibus, bus);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH] Correctly assign PCI domain numbers
2011-08-01 6:51 [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers David Gibson
@ 2011-08-01 8:31 ` Isaku Yamahata
2011-08-01 13:32 ` David Gibson
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
1 sibling, 1 reply; 8+ messages in thread
From: Isaku Yamahata @ 2011-08-01 8:31 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-trivial, qemu-devel, mst
[Added mst to Cc.]
In order to use multi PCI domain, several areas need to be addressed
in addition to this patch. For example, bios, acpi dsdt.
Do you have any plan for addressing those area?
What's your motivation for multi pci domain?
NOTE: I'm not opposing to this patch. Just curious for your motivation/plan.
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>
> ---
> 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);
>
> vmstate_register(NULL, -1, &vmstate_pcibus, bus);
> }
> --
> 1.7.5.4
>
>
--
yamahata
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
2011-08-01 6:51 [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers David Gibson
2011-08-01 8:31 ` [Qemu-trivial] [Qemu-devel] " Isaku Yamahata
@ 2011-08-01 10:10 ` Michael S. Tsirkin
2011-08-01 13:33 ` David Gibson
` (2 more replies)
1 sibling, 3 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-08-01 10:10 UTC (permalink / raw)
To: David Gibson; +Cc: qemu-trivial, qemu-devel
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?
>
> vmstate_register(NULL, -1, &vmstate_pcibus, bus);
> }
> --
> 1.7.5.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH] Correctly assign PCI domain numbers
2011-08-01 8:31 ` [Qemu-trivial] [Qemu-devel] " Isaku Yamahata
@ 2011-08-01 13:32 ` David Gibson
0 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2011-08-01 13:32 UTC (permalink / raw)
To: Isaku Yamahata; +Cc: qemu-trivial, qemu-devel, mst
On Mon, Aug 01, 2011 at 05:31:06PM +0900, Isaku Yamahata wrote:
> [Added mst to Cc.]
>
> In order to use multi PCI domain, several areas need to be addressed
> in addition to this patch. For example, bios, acpi dsdt.
For x86, yes. For powerpc, which is what I'm working on, no.
> Do you have any plan for addressing those area?
No. AFAICT this won't make anything less working than it is now, and
is sufficient to be useful for the pseries machine.
> What's your motivation for multi pci domain?
Multiple PCI host bridges is typical on IBM pSeries (powerpc)
machines.
--
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
@ 2011-08-01 13:33 ` David Gibson
2011-08-03 10:13 ` Stefan Hajnoczi
2011-08-10 3:05 ` David Gibson
2 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2011-08-01 13:33 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-trivial, qemu-devel
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?
For the pseries machine, which is what I'm concerned with, each host
bridge is advertised through the device tree passed to the guest.
That gives the necessary handles and addresses for accesing config
space and memory and IO windows for each host bridge.
--
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
2011-08-01 13:33 ` David Gibson
@ 2011-08-03 10:13 ` Stefan Hajnoczi
2011-08-03 10:21 ` Michael S. Tsirkin
2011-08-10 3:05 ` David Gibson
2 siblings, 1 reply; 8+ messages in thread
From: Stefan Hajnoczi @ 2011-08-03 10:13 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-trivial, qemu-devel, David Gibson
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
2011-08-03 10:13 ` Stefan Hajnoczi
@ 2011-08-03 10:21 ` Michael S. Tsirkin
0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 10:21 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: qemu-trivial, qemu-devel, David Gibson
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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
2011-08-01 13:33 ` David Gibson
2011-08-03 10:13 ` Stefan Hajnoczi
@ 2011-08-10 3:05 ` David Gibson
2 siblings, 0 replies; 8+ messages in thread
From: David Gibson @ 2011-08-10 3:05 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-trivial, qemu-devel
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?
Well, I guess we get an overlap, and therefore multiple domains with
the same number.
So, exactly what happens now, only four billion times less often.
--
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-08-10 3:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-01 6:51 [Qemu-trivial] [PATCH] Correctly assign PCI domain numbers David Gibson
2011-08-01 8:31 ` [Qemu-trivial] [Qemu-devel] " Isaku Yamahata
2011-08-01 13:32 ` David Gibson
2011-08-01 10:10 ` [Qemu-trivial] " Michael S. Tsirkin
2011-08-01 13:33 ` David Gibson
2011-08-03 10:13 ` Stefan Hajnoczi
2011-08-03 10:21 ` Michael S. Tsirkin
2011-08-10 3:05 ` David Gibson
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).