Re: [libvirt] [PATCH 01/10] qemu: auto assign pci address for shared memory device
On 07/08/2015 05:37 PM, Martin Kletzander wrote: On Fri, Jul 03, 2015 at 02:39:49PM +0200, Martin Kletzander wrote: On Wed, Jun 17, 2015 at 11:56:12AM +0800, Luyao Huang wrote: Shared memory device is base on PCI address, even we do not pass the pci address to qemu, qemu will auto assign a pci address for it. Signed-off-by: Luyao Huang --- src/qemu/qemu_command.c| 11 +++ tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 16 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 89f775d..5ac43d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + Spurious change, ACK without that. I also squashed in the following to make sure it works fine (which it does): Good idea ! Thanks a lot for your help. diff --git i/tests/qemuxml2argvdata/qemuxml2argv-shmem.args w/tests/qemuxml2argvdata/qemuxml2argv-shmem.args index 4c383db6985f..08cd5ac4588e 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-shmem.args +++ w/tests/qemuxml2argvdata/qemuxml2argv-shmem.args @@ -2,8 +2,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -device ivshmem,shm=shmem0,id=shmem0,bus=pci.0,addr=0x3 \ --device ivshmem,size=128m,shm=shmem1,id=shmem1,bus=pci.0,addr=0x4 \ --device ivshmem,size=256m,shm=shmem2,id=shmem2,bus=pci.0,addr=0x5 \ +-device ivshmem,size=128m,shm=shmem1,id=shmem1,bus=pci.0,addr=0x5 \ +-device ivshmem,size=256m,shm=shmem2,id=shmem2,bus=pci.0,addr=0x4 \ -device ivshmem,size=512m,chardev=charshmem3,id=shmem3,bus=pci.0,addr=0x6 \ -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ -device ivshmem,size=1024m,chardev=charshmem4,id=shmem4,bus=pci.0,addr=0x7 \ diff --git i/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml w/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml index fd79c89c1a43..d4b38f91b050 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml +++ w/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml @@ -23,6 +23,7 @@ 256 + function='0x0'/> 512 Luyao -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/10] qemu: auto assign pci address for shared memory device
On Fri, Jul 03, 2015 at 02:39:49PM +0200, Martin Kletzander wrote: On Wed, Jun 17, 2015 at 11:56:12AM +0800, Luyao Huang wrote: Shared memory device is base on PCI address, even we do not pass the pci address to qemu, qemu will auto assign a pci address for it. Signed-off-by: Luyao Huang --- src/qemu/qemu_command.c| 11 +++ tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 16 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 89f775d..5ac43d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + Spurious change, ACK without that. I also squashed in the following to make sure it works fine (which it does): diff --git i/tests/qemuxml2argvdata/qemuxml2argv-shmem.args w/tests/qemuxml2argvdata/qemuxml2argv-shmem.args index 4c383db6985f..08cd5ac4588e 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-shmem.args +++ w/tests/qemuxml2argvdata/qemuxml2argv-shmem.args @@ -2,8 +2,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -device ivshmem,shm=shmem0,id=shmem0,bus=pci.0,addr=0x3 \ --device ivshmem,size=128m,shm=shmem1,id=shmem1,bus=pci.0,addr=0x4 \ --device ivshmem,size=256m,shm=shmem2,id=shmem2,bus=pci.0,addr=0x5 \ +-device ivshmem,size=128m,shm=shmem1,id=shmem1,bus=pci.0,addr=0x5 \ +-device ivshmem,size=256m,shm=shmem2,id=shmem2,bus=pci.0,addr=0x4 \ -device ivshmem,size=512m,chardev=charshmem3,id=shmem3,bus=pci.0,addr=0x6 \ -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ -device ivshmem,size=1024m,chardev=charshmem4,id=shmem4,bus=pci.0,addr=0x7 \ diff --git i/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml w/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml index fd79c89c1a43..d4b38f91b050 100644 --- i/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml +++ w/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml @@ -23,6 +23,7 @@ 256 + 512 /* Further non-primary video cards which have to be qxl type */ for (i = 1; i < def->nvideos; i++) { if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { @@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + +/* Shared Memory */ +for (i = 0; i < def->nshmems; i++) { +if (def->shmems[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) +continue; + +if (virDomainPCIAddressReserveNextSlot(addrs, + &def->shmems[i]->info, flags) < 0) +goto error; +} for (i = 0; i < def->ninputs; i++) { /* Nada - none are PCI based (yet) */ } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args index a3d3cc8..d37879a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args @@ -1,16 +1,16 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ --device ivshmem,shm=shmem0 \ --device ivshmem,size=128m,shm=shmem1 \ --device ivshmem,size=256m,shm=shmem2 \ --device ivshmem,size=512m,chardev=charshmem3 \ +-device ivshmem,shm=shmem0,bus=pci.0,addr=0x3 \ +-device ivshmem,size=128m,shm=shmem1,bus=pci.0,addr=0x4 \ +-device ivshmem,size=256m,shm=shmem2,bus=pci.0,addr=0x5 \ +-device ivshmem,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \ -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ --device ivshmem,size=1024m,chardev=charshmem4 \ +-device ivshmem,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x7 \ -chardev socket,id=charshmem4,path=/tmp/shmem4-sock \ --device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off \ +-device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,addr=0x8 \ -chardev socket,id=charshmem5,path=/tmp/shmem5-sock \ --device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16 \ +-device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16,bus=pci.0,addr=0x9 \ -chardev socket,id=charshmem6,path=/tmp/shmem6-sock \ --device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on \ +-device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0xa \ -chardev socket,id=charshmem7,path=/tmp/shmem7-sock -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailm
Re: [libvirt] [PATCH 01/10] qemu: auto assign pci address for shared memory device
On 07/03/2015 08:39 PM, Martin Kletzander wrote: On Wed, Jun 17, 2015 at 11:56:12AM +0800, Luyao Huang wrote: Shared memory device is base on PCI address, even we do not pass the pci address to qemu, qemu will auto assign a pci address for it. Signed-off-by: Luyao Huang --- src/qemu/qemu_command.c| 11 +++ tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 16 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 89f775d..5ac43d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + Spurious change, ACK without that. Thanks a lot for your review, i will remove it in next version. Luyao /* Further non-primary video cards which have to be qxl type */ for (i = 1; i < def->nvideos; i++) { if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { @@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + +/* Shared Memory */ +for (i = 0; i < def->nshmems; i++) { +if (def->shmems[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) +continue; + +if (virDomainPCIAddressReserveNextSlot(addrs, + &def->shmems[i]->info, flags) < 0) +goto error; +} for (i = 0; i < def->ninputs; i++) { /* Nada - none are PCI based (yet) */ } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args index a3d3cc8..d37879a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args @@ -1,16 +1,16 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ --device ivshmem,shm=shmem0 \ --device ivshmem,size=128m,shm=shmem1 \ --device ivshmem,size=256m,shm=shmem2 \ --device ivshmem,size=512m,chardev=charshmem3 \ +-device ivshmem,shm=shmem0,bus=pci.0,addr=0x3 \ +-device ivshmem,size=128m,shm=shmem1,bus=pci.0,addr=0x4 \ +-device ivshmem,size=256m,shm=shmem2,bus=pci.0,addr=0x5 \ +-device ivshmem,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \ -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ --device ivshmem,size=1024m,chardev=charshmem4 \ +-device ivshmem,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x7 \ -chardev socket,id=charshmem4,path=/tmp/shmem4-sock \ --device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off \ +-device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,addr=0x8 \ -chardev socket,id=charshmem5,path=/tmp/shmem5-sock \ --device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16 \ +-device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16,bus=pci.0,addr=0x9 \ -chardev socket,id=charshmem6,path=/tmp/shmem6-sock \ --device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on \ +-device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0xa \ -chardev socket,id=charshmem7,path=/tmp/shmem7-sock -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 01/10] qemu: auto assign pci address for shared memory device
On Wed, Jun 17, 2015 at 11:56:12AM +0800, Luyao Huang wrote: Shared memory device is base on PCI address, even we do not pass the pci address to qemu, qemu will auto assign a pci address for it. Signed-off-by: Luyao Huang --- src/qemu/qemu_command.c| 11 +++ tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 16 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 89f775d..5ac43d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + Spurious change, ACK without that. /* Further non-primary video cards which have to be qxl type */ for (i = 1; i < def->nvideos; i++) { if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { @@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + +/* Shared Memory */ +for (i = 0; i < def->nshmems; i++) { +if (def->shmems[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) +continue; + +if (virDomainPCIAddressReserveNextSlot(addrs, + &def->shmems[i]->info, flags) < 0) +goto error; +} for (i = 0; i < def->ninputs; i++) { /* Nada - none are PCI based (yet) */ } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args index a3d3cc8..d37879a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args @@ -1,16 +1,16 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ --device ivshmem,shm=shmem0 \ --device ivshmem,size=128m,shm=shmem1 \ --device ivshmem,size=256m,shm=shmem2 \ --device ivshmem,size=512m,chardev=charshmem3 \ +-device ivshmem,shm=shmem0,bus=pci.0,addr=0x3 \ +-device ivshmem,size=128m,shm=shmem1,bus=pci.0,addr=0x4 \ +-device ivshmem,size=256m,shm=shmem2,bus=pci.0,addr=0x5 \ +-device ivshmem,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \ -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ --device ivshmem,size=1024m,chardev=charshmem4 \ +-device ivshmem,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x7 \ -chardev socket,id=charshmem4,path=/tmp/shmem4-sock \ --device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off \ +-device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,addr=0x8 \ -chardev socket,id=charshmem5,path=/tmp/shmem5-sock \ --device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16 \ +-device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16,bus=pci.0,addr=0x9 \ -chardev socket,id=charshmem6,path=/tmp/shmem6-sock \ --device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on \ +-device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0xa \ -chardev socket,id=charshmem7,path=/tmp/shmem7-sock -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 01/10] qemu: auto assign pci address for shared memory device
Shared memory device is base on PCI address, even we do not pass the pci address to qemu, qemu will auto assign a pci address for it. Signed-off-by: Luyao Huang --- src/qemu/qemu_command.c| 11 +++ tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 16 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 89f775d..5ac43d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + /* Further non-primary video cards which have to be qxl type */ for (i = 1; i < def->nvideos; i++) { if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { @@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, flags) < 0) goto error; } + +/* Shared Memory */ +for (i = 0; i < def->nshmems; i++) { +if (def->shmems[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) +continue; + +if (virDomainPCIAddressReserveNextSlot(addrs, + &def->shmems[i]->info, flags) < 0) +goto error; +} for (i = 0; i < def->ninputs; i++) { /* Nada - none are PCI based (yet) */ } diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args index a3d3cc8..d37879a 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args @@ -1,16 +1,16 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ --device ivshmem,shm=shmem0 \ --device ivshmem,size=128m,shm=shmem1 \ --device ivshmem,size=256m,shm=shmem2 \ --device ivshmem,size=512m,chardev=charshmem3 \ +-device ivshmem,shm=shmem0,bus=pci.0,addr=0x3 \ +-device ivshmem,size=128m,shm=shmem1,bus=pci.0,addr=0x4 \ +-device ivshmem,size=256m,shm=shmem2,bus=pci.0,addr=0x5 \ +-device ivshmem,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \ -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ --device ivshmem,size=1024m,chardev=charshmem4 \ +-device ivshmem,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x7 \ -chardev socket,id=charshmem4,path=/tmp/shmem4-sock \ --device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off \ +-device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,addr=0x8 \ -chardev socket,id=charshmem5,path=/tmp/shmem5-sock \ --device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16 \ +-device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16,bus=pci.0,addr=0x9 \ -chardev socket,id=charshmem6,path=/tmp/shmem6-sock \ --device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on \ +-device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0xa \ -chardev socket,id=charshmem7,path=/tmp/shmem7-sock -- 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list