VFIO failed to initialize IOMMU mapping because IOMMU width (48) is not sufficient?

0

I am trying to enable VFIO in Ubuntu 18.10 64-bit system (kernel 4.18) but it failed at intel_iommu_map() with error 'IOMMU width (48) is not sufficient for the mapped address'.

static int intel_iommu_map(struct iommu_domain *domain,
               unsigned long iova, phys_addr_t hpa,
               size_t size, int iommu_prot)
{
    .......
    max_addr = iova + size;
    if (dmar_domain->max_addr < max_addr) {
        u64 end;

        /* check if minimum agaw is sufficient for mapped address */
        end = __DOMAIN_MAX_ADDR(dmar_domain->gaw) + 1;
        if (end < max_addr) {
            pr_err("%s: iommu width (%d) is not "
                   "sufficient for the mapped address (%llx)\n",
                   __func__, dmar_domain->gaw, max_addr);
            return -EFAULT;
        }
        dmar_domain->max_addr = max_addr;
    }

    .......
}

I have added debug message to print max_addr, iova and size, looks like VFIO is trying to find the minimum IOMMU address length by doubling iova until it verifies the longest width (48) fails.

[intel_iommu_map] max_addr (0x200001000 ) | iova (0x20000000) | size (0x1000)
[intel_iommu_map] end (0x1000000000000)
[intel_iommu_unmap]
[intel_iommu_map] max_addr (0x400001000 ) | iova (0x40000000) | size (0x1000)
[intel_iommu_map] end (0x1000000000000)
[intel_iommu_unmap]
[intel_iommu_map] max_addr (0x800001000 ) | iova (0x80000000) | size (0x1000)
[intel_iommu_unmap]
[intel_iommu_map] max_addr (0x1000001000 ) | iova (0x100000000) | size (0x1000)
[intel_iommu_map] end (0x1000000000000)
[intel_iommu_unmap]
.......
[intel_iommu_map] max_addr (0x1000000001000) | iova (0x1000000000000) | size (0x1000)
[intel_iommu_map] end iommu width (48) is not sufficient for the mapped address (0x1000000001000)

Is anyway I can limit the mapped address within 48 bits to fix in the iommu width limit?

linux-kernel
vfio
asked on Stack Overflow Apr 19, 2019 by keye • edited Apr 19, 2019 by keye

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0