|
|
7a3408 |
From 1298c305b6e4dcb364e8944a60bf2f698eb601ca Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <1298c305b6e4dcb364e8944a60bf2f698eb601ca@dist-git>
|
|
|
7a3408 |
From: Luyao Huang <lhuang@redhat.com>
|
|
|
7a3408 |
Date: Thu, 6 Aug 2015 13:09:12 +0200
|
|
|
7a3408 |
Subject: [PATCH] qemu: Auto assign pci addresses for shared memory devices
|
|
|
7a3408 |
|
|
|
7a3408 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1165029
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Luyao Huang <lhuang@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit e309ea66580798860154c70f275c56236702c7dc)
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/qemu/qemu_command.c | 11 +++++++++++
|
|
|
7a3408 |
tests/qemuxml2argvdata/qemuxml2argv-shmem.args | 19 +++++++++++--------
|
|
|
7a3408 |
tests/qemuxml2argvdata/qemuxml2argv-shmem.xml | 1 +
|
|
|
7a3408 |
3 files changed, 23 insertions(+), 8 deletions(-)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
7a3408 |
index feba308..1e5e244 100644
|
|
|
7a3408 |
--- a/src/qemu/qemu_command.c
|
|
|
7a3408 |
+++ b/src/qemu/qemu_command.c
|
|
|
7a3408 |
@@ -2562,6 +2562,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
|
|
7a3408 |
flags) < 0)
|
|
|
7a3408 |
goto error;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
+
|
|
|
7a3408 |
/* Further non-primary video cards which have to be qxl type */
|
|
|
7a3408 |
for (i = 1; i < def->nvideos; i++) {
|
|
|
7a3408 |
if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
|
|
|
7a3408 |
@@ -2575,6 +2576,16 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
|
|
|
7a3408 |
flags) < 0)
|
|
|
7a3408 |
goto error;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ /* Shared Memory */
|
|
|
7a3408 |
+ for (i = 0; i < def->nshmems; i++) {
|
|
|
7a3408 |
+ if (def->shmems[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
|
|
7a3408 |
+ continue;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (virDomainPCIAddressReserveNextSlot(addrs,
|
|
|
7a3408 |
+ &def->shmems[i]->info, flags) < 0)
|
|
|
7a3408 |
+ goto error;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
for (i = 0; i < def->ninputs; i++) {
|
|
|
7a3408 |
/* Nada - none are PCI based (yet) */
|
|
|
7a3408 |
}
|
|
|
7a3408 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args
|
|
|
7a3408 |
index a3d3cc8..7e10fc4 100644
|
|
|
7a3408 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args
|
|
|
7a3408 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args
|
|
|
7a3408 |
@@ -1,16 +1,19 @@
|
|
|
7a3408 |
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
|
|
7a3408 |
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefaults \
|
|
|
7a3408 |
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
|
|
|
7a3408 |
--device ivshmem,shm=shmem0 \
|
|
|
7a3408 |
--device ivshmem,size=128m,shm=shmem1 \
|
|
|
7a3408 |
--device ivshmem,size=256m,shm=shmem2 \
|
|
|
7a3408 |
--device ivshmem,size=512m,chardev=charshmem3 \
|
|
|
7a3408 |
+-device ivshmem,shm=shmem0,bus=pci.0,addr=0x3 \
|
|
|
7a3408 |
+-device ivshmem,size=128m,shm=shmem1,bus=pci.0,addr=0x5 \
|
|
|
7a3408 |
+-device ivshmem,size=256m,shm=shmem2,bus=pci.0,addr=0x4 \
|
|
|
7a3408 |
+-device ivshmem,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \
|
|
|
7a3408 |
-chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \
|
|
|
7a3408 |
--device ivshmem,size=1024m,chardev=charshmem4 \
|
|
|
7a3408 |
+-device ivshmem,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x7 \
|
|
|
7a3408 |
-chardev socket,id=charshmem4,path=/tmp/shmem4-sock \
|
|
|
7a3408 |
--device ivshmem,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off \
|
|
|
7a3408 |
+-device ivshmem,size=2048m,chardev=charshmem5,\
|
|
|
7a3408 |
+msi=on,ioeventfd=off,bus=pci.0,addr=0x8 \
|
|
|
7a3408 |
-chardev socket,id=charshmem5,path=/tmp/shmem5-sock \
|
|
|
7a3408 |
--device ivshmem,size=4096m,chardev=charshmem6,msi=on,vectors=16 \
|
|
|
7a3408 |
+-device ivshmem,size=4096m,chardev=charshmem6,\
|
|
|
7a3408 |
+msi=on,vectors=16,bus=pci.0,addr=0x9 \
|
|
|
7a3408 |
-chardev socket,id=charshmem6,path=/tmp/shmem6-sock \
|
|
|
7a3408 |
--device ivshmem,size=8192m,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on \
|
|
|
7a3408 |
+-device ivshmem,size=8192m,chardev=charshmem7,\
|
|
|
7a3408 |
+msi=on,vectors=32,ioeventfd=on,bus=pci.0,addr=0xa \
|
|
|
7a3408 |
-chardev socket,id=charshmem7,path=/tmp/shmem7-sock
|
|
|
7a3408 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml b/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml
|
|
|
7a3408 |
index fd79c89..d4b38f9 100644
|
|
|
7a3408 |
--- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml
|
|
|
7a3408 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.xml
|
|
|
7a3408 |
@@ -23,6 +23,7 @@
|
|
|
7a3408 |
</shmem>
|
|
|
7a3408 |
<shmem name='shmem2'>
|
|
|
7a3408 |
<size unit='M'>256</size>
|
|
|
7a3408 |
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
|
|
7a3408 |
</shmem>
|
|
|
7a3408 |
<shmem name='shmem3'>
|
|
|
7a3408 |
<size unit='M'>512</size>
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|