From 61aa89da127d06b937710f11118a6373f17a74e5 Mon Sep 17 00:00:00 2001 From: lirui34 Date: Thu, 23 Jul 2020 13:05:10 +0800 Subject: [PATCH] HV: fix hide all sriov in ecap When VM read pre-sriov header in ECAP of ptdev, only emulate the reading if SRIOV is hidden. Write to pre-sriov header is ignored so no need to fix writting. Tracked-On: #5085 Signed-off-by: Tao Yuhong --- hypervisor/dm/vpci/vpci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index 0f0b00fa4..75154fb40 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -521,7 +521,7 @@ static int32_t read_pt_dev_cfg(const struct pci_vdev *vdev, uint32_t offset, } else if (sriovcap_access(vdev, offset)) { read_sriov_cap_reg(vdev, offset, bytes, val); } else { - if (offset == vdev->pdev->sriov.pre_pos) { + if ((offset == vdev->pdev->sriov.pre_pos) && (vdev->pdev->sriov.hide_sriov)) { *val = pci_vdev_read_vcfg(vdev, offset, bytes); } else if (!is_quirk_ptdev(vdev)) { /* passthru to physical device */