<value>mdev</value>
</attribute>
<attribute name="model">
- <value>vfio-pci</value>
+ <choice>
+ <value>vfio-pci</value>
+ <value>vfio-ccw</value>
+ </choice>
</attribute>
<element name="source">
<ref name="mdevaddress"/>
virMediatedDeviceModelTypeToString(model));
return -1;
}
+
+ if ((model == VIR_MDEV_MODEL_TYPE_VFIO_PCI &&
+ dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) ||
+ (model == VIR_MDEV_MODEL_TYPE_VFIO_CCW &&
+ dev->info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Unsupported address type '%s' with mediated "
+ "device model '%s'"),
+ virDomainDeviceAddressTypeToString(dev->info->type),
+ virMediatedDeviceModelTypeToString(model));
+ return -1;
+ }
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
}
+static void
+qemuDomainPrimeVfioDeviceAddresses(virDomainDefPtr def,
+ virDomainDeviceAddressType type)
+{
+ size_t i;
+
+ for (i = 0; i < def->nhostdevs; i++) {
+ virDomainHostdevSubsysPtr subsys = &def->hostdevs[i]->source.subsys;
+
+ if (virHostdevIsMdevDevice(def->hostdevs[i]) &&
+ subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_CCW &&
+ def->hostdevs[i]->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
+ def->hostdevs[i]->info->type = type;
+ }
+}
+
+
static void
qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
virDomainDeviceAddressType type)
if (qemuDomainIsS390CCW(def) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW))
+ qemuDomainPrimeVfioDeviceAddresses(
+ def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
qemuDomainPrimeVirtioDeviceAddresses(
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
};
VIR_ENUM_IMPL(virMediatedDeviceModel, VIR_MDEV_MODEL_TYPE_LAST,
- "vfio-pci")
+ "vfio-pci",
+ "vfio-ccw")
static virClassPtr virMediatedDeviceListClass;
typedef enum {
VIR_MDEV_MODEL_TYPE_VFIO_PCI = 0,
+ VIR_MDEV_MODEL_TYPE_VFIO_CCW = 1,
VIR_MDEV_MODEL_TYPE_LAST
} virMediatedDeviceModelType;
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <hostdev mode='subsystem' type='mdev' model='vfio-ccw'>
+ <source>
+ <address uuid='90c6c135-ad44-41d0-b1b7-bae47de48627'/>
+ </source>
+ </hostdev>
+ </devices>
+</domain>
--- /dev/null
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>2</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <hostdev mode='subsystem' type='mdev' managed='no' model='vfio-ccw'>
+ <source>
+ <address uuid='90c6c135-ad44-41d0-b1b7-bae47de48627'/>
+ </source>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </hostdev>
+ <memballoon model='virtio'>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </memballoon>
+ <panic model='s390'/>
+ </devices>
+</domain>
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
QEMU_CAPS_DEVICE_SCSI_GENERIC);
+ DO_TEST("hostdev-subsys-mdev-vfio-ccw",
+ QEMU_CAPS_CCW,
+ QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
+ QEMU_CAPS_DEVICE_VFIO_CCW);
+
DO_TEST("s390-defaultconsole",
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
DO_TEST("s390-panic",