lkml.org 
[lkml]   [2020]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] iommu/intel-iommu: set as DUMMY_DEVICE_DOMAIN_INFO if no IOMMU
From
Date
Hi,

On 2020/2/3 17:10, Jian-Hong Pan wrote:
> If the device has no IOMMU, it still invokes iommu_need_mapping during
> intel_alloc_coherent. However, iommu_need_mapping can only check the
> device is DUMMY_DEVICE_DOMAIN_INFO or not. This patch marks the device
> is a DUMMY_DEVICE_DOMAIN_INFO if the device has no IOMMU.
>
> Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
> ---
> drivers/iommu/intel-iommu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index 35a4a3abedc6..878bc986a015 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -5612,8 +5612,10 @@ static int intel_iommu_add_device(struct device *dev)
> int ret;
>
> iommu = device_to_iommu(dev, &bus, &devfn);
> - if (!iommu)
> + if (!iommu) {
> + dev->archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;

Is this a DMA capable device? I am afraid some real bugs might be
covered up if we marking the device as IOMMU dummy here.

Best regards,
baolu

> return -ENODEV;
> + }
>
> iommu_device_link(&iommu->iommu, dev);
>
>

\
 
 \ /
  Last update: 2020-02-04 07:12    [W:0.079 / U:0.988 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site