conf: move/rename hostdev PCI driver type enum to device_conf.h

Currently this enum is defined in domain_conf.h and named
virDomainHostdevSubsysPCIDriverType. I want to use it in parts of the
network and networkport config, so am moving its definition to
device_conf.h which is / can be included by all interested parties,
and renaming it to match the name of the corresponding XML attribute
("driver name"). The name change (which includes enum values) does cause a
lot of churn, but it's all mechanical.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Laine Stump 2024-01-04 20:12:51 -05:00
parent deefaf8f1c
commit a435e7e6c8
23 changed files with 89 additions and 90 deletions

View File

@ -29,6 +29,15 @@
#define VIR_FROM_THIS VIR_FROM_DEVICE
VIR_ENUM_IMPL(virDeviceHostdevPCIDriverName,
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
"default",
"kvm",
"vfio",
"xen",
);
VIR_ENUM_IMPL(virDomainDeviceAddress,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",

View File

@ -31,6 +31,18 @@
#include "virnetdev.h"
#include "virenum.h"
/* the backend driver used for PCI hostdev devices */
typedef enum {
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT = 0, /* detect automatically, prefer VFIO */
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM, /* force legacy kvm style */
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO, /* force vfio */
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN, /* force legacy xen style, use pciback */
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST
} virDeviceHostdevPCIDriverName;
VIR_ENUM_DECL(virDeviceHostdevPCIDriverName);
typedef enum {
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE = 0,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,

View File

@ -524,7 +524,7 @@ virDomainCapsDeviceHostdevFormat(virBuffer *buf,
ENUM_PROCESS(hostdev, startupPolicy, virDomainStartupPolicyTypeToString);
ENUM_PROCESS(hostdev, subsysType, virDomainHostdevSubsysTypeToString);
ENUM_PROCESS(hostdev, capsType, virDomainHostdevCapsTypeToString);
ENUM_PROCESS(hostdev, pciBackend, virDomainHostdevSubsysPCIBackendTypeToString);
ENUM_PROCESS(hostdev, pciBackend, virDeviceHostdevPCIDriverNameTypeToString);
FORMAT_EPILOGUE(hostdev);
}

View File

@ -99,7 +99,7 @@ STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_MODE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_STARTUP_POLICY_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST);
STATIC_ASSERT_ENUM(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST);
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
struct _virDomainCapsDeviceHostdev {
virTristateBool supported;

View File

@ -1054,13 +1054,6 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys,
"mdev",
);
VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
"default",
"kvm",
"vfio",
"xen",
);
VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIProtocol,
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST,
@ -6292,7 +6285,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
driver_node = virXPathNode("./driver", ctxt);
if (virXMLPropEnum(driver_node, "name",
virDomainHostdevSubsysPCIBackendTypeFromString,
virDeviceHostdevPCIDriverNameTypeFromString,
VIR_XML_PROP_NONZERO,
&pcisrc->backend) < 0)
return -1;
@ -23438,8 +23431,8 @@ virDomainHostdevDefFormatSubsysPCI(virBuffer *buf,
virBufferAsprintf(&sourceAttrBuf, " writeFiltering='%s'",
virTristateBoolTypeToString(def->writeFiltering));
if (pcisrc->backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
const char *backend = virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend);
if (pcisrc->backend != VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
const char *backend = virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend);
if (!backend) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@ -29970,18 +29963,15 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDef *iface,
actual->data.hostdev.def.source.subsys.u.pci.addr = port->plug.hostdevpci.addr;
switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.driver) {
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
actual->data.hostdev.def.source.subsys.u.pci.backend =
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT;
actual->data.hostdev.def.source.subsys.u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT;
break;
case VIR_NETWORK_FORWARD_DRIVER_NAME_KVM:
actual->data.hostdev.def.source.subsys.u.pci.backend =
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
actual->data.hostdev.def.source.subsys.u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM;
break;
case VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO:
actual->data.hostdev.def.source.subsys.u.pci.backend =
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
actual->data.hostdev.def.source.subsys.u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
break;
case VIR_NETWORK_FORWARD_DRIVER_NAME_LAST:
@ -30092,26 +30082,26 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
port->plug.hostdevpci.managed = virTristateBoolFromBool(actual->data.hostdev.def.managed);
port->plug.hostdevpci.addr = actual->data.hostdev.def.source.subsys.u.pci.addr;
switch (actual->data.hostdev.def.source.subsys.u.pci.backend) {
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT;
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_KVM;
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO;
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Unexpected PCI backend 'xen'"));
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
default:
virReportEnumRangeError(virDomainHostdevSubsysPCIBackendType,
virReportEnumRangeError(virDeviceHostdevPCIDriverName,
actual->data.hostdev.def.source.subsys.u.pci.backend);
return NULL;
}
@ -31056,7 +31046,7 @@ virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev)
{
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
hostdev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
hostdev->source.subsys.u.pci.backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
}

View File

@ -201,18 +201,6 @@ typedef enum {
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
} virDomainHostdevSubsysType;
/* the backend driver used for PCI hostdev devices */
typedef enum {
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT = 0, /* detect automatically, prefer VFIO */
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM, /* force legacy kvm style */
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO, /* force vfio */
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN, /* force legacy xen style, use pciback */
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
} virDomainHostdevSubsysPCIBackendType;
VIR_ENUM_DECL(virDomainHostdevSubsysPCIBackend);
typedef enum {
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE,
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI,
@ -247,7 +235,7 @@ struct _virDomainHostdevSubsysUSB {
struct _virDomainHostdevSubsysPCI {
virPCIDeviceAddress addr; /* host address */
virDomainHostdevSubsysPCIBackendType backend;
virDeviceHostdevPCIDriverName backend;
virBitmap *origstates;
};

View File

@ -243,14 +243,14 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
virPCIDeviceSetManaged(actual, hostdev->managed);
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
} else if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
} else if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN) {
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN);
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("pci backend driver '%1$s' is not supported"),
virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend));
_("pci backend driver type '%1$s' is not supported"),
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend));
return -1;
}

View File

@ -126,6 +126,7 @@ virCPUModeTypeToString;
# conf/device_conf.h
virCCWDeviceAddressParseXML;
virDeviceHostdevPCIDriverNameTypeToString;
virDeviceInfoPCIAddressExtensionIsPresent;
virDeviceInfoPCIAddressExtensionIsWanted;
virDeviceInfoPCIAddressIsPresent;
@ -467,7 +468,6 @@ virDomainHostdevInsert;
virDomainHostdevMatch;
virDomainHostdevModeTypeToString;
virDomainHostdevRemove;
virDomainHostdevSubsysPCIBackendTypeToString;
virDomainHostdevSubsysSCSIVHostModelTypeFromString;
virDomainHostdevSubsysSCSIVHostModelTypeToString;
virDomainHostdevSubsysTypeToString;

View File

@ -623,8 +623,7 @@ libxlMakeDomainDeviceHostdevCaps(virDomainCapsDeviceHostdev *dev)
virDomainCapsEnumClear(&dev->capsType);
virDomainCapsEnumClear(&dev->pciBackend);
VIR_DOMAIN_CAPS_ENUM_SET(dev->pciBackend,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN);
VIR_DOMAIN_CAPS_ENUM_SET(dev->pciBackend, VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN);
return 0;
}

View File

@ -160,8 +160,8 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDef *dev,
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT)
pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT)
pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
}
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
@ -997,7 +997,7 @@ libxlNetworkPrepareDevices(virDomainDef *def)
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
if (virDomainHostdevInsert(def, hostdev) < 0)
return -1;

View File

@ -3398,12 +3398,12 @@ libxlDomainAttachNetDevice(libxlDriverPrivate *driver,
virDomainHostdevSubsysPCI *pcisrc = &hostdev->source.subsys.u.pci;
/* For those just allocated from a network pool whose backend is
* still VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, we need to set
* still VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT, we need to set
* backend correctly.
*/
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
pcisrc->backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
/* This is really a "smart hostdev", so it should be attached
* as a hostdev (the hostdev code will reach over into the

View File

@ -6351,8 +6351,8 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCaps *qemuCaps,
if (supportsPassthroughVFIO &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
VIR_DOMAIN_CAPS_ENUM_SET(hostdev->pciBackend,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT,
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO);
}
}

View File

@ -4709,16 +4709,16 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
/* caller has to assign proper passthrough backend type */
switch (pcisrc->backend) {
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("invalid PCI passthrough type '%1$s'"),
virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend));
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend));
return NULL;
}

View File

@ -10534,7 +10534,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
switch (dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&pcisrc->addr)))
return -1;
@ -11305,14 +11305,14 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
virQEMUCaps *qemuCaps)
{
bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO();
virDomainHostdevSubsysPCIBackendType *backend = &hostdev->source.subsys.u.pci.backend;
virDeviceHostdevPCIDriverName *driverName = &hostdev->source.subsys.u.pci.backend;
/* assign defaults for hostdev passthrough */
switch (*backend) {
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
switch (*driverName) {
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
if (supportsPassthroughVFIO) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
*backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
*driverName = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("VFIO PCI device assignment is not supported by this version of QEMU"));
@ -11325,7 +11325,7 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
}
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
if (!supportsPassthroughVFIO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support VFIO PCI passthrough"));
@ -11333,20 +11333,20 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
}
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("host doesn't support legacy PCI passthrough"));
return false;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("QEMU does not support device assignment mode '%1$s'"),
virDomainHostdevSubsysPCIBackendTypeToString(*backend));
virDeviceHostdevPCIDriverNameTypeToString(*driverName));
return false;
default:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
virReportEnumRangeError(virDomainHostdevSubsysPCIBackendType, *backend);
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
virReportEnumRangeError(virDeviceHostdevPCIDriverName, *driverName);
break;
}

View File

@ -2464,7 +2464,7 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
backend = hostdev->source.subsys.u.pci.backend;
if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("VFIO PCI device assignment is not supported by this version of qemu"));

View File

@ -869,7 +869,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManager *mgr,
if (!pci)
goto done;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev) {

View File

@ -1257,7 +1257,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr,
if (!pci)
return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)
@ -1418,7 +1418,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager *mgr,
if (!pci)
return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)

View File

@ -2201,7 +2201,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManager *mgr,
if (!pci)
return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)
@ -2437,7 +2437,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManager *mgr,
if (!pci)
return -1;
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
if (!vfioGroupDev)

View File

@ -1092,9 +1092,10 @@ get_files(vahControl * ctl)
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
virPCIDevice *pci = virPCIDeviceNew(&dev->source.subsys.u.pci.addr);
virDomainHostdevSubsysPCIBackendType backend = dev->source.subsys.u.pci.backend;
if (backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO ||
backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) {
virDeviceHostdevPCIDriverName driverName = dev->source.subsys.u.pci.backend;
if (driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO ||
driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
needsVfio = true;
}

View File

@ -10045,16 +10045,16 @@ testDomainAttachHostPCIDevice(testDriver *driver G_GNUC_UNUSED,
int backend = hostdev->source.subsys.u.pci.backend;
switch (backend) {
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
break;
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("test hypervisor does not support device assignment mode '%1$s'"),
virDomainHostdevSubsysPCIBackendTypeToString(backend));
virDeviceHostdevPCIDriverNameTypeToString(backend));
return -1;
}
@ -10080,7 +10080,7 @@ testDomainAttachHostDevice(testDriver *driver,
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hotplug is not supported for hostdev subsys type '%1$s'"),
virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
virDeviceHostdevPCIDriverNameTypeToString(hostdev->source.subsys.type));
return -1;
}

View File

@ -109,8 +109,8 @@ fillQemuCaps(virDomainCaps *domCaps,
* successfully mocked as they are not exposed as internal APIs. Therefore,
* instead of mocking set the expected values here by hand. */
VIR_DOMAIN_CAPS_ENUM_SET(domCaps->hostdev.pciBackend,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT,
VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO);
/* As of f05b6a918e28 we are expecting to see OVMF_CODE.fd file which
* may not exists everywhere. */

View File

@ -134,7 +134,7 @@ myInit(void)
subsys->u.pci.addr.bus = 0;
subsys->u.pci.addr.slot = i + 1;
subsys->u.pci.addr.function = 0;
subsys->u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
subsys->u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
}
for (i = 0; i < nhostdevs; i++) {

View File

@ -110,6 +110,6 @@ virshNodeDevicePCIBackendCompleter(vshControl *ctl G_GNUC_UNUSED,
{
virCheckFlags(0, NULL);
return virshEnumComplete(VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
virDomainHostdevSubsysPCIBackendTypeToString);
return virshEnumComplete(VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST,
virDeviceHostdevPCIDriverNameTypeToString);
}