* [Qemu-devel] [PATCH V2] hw/pxb: add chassis_nr property
@ 2015-10-12 10:09 Marcel Apfelbaum
2015-10-12 12:39 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Marcel Apfelbaum @ 2015-10-12 10:09 UTC (permalink / raw)
To: qemu-devel; +Cc: mst
Add a chassis_nr property instead of using PXB bus number
as internal bridge's chassis nr.
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
v1->v2:
- Rebased on master
docs/pci_expander_bridge.txt | 7 +++----
hw/pci-bridge/pci_expander_bridge.c | 5 ++++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/docs/pci_expander_bridge.txt b/docs/pci_expander_bridge.txt
index d7913fb..fed2bbe 100644
--- a/docs/pci_expander_bridge.txt
+++ b/docs/pci_expander_bridge.txt
@@ -23,9 +23,9 @@ A detailed command line would be:
-m 2G
-object memory-backend-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
-object memory-backend-ram,size=1024M,policy=bind,host-nodes=1,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1
--device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd
--device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0 -device e1000,bus=bridge2,addr=0x3
--device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
+-device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4,chassis_nr=1 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd
+-device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0,chassis_nr=2 -device e1000,bus=bridge2,addr=0x3
+-device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0,chassis_nr=3 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
Here you have:
- 2 NUMA nodes for the guest, 0 and 1. (both mapped to the same NUMA node in host, but you can and should put it in different host NUMA nodes)
@@ -55,4 +55,3 @@ The PXB is composed by:
- Using the bridge will enable hotplug support
- All the devices behind the bridge will use bridge's IO/MEM windows compacting
the PCI address space.
-
diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
index 57f8a37..8645650 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -39,6 +39,7 @@ typedef struct PXBDev {
PCIDevice parent_obj;
/*< public >*/
+ uint8_t chassis_nr;
uint8_t bus_nr;
uint16_t numa_node;
} PXBDev;
@@ -220,7 +221,7 @@ static int pxb_dev_initfn(PCIDevice *dev)
bds = qdev_create(BUS(bus), "pci-bridge");
bds->id = dev_name;
- qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
+ qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->chassis_nr);
qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
PCI_HOST_BRIDGE(ds)->bus = bus;
@@ -248,6 +249,8 @@ static void pxb_dev_exitfn(PCIDevice *pci_dev)
}
static Property pxb_dev_properties[] = {
+ /* Note: 0 is not a legal chassis number. */
+ DEFINE_PROP_UINT8("chassis_nr", PXBDev, chassis_nr, 0),
/* Note: 0 is not a legal a PXB bus number. */
DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0),
DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED),
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH V2] hw/pxb: add chassis_nr property
2015-10-12 10:09 [Qemu-devel] [PATCH V2] hw/pxb: add chassis_nr property Marcel Apfelbaum
@ 2015-10-12 12:39 ` Michael S. Tsirkin
2015-10-12 12:43 ` Marcel Apfelbaum
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-10-12 12:39 UTC (permalink / raw)
To: Marcel Apfelbaum; +Cc: qemu-devel
On Mon, Oct 12, 2015 at 01:09:37PM +0300, Marcel Apfelbaum wrote:
> Add a chassis_nr property instead of using PXB bus number
> as internal bridge's chassis nr.
>
> Suggested-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
OK, but we need to be compatible with old systems.
So you need to use bus nr if chassis nr is 0.
> ---
> v1->v2:
> - Rebased on master
>
> docs/pci_expander_bridge.txt | 7 +++----
> hw/pci-bridge/pci_expander_bridge.c | 5 ++++-
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/docs/pci_expander_bridge.txt b/docs/pci_expander_bridge.txt
> index d7913fb..fed2bbe 100644
> --- a/docs/pci_expander_bridge.txt
> +++ b/docs/pci_expander_bridge.txt
> @@ -23,9 +23,9 @@ A detailed command line would be:
> -m 2G
> -object memory-backend-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
> -object memory-backend-ram,size=1024M,policy=bind,host-nodes=1,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1
> --device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd
> --device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0 -device e1000,bus=bridge2,addr=0x3
> --device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
> +-device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4,chassis_nr=1 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd
> +-device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0,chassis_nr=2 -device e1000,bus=bridge2,addr=0x3
> +-device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0,chassis_nr=3 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
>
> Here you have:
> - 2 NUMA nodes for the guest, 0 and 1. (both mapped to the same NUMA node in host, but you can and should put it in different host NUMA nodes)
> @@ -55,4 +55,3 @@ The PXB is composed by:
> - Using the bridge will enable hotplug support
> - All the devices behind the bridge will use bridge's IO/MEM windows compacting
> the PCI address space.
> -
> diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
> index 57f8a37..8645650 100644
> --- a/hw/pci-bridge/pci_expander_bridge.c
> +++ b/hw/pci-bridge/pci_expander_bridge.c
> @@ -39,6 +39,7 @@ typedef struct PXBDev {
> PCIDevice parent_obj;
> /*< public >*/
>
> + uint8_t chassis_nr;
> uint8_t bus_nr;
> uint16_t numa_node;
> } PXBDev;
> @@ -220,7 +221,7 @@ static int pxb_dev_initfn(PCIDevice *dev)
>
> bds = qdev_create(BUS(bus), "pci-bridge");
> bds->id = dev_name;
> - qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
> + qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->chassis_nr);
> qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
>
> PCI_HOST_BRIDGE(ds)->bus = bus;
> @@ -248,6 +249,8 @@ static void pxb_dev_exitfn(PCIDevice *pci_dev)
> }
>
> static Property pxb_dev_properties[] = {
> + /* Note: 0 is not a legal chassis number. */
> + DEFINE_PROP_UINT8("chassis_nr", PXBDev, chassis_nr, 0),
> /* Note: 0 is not a legal a PXB bus number. */
> DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0),
> DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED),
> --
> 2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH V2] hw/pxb: add chassis_nr property
2015-10-12 12:39 ` Michael S. Tsirkin
@ 2015-10-12 12:43 ` Marcel Apfelbaum
0 siblings, 0 replies; 3+ messages in thread
From: Marcel Apfelbaum @ 2015-10-12 12:43 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: qemu-devel
On 10/12/2015 03:39 PM, Michael S. Tsirkin wrote:
> On Mon, Oct 12, 2015 at 01:09:37PM +0300, Marcel Apfelbaum wrote:
>> Add a chassis_nr property instead of using PXB bus number
>> as internal bridge's chassis nr.
>>
>> Suggested-by: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>
> OK, but we need to be compatible with old systems.
> So you need to use bus nr if chassis nr is 0.
Sure, I'll add this.
Thanks,
Marcel
>
>> ---
>> v1->v2:
>> - Rebased on master
>>
>> docs/pci_expander_bridge.txt | 7 +++----
>> hw/pci-bridge/pci_expander_bridge.c | 5 ++++-
>> 2 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/docs/pci_expander_bridge.txt b/docs/pci_expander_bridge.txt
>> index d7913fb..fed2bbe 100644
>> --- a/docs/pci_expander_bridge.txt
>> +++ b/docs/pci_expander_bridge.txt
>> @@ -23,9 +23,9 @@ A detailed command line would be:
>> -m 2G
>> -object memory-backend-ram,size=1024M,policy=bind,host-nodes=0,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
>> -object memory-backend-ram,size=1024M,policy=bind,host-nodes=1,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1
>> --device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd
>> --device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0 -device e1000,bus=bridge2,addr=0x3
>> --device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
>> +-device pxb,id=bridge1,bus=pci.0,numa_node=1,bus_nr=4,chassis_nr=1 -netdev user,id=nd-device e1000,bus=bridge1,addr=0x4,netdev=nd
>> +-device pxb,id=bridge2,bus=pci.0,numa_node=0,bus_nr=8,bus=pci.0,chassis_nr=2 -device e1000,bus=bridge2,addr=0x3
>> +-device pxb,id=bridge3,bus=pci.0,bus_nr=40,bus=pci.0,chassis_nr=3 -drive if=none,id=drive0,file=[img] -device virtio-blk-pci,drive=drive0,scsi=off,bus=bridge3,addr=1
>>
>> Here you have:
>> - 2 NUMA nodes for the guest, 0 and 1. (both mapped to the same NUMA node in host, but you can and should put it in different host NUMA nodes)
>> @@ -55,4 +55,3 @@ The PXB is composed by:
>> - Using the bridge will enable hotplug support
>> - All the devices behind the bridge will use bridge's IO/MEM windows compacting
>> the PCI address space.
>> -
>> diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c
>> index 57f8a37..8645650 100644
>> --- a/hw/pci-bridge/pci_expander_bridge.c
>> +++ b/hw/pci-bridge/pci_expander_bridge.c
>> @@ -39,6 +39,7 @@ typedef struct PXBDev {
>> PCIDevice parent_obj;
>> /*< public >*/
>>
>> + uint8_t chassis_nr;
>> uint8_t bus_nr;
>> uint16_t numa_node;
>> } PXBDev;
>> @@ -220,7 +221,7 @@ static int pxb_dev_initfn(PCIDevice *dev)
>>
>> bds = qdev_create(BUS(bus), "pci-bridge");
>> bds->id = dev_name;
>> - qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
>> + qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->chassis_nr);
>> qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
>>
>> PCI_HOST_BRIDGE(ds)->bus = bus;
>> @@ -248,6 +249,8 @@ static void pxb_dev_exitfn(PCIDevice *pci_dev)
>> }
>>
>> static Property pxb_dev_properties[] = {
>> + /* Note: 0 is not a legal chassis number. */
>> + DEFINE_PROP_UINT8("chassis_nr", PXBDev, chassis_nr, 0),
>> /* Note: 0 is not a legal a PXB bus number. */
>> DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0),
>> DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED),
>> --
>> 2.1.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-12 12:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12 10:09 [Qemu-devel] [PATCH V2] hw/pxb: add chassis_nr property Marcel Apfelbaum
2015-10-12 12:39 ` Michael S. Tsirkin
2015-10-12 12:43 ` Marcel Apfelbaum
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).