From: Kunkun Jiang jiangkunkun@huawei.com
virt inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I46K8O CVE: NA
------------------------
Some vendor IOMMU drivers doesn't implement their own domain_get_attr callback or the processing of DOMAIN_ATTR_NESTING. Then iommu_domain_get_attr may return an error. But it shouldn't affect the result of vfio_pci_enable. We print a log to indicate the error and return 0.
Signed-off-by: Kunkun Jiang jiangkunkun@huawei.com Reviewed-by: Xinle Guo guoxinle1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/vfio/pci/vfio_pci.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index a9d25b339572..42612e193a00 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -502,8 +502,12 @@ static int vfio_pci_dma_fault_init(struct vfio_pci_device *vdev) return 0;
ret = iommu_domain_get_attr(domain, DOMAIN_ATTR_NESTING, &nested); - if (ret || !nested) - return ret; + if (ret || !nested) { + if (ret) + pr_warn("%s: Get DOMAIN_ATTR_NESTING failed: %d.\n", + __func__, ret); + return 0; + }
mutex_init(&vdev->fault_queue_lock);
@@ -592,8 +596,12 @@ static int vfio_pci_dma_fault_response_init(struct vfio_pci_device *vdev) return 0;
ret = iommu_domain_get_attr(domain, DOMAIN_ATTR_NESTING, &nested); - if (ret || !nested) - return ret; + if (ret || !nested) { + if (ret) + pr_warn("%s: Get DOMAIN_ATTR_NESTING failed: %d.\n", + __func__, ret); + return 0; + }
mutex_init(&vdev->fault_response_queue_lock);