mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
conf: put hostdev PCI backend into a struct
The new struct is virDeviceHostdevPCIDriverInfo, and the "backend" enum in the hostdevDef will be replaced with a virDeviceHostdevPCIDriverInfo named "driver'. Since the enum value in this new struct is called "name", it means that all references to "backend" will become "driver.name". This will allow easily adding other items for new attributes in the <driver> element / C struct, which will be useful once we are using this new struct in multiple places. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
e7d31d8b00
commit
e04ca000bd
@ -43,6 +43,10 @@ typedef enum {
|
|||||||
|
|
||||||
VIR_ENUM_DECL(virDeviceHostdevPCIDriverName);
|
VIR_ENUM_DECL(virDeviceHostdevPCIDriverName);
|
||||||
|
|
||||||
|
struct _virDeviceHostdevPCIDriverInfo {
|
||||||
|
virDeviceHostdevPCIDriverName name;
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE = 0,
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE = 0,
|
||||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
|
||||||
|
@ -6287,7 +6287,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
|
|||||||
if (virXMLPropEnum(driver_node, "name",
|
if (virXMLPropEnum(driver_node, "name",
|
||||||
virDeviceHostdevPCIDriverNameTypeFromString,
|
virDeviceHostdevPCIDriverNameTypeFromString,
|
||||||
VIR_XML_PROP_NONZERO,
|
VIR_XML_PROP_NONZERO,
|
||||||
&pcisrc->backend) < 0) {
|
&pcisrc->driver.name) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23429,17 +23429,17 @@ virDomainHostdevDefFormatSubsysPCI(virBuffer *buf,
|
|||||||
g_auto(virBuffer) sourceChildBuf = VIR_BUFFER_INIT_CHILD(buf);
|
g_auto(virBuffer) sourceChildBuf = VIR_BUFFER_INIT_CHILD(buf);
|
||||||
virDomainHostdevSubsysPCI *pcisrc = &def->source.subsys.u.pci;
|
virDomainHostdevSubsysPCI *pcisrc = &def->source.subsys.u.pci;
|
||||||
|
|
||||||
if (pcisrc->backend != VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
|
if (pcisrc->driver.name != VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
|
||||||
const char *backend = virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend);
|
const char *driverName = virDeviceHostdevPCIDriverNameTypeToString(pcisrc->driver.name);
|
||||||
|
|
||||||
if (!backend) {
|
if (!driverName) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected pci hostdev driver name type %1$d"),
|
_("unexpected pci hostdev driver type %1$d"),
|
||||||
pcisrc->backend);
|
pcisrc->driver.name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(&driverAttrBuf, " name='%s'", backend);
|
virBufferAsprintf(&driverAttrBuf, " name='%s'", driverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
|
virXMLFormatElement(buf, "driver", &driverAttrBuf, NULL);
|
||||||
@ -29967,15 +29967,15 @@ virDomainNetDefActualFromNetworkPort(virDomainNetDef *iface,
|
|||||||
actual->data.hostdev.def.source.subsys.u.pci.addr = port->plug.hostdevpci.addr;
|
actual->data.hostdev.def.source.subsys.u.pci.addr = port->plug.hostdevpci.addr;
|
||||||
switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.driver) {
|
switch ((virNetworkForwardDriverNameType)port->plug.hostdevpci.driver) {
|
||||||
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
|
case VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT:
|
||||||
actual->data.hostdev.def.source.subsys.u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT;
|
actual->data.hostdev.def.source.subsys.u.pci.driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_NETWORK_FORWARD_DRIVER_NAME_KVM:
|
case VIR_NETWORK_FORWARD_DRIVER_NAME_KVM:
|
||||||
actual->data.hostdev.def.source.subsys.u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM;
|
actual->data.hostdev.def.source.subsys.u.pci.driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO:
|
case VIR_NETWORK_FORWARD_DRIVER_NAME_VFIO:
|
||||||
actual->data.hostdev.def.source.subsys.u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
|
actual->data.hostdev.def.source.subsys.u.pci.driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_NETWORK_FORWARD_DRIVER_NAME_LAST:
|
case VIR_NETWORK_FORWARD_DRIVER_NAME_LAST:
|
||||||
@ -30085,7 +30085,7 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
|
|||||||
}
|
}
|
||||||
port->plug.hostdevpci.managed = virTristateBoolFromBool(actual->data.hostdev.def.managed);
|
port->plug.hostdevpci.managed = virTristateBoolFromBool(actual->data.hostdev.def.managed);
|
||||||
port->plug.hostdevpci.addr = actual->data.hostdev.def.source.subsys.u.pci.addr;
|
port->plug.hostdevpci.addr = actual->data.hostdev.def.source.subsys.u.pci.addr;
|
||||||
switch (actual->data.hostdev.def.source.subsys.u.pci.backend) {
|
switch (actual->data.hostdev.def.source.subsys.u.pci.driver.name) {
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
|
||||||
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT;
|
port->plug.hostdevpci.driver = VIR_NETWORK_FORWARD_DRIVER_NAME_DEFAULT;
|
||||||
break;
|
break;
|
||||||
@ -30099,14 +30099,10 @@ virDomainNetDefActualToNetworkPort(virDomainDef *dom,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("Unexpected PCI backend 'xen'"));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
|
||||||
default:
|
default:
|
||||||
virReportEnumRangeError(virDeviceHostdevPCIDriverName,
|
virReportEnumRangeError(virDeviceHostdevPCIDriverName,
|
||||||
actual->data.hostdev.def.source.subsys.u.pci.backend);
|
actual->data.hostdev.def.source.subsys.u.pci.driver.name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31050,7 +31046,7 @@ virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev)
|
|||||||
{
|
{
|
||||||
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
return hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||||
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||||
hostdev->source.subsys.u.pci.backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
|
hostdev->source.subsys.u.pci.driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ struct _virDomainHostdevSubsysUSB {
|
|||||||
|
|
||||||
struct _virDomainHostdevSubsysPCI {
|
struct _virDomainHostdevSubsysPCI {
|
||||||
virPCIDeviceAddress addr; /* host address */
|
virPCIDeviceAddress addr; /* host address */
|
||||||
virDeviceHostdevPCIDriverName backend;
|
virDeviceHostdevPCIDriverInfo driver;
|
||||||
|
|
||||||
virBitmap *origstates;
|
virBitmap *origstates;
|
||||||
};
|
};
|
||||||
|
@ -66,6 +66,8 @@ typedef struct _virCapsHostSecModelLabel virCapsHostSecModelLabel;
|
|||||||
|
|
||||||
typedef struct _virCapsStoragePool virCapsStoragePool;
|
typedef struct _virCapsStoragePool virCapsStoragePool;
|
||||||
|
|
||||||
|
typedef struct _virDeviceHostdevPCIDriverInfo virDeviceHostdevPCIDriverInfo;
|
||||||
|
|
||||||
typedef struct _virDomainABIStability virDomainABIStability;
|
typedef struct _virDomainABIStability virDomainABIStability;
|
||||||
|
|
||||||
typedef struct _virDomainActualNetDef virDomainActualNetDef;
|
typedef struct _virDomainActualNetDef virDomainActualNetDef;
|
||||||
|
@ -243,14 +243,14 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
|
|||||||
|
|
||||||
virPCIDeviceSetManaged(actual, hostdev->managed);
|
virPCIDeviceSetManaged(actual, hostdev->managed);
|
||||||
|
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
|
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
|
||||||
} else if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN) {
|
} else if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN) {
|
||||||
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN);
|
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN);
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("pci backend driver type '%1$s' is not supported"),
|
_("pci backend driver type '%1$s' is not supported"),
|
||||||
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend));
|
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->driver.name));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,8 +160,8 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDef *dev,
|
|||||||
|
|
||||||
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||||
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
|
||||||
pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT)
|
pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT)
|
||||||
pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
|
pcisrc->driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
|
if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) {
|
||||||
@ -997,7 +997,7 @@ libxlNetworkPrepareDevices(virDomainDef *def)
|
|||||||
|
|
||||||
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||||
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
|
pcisrc->driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
|
||||||
|
|
||||||
if (virDomainHostdevInsert(def, hostdev) < 0)
|
if (virDomainHostdevInsert(def, hostdev) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3397,13 +3397,13 @@ libxlDomainAttachNetDevice(libxlDriverPrivate *driver,
|
|||||||
virDomainHostdevDef *hostdev = virDomainNetGetActualHostdev(net);
|
virDomainHostdevDef *hostdev = virDomainNetGetActualHostdev(net);
|
||||||
virDomainHostdevSubsysPCI *pcisrc = &hostdev->source.subsys.u.pci;
|
virDomainHostdevSubsysPCI *pcisrc = &hostdev->source.subsys.u.pci;
|
||||||
|
|
||||||
/* For those just allocated from a network pool whose backend is
|
/* For those just allocated from a network pool whose driver type is
|
||||||
* still VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT, we need to set
|
* still VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT, we need to set
|
||||||
* backend correctly.
|
* driver name correctly.
|
||||||
*/
|
*/
|
||||||
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
||||||
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
||||||
pcisrc->backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
|
pcisrc->driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_XEN;
|
||||||
|
|
||||||
/* This is really a "smart hostdev", so it should be attached
|
/* This is really a "smart hostdev", so it should be attached
|
||||||
* as a hostdev (the hostdev code will reach over into the
|
* as a hostdev (the hostdev code will reach over into the
|
||||||
|
@ -4707,8 +4707,8 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
|
|||||||
g_autofree char *host = virPCIDeviceAddressAsString(&pcisrc->addr);
|
g_autofree char *host = virPCIDeviceAddressAsString(&pcisrc->addr);
|
||||||
const char *failover_pair_id = NULL;
|
const char *failover_pair_id = NULL;
|
||||||
|
|
||||||
/* caller has to assign proper passthrough backend type */
|
/* caller has to assign proper passthrough driver name */
|
||||||
switch (pcisrc->backend) {
|
switch (pcisrc->driver.name) {
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4718,7 +4718,7 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
|
|||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid PCI passthrough type '%1$s'"),
|
_("invalid PCI passthrough type '%1$s'"),
|
||||||
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->backend));
|
virDeviceHostdevPCIDriverNameTypeToString(pcisrc->driver.name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10534,7 +10534,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
|
|||||||
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
|
case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
|
||||||
switch (dev->source.subsys.type) {
|
switch (dev->source.subsys.type) {
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&pcisrc->addr)))
|
if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&pcisrc->addr)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -11305,7 +11305,7 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
|
|||||||
virQEMUCaps *qemuCaps)
|
virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO();
|
bool supportsPassthroughVFIO = qemuHostdevHostSupportsPassthroughVFIO();
|
||||||
virDeviceHostdevPCIDriverName *driverName = &hostdev->source.subsys.u.pci.backend;
|
virDeviceHostdevPCIDriverName *driverName = &hostdev->source.subsys.u.pci.driver.name;
|
||||||
|
|
||||||
/* assign defaults for hostdev passthrough */
|
/* assign defaults for hostdev passthrough */
|
||||||
switch (*driverName) {
|
switch (*driverName) {
|
||||||
|
@ -2437,7 +2437,7 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
|
|||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
virQEMUCaps *qemuCaps)
|
virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
int backend;
|
virDeviceHostdevPCIDriverName driverName;
|
||||||
|
|
||||||
/* forbid capabilities mode hostdev in this kind of hypervisor */
|
/* forbid capabilities mode hostdev in this kind of hypervisor */
|
||||||
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
|
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
|
||||||
@ -2462,9 +2462,9 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||||
backend = hostdev->source.subsys.u.pci.backend;
|
driverName = hostdev->source.subsys.u.pci.driver.name;
|
||||||
|
|
||||||
if (backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("VFIO PCI device assignment is not supported by this version of qemu"));
|
_("VFIO PCI device assignment is not supported by this version of qemu"));
|
||||||
|
@ -869,7 +869,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManager *mgr,
|
|||||||
if (!pci)
|
if (!pci)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
||||||
|
|
||||||
if (!vfioGroupDev) {
|
if (!vfioGroupDev) {
|
||||||
|
@ -1257,7 +1257,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr,
|
|||||||
if (!pci)
|
if (!pci)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
||||||
|
|
||||||
if (!vfioGroupDev)
|
if (!vfioGroupDev)
|
||||||
@ -1418,7 +1418,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager *mgr,
|
|||||||
if (!pci)
|
if (!pci)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
||||||
|
|
||||||
if (!vfioGroupDev)
|
if (!vfioGroupDev)
|
||||||
|
@ -2201,7 +2201,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManager *mgr,
|
|||||||
if (!pci)
|
if (!pci)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
||||||
|
|
||||||
if (!vfioGroupDev)
|
if (!vfioGroupDev)
|
||||||
@ -2437,7 +2437,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManager *mgr,
|
|||||||
if (!pci)
|
if (!pci)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (pcisrc->backend == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) {
|
||||||
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
g_autofree char *vfioGroupDev = virPCIDeviceGetIOMMUGroupDev(pci);
|
||||||
|
|
||||||
if (!vfioGroupDev)
|
if (!vfioGroupDev)
|
||||||
|
@ -1092,7 +1092,7 @@ get_files(vahControl * ctl)
|
|||||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: {
|
||||||
virPCIDevice *pci = virPCIDeviceNew(&dev->source.subsys.u.pci.addr);
|
virPCIDevice *pci = virPCIDeviceNew(&dev->source.subsys.u.pci.addr);
|
||||||
|
|
||||||
virDeviceHostdevPCIDriverName driverName = dev->source.subsys.u.pci.backend;
|
virDeviceHostdevPCIDriverName driverName = dev->source.subsys.u.pci.driver.name;
|
||||||
|
|
||||||
if (driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO ||
|
if (driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO ||
|
||||||
driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
|
driverName == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT) {
|
||||||
|
@ -10042,9 +10042,9 @@ testDomainAttachHostPCIDevice(testDriver *driver G_GNUC_UNUSED,
|
|||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
virDomainHostdevDef *hostdev)
|
virDomainHostdevDef *hostdev)
|
||||||
{
|
{
|
||||||
int backend = hostdev->source.subsys.u.pci.backend;
|
int driverName = hostdev->source.subsys.u.pci.driver.name;
|
||||||
|
|
||||||
switch (backend) {
|
switch (driverName) {
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO:
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAULT:
|
||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_KVM:
|
||||||
@ -10054,7 +10054,7 @@ testDomainAttachHostPCIDevice(testDriver *driver G_GNUC_UNUSED,
|
|||||||
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
|
case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_LAST:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("test hypervisor does not support device assignment mode '%1$s'"),
|
_("test hypervisor does not support device assignment mode '%1$s'"),
|
||||||
virDeviceHostdevPCIDriverNameTypeToString(backend));
|
virDeviceHostdevPCIDriverNameTypeToString(driverName));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ myInit(void)
|
|||||||
subsys->u.pci.addr.bus = 0;
|
subsys->u.pci.addr.bus = 0;
|
||||||
subsys->u.pci.addr.slot = i + 1;
|
subsys->u.pci.addr.slot = i + 1;
|
||||||
subsys->u.pci.addr.function = 0;
|
subsys->u.pci.addr.function = 0;
|
||||||
subsys->u.pci.backend = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
|
subsys->u.pci.driver.name = VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nhostdevs; i++) {
|
for (i = 0; i < nhostdevs; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user