hv: vpci: split vPCI device from SOS for post-launched VM

When assgined a PCI PTDev to post-launched VM from SOS, using a pointer to point to
the real struct pci_vdev. When post-launched VM access its PTDev configure space in
SOS address space, using this real struct pci_vdev.

Tracked-On: #3475
Signed-off-by: Li, Fei1 <fei1.li@intel.com>
This commit is contained in:
Li, Fei1
2019-08-09 22:16:50 +08:00
committed by wenlingz
parent 13de9a4cf6
commit 90480db553
5 changed files with 34 additions and 56 deletions

View File

@@ -74,7 +74,7 @@ void pci_vdev_write_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes,
* @pre vpci != NULL
* @pre vpci->pci_vdev_cnt <= CONFIG_MAX_PCI_DEV_NUM
*/
struct pci_vdev *pci_find_vdev_by_vbdf(const struct acrn_vpci *vpci, union pci_bdf vbdf)
struct pci_vdev *pci_find_vdev(const struct acrn_vpci *vpci, union pci_bdf vbdf)
{
struct pci_vdev *vdev, *tmp;
uint32_t i;
@@ -91,25 +91,3 @@ struct pci_vdev *pci_find_vdev_by_vbdf(const struct acrn_vpci *vpci, union pci_b
return vdev;
}
/**
* @pre vpci != NULL
* @pre vpci->pci_vdev_cnt <= CONFIG_MAX_PCI_DEV_NUM
*/
struct pci_vdev *pci_find_vdev_by_pbdf(const struct acrn_vpci *vpci, union pci_bdf pbdf)
{
struct pci_vdev *vdev, *tmp;
uint32_t i;
vdev = NULL;
for (i = 0U; i < vpci->pci_vdev_cnt; i++) {
tmp = (struct pci_vdev *)&(vpci->pci_vdevs[i]);
if ((tmp->pdev != NULL) && bdf_is_equal((union pci_bdf *)&(tmp->pdev->bdf), &pbdf)) {
vdev = tmp;
break;
}
}
return vdev;
}