mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
qemu_domain_address.c: turn qemuDomainFillDeviceIsolationGroup to void
Starting on commit1f43393283
, qemuDomainFillDeviceIsolationGroup() returns 0 in all circunstances. Let's turn it to 'void' make it clearer that the function will not fail. This also spares a check for < 0 return in qemu_hotplug.c. The qemuDomainFillDeviceIsolationGroupIter() callback now returns 0 at all times - which is already happening anyway. Refer to1f43393283
commit message for more details on why the function was changed to never return an error. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
02ad5d2359
commit
4427903722
@ -1249,10 +1249,8 @@ qemuDomainFindUnusedIsolationGroup(virDomainDefPtr def)
|
|||||||
* @dev: device definition
|
* @dev: device definition
|
||||||
*
|
*
|
||||||
* Fill isolation group information for a single device.
|
* Fill isolation group information for a single device.
|
||||||
*
|
*/
|
||||||
* Return: 0 on success, <0 on failure
|
void
|
||||||
* */
|
|
||||||
int
|
|
||||||
qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||||
virDomainDeviceDefPtr dev)
|
virDomainDeviceDefPtr dev)
|
||||||
{
|
{
|
||||||
@ -1270,7 +1268,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
/* Only PCI host devices are subject to isolation */
|
/* Only PCI host devices are subject to isolation */
|
||||||
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) {
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostAddr = &hostdev->source.subsys.u.pci.addr;
|
hostAddr = &hostdev->source.subsys.u.pci.addr;
|
||||||
@ -1278,7 +1276,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
/* If a non-default isolation has already been assigned to the
|
/* If a non-default isolation has already been assigned to the
|
||||||
* device, we can avoid looking up the information again */
|
* device, we can avoid looking up the information again */
|
||||||
if (info->isolationGroup > 0)
|
if (info->isolationGroup > 0)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
/* The isolation group depends on the IOMMU group assigned by the host */
|
/* The isolation group depends on the IOMMU group assigned by the host */
|
||||||
tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr);
|
tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr);
|
||||||
@ -1288,7 +1286,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
"%04x:%02x:%02x.%x, device won't be isolated",
|
"%04x:%02x:%02x.%x, device won't be isolated",
|
||||||
hostAddr->domain, hostAddr->bus,
|
hostAddr->domain, hostAddr->bus,
|
||||||
hostAddr->slot, hostAddr->function);
|
hostAddr->slot, hostAddr->function);
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The isolation group for a host device is its IOMMU group,
|
/* The isolation group for a host device is its IOMMU group,
|
||||||
@ -1314,13 +1312,13 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
* require us to isolate the guest device, so we can skip them */
|
* require us to isolate the guest device, so we can skip them */
|
||||||
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK ||
|
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||||
virDomainNetResolveActualType(iface) != VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
virDomainNetResolveActualType(iface) != VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a non-default isolation has already been assigned to the
|
/* If a non-default isolation has already been assigned to the
|
||||||
* device, we can avoid looking up the information again */
|
* device, we can avoid looking up the information again */
|
||||||
if (info->isolationGroup > 0)
|
if (info->isolationGroup > 0)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
/* Obtain a synthetic isolation group for the device, since at this
|
/* Obtain a synthetic isolation group for the device, since at this
|
||||||
* point in time we don't have access to the IOMMU group of the host
|
* point in time we don't have access to the IOMMU group of the host
|
||||||
@ -1332,7 +1330,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
"configured to use hostdev-backed network '%s', "
|
"configured to use hostdev-backed network '%s', "
|
||||||
"device won't be isolated",
|
"device won't be isolated",
|
||||||
iface->data.network.name);
|
iface->data.network.name);
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->isolationGroup = tmp;
|
info->isolationGroup = tmp;
|
||||||
@ -1341,8 +1339,6 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
"hostdev-backed network '%s' is %u",
|
"hostdev-backed network '%s' is %u",
|
||||||
iface->data.network.name, info->isolationGroup);
|
iface->data.network.name, info->isolationGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1364,7 +1360,9 @@ qemuDomainFillDeviceIsolationGroupIter(virDomainDefPtr def,
|
|||||||
virDomainDeviceInfoPtr info G_GNUC_UNUSED,
|
virDomainDeviceInfoPtr info G_GNUC_UNUSED,
|
||||||
void *opaque G_GNUC_UNUSED)
|
void *opaque G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
return qemuDomainFillDeviceIsolationGroup(def, dev);
|
qemuDomainFillDeviceIsolationGroup(def, dev);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ int qemuDomainEnsurePCIAddress(virDomainObjPtr obj,
|
|||||||
virQEMUDriverPtr driver)
|
virQEMUDriverPtr driver)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||||
|
|
||||||
int qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
void qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||||
virDomainDeviceDefPtr dev)
|
virDomainDeviceDefPtr dev)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
|
@ -1598,11 +1598,9 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
|
|||||||
if (qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1) < 0)
|
if (qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (qemuDomainIsPSeries(vm->def)) {
|
if (qemuDomainIsPSeries(vm->def))
|
||||||
/* Isolation groups are only relevant for pSeries guests */
|
/* Isolation groups are only relevant for pSeries guests */
|
||||||
if (qemuDomainFillDeviceIsolationGroup(vm->def, &dev) < 0)
|
qemuDomainFillDeviceIsolationGroup(vm->def, &dev);
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
|
if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user