> From: Nicolin Chen <nicol...@nvidia.com>
> Sent: Thursday, September 15, 2022 3:54 PM
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index 1f2cd43cf9bc..51ef42b1bd4e 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -4158,19 +4158,15 @@ static int prepare_domain_attach_device(struct
> iommu_domain *domain,
>               return -ENODEV;
> 
>       if (dmar_domain->force_snooping && !ecap_sc_support(iommu-
> >ecap))
> -             return -EOPNOTSUPP;
> +             return -EINVAL;
> 
>       /* check if this iommu agaw is sufficient for max mapped address */
>       addr_width = agaw_to_width(iommu->agaw);
>       if (addr_width > cap_mgaw(iommu->cap))
>               addr_width = cap_mgaw(iommu->cap);
> 
> -     if (dmar_domain->max_addr > (1LL << addr_width)) {
> -             dev_err(dev, "%s: iommu width (%d) is not "
> -                     "sufficient for the mapped address (%llx)\n",
> -                     __func__, addr_width, dmar_domain->max_addr);
> -             return -EFAULT;
> -     }
> +     if (dmar_domain->max_addr > (1LL << addr_width))
> +             return -EINVAL;
>       dmar_domain->gaw = addr_width;
> 
>       /*

Above lacks of a conversion in intel-iommu:

intel_iommu_attach_device()
        if (domain->type == IOMMU_DOMAIN_UNMANAGED &&
            device_is_rmrr_locked(dev)) {
                dev_warn(dev, "Device is ineligible for IOMMU domain attach due 
to platform RMRR requirement.  Contact your platform vendor.\n");
                return -EPERM;
        }

since it's based on the domain type, picking a different domain
may work in theory though it won't apply to vfio which always
creates unmanaged type.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to