hv: implement SRIOV VF_BAR initialization

All SRIOV VF physical devices don't have bars in configuration space,
they are from the VF associated PF's VF_BAR registers of SRIOV capability.

Adding a vbars data structure in pci_cap_sriov data structure to store
SRIOV VF_BAR information, so that each VF bars can be initialized directly
through the vbars instead multiple accessing of the PF VF_BAR registers.

Tracked-On: #4433

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yuan Liu
2020-02-28 21:49:25 +08:00
committed by wenlingz
parent 298ef2f5c4
commit abbdef4f5d
6 changed files with 68 additions and 20 deletions

View File

@@ -74,8 +74,7 @@ static bool is_vf_enabled(const struct pci_vdev *pf_vdev)
*/
static void init_sriov_vf_bar(struct pci_vdev *pf_vdev)
{
/* Implementation in next patch */
(void)pf_vdev;
init_vdev_pt(pf_vdev, true);
}
/**
@@ -234,3 +233,12 @@ void write_sriov_cap_reg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes,
pci_pdev_write_cfg(vdev->pdev->bdf, offset, bytes, val);
}
}
/**
* @pre vdev != NULL
*/
uint32_t sriov_bar_offset(const struct pci_vdev *vdev, uint32_t bar_idx)
{
return (vdev->sriov.capoff + PCIR_SRIOV_VF_BAR_OFF + (bar_idx << 2U));
}