提交 e309ea66 编写于 作者: L Luyao Huang 提交者: Martin Kletzander

qemu: Auto assign pci addresses for shared memory devices

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1165029Signed-off-by: NLuyao Huang <lhuang@redhat.com>
上级 7d73ca06
...@@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, ...@@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
flags) < 0) flags) < 0)
goto error; goto error;
} }
/* Further non-primary video cards which have to be qxl type */ /* Further non-primary video cards which have to be qxl type */
for (i = 1; i < def->nvideos; i++) { for (i = 1; i < def->nvideos; i++) {
if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
...@@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, ...@@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
flags) < 0) flags) < 0)
goto error; 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++) { for (i = 0; i < def->ninputs; i++) {
/* Nada - none are PCI based (yet) */ /* Nada - none are PCI based (yet) */
} }
......
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ 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 \ /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
-device ivshmem,shm=shmem0 \ -device ivshmem,shm=shmem0,bus=pci.0,addr=0x3 \
-device ivshmem,size=128m,shm=shmem1 \ -device ivshmem,size=128m,shm=shmem1,bus=pci.0,addr=0x5 \
-device ivshmem,size=256m,shm=shmem2 \ -device ivshmem,size=256m,shm=shmem2,bus=pci.0,addr=0x4 \
-device ivshmem,size=512m,chardev=charshmem3 \ -device ivshmem,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \
-chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \ -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 \ -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 \ -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 \ -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 -chardev socket,id=charshmem7,path=/tmp/shmem7-sock
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
</shmem> </shmem>
<shmem name='shmem2'> <shmem name='shmem2'>
<size unit='M'>256</size> <size unit='M'>256</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</shmem> </shmem>
<shmem name='shmem3'> <shmem name='shmem3'>
<size unit='M'>512</size> <size unit='M'>512</size>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册