hv: vpci: remove vm structure pointer from vpci

We could use container_of to get vm structure pointer from vpci. So vm
structure pointer is no need in vpci structure.

Tracked-On: #4550
Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
Li Fei1
2020-03-30 13:32:27 +08:00
committed by wenlingz
parent a7768fdb6a
commit 0a7770cbb7
8 changed files with 46 additions and 39 deletions

View File

@@ -96,7 +96,7 @@ static void create_vf(struct pci_vdev *pf_vdev, union pci_bdf vf_bdf, uint16_t v
dev_cfg = init_one_dev_config(vf_pdev);
if (dev_cfg != NULL) {
vf_vdev = vpci_init_vdev(&pf_vdev->vpci->vm->vpci, dev_cfg, pf_vdev);
vf_vdev = vpci_init_vdev(&vpci2vm(pf_vdev->vpci)->vpci, dev_cfg, pf_vdev);
}
}
@@ -202,7 +202,7 @@ static void enable_vfs(struct pci_vdev *pf_vdev)
* The VF maybe have already existed but it is a zombie instance that vf_vdev->vpci
* is NULL, in this case, we need to make the vf_vdev available again in here.
*/
vf_vdev = pci_find_vdev(&pf_vdev->vpci->vm->vpci, vf_bdf);
vf_vdev = pci_find_vdev(&vpci2vm(pf_vdev->vpci)->vpci, vf_bdf);
if (vf_vdev == NULL) {
create_vf(pf_vdev, vf_bdf, idx);
} else {
@@ -248,7 +248,7 @@ 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);
vf_vdev = pci_find_vdev(&vpci2vm(pf_vdev->vpci)->vpci, bdf);
if ((vf_vdev != NULL) && (!is_zombie_vf(vf_vdev))) {
/* set disabled VF as zombie vdev instance */
vf_vdev->vdev_ops->deinit_vdev(vf_vdev);