}
+static int
+qemuDomainShmemDefPostParse(virDomainShmemDefPtr shm)
+{
+ /* This was the default since the introduction of this device. */
+ if (shm->model != VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL && !shm->size)
+ shm->size = 4 << 20;
+
+ /* Nothing more to check/change for IVSHMEM */
+ if (shm->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM)
+ return 0;
+
+ if (!shm->server.enabled) {
+ if (shm->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("shmem model '%s' is supported "
+ "only with server option enabled"),
+ virDomainShmemModelTypeToString(shm->model));
+ return -1;
+ }
+
+ if (shm->msi.enabled) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("shmem model '%s' doesn't support "
+ "msi"),
+ virDomainShmemModelTypeToString(shm->model));
+ }
+ } else {
+ if (shm->model == VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("shmem model '%s' is supported "
+ "only with server option disabled"),
+ virDomainShmemModelTypeToString(shm->model));
+ return -1;
+ }
+
+ if (shm->size) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("shmem model '%s' does not support size setting"),
+ virDomainShmemModelTypeToString(shm->model));
+ return -1;
+ }
+ shm->msi.enabled = true;
+ if (!shm->msi.ioeventfd)
+ shm->msi.ioeventfd = VIR_TRISTATE_SWITCH_ON;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
const virDomainDef *def,
}
}
+ if (dev->type == VIR_DOMAIN_DEVICE_SHMEM &&
+ qemuDomainShmemDefPostParse(dev->data.shmem) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
-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 \
<memballoon model='none'/>
<shmem name='shmem0'>
<model type='ivshmem-plain'/>
+ <size unit='M'>4</size>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</shmem>
<shmem name='shmem1'>
<shmem name='shmem3'>
<model type='ivshmem-doorbell'/>
<server/>
+ <msi ioeventfd='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</shmem>
<shmem name='shmem4'>
<model type='ivshmem-doorbell'/>
<server path='/tmp/shmem4-sock'/>
+ <msi ioeventfd='on'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</shmem>
<shmem name='shmem5'>
<shmem name='shmem6'>
<model type='ivshmem-doorbell'/>
<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'>