提交 bec9b9b0 编写于 作者: S Shivaprasad G Bhat 提交者: Martin Kletzander

util: Forbid assigning a pci-bridge to a guest

Non-endpoint devices like pci-bridges cannot be assigned to guests.
Prevent such attempts.
Signed-off-by: NShivaprasad G Bhat <sbhat@linux.vnet.ibm.com>
上级 5f580d82
......@@ -532,6 +532,17 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
bool strict_acs_check = !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK);
bool usesVFIO = (virPCIDeviceGetStubDriver(pci) == VIR_PCI_STUB_DRIVER_VFIO);
struct virHostdevIsPCINodeDeviceUsedData data = { mgr, dom_name, usesVFIO };
int hdrType = -1;
if (virPCIGetHeaderType(pci, &hdrType) < 0)
goto cleanup;
if (hdrType != VIR_PCI_HEADER_ENDPOINT) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Non-endpoint PCI devices cannot be assigned "
"to guests"));
goto cleanup;
}
if (!usesVFIO && !virPCIDeviceIsAssignable(pci, strict_acs_check)) {
virReportError(VIR_ERR_OPERATION_INVALID,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册