mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: vfio-ap device support
Adjusting domain format documentation, adding device address support and adding command line generation for vfio-ap. Since only one mediated hostdev with model vfio-ap is supported a check disallows to define domains with more than one such hostdev device. Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com> Reviewed-by: Chris Venteicher <cventeic@redhat.com>
This commit is contained in:
parent
dc788d2540
commit
1170864198
@ -4616,8 +4616,9 @@
|
|||||||
<dd>For mediated devices (<span class="since">Since 3.2.0</span>)
|
<dd>For mediated devices (<span class="since">Since 3.2.0</span>)
|
||||||
the <code>model</code> attribute specifies the device API which
|
the <code>model</code> attribute specifies the device API which
|
||||||
determines how the host's vfio driver will expose the device to the
|
determines how the host's vfio driver will expose the device to the
|
||||||
guest. Currently, <code>model='vfio-pci'</code> and
|
guest. Currently, <code>model='vfio-pci'</code>,
|
||||||
<code>model='vfio-ccw'</code> (<span class="since">Since 4.4.0</span>)
|
<code>model='vfio-ccw'</code> (<span class="since">Since 4.4.0</span>)
|
||||||
|
and <code>model='vfio-ap'</code> (<span class="since">Since 4.9.0</span>)
|
||||||
is supported. <a href="drvnodedev.html#MDEV">MDEV</a> section
|
is supported. <a href="drvnodedev.html#MDEV">MDEV</a> section
|
||||||
provides more information about mediated devices as well as how to
|
provides more information about mediated devices as well as how to
|
||||||
create mediated devices on the host.
|
create mediated devices on the host.
|
||||||
|
@ -4618,6 +4618,7 @@
|
|||||||
<choice>
|
<choice>
|
||||||
<value>vfio-pci</value>
|
<value>vfio-pci</value>
|
||||||
<value>vfio-ccw</value>
|
<value>vfio-ccw</value>
|
||||||
|
<value>vfio-ap</value>
|
||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
<optional>
|
<optional>
|
||||||
|
@ -4275,6 +4275,31 @@ virDomainDefPostParseGraphics(virDomainDef *def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainDefPostParseHostdev(virDomainDefPtr def)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
bool vfioap_found = false;
|
||||||
|
|
||||||
|
/* verify settings of hostdevs vfio-ap */
|
||||||
|
for (i = 0; i < def->nhostdevs; i++) {
|
||||||
|
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
||||||
|
|
||||||
|
if (virHostdevIsMdevDevice(hostdev) &&
|
||||||
|
hostdev->source.subsys.u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_AP) {
|
||||||
|
if (vfioap_found) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Only one hostdev of model vfio-ap is "
|
||||||
|
"supported"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
vfioap_found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virDomainDriveAddressIsUsedByDisk:
|
* virDomainDriveAddressIsUsedByDisk:
|
||||||
* @def: domain definition containing the disks to check
|
* @def: domain definition containing the disks to check
|
||||||
@ -5185,6 +5210,9 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
|
|||||||
|
|
||||||
virDomainDefPostParseGraphics(def);
|
virDomainDefPostParseGraphics(def);
|
||||||
|
|
||||||
|
if (virDomainDefPostParseHostdev(def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (virDomainDefPostParseCPU(def) < 0)
|
if (virDomainDefPostParseCPU(def) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -5476,6 +5476,14 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case VIR_MDEV_MODEL_TYPE_VFIO_AP:
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_AP)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("VFIO AP device assignment is not "
|
||||||
|
"supported by this version of QEMU"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case VIR_MDEV_MODEL_TYPE_LAST:
|
case VIR_MDEV_MODEL_TYPE_LAST:
|
||||||
default:
|
default:
|
||||||
virReportEnumRangeError(virMediatedDeviceModelType,
|
virReportEnumRangeError(virMediatedDeviceModelType,
|
||||||
|
@ -294,6 +294,10 @@ qemuDomainPrimeVfioDeviceAddresses(virDomainDefPtr def,
|
|||||||
subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_CCW &&
|
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 == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
||||||
def->hostdevs[i]->info->type = type;
|
def->hostdevs[i]->info->type = type;
|
||||||
|
|
||||||
|
if (virHostdevIsMdevDevice(def->hostdevs[i]) &&
|
||||||
|
subsys->u.mdev.model == VIR_MDEV_MODEL_TYPE_VFIO_AP)
|
||||||
|
def->hostdevs[i]->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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")
|
"vfio-ccw",
|
||||||
|
"vfio-ap")
|
||||||
|
|
||||||
static virClassPtr virMediatedDeviceListClass;
|
static virClassPtr virMediatedDeviceListClass;
|
||||||
|
|
||||||
|
@ -27,6 +27,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_VFIO_CCW = 1,
|
||||||
|
VIR_MDEV_MODEL_TYPE_VFIO_AP = 2,
|
||||||
|
|
||||||
VIR_MDEV_MODEL_TYPE_LAST
|
VIR_MDEV_MODEL_TYPE_LAST
|
||||||
} virMediatedDeviceModelType;
|
} virMediatedDeviceModelType;
|
||||||
|
Loading…
Reference in New Issue
Block a user