vhost-vdpa: print warning when vhost_vdpa_alloc_domain fails
authorAlvaro Karsz <alvaro.karsz@solid-run.com>
Thu, 2 Feb 2023 08:42:12 +0000 (10:42 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 21 Feb 2023 00:26:59 +0000 (19:26 -0500)
Add a print explaining why vhost_vdpa_alloc_domain failed if the device
is not IOMMU cache coherent capable.

Without this print, we have no hint why the operation failed.

For example:

$ virsh start <domain>
error: Failed to start domain <domain>
error: Unable to open '/dev/vhost-vdpa-<idx>' for vdpa device:
       Unknown error 524

Suggested-by: Eugenio Perez Martin <eperezma@redhat.com>
Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
Message-Id: <20230202084212.1328530-1-alvaro.karsz@solid-run.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eugenio PĂ©rez Martin <eperezma@redhat.com>
drivers/vhost/vdpa.c

index 23db92388393fbfec3c6b7103b5f1ce67c2c08e5..135f8aa70fb2dc437396eb005c5f63a2624a4f66 100644 (file)
@@ -1151,8 +1151,11 @@ static int vhost_vdpa_alloc_domain(struct vhost_vdpa *v)
        if (!bus)
                return -EFAULT;
 
-       if (!device_iommu_capable(dma_dev, IOMMU_CAP_CACHE_COHERENCY))
+       if (!device_iommu_capable(dma_dev, IOMMU_CAP_CACHE_COHERENCY)) {
+               dev_warn_once(&v->dev,
+                             "Failed to allocate domain, device is not IOMMU cache coherent capable\n");
                return -ENOTSUPP;
+       }
 
        v->domain = iommu_domain_alloc(bus);
        if (!v->domain)