hv: add SRIOV capability read/write entries

Introduce SRIOV capability field for pci_vdev and add SRIOV capability
interception entries.

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-20 09:05:17 +08:00
committed by wenlingz
parent 5e989f13c6
commit 14931d11e0
5 changed files with 97 additions and 0 deletions

View File

@@ -101,6 +101,22 @@ static inline bool msixcap_access(const struct pci_vdev *vdev, uint32_t offset)
return (has_msix_cap(vdev) && in_range(offset, vdev->msix.capoff, vdev->msix.caplen));
}
/*
* @pre vdev != NULL
*/
static inline bool has_sriov_cap(const struct pci_vdev *vdev)
{
return (vdev->sriov.capoff != 0U);
}
/*
* @pre vdev != NULL
*/
static inline bool sriovcap_access(const struct pci_vdev *vdev, uint32_t offset)
{
return (has_sriov_cap(vdev) && in_range(offset, vdev->sriov.capoff, vdev->sriov.caplen));
}
/**
* @pre vdev != NULL
*/
@@ -140,6 +156,10 @@ void vmsix_read_cfg(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes
void vmsix_write_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
void deinit_vmsix(const struct pci_vdev *vdev);
void init_vsriov(struct pci_vdev *vdev);
void read_sriov_cap_reg(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
void write_sriov_cap_reg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
uint32_t pci_vdev_read_cfg(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes);
void pci_vdev_write_cfg(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);