We're keeping some things at default and that's not something we want to
do intentionaly.  Let's save some sensible defaults upfront then having
problems later.  The details for the defaults (of the newer
implementation) can be found in qemu's commit 5400c02b90bb:

  http://git.qemu.org/?p=qemu.git;a=commit;h=5400c02b90bb

Signed-off-by: Martin Kletzander <mklet...@redhat.com>
---
 docs/formatdomain.html.in                         |  1 -
 src/qemu/qemu_domain.c                            | 12 ++++++++++++
 tests/qemuxml2argvdata/qemuxml2argv-shmem.args    | 18 ++++++++++--------
 tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml | 10 ++++------
 4 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f48a4d8b813f..b9163584d9f5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6751,7 +6751,6 @@ qemu-kvm -net nic,model=? /dev/null
       &lt;size unit='M'&gt;4&lt;/size&gt;
     &lt;/shmem&gt;
     &lt;shmem name='shmem_server'&gt;
-      &lt;size unit='M'&gt;2&lt;/size&gt;
       &lt;server path='/tmp/socket-shmem'/&gt;
       &lt;msi vectors='32' ioeventfd='on'/&gt;
     &lt;/shmem&gt;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 177525b0ab81..f533086b8eef 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2747,6 +2747,18 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
         }
     }

+    if (dev->type == VIR_DOMAIN_DEVICE_SHMEM) {
+        if (!dev->data.shmem->server.enabled) {
+            if (!dev->data.shmem->size)
+                dev->data.shmem->size = 4 << 20;
+        } else {
+            dev->data.shmem->size = 0;
+            dev->data.shmem->msi.enabled = true;
+            if (!dev->data.shmem->msi.ioeventfd)
+                dev->data.shmem->msi.ioeventfd = VIR_TRISTATE_SWITCH_ON;
+        }
+    }
+
     ret = 0;

  cleanup:
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args 
b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args
index 99fac119b04c..9dab81219051 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-shmem.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-shmem.args
@@ -17,19 +17,21 @@ QEMU_AUDIO_DRV=none \
 -no-acpi \
 -boot c \
 -usb \
--device ivshmem,id=shmem0,shm=shmem0,bus=pci.0,addr=0x3 \
+-device ivshmem,id=shmem0,size=4m,shm=shmem0,bus=pci.0,addr=0x3 \
 -device ivshmem,id=shmem1,size=128m,shm=shmem1,bus=pci.0,addr=0x5 \
 -device ivshmem,id=shmem2,size=256m,shm=shmem2,bus=pci.0,addr=0x4 \
--device ivshmem,id=shmem3,size=512m,chardev=charshmem3,bus=pci.0,addr=0x6 \
+-device ivshmem,id=shmem3,chardev=charshmem3,msi=on,ioeventfd=on,bus=pci.0,\
+addr=0x6 \
 -chardev socket,id=charshmem3,path=/var/lib/libvirt/shmem-shmem3-sock \
--device ivshmem,id=shmem4,size=1024m,chardev=charshmem4,bus=pci.0,addr=0x7 \
+-device ivshmem,id=shmem4,chardev=charshmem4,msi=on,ioeventfd=on,bus=pci.0,\
+addr=0x7 \
 -chardev socket,id=charshmem4,path=/tmp/shmem4-sock \
--device ivshmem,id=shmem5,size=2048m,chardev=charshmem5,msi=on,ioeventfd=off,\
-bus=pci.0,addr=0x8 \
+-device ivshmem,id=shmem5,chardev=charshmem5,msi=on,ioeventfd=off,bus=pci.0,\
+addr=0x8 \
 -chardev socket,id=charshmem5,path=/tmp/shmem5-sock \
--device ivshmem,id=shmem6,size=4096m,chardev=charshmem6,msi=on,vectors=16,\
+-device ivshmem,id=shmem6,chardev=charshmem6,msi=on,vectors=16,ioeventfd=on,\
 bus=pci.0,addr=0x9 \
 -chardev socket,id=charshmem6,path=/tmp/shmem6-sock \
--device ivshmem,id=shmem7,size=8192m,chardev=charshmem7,msi=on,vectors=32,\
-ioeventfd=on,bus=pci.0,addr=0xa \
+-device ivshmem,id=shmem7,chardev=charshmem7,msi=on,vectors=32,ioeventfd=on,\
+bus=pci.0,addr=0xa \
 -chardev socket,id=charshmem7,path=/tmp/shmem7-sock
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml 
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
index 1197f361e3c4..38f14fc4fa9b 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-shmem.xml
@@ -22,6 +22,7 @@
     <input type='keyboard' bus='ps2'/>
     <memballoon model='none'/>
     <shmem name='shmem0'>
+      <size unit='M'>4</size>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' 
function='0x0'/>
     </shmem>
     <shmem name='shmem1'>
@@ -33,29 +34,26 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x04' 
function='0x0'/>
     </shmem>
     <shmem name='shmem3'>
-      <size unit='M'>512</size>
       <server/>
+      <msi ioeventfd='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x06' 
function='0x0'/>
     </shmem>
     <shmem name='shmem4'>
-      <size unit='M'>1024</size>
       <server path='/tmp/shmem4-sock'/>
+      <msi ioeventfd='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 
function='0x0'/>
     </shmem>
     <shmem name='shmem5'>
-      <size unit='M'>2048</size>
       <server path='/tmp/shmem5-sock'/>
       <msi ioeventfd='off'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x08' 
function='0x0'/>
     </shmem>
     <shmem name='shmem6'>
-      <size unit='M'>4096</size>
       <server path='/tmp/shmem6-sock'/>
-      <msi vectors='16'/>
+      <msi vectors='16' ioeventfd='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x09' 
function='0x0'/>
     </shmem>
     <shmem name='shmem7'>
-      <size unit='M'>8192</size>
       <server path='/tmp/shmem7-sock'/>
       <msi vectors='32' ioeventfd='on'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' 
function='0x0'/>
-- 
2.10.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to