From: Alvaro Karsz Date: Thu, 2 Feb 2023 08:42:12 +0000 (+0200) Subject: vhost-vdpa: print warning when vhost_vdpa_alloc_domain fails X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6830a6aba9d40f1491f991d7b31bb2b90187111c;p=linux.git vhost-vdpa: print warning when vhost_vdpa_alloc_domain fails 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 error: Failed to start domain error: Unable to open '/dev/vhost-vdpa-' for vdpa device: Unknown error 524 Suggested-by: Eugenio Perez Martin Signed-off-by: Alvaro Karsz Message-Id: <20230202084212.1328530-1-alvaro.karsz@solid-run.com> Signed-off-by: Michael S. Tsirkin Acked-by: Eugenio Pérez Martin --- diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 23db92388393f..135f8aa70fb2d 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -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)