mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: vfio-ccw device address generation
Introduces the vfio-ccw model for mediated devices and prime vfio-ccw devices such that CCW address will be generated. Alters the qemuxml2xmltest for testing a basic mdev device using vfio-ccw. Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.vnet.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Stefan Zimmermann <stzi@linux.ibm.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
2b9690b62d
commit
7224144400
@ -4457,7 +4457,10 @@
|
|||||||
<value>mdev</value>
|
<value>mdev</value>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="model">
|
<attribute name="model">
|
||||||
<value>vfio-pci</value>
|
<choice>
|
||||||
|
<value>vfio-pci</value>
|
||||||
|
<value>vfio-ccw</value>
|
||||||
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
<element name="source">
|
<element name="source">
|
||||||
<ref name="mdevaddress"/>
|
<ref name="mdevaddress"/>
|
||||||
|
@ -4470,6 +4470,18 @@ virDomainHostdevDefPostParse(virDomainHostdevDefPtr dev,
|
|||||||
virMediatedDeviceModelTypeToString(model));
|
virMediatedDeviceModelTypeToString(model));
|
||||||
return -1;
|
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:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
||||||
|
@ -281,6 +281,23 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
|
qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
|
||||||
virDomainDeviceAddressType type)
|
virDomainDeviceAddressType type)
|
||||||
@ -397,6 +414,9 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
|||||||
|
|
||||||
if (qemuDomainIsS390CCW(def) &&
|
if (qemuDomainIsS390CCW(def) &&
|
||||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) {
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) {
|
||||||
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW))
|
||||||
|
qemuDomainPrimeVfioDeviceAddresses(
|
||||||
|
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
||||||
qemuDomainPrimeVirtioDeviceAddresses(
|
qemuDomainPrimeVirtioDeviceAddresses(
|
||||||
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ struct _virMediatedDeviceList {
|
|||||||
};
|
};
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virMediatedDeviceModel, VIR_MDEV_MODEL_TYPE_LAST,
|
VIR_ENUM_IMPL(virMediatedDeviceModel, VIR_MDEV_MODEL_TYPE_LAST,
|
||||||
"vfio-pci")
|
"vfio-pci",
|
||||||
|
"vfio-ccw")
|
||||||
|
|
||||||
static virClassPtr virMediatedDeviceListClass;
|
static virClassPtr virMediatedDeviceListClass;
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_MDEV_MODEL_TYPE_VFIO_PCI = 0,
|
VIR_MDEV_MODEL_TYPE_VFIO_PCI = 0,
|
||||||
|
VIR_MDEV_MODEL_TYPE_VFIO_CCW = 1,
|
||||||
|
|
||||||
VIR_MDEV_MODEL_TYPE_LAST
|
VIR_MDEV_MODEL_TYPE_LAST
|
||||||
} virMediatedDeviceModelType;
|
} virMediatedDeviceModelType;
|
||||||
|
22
tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw.xml
Normal file
22
tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<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>
|
28
tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml
Normal file
28
tests/qemuxml2xmloutdata/hostdev-subsys-mdev-vfio-ccw.xml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<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>
|
@ -962,6 +962,11 @@ mymain(void)
|
|||||||
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI,
|
||||||
QEMU_CAPS_DEVICE_SCSI_GENERIC);
|
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",
|
DO_TEST("s390-defaultconsole",
|
||||||
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
|
QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390);
|
||||||
DO_TEST("s390-panic",
|
DO_TEST("s390-panic",
|
||||||
|
Loading…
Reference in New Issue
Block a user