mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
add hostdev pci backend type for xen
Add VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN. For legacy xen, it will use "pciback" as stub driver.
This commit is contained in:
parent
53aba258b2
commit
98c5c53d69
@ -3421,6 +3421,7 @@
|
||||
<choice>
|
||||
<value>kvm</value>
|
||||
<value>vfio</value>
|
||||
<value>xen</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<empty/>
|
||||
|
@ -627,7 +627,8 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysPciBackend,
|
||||
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
|
||||
"default",
|
||||
"kvm",
|
||||
"vfio")
|
||||
"vfio",
|
||||
"xen")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
||||
"storage",
|
||||
|
@ -415,6 +415,7 @@ typedef enum {
|
||||
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automaticaly, 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;
|
||||
|
@ -478,6 +478,15 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
STRNEQ(def->os.type, "hvm"))
|
||||
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
|
||||
virDomainHostdevDefPtr hostdev = dev->data.hostdev;
|
||||
|
||||
if (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_DEFAULT)
|
||||
hostdev->source.subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5544,8 +5544,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
|
||||
virBufferAddLit(&buf, "vfio-pci");
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid PCI passthrough type '%s'"),
|
||||
virDomainHostdevSubsysPciBackendTypeToString(backend));
|
||||
|
@ -205,6 +205,7 @@ qemuPrepareHostdevPCICheckSupport(virDomainHostdevDefPtr *hostdevs,
|
||||
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
||||
break;
|
||||
}
|
||||
|
@ -1199,9 +1199,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
|
||||
virProcessSetMaxMemLock(vm->pid, memKB * 1024);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
|
||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,12 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
||||
virObjectUnref(list);
|
||||
return NULL;
|
||||
}
|
||||
} else if (hostdev->source.subsys.u.pci.backend
|
||||
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
|
||||
if (virPCIDeviceSetStubDriver(dev, "pciback") < 0) {
|
||||
virObjectUnref(list);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0) {
|
||||
virObjectUnref(list);
|
||||
@ -819,6 +825,10 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
|
||||
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
|
||||
if (virPCIDeviceSetStubDriver(dev, "vfio-pci") < 0)
|
||||
goto cleanup;
|
||||
} else if (hostdev->source.subsys.u.pci.backend
|
||||
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
|
||||
if (virPCIDeviceSetStubDriver(dev, "pciback") < 0)
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0)
|
||||
goto cleanup;
|
||||
|
Loading…
x
Reference in New Issue
Block a user