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>
|
<choice>
|
||||||
<value>kvm</value>
|
<value>kvm</value>
|
||||||
<value>vfio</value>
|
<value>vfio</value>
|
||||||
|
<value>xen</value>
|
||||||
</choice>
|
</choice>
|
||||||
</attribute>
|
</attribute>
|
||||||
<empty/>
|
<empty/>
|
||||||
|
@ -627,7 +627,8 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysPciBackend,
|
|||||||
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
|
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
|
||||||
"default",
|
"default",
|
||||||
"kvm",
|
"kvm",
|
||||||
"vfio")
|
"vfio",
|
||||||
|
"xen")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
||||||
"storage",
|
"storage",
|
||||||
|
@ -415,6 +415,7 @@ typedef enum {
|
|||||||
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automaticaly, prefer VFIO */
|
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_KVM, /* force legacy kvm style */
|
||||||
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO, /* force vfio */
|
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
|
VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST
|
||||||
} virDomainHostdevSubsysPciBackendType;
|
} virDomainHostdevSubsysPciBackendType;
|
||||||
|
@ -478,6 +478,15 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
|||||||
STRNEQ(def->os.type, "hvm"))
|
STRNEQ(def->os.type, "hvm"))
|
||||||
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5544,8 +5544,7 @@ qemuBuildPCIHostdevDevStr(virDomainDefPtr def,
|
|||||||
virBufferAddLit(&buf, "vfio-pci");
|
virBufferAddLit(&buf, "vfio-pci");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
|
default:
|
||||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("invalid PCI passthrough type '%s'"),
|
_("invalid PCI passthrough type '%s'"),
|
||||||
virDomainHostdevSubsysPciBackendTypeToString(backend));
|
virDomainHostdevSubsysPciBackendTypeToString(backend));
|
||||||
|
@ -205,6 +205,7 @@ qemuPrepareHostdevPCICheckSupport(virDomainHostdevDefPtr *hostdevs,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
|
||||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1199,9 +1199,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
|
|||||||
virProcessSetMaxMemLock(vm->pid, memKB * 1024);
|
virProcessSetMaxMemLock(vm->pid, memKB * 1024);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
|
default:
|
||||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
|
|
||||||
case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,6 +170,12 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
|
|||||||
virObjectUnref(list);
|
virObjectUnref(list);
|
||||||
return NULL;
|
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 {
|
} else {
|
||||||
if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0) {
|
if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0) {
|
||||||
virObjectUnref(list);
|
virObjectUnref(list);
|
||||||
@ -819,6 +825,10 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
|
|||||||
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
|
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
|
||||||
if (virPCIDeviceSetStubDriver(dev, "vfio-pci") < 0)
|
if (virPCIDeviceSetStubDriver(dev, "vfio-pci") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
} else if (hostdev->source.subsys.u.pci.backend
|
||||||
|
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) {
|
||||||
|
if (virPCIDeviceSetStubDriver(dev, "pciback") < 0)
|
||||||
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0)
|
if (virPCIDeviceSetStubDriver(dev, "pci-stub") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user