[libvirt] [PATCH 01/10] qemu: auto assign pci address for shared memory device

lhuang lhuang at redhat.com
Mon Jul 6 02:21:51 UTC 2015


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 <lhuang at redhat.com>
>> ---
>> 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 at redhat.com
>> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list