lkml.org 
[lkml]   [2019]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] iommu/vt-d: Handle hotplug devices' default identity mapping setting
From
Date
Hi

On 2/22/19 1:06 PM, Lu Baolu wrote:

> Do you mind checking this?
>
> diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> index 6ecdcf8fc8c0..f62f30bc1339 100644
> --- a/drivers/iommu/intel-iommu.c
> +++ b/drivers/iommu/intel-iommu.c
> @@ -2632,6 +2632,9 @@ static struct dmar_domain
> *find_or_alloc_domain(struct device *dev, int gaw)
>                         goto out;
>         }
>
> +       if (!iommu_should_identity_map(dev, 0))
> +               return si_domain;
> +
>         /* Allocate and initialize new domain for the device */
>         domain = alloc_domain(0);
>         if (!domain)

Oops! This can't be compiled. Please try below instead if you'd like to.
Sorry about it.

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 6ecdcf8fc8c0..b89f5ba6a3c8 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -174,6 +174,8 @@ static inline unsigned long virt_to_dma_pfn(void *p)
return page_to_dma_pfn(virt_to_page(p));
}

+static int iommu_should_identity_map(struct device *dev, int startup);
+
/* global iommu list, set NULL for ignored DMAR units */
static struct intel_iommu **g_iommus;

@@ -2632,6 +2634,9 @@ static struct dmar_domain
*find_or_alloc_domain(struct device *dev, int gaw)
goto out;
}

+ if (iommu_should_identity_map(dev, 0))
+ return si_domain;
+
/* Allocate and initialize new domain for the device */
domain = alloc_domain(0);
if (!domain)
Best regards,
Lu Baolu


\
 
 \ /
  Last update: 2019-02-22 06:36    [W:0.088 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site