From 7b429fe4833017d6b78330604847d47909782558 Mon Sep 17 00:00:00 2001 From: Yuan Liu Date: Wed, 26 Feb 2020 11:20:53 +0800 Subject: [PATCH] hv: prohibit PF from being assigned We didn't support SR-IOV capability of PF in UOS for now, we should hide the SR-IOV capability if we pass through the PF to a UOS. For now, we don't support assignment of PF to a UOS. Tracked-On: #4433 Signed-off-by: Yuan Liu Acked-by: Eddie Dong --- hypervisor/dm/vpci/vpci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index c1a35cc2d..48b1e9cfe 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -710,7 +710,13 @@ int32_t vpci_assign_pcidev(struct acrn_vm *tgt_vm, struct acrn_assign_pcidev *pc sos_vm = get_sos_vm(); spinlock_obtain(&sos_vm->vpci.lock); vdev_in_sos = pci_find_vdev(&sos_vm->vpci, bdf); - if ((vdev_in_sos != NULL) && (vdev_in_sos->vpci->vm == sos_vm) && (vdev_in_sos->pdev != NULL)) { + /* + * TODO We didn't support SR-IOV capability of PF in UOS for now, we should + * hide the SR-IOV capability if we pass through the PF to a UOS. + * + * For now, we don't support assignment of PF to a UOS. + */ + if ((vdev_in_sos != NULL) && (vdev_in_sos->vpci->vm == sos_vm) && (vdev_in_sos->pdev != NULL) && (!has_sriov_cap(vdev_in_sos))) { /* ToDo: Each PT device must support one type reset */ if (!vdev_in_sos->pdev->has_pm_reset && !vdev_in_sos->pdev->has_flr && !vdev_in_sos->pdev->has_af_flr) {