mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Compare commits
15 Commits
de71573bfe
...
ab26247f46
Author | SHA1 | Date | |
---|---|---|---|
|
ab26247f46 | ||
|
42c09b68df | ||
|
cfb0294344 | ||
|
c2fd8c2b29 | ||
|
1522e7f9b7 | ||
|
7ef2846f9b | ||
|
27d1f9e404 | ||
|
10e8a518a0 | ||
|
24beaffec3 | ||
|
928296b044 | ||
|
2d9c9445b9 | ||
|
6ce071f609 | ||
|
222b66974e | ||
|
1bb9617971 | ||
|
cd2843f546 |
@ -462,6 +462,7 @@ virDomainDriverNodeDeviceReAttach(virNodeDevicePtr dev,
|
||||
int
|
||||
virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
virHostdevManager *hostdevMgr,
|
||||
virPCIStubDriver driverType,
|
||||
const char *driverName)
|
||||
{
|
||||
g_autoptr(virPCIDevice) pci = NULL;
|
||||
@ -471,8 +472,10 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
g_autoptr(virConnect) nodeconn = NULL;
|
||||
g_autoptr(virNodeDevice) nodedev = NULL;
|
||||
|
||||
if (!driverName)
|
||||
if (driverType == VIR_PCI_STUB_DRIVER_NONE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("driver type not set"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(nodeconn = virGetConnectNodeDev()))
|
||||
return -1;
|
||||
@ -504,10 +507,8 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
if (!pci)
|
||||
return -1;
|
||||
|
||||
if (STREQ(driverName, "vfio"))
|
||||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
else if (STREQ(driverName, "xen"))
|
||||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN);
|
||||
virPCIDeviceSetStubDriverType(pci, driverType);
|
||||
virPCIDeviceSetStubDriverName(pci, driverName);
|
||||
|
||||
return virHostdevPCINodeDeviceDetach(hostdevMgr, pci);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "node_device_conf.h"
|
||||
#include "virhostdev.h"
|
||||
#include "virpci.h"
|
||||
|
||||
char *
|
||||
virDomainDriverGenerateRootHash(const char *drivername,
|
||||
@ -58,6 +59,7 @@ int virDomainDriverNodeDeviceReAttach(virNodeDevicePtr dev,
|
||||
|
||||
int virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
virHostdevManager *hostdevMgr,
|
||||
virPCIStubDriver driverType,
|
||||
const char *driverName);
|
||||
|
||||
int virDomainDriverAddIOThreadCheck(virDomainDef *def,
|
||||
|
@ -244,9 +244,9 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
|
||||
virPCIDeviceSetManaged(actual, hostdev->managed);
|
||||
|
||||
if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
|
||||
virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
} else if (pcisrc->backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
|
||||
virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN);
|
||||
virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN);
|
||||
} else {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("pci backend driver '%1$s' is not supported"),
|
||||
@ -679,7 +679,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
|
||||
for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
|
||||
virPCIDevice *pci = virPCIDeviceListGet(pcidevs, i);
|
||||
bool strict_acs_check = !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK);
|
||||
bool usesVFIO = (virPCIDeviceGetStubDriver(pci) == VIR_PCI_STUB_DRIVER_VFIO);
|
||||
bool usesVFIO = (virPCIDeviceGetStubDriverType(pci) == VIR_PCI_STUB_DRIVER_VFIO);
|
||||
struct virHostdevIsPCINodeDeviceUsedData data = {mgr, drv_name, dom_name, false};
|
||||
int hdrType = -1;
|
||||
|
||||
@ -743,9 +743,8 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
|
||||
mgr->inactivePCIHostdevs) < 0)
|
||||
goto reattachdevs;
|
||||
} else {
|
||||
g_autofree char *driverPath = NULL;
|
||||
g_autofree char *driverName = NULL;
|
||||
int stub;
|
||||
g_autofree char *drvName = NULL;
|
||||
virPCIStubDriver drvType;
|
||||
|
||||
/* Unmanaged devices should already have been marked as
|
||||
* inactive: if that's the case, we can simply move on */
|
||||
@ -765,18 +764,17 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr,
|
||||
* information about active / inactive device across
|
||||
* daemon restarts has been implemented */
|
||||
|
||||
if (virPCIDeviceGetDriverPathAndName(pci,
|
||||
&driverPath, &driverName) < 0)
|
||||
if (virPCIDeviceGetCurrentDriverNameAndType(pci, &drvName,
|
||||
&drvType) < 0) {
|
||||
goto reattachdevs;
|
||||
}
|
||||
|
||||
stub = virPCIStubDriverTypeFromString(driverName);
|
||||
|
||||
if (stub > VIR_PCI_STUB_DRIVER_NONE &&
|
||||
stub < VIR_PCI_STUB_DRIVER_LAST) {
|
||||
if (drvType > VIR_PCI_STUB_DRIVER_NONE) {
|
||||
|
||||
/* The device is bound to a known stub driver: store this
|
||||
* information and add a copy to the inactive list */
|
||||
virPCIDeviceSetStubDriver(pci, stub);
|
||||
virPCIDeviceSetStubDriverType(pci, drvType);
|
||||
virPCIDeviceSetStubDriverName(pci, drvName);
|
||||
|
||||
VIR_DEBUG("Adding PCI device %s to inactive list",
|
||||
virPCIDeviceGetName(pci));
|
||||
@ -2290,18 +2288,13 @@ virHostdevPrepareOneNVMeDevice(virHostdevManager *hostdev_mgr,
|
||||
/* Let's check if all PCI devices are NVMe disks. */
|
||||
for (i = 0; i < virPCIDeviceListCount(pciDevices); i++) {
|
||||
virPCIDevice *pci = virPCIDeviceListGet(pciDevices, i);
|
||||
g_autofree char *drvPath = NULL;
|
||||
g_autofree char *drvName = NULL;
|
||||
int stub = VIR_PCI_STUB_DRIVER_NONE;
|
||||
virPCIStubDriver drvType;
|
||||
|
||||
if (virPCIDeviceGetDriverPathAndName(pci, &drvPath, &drvName) < 0)
|
||||
if (virPCIDeviceGetCurrentDriverNameAndType(pci, &drvName, &drvType) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (drvName)
|
||||
stub = virPCIStubDriverTypeFromString(drvName);
|
||||
|
||||
if (stub == VIR_PCI_STUB_DRIVER_VFIO ||
|
||||
STREQ_NULLABLE(drvName, "nvme"))
|
||||
if (drvType == VIR_PCI_STUB_DRIVER_VFIO || STREQ_NULLABLE(drvName, "nvme"))
|
||||
continue;
|
||||
|
||||
VIR_WARN("Suspicious NVMe disk assignment. PCI device "
|
||||
|
@ -3074,7 +3074,8 @@ virPCIDeviceFileIterate;
|
||||
virPCIDeviceFree;
|
||||
virPCIDeviceGetAddress;
|
||||
virPCIDeviceGetConfigPath;
|
||||
virPCIDeviceGetDriverPathAndName;
|
||||
virPCIDeviceGetCurrentDriverNameAndType;
|
||||
virPCIDeviceGetCurrentDriverPathAndName;
|
||||
virPCIDeviceGetIOMMUGroupDev;
|
||||
virPCIDeviceGetIOMMUGroupList;
|
||||
virPCIDeviceGetLinkCapSta;
|
||||
@ -3082,7 +3083,8 @@ virPCIDeviceGetManaged;
|
||||
virPCIDeviceGetName;
|
||||
virPCIDeviceGetRemoveSlot;
|
||||
virPCIDeviceGetReprobe;
|
||||
virPCIDeviceGetStubDriver;
|
||||
virPCIDeviceGetStubDriverName;
|
||||
virPCIDeviceGetStubDriverType;
|
||||
virPCIDeviceGetUnbindFromStub;
|
||||
virPCIDeviceGetUsedBy;
|
||||
virPCIDeviceGetVPD;
|
||||
@ -3108,7 +3110,8 @@ virPCIDeviceReset;
|
||||
virPCIDeviceSetManaged;
|
||||
virPCIDeviceSetRemoveSlot;
|
||||
virPCIDeviceSetReprobe;
|
||||
virPCIDeviceSetStubDriver;
|
||||
virPCIDeviceSetStubDriverName;
|
||||
virPCIDeviceSetStubDriverType;
|
||||
virPCIDeviceSetUnbindFromStub;
|
||||
virPCIDeviceSetUsedBy;
|
||||
virPCIDeviceUnbind;
|
||||
|
@ -5876,7 +5876,8 @@ libxlNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
|
||||
/* virNodeDeviceDetachFlagsEnsureACL() is being called by
|
||||
* virDomainDriverNodeDeviceDetachFlags() */
|
||||
return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr, driverName);
|
||||
return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr,
|
||||
VIR_PCI_STUB_DRIVER_XEN, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -70,7 +70,6 @@
|
||||
#include "domain_driver.h"
|
||||
#include "domain_postparse.h"
|
||||
#include "domain_validate.h"
|
||||
#include "virpci.h"
|
||||
#include "virpidfile.h"
|
||||
#include "virprocess.h"
|
||||
#include "libvirt_internal.h"
|
||||
@ -11407,34 +11406,38 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (!driverName)
|
||||
driverName = "vfio";
|
||||
/* For historical reasons, if driverName is "vfio", that is the
|
||||
* same as NULL, i.e. the default vfio driver for this device
|
||||
*/
|
||||
if (STREQ_NULLABLE(driverName, "vfio"))
|
||||
driverName = NULL;
|
||||
|
||||
/* Only the 'vfio' driver is supported and a special error message for
|
||||
* the previously supported 'kvm' driver is provided below. */
|
||||
if (STRNEQ(driverName, "vfio") && STRNEQ(driverName, "kvm")) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("unknown driver name '%1$s'"), driverName);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (STREQ(driverName, "kvm")) {
|
||||
/* the "kvm" driver name was used a very long time ago to force
|
||||
* "legacy KVM device assignment", which hasn't been supported in
|
||||
* over 10 years.
|
||||
*/
|
||||
if (STREQ_NULLABLE(driverName, "kvm")) {
|
||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||
_("KVM device assignment is no longer "
|
||||
"supported on this system"));
|
||||
_("'legacy KVM' device assignment is no longer supported on this system"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* for any other driver, we can't know whether or not it is a VFIO
|
||||
* driver until the device has been bound to it, so we will defer
|
||||
* further validation until then.
|
||||
*/
|
||||
|
||||
if (!qemuHostdevHostSupportsPassthroughVFIO()) {
|
||||
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
|
||||
_("VFIO device assignment is currently not "
|
||||
"supported on this system"));
|
||||
_("VFIO device assignment is currently not supported on this system"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* virNodeDeviceDetachFlagsEnsureACL() is being called by
|
||||
* virDomainDriverNodeDeviceDetachFlags() */
|
||||
return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr, driverName);
|
||||
return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr,
|
||||
VIR_PCI_STUB_DRIVER_VFIO,
|
||||
driverName);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -292,7 +292,7 @@ virNVMeDeviceCreatePCIDevice(const virNVMeDevice *nvme)
|
||||
return NULL;
|
||||
|
||||
/* NVMe devices must be bound to vfio */
|
||||
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetManaged(pci, nvme->managed);
|
||||
|
||||
return g_steal_pointer(&pci);
|
||||
|
@ -87,7 +87,8 @@ struct _virPCIDevice {
|
||||
|
||||
bool managed;
|
||||
|
||||
virPCIStubDriver stubDriver;
|
||||
virPCIStubDriver stubDriverType;
|
||||
char *stubDriverName; /* if blank, use default for type */
|
||||
|
||||
/* used by reattach function */
|
||||
bool unbind_from_stub;
|
||||
@ -227,7 +228,7 @@ virPCIFile(const char *device, const char *file)
|
||||
}
|
||||
|
||||
|
||||
/* virPCIDeviceGetDriverPathAndName - put the path to the driver
|
||||
/* virPCIDeviceGetCurrentDriverPathAndName - put the path to the driver
|
||||
* directory of the driver in use for this device in @path and the
|
||||
* name of the driver in @name. Both could be NULL if it's not bound
|
||||
* to any driver.
|
||||
@ -235,7 +236,9 @@ virPCIFile(const char *device, const char *file)
|
||||
* Return 0 for success, -1 for error.
|
||||
*/
|
||||
int
|
||||
virPCIDeviceGetDriverPathAndName(virPCIDevice *dev, char **path, char **name)
|
||||
virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev,
|
||||
char **path,
|
||||
char **name)
|
||||
{
|
||||
int ret = -1;
|
||||
g_autofree char *drvlink = NULL;
|
||||
@ -277,6 +280,73 @@ virPCIDeviceGetDriverPathAndName(virPCIDevice *dev, char **path, char **name)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virPCIDeviceGetCurrentDriverNameAndType:
|
||||
* @dev: virPCIDevice object to examine
|
||||
* @drvName: returns name of driver bound to this device (if any)
|
||||
* @drvType: returns type of driver if it is a known stub driver type
|
||||
*
|
||||
* Find the name of the driver bound to @dev (if any) and the type of
|
||||
* the driver if it is a known/recognized "stub" driver (based on the
|
||||
* driver name).
|
||||
*
|
||||
* There are vfio "variant" drivers that provide all the basic
|
||||
* functionality of the standard vfio-pci driver as well as additional
|
||||
* stuff. As of kernel 6.1, the vfio-pci driver and all vfio variant
|
||||
* drivers can be identified (once the driver has been bound to a
|
||||
* device) by looking for the subdirectory "vfio-dev" in the device's
|
||||
* sysfs directory; for example, if the directory
|
||||
* /sys/bus/pci/devices/0000:04:11.4/vfio-dev exists, then the driver
|
||||
* that is currently bound to PCI device 0000:04:11.4 is either
|
||||
* vfio-pci, or a vfio-pci variant driver.
|
||||
*
|
||||
* Return 0 on success, -1 on failure. If -1 is returned, then an error
|
||||
* message has been logged.
|
||||
*/
|
||||
int
|
||||
virPCIDeviceGetCurrentDriverNameAndType(virPCIDevice *dev,
|
||||
char **drvName,
|
||||
virPCIStubDriver *drvType)
|
||||
{
|
||||
g_autofree char *drvPath = NULL;
|
||||
g_autofree char *vfioDevDir = NULL;
|
||||
int tmpType;
|
||||
|
||||
if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvPath, drvName) < 0)
|
||||
return -1;
|
||||
|
||||
if (!*drvName) {
|
||||
*drvType = VIR_PCI_STUB_DRIVER_NONE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
tmpType = virPCIStubDriverTypeFromString(*drvName);
|
||||
|
||||
if (tmpType > VIR_PCI_STUB_DRIVER_NONE) {
|
||||
*drvType = tmpType;
|
||||
return 0; /* exact match of a known driver name (or no name) */
|
||||
}
|
||||
|
||||
/* If the sysfs directory of this device contains a directory
|
||||
* named "vfio-dev" then the currently-bound driver is a vfio
|
||||
* variant driver.
|
||||
*/
|
||||
|
||||
vfioDevDir = virPCIFile(dev->name, "vfio-dev");
|
||||
|
||||
if (virFileIsDir(vfioDevDir)) {
|
||||
VIR_DEBUG("Driver %s is a vfio_pci driver", *drvName);
|
||||
*drvType = VIR_PCI_STUB_DRIVER_VFIO;
|
||||
} else {
|
||||
VIR_DEBUG("Driver %s is NOT a vfio_pci driver, or kernel is too old",
|
||||
*drvName);
|
||||
*drvType = VIR_PCI_STUB_DRIVER_NONE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virPCIDeviceConfigOpenInternal(virPCIDevice *dev, bool readonly, bool fatal)
|
||||
{
|
||||
@ -1004,8 +1074,8 @@ virPCIDeviceReset(virPCIDevice *dev,
|
||||
virPCIDeviceList *activeDevs,
|
||||
virPCIDeviceList *inactiveDevs)
|
||||
{
|
||||
g_autofree char *drvPath = NULL;
|
||||
g_autofree char *drvName = NULL;
|
||||
virPCIStubDriver drvType;
|
||||
int ret = -1;
|
||||
int fd = -1;
|
||||
int hdrType = -1;
|
||||
@ -1031,15 +1101,16 @@ virPCIDeviceReset(virPCIDevice *dev,
|
||||
* reset it whenever appropriate, so doing it ourselves would just
|
||||
* be redundant.
|
||||
*/
|
||||
if (virPCIDeviceGetDriverPathAndName(dev, &drvPath, &drvName) < 0)
|
||||
if (virPCIDeviceGetCurrentDriverNameAndType(dev, &drvName, &drvType) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virPCIStubDriverTypeFromString(drvName) == VIR_PCI_STUB_DRIVER_VFIO) {
|
||||
VIR_DEBUG("Device %s is bound to vfio-pci - skip reset",
|
||||
dev->name);
|
||||
if (drvType == VIR_PCI_STUB_DRIVER_VFIO) {
|
||||
|
||||
VIR_DEBUG("Device %s is bound to %s - skip reset", dev->name, drvName);
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
VIR_DEBUG("Resetting device %s", dev->name);
|
||||
|
||||
if ((fd = virPCIDeviceConfigOpenWrite(dev)) < 0)
|
||||
@ -1083,28 +1154,19 @@ virPCIDeviceReset(virPCIDevice *dev,
|
||||
|
||||
|
||||
static int
|
||||
virPCIProbeStubDriver(virPCIStubDriver driver)
|
||||
virPCIProbeDriver(const char *driverName)
|
||||
{
|
||||
const char *drvname = NULL;
|
||||
g_autofree char *drvpath = NULL;
|
||||
g_autofree char *errbuf = NULL;
|
||||
|
||||
if (driver == VIR_PCI_STUB_DRIVER_NONE ||
|
||||
!(drvname = virPCIStubDriverTypeToString(driver))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s",
|
||||
_("Attempting to use unknown stub driver"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
drvpath = virPCIDriverDir(drvname);
|
||||
drvpath = virPCIDriverDir(driverName);
|
||||
|
||||
/* driver previously loaded, return */
|
||||
if (virFileExists(drvpath))
|
||||
return 0;
|
||||
|
||||
if ((errbuf = virKModLoad(drvname))) {
|
||||
VIR_WARN("failed to load driver %s: %s", drvname, errbuf);
|
||||
if ((errbuf = virKModLoad(driverName))) {
|
||||
VIR_WARN("failed to load driver %s: %s", driverName, errbuf);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1116,14 +1178,14 @@ virPCIProbeStubDriver(virPCIStubDriver driver)
|
||||
/* If we know failure was because of admin config, let's report that;
|
||||
* otherwise, report a more generic failure message
|
||||
*/
|
||||
if (virKModIsProhibited(drvname)) {
|
||||
if (virKModIsProhibited(driverName)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to load PCI stub module %1$s: administratively prohibited"),
|
||||
drvname);
|
||||
_("Failed to load PCI driver module %1$s: administratively prohibited"),
|
||||
driverName);
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to load PCI stub module %1$s"),
|
||||
drvname);
|
||||
_("Failed to load PCI driver module %1$s"),
|
||||
driverName);
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -1136,7 +1198,7 @@ virPCIDeviceUnbind(virPCIDevice *dev)
|
||||
g_autofree char *drvpath = NULL;
|
||||
g_autofree char *driver = NULL;
|
||||
|
||||
if (virPCIDeviceGetDriverPathAndName(dev, &drvpath, &driver) < 0)
|
||||
if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvpath, &driver) < 0)
|
||||
return -1;
|
||||
|
||||
if (!driver)
|
||||
@ -1228,23 +1290,29 @@ virPCIDeviceUnbindFromStub(virPCIDevice *dev)
|
||||
static int
|
||||
virPCIDeviceBindToStub(virPCIDevice *dev)
|
||||
{
|
||||
const char *stubDriverName;
|
||||
const char *stubDriverName = dev->stubDriverName;
|
||||
g_autofree char *stubDriverPath = NULL;
|
||||
g_autofree char *driverLink = NULL;
|
||||
|
||||
/* Check the device is configured to use one of the known stub drivers */
|
||||
if (dev->stubDriver == VIR_PCI_STUB_DRIVER_NONE) {
|
||||
|
||||
if (dev->stubDriverType == VIR_PCI_STUB_DRIVER_NONE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("No stub driver configured for PCI device %1$s"),
|
||||
dev->name);
|
||||
return -1;
|
||||
} else if (!(stubDriverName = virPCIStubDriverTypeToString(dev->stubDriver))) {
|
||||
}
|
||||
|
||||
if (!stubDriverName
|
||||
&& !(stubDriverName = virPCIStubDriverTypeToString(dev->stubDriverType))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown stub driver configured for PCI device %1$s"),
|
||||
dev->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virPCIProbeDriver(stubDriverName) < 0)
|
||||
return -1;
|
||||
|
||||
stubDriverPath = virPCIDriverDir(stubDriverName);
|
||||
driverLink = virPCIFile(dev->name, "driver");
|
||||
|
||||
@ -1267,9 +1335,10 @@ virPCIDeviceBindToStub(virPCIDevice *dev)
|
||||
/* virPCIDeviceDetach:
|
||||
*
|
||||
* Detach this device from the host driver, attach it to the stub
|
||||
* driver (previously set with virPCIDeviceSetStubDriver(), and add *a
|
||||
* copy* of the object to the inactiveDevs list (if provided). This
|
||||
* function will *never* consume dev, so the caller should free it.
|
||||
* driver (previously set with virPCIDeviceSetStubDriverType(), and
|
||||
* add *a copy* of the object to the inactiveDevs list (if provided).
|
||||
* This function will *never* consume dev, so the caller should free
|
||||
* it.
|
||||
*
|
||||
* Returns 0 on success, -1 on failure (will fail if the device is
|
||||
* already in the activeDevs list, but will be a NOP if the device is
|
||||
@ -1287,9 +1356,6 @@ virPCIDeviceDetach(virPCIDevice *dev,
|
||||
virPCIDeviceList *activeDevs,
|
||||
virPCIDeviceList *inactiveDevs)
|
||||
{
|
||||
if (virPCIProbeStubDriver(dev->stubDriver) < 0)
|
||||
return -1;
|
||||
|
||||
if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Not detaching active device %1$s"), dev->name);
|
||||
@ -1507,6 +1573,7 @@ virPCIDeviceCopy(virPCIDevice *dev)
|
||||
copy->path = g_strdup(dev->path);
|
||||
copy->used_by_drvname = g_strdup(dev->used_by_drvname);
|
||||
copy->used_by_domname = g_strdup(dev->used_by_domname);
|
||||
copy->stubDriverName = g_strdup(dev->stubDriverName);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@ -1521,6 +1588,7 @@ virPCIDeviceFree(virPCIDevice *dev)
|
||||
g_free(dev->path);
|
||||
g_free(dev->used_by_drvname);
|
||||
g_free(dev->used_by_domname);
|
||||
g_free(dev->stubDriverName);
|
||||
g_free(dev);
|
||||
}
|
||||
|
||||
@ -1569,15 +1637,29 @@ virPCIDeviceGetManaged(virPCIDevice *dev)
|
||||
}
|
||||
|
||||
void
|
||||
virPCIDeviceSetStubDriver(virPCIDevice *dev, virPCIStubDriver driver)
|
||||
virPCIDeviceSetStubDriverType(virPCIDevice *dev, virPCIStubDriver driverType)
|
||||
{
|
||||
dev->stubDriver = driver;
|
||||
dev->stubDriverType = driverType;
|
||||
}
|
||||
|
||||
virPCIStubDriver
|
||||
virPCIDeviceGetStubDriver(virPCIDevice *dev)
|
||||
virPCIDeviceGetStubDriverType(virPCIDevice *dev)
|
||||
{
|
||||
return dev->stubDriver;
|
||||
return dev->stubDriverType;
|
||||
}
|
||||
|
||||
void
|
||||
virPCIDeviceSetStubDriverName(virPCIDevice *dev,
|
||||
const char *driverName)
|
||||
{
|
||||
g_free(dev->stubDriverName);
|
||||
dev->stubDriverName = g_strdup(driverName);
|
||||
}
|
||||
|
||||
const char *
|
||||
virPCIDeviceGetStubDriverName(virPCIDevice *dev)
|
||||
{
|
||||
return dev->stubDriverName;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -134,9 +134,12 @@ int virPCIDeviceReset(virPCIDevice *dev,
|
||||
void virPCIDeviceSetManaged(virPCIDevice *dev,
|
||||
bool managed);
|
||||
bool virPCIDeviceGetManaged(virPCIDevice *dev);
|
||||
void virPCIDeviceSetStubDriver(virPCIDevice *dev,
|
||||
virPCIStubDriver driver);
|
||||
virPCIStubDriver virPCIDeviceGetStubDriver(virPCIDevice *dev);
|
||||
void virPCIDeviceSetStubDriverType(virPCIDevice *dev,
|
||||
virPCIStubDriver driverType);
|
||||
virPCIStubDriver virPCIDeviceGetStubDriverType(virPCIDevice *dev);
|
||||
void virPCIDeviceSetStubDriverName(virPCIDevice *dev,
|
||||
const char *driverName);
|
||||
const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev);
|
||||
virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev);
|
||||
int virPCIDeviceSetUsedBy(virPCIDevice *dev,
|
||||
const char *drv_name,
|
||||
@ -277,9 +280,12 @@ virPCIVPDResource * virPCIDeviceGetVPD(virPCIDevice *dev);
|
||||
|
||||
int virPCIDeviceUnbind(virPCIDevice *dev);
|
||||
int virPCIDeviceRebind(virPCIDevice *dev);
|
||||
int virPCIDeviceGetDriverPathAndName(virPCIDevice *dev,
|
||||
char **path,
|
||||
char **name);
|
||||
int virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev,
|
||||
char **path,
|
||||
char **name);
|
||||
int virPCIDeviceGetCurrentDriverNameAndType(virPCIDevice *dev,
|
||||
char **drvName,
|
||||
virPCIStubDriver *drvType);
|
||||
|
||||
int virPCIDeviceIsPCIExpress(virPCIDevice *dev);
|
||||
int virPCIDeviceHasPCIExpressLink(virPCIDevice *dev);
|
||||
|
@ -6,7 +6,7 @@
|
||||
<vcpu placement='static'>2</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64'>hvm</type>
|
||||
<kernel>hypervisor-fw</kernel>
|
||||
<kernel>/path/to/hypervisor-fw</kernel>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
@ -16,7 +16,7 @@
|
||||
<devices>
|
||||
<emulator>/usr/local/bin/cloud-hypervisor</emulator>
|
||||
<disk type='file' device='disk'>
|
||||
<source file='disk.raw'/>
|
||||
<source file='/path/to/disk.raw'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
</disk>
|
||||
<interface type='ethernet'>
|
||||
|
@ -8,6 +8,9 @@
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
@ -20,7 +23,7 @@
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<controller type='usb' index='0' model='piix3-uhci'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
@ -8,6 +8,9 @@
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
@ -20,7 +23,7 @@
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<controller type='usb' index='0' model='piix3-uhci'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
@ -16,13 +16,16 @@
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<controller type='usb' index='0' model='piix3-uhci'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
@ -8,6 +8,9 @@
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
@ -32,7 +35,7 @@
|
||||
<target dev='hdb' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='1'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<controller type='usb' index='0' model='piix3-uhci'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
@ -8,6 +8,9 @@
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
@ -20,7 +23,7 @@
|
||||
<target dev='hda' bus='ide'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<controller type='usb' index='0'>
|
||||
<controller type='usb' index='0' model='piix3-uhci'>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
@ -19,13 +19,6 @@
|
||||
|
||||
static virQEMUDriver driver;
|
||||
|
||||
enum {
|
||||
WHEN_INACTIVE = 1,
|
||||
WHEN_ACTIVE = 2,
|
||||
WHEN_BOTH = 3,
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
testXML2XMLCommon(const struct testQemuInfo *info)
|
||||
{
|
||||
@ -46,6 +39,9 @@ testXML2XMLActive(const void *opaque)
|
||||
{
|
||||
const struct testQemuInfo *info = opaque;
|
||||
|
||||
if (info->flags & FLAG_SKIP_CONFIG_ACTIVE)
|
||||
return EXIT_AM_SKIP;
|
||||
|
||||
if (testXML2XMLCommon(info) < 0 ||
|
||||
testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt,
|
||||
info->infile, info->outfile, true,
|
||||
@ -75,10 +71,22 @@ testXML2XMLInactive(const void *opaque)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* testInfoSetPaths:
|
||||
* @info: test info structure to populate
|
||||
* @suffix: suffix used to create output file name e.g. ".x86-64_latest"
|
||||
* @statesuffix: suffix to create output file name based on tested state ("active" | "inactive")
|
||||
*
|
||||
* This function populates @info with the correct input and output file paths.
|
||||
*
|
||||
* The output file is chosen based on whether a version with @statesuffix exists.
|
||||
* If yes, it's used, if no the @statesuffix is omitted and it's expected that
|
||||
* both the "active" and "inactive" versions are the same.
|
||||
*/
|
||||
static void
|
||||
testInfoSetPaths(struct testQemuInfo *info,
|
||||
const char *suffix,
|
||||
int when)
|
||||
const char *statesuffix)
|
||||
{
|
||||
VIR_FREE(info->infile);
|
||||
VIR_FREE(info->outfile);
|
||||
@ -88,7 +96,7 @@ testInfoSetPaths(struct testQemuInfo *info,
|
||||
|
||||
info->outfile = g_strdup_printf("%s/qemuxml2xmloutdata/%s-%s%s.xml",
|
||||
abs_srcdir, info->name,
|
||||
when == WHEN_ACTIVE ? "active" : "inactive", suffix);
|
||||
statesuffix, suffix);
|
||||
|
||||
if (!virFileExists(info->outfile)) {
|
||||
VIR_FREE(info->outfile);
|
||||
@ -138,32 +146,24 @@ mymain(void)
|
||||
virSetConnectSecret(conn);
|
||||
virSetConnectStorage(conn);
|
||||
|
||||
#define DO_TEST_FULL(_name, suffix, when, ...) \
|
||||
#define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \
|
||||
do { \
|
||||
static struct testQemuInfo info = { \
|
||||
.name = _name, \
|
||||
}; \
|
||||
testQemuInfoSetArgs(&info, &testConf, __VA_ARGS__); \
|
||||
testQemuInfoSetArgs(&info, &testConf, \
|
||||
ARG_CAPS_ARCH, arch, \
|
||||
ARG_CAPS_VER, ver, \
|
||||
__VA_ARGS__, ARG_END); \
|
||||
\
|
||||
if (when & WHEN_INACTIVE) { \
|
||||
testInfoSetPaths(&info, suffix, WHEN_INACTIVE); \
|
||||
virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \
|
||||
} \
|
||||
testInfoSetPaths(&info, "." arch "-" ver, "inactive"); \
|
||||
virTestRunLog(&ret, "QEMU XML-2-XML-inactive " _name, testXML2XMLInactive, &info); \
|
||||
\
|
||||
if (when & WHEN_ACTIVE) { \
|
||||
testInfoSetPaths(&info, suffix, WHEN_ACTIVE); \
|
||||
virTestRunLog(&ret, "QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \
|
||||
} \
|
||||
testInfoSetPaths(&info, "." arch "-" ver, "active"); \
|
||||
virTestRunLog(&ret, "QEMU XML-2-XML-active " _name, testXML2XMLActive, &info); \
|
||||
testQemuInfoClear(&info); \
|
||||
} while (0)
|
||||
|
||||
#define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \
|
||||
DO_TEST_FULL(name, "." arch "-" ver, WHEN_BOTH, \
|
||||
ARG_CAPS_ARCH, arch, \
|
||||
ARG_CAPS_VER, ver, \
|
||||
__VA_ARGS__, \
|
||||
ARG_END)
|
||||
|
||||
#define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \
|
||||
DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__)
|
||||
|
||||
@ -499,20 +499,17 @@ mymain(void)
|
||||
DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-single", "ppc64");
|
||||
DO_TEST_CAPS_ARCH_LATEST("ppc64-tpmproxy-with-tpm", "ppc64");
|
||||
|
||||
DO_TEST_FULL("seclabel-dynamic-baselabel", "", WHEN_INACTIVE, ARG_END);
|
||||
DO_TEST_FULL("seclabel-dynamic-override", "", WHEN_INACTIVE, ARG_END);
|
||||
DO_TEST_FULL("seclabel-dynamic-labelskip", "", WHEN_INACTIVE, ARG_END);
|
||||
DO_TEST_FULL("seclabel-dynamic-relabel", "", WHEN_INACTIVE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("seclabel-dynamic-baselabel", "x86_64", ARG_FLAGS, FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("seclabel-dynamic-override", "x86_64", ARG_FLAGS, FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("seclabel-dynamic-labelskip", "x86_64", ARG_FLAGS, FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("seclabel-dynamic-relabel", "x86_64", ARG_FLAGS, FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
|
||||
DO_TEST_CAPS_LATEST("seclabel-static");
|
||||
DO_TEST_CAPS_LATEST("seclabel-static-labelskip");
|
||||
DO_TEST_CAPS_LATEST("seclabel-none");
|
||||
DO_TEST_CAPS_LATEST("seclabel-dac-none");
|
||||
DO_TEST_CAPS_LATEST("seclabel-dynamic-none");
|
||||
DO_TEST_CAPS_LATEST("seclabel-device-multiple");
|
||||
DO_TEST_FULL("seclabel-dynamic-none-relabel", "", WHEN_INACTIVE,
|
||||
ARG_QEMU_CAPS, QEMU_CAPS_DEVICE_CIRRUS_VGA,
|
||||
QEMU_CAPS_SPICE, QEMU_CAPS_LAST,
|
||||
ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("seclabel-dynamic-none-relabel", "x86_64", ARG_FLAGS, FLAG_SKIP_CONFIG_ACTIVE, ARG_END);
|
||||
DO_TEST_CAPS_LATEST("numad-static-vcpu-no-numatune");
|
||||
|
||||
DO_TEST_CAPS_LATEST("disk-scsi-disk-vpd");
|
||||
@ -770,69 +767,27 @@ mymain(void)
|
||||
DO_TEST_CAPS_ARCH_LATEST("aarch64-traditional-pci", "aarch64");
|
||||
DO_TEST_CAPS_ARCH_LATEST("aarch64-video-default", "aarch64");
|
||||
|
||||
DO_TEST_FULL("aarch64-gic-none", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-none-v2", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-none-v3", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-none-both", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-none-tcg", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-default", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-default-v2", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-default-v3", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-default-both", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v2", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v2", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v2", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v2", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v3", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v3", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v3", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-v3", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-host", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-host", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-host", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_FULL("aarch64-gic-host", ".aarch64-latest", WHEN_BOTH,
|
||||
ARG_CAPS_ARCH, "aarch64", ARG_CAPS_VER, "latest",
|
||||
ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-none", "aarch64", ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-none-v2", "aarch64", ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-none-v3", "aarch64", ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-none-both", "aarch64", ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-none-tcg", "aarch64", ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-default", "aarch64", ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-default-v2", "aarch64", ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-default-v3", "aarch64", ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-default-both", "aarch64", ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v2", "aarch64", ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v2", "aarch64", ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v2", "aarch64", ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v2", "aarch64", ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v3", "aarch64", ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v3", "aarch64", ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v3", "aarch64", ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-v3", "aarch64", ARG_GIC, GIC_BOTH, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-host", "aarch64", ARG_GIC, GIC_NONE, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-host", "aarch64", ARG_GIC, GIC_V2, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-host", "aarch64", ARG_GIC, GIC_V3, ARG_END);
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("aarch64-gic-host", "aarch64", ARG_GIC, GIC_BOTH, ARG_END);
|
||||
|
||||
/* SVE aarch64 CPU features work on modern QEMU */
|
||||
DO_TEST_CAPS_ARCH_LATEST("aarch64-features-sve", "aarch64");
|
||||
|
@ -59,6 +59,7 @@ typedef enum {
|
||||
FLAG_REAL_CAPS = 1 << 3,
|
||||
FLAG_SKIP_LEGACY_CPUS = 1 << 4,
|
||||
FLAG_SLIRP_HELPER = 1 << 5,
|
||||
FLAG_SKIP_CONFIG_ACTIVE = 1 << 6, /* Skip 'active' config test in qemuxml2xmltest */
|
||||
} testQemuInfoFlags;
|
||||
|
||||
struct testQemuConf {
|
||||
|
@ -142,7 +142,7 @@ myInit(void)
|
||||
if (!(dev[i] = virPCIDeviceNew(&subsys->u.pci.addr)))
|
||||
goto cleanup;
|
||||
|
||||
virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
}
|
||||
|
||||
for (i = 0; i < ndisks; i++) {
|
||||
|
@ -37,7 +37,7 @@ testVirPCIDeviceCheckDriver(virPCIDevice *dev, const char *expected)
|
||||
g_autofree char *path = NULL;
|
||||
g_autofree char *driver = NULL;
|
||||
|
||||
if (virPCIDeviceGetDriverPathAndName(dev, &path, &driver) < 0)
|
||||
if (virPCIDeviceGetCurrentDriverPathAndName(dev, &path, &driver) < 0)
|
||||
return -1;
|
||||
|
||||
if (STRNEQ_NULLABLE(driver, expected)) {
|
||||
@ -107,7 +107,7 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED)
|
||||
if (!(dev[i] = virPCIDeviceNew(&devAddr)))
|
||||
goto cleanup;
|
||||
|
||||
virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
|
||||
if (virPCIDeviceDetach(dev[i], activeDevs, inactiveDevs) < 0)
|
||||
goto cleanup;
|
||||
@ -149,7 +149,7 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED)
|
||||
if (!(dev[i] = virPCIDeviceNew(&devAddr)))
|
||||
goto cleanup;
|
||||
|
||||
virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
|
||||
if (virPCIDeviceReset(dev[i], activeDevs, inactiveDevs) < 0)
|
||||
goto cleanup;
|
||||
@ -190,7 +190,7 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUSED)
|
||||
CHECK_LIST_COUNT(activeDevs, 0);
|
||||
CHECK_LIST_COUNT(inactiveDevs, i + 1);
|
||||
|
||||
virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
|
||||
}
|
||||
|
||||
CHECK_LIST_COUNT(activeDevs, 0);
|
||||
@ -249,7 +249,7 @@ testVirPCIDeviceDetachSingle(const void *opaque)
|
||||
if (!dev)
|
||||
goto cleanup;
|
||||
|
||||
virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
virPCIDeviceSetStubDriverType(dev, VIR_PCI_STUB_DRIVER_VFIO);
|
||||
|
||||
if (virPCIDeviceDetach(dev, NULL, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
@ -237,6 +237,8 @@ static const struct testSchemaEntry schemaDomain[] = {
|
||||
{ .dir = "tests/xml2vmxdata" },
|
||||
{ .dir = "tests/bhyveargv2xmldata" },
|
||||
{ .dir = "tests/qemuagentdata" },
|
||||
{ .dir = "tests/chxml2xmlin" },
|
||||
{ .dir = "tests/chxml2xmlout" },
|
||||
};
|
||||
|
||||
static const struct testSchemaEntry schemaDomainCaps[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user