mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-27 03:33:19 +00:00
hv: the VM can only deinit its own devices
VM needs to check if it owns this device before deiniting it. Tracked-On: #4433 Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -207,8 +207,9 @@ static void enable_vfs(struct pci_vdev *pf_vdev)
|
||||
create_vf(pf_vdev, vf_bdf, idx);
|
||||
} else {
|
||||
/* Re-activate a zombie VF */
|
||||
if (vf_vdev->vpci == NULL) {
|
||||
if (is_zombie_vf(vf_vdev)) {
|
||||
vf_vdev->vpci = pf_vdev->vpci;
|
||||
vf_vdev->vdev_ops->init_vdev(vf_vdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,8 +251,9 @@ static void disable_vfs(struct pci_vdev *pf_vdev)
|
||||
bdf.fields.bus = get_vf_bus(pf_vdev, first, stride, idx);
|
||||
bdf.fields.devfun = get_vf_devfun(pf_vdev, first, stride, idx);
|
||||
vf_vdev = pci_find_vdev(&pf_vdev->vpci->vm->vpci, bdf);
|
||||
if (vf_vdev != NULL) {
|
||||
if ((vf_vdev != NULL) && (!is_zombie_vf(vf_vdev))) {
|
||||
/* set disabled VF as zombie vdev instance */
|
||||
vf_vdev->vdev_ops->deinit_vdev(vf_vdev);
|
||||
vf_vdev->vpci = NULL;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user