Skip to contentSkip to conversation

Convert the intel iommu driver to the dma-iommu api

PATCH Superseded Lu Baolu 5 participants 23 messages Sep 12, 2020 – Sep 24, 2020

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH v3 1/6 iommu: Handle freelists when using deferred flushing in iommu drivers

In reply to Lu Baolu

From: Tom Murphy <[email protected]>

Allow the iommu_unmap_fast to return newly freed page table pages and pass the freelist to queue_iova in the dma-iommu ops path.

This is useful for iommu drivers (in this case the intel iommu driver) which need to wait for the ioTLB to be flushed before newly free/unmapped page table pages can be freed. This way we can still batch ioTLB free operations and handle the freelists.

---
 drivers/iommu/dma-iommu.c   | 30 ++++++++++++++------
 drivers/iommu/intel/iommu.c | 55 ++++++++++++++++++++++++-------------
 include/linux/iommu.h       |  1 +
 3 files changed, 59 insertions(+), 27 deletions(-)
drivers/iommu/dma-iommu.c +22 -8
index 5141d49a046b..82c071b2d5c8 100644
@@ -50,6 +50,18 @@ struct iommu_dma_cookie {
 	struct iommu_domain		*fq_domain;
 };
 
+static void iommu_dma_entry_dtor(unsigned long data)
+{
+	struct page *freelist = (struct page *)data;
+
+	while (freelist) {
+		unsigned long p = (unsigned long)page_address(freelist);
+
+		freelist = freelist->freelist;
+		free_page(p);
+	}
+}
+
 static inline size_t cookie_msi_granule(struct iommu_dma_cookie *cookie)
 {
 	if (cookie->type == IOMMU_DMA_IOVA_COOKIE)
@@ -344,7 +356,8 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
 	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
 			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
 		cookie->fq_domain = domain;
-		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
+		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
+				      iommu_dma_entry_dtor);
 	}
 
 	if (!dev)
@@ -438,7 +451,7 @@ static dma_addr_t iommu_dma_alloc_iova(struct iommu_domain *domain,
 }
 
 static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie,
-		dma_addr_t iova, size_t size)
+		dma_addr_t iova, size_t size, struct page *freelist)
 {
 	struct iova_domain *iovad = &cookie->iovad;
 
@@ -447,7 +460,8 @@ static void iommu_dma_free_iova(struct iommu_dma_cookie *cookie,
 		cookie->msi_iova -= size;
 	else if (cookie->fq_domain)	/* non-strict mode */
 		queue_iova(iovad, iova_pfn(iovad, iova),
-				size >> iova_shift(iovad), 0);
+				size >> iova_shift(iovad),
+				(unsigned long)freelist);
 	else
 		free_iova_fast(iovad, iova_pfn(iovad, iova),
 				size >> iova_shift(iovad));
@@ -472,7 +486,7 @@ static void __iommu_dma_unmap(struct device *dev, dma_addr_t dma_addr,
 
 	if (!cookie->fq_domain)
 		iommu_tlb_sync(domain, &iotlb_gather);
-	iommu_dma_free_iova(cookie, dma_addr, size);
+	iommu_dma_free_iova(cookie, dma_addr, size, iotlb_gather.freelist);
 }
 
 static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
@@ -494,7 +508,7 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
 		return DMA_MAPPING_ERROR;
 
 	if (iommu_map_atomic(domain, iova, phys - iova_off, size, prot)) {
-		iommu_dma_free_iova(cookie, iova, size);
+		iommu_dma_free_iova(cookie, iova, size, NULL);
 		return DMA_MAPPING_ERROR;
 	}
 	return iova + iova_off;
@@ -649,7 +663,7 @@ static void *iommu_dma_alloc_remap(struct device *dev, size_t size,
 out_free_sg:
 	sg_free_table(&sgt);
 out_free_iova:
-	iommu_dma_free_iova(cookie, iova, size);
+	iommu_dma_free_iova(cookie, iova, size, NULL);
 out_free_pages:
 	__iommu_dma_free_pages(pages, count);
 	return NULL;
@@ -900,7 +914,7 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
 	return __finalise_sg(dev, sg, nents, iova);
 
 out_free_iova:
-	iommu_dma_free_iova(cookie, iova, iova_len);
+	iommu_dma_free_iova(cookie, iova, iova_len, NULL);
 out_restore_sg:
 	__invalidate_sg(sg, nents);
 	return 0;
@@ -1194,7 +1208,7 @@ static struct iommu_dma_msi_page *iommu_dma_get_msi_page(struct device *dev,
 	return msi_page;
 
 out_free_iova:
-	iommu_dma_free_iova(cookie, iova, size);
+	iommu_dma_free_iova(cookie, iova, size, NULL);
 out_free_page:
 	kfree(msi_page);
 	return NULL;
drivers/iommu/intel/iommu.c +36 -19

112 lines not on this page · raw message

include/linux/iommu.h +1 -0
index fee209efb756..f0d56360a976 100644
@@ -180,6 +180,7 @@ struct iommu_iotlb_gather {
 	unsigned long		start;
 	unsigned long		end;
 	size_t			pgsize;
+	struct page		*freelist;
 };
 
 /**
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Lu Baolu

author maintainer
#0 lore raw

v3 cover Convert the intel iommu driver to the dma-iommu api

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

Please review and test.

Best regards,
baolu

Lu Baolu (2):
iommu: Add quirk for Intel graphic devices in map_sg iommu/vt-d: Cleanup after converting to dma-iommu ops

Tom Murphy (4):
iommu: Handle freelists when using deferred flushing in iommu drivers
iommu: Add iommu_dma_free_cpu_cached_iovas()
iommu: Allow the dma-iommu api to use bounce buffers iommu/vt-d: Convert intel iommu driver to the iommu ops

 .../admin-guide/kernel-parameters.txt         |   5 -
 drivers/iommu/dma-iommu.c                     | 229 ++++-
 drivers/iommu/intel/Kconfig                   |   1 +
 drivers/iommu/intel/iommu.c                   | 885 +++---------------
 include/linux/dma-iommu.h                     |   8 +
 include/linux/iommu.h                         |   1 +
 6 files changed, 323 insertions(+), 806 deletions(-)
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#2 lore raw

PATCH v3 2/6 iommu: Add iommu_dma_free_cpu_cached_iovas()

From: Tom Murphy <[email protected]>

Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which use the dma-iommu ops to free cached cpu iovas.

---
 drivers/iommu/dma-iommu.c | 9 +++++++++
 include/linux/dma-iommu.h | 8 ++++++++
 2 files changed, 17 insertions(+)
drivers/iommu/dma-iommu.c +9 -0
index 82c071b2d5c8..d06411bd5e08 100644
@@ -50,6 +50,15 @@ struct iommu_dma_cookie {
 	struct iommu_domain		*fq_domain;
 };
 
+void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+		struct iommu_domain *domain)
+{
+	struct iommu_dma_cookie *cookie = domain->iova_cookie;
+	struct iova_domain *iovad = &cookie->iovad;
+
+	free_cpu_cached_iovas(cpu, iovad);
+}
+
 static void iommu_dma_entry_dtor(unsigned long data)
 {
 	struct page *freelist = (struct page *)data;
include/linux/dma-iommu.h +8 -0
index 2112f21f73d8..706b68d1359b 100644
@@ -37,6 +37,9 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc,
 
 void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
 
+void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+		struct iommu_domain *domain);
+
 #else /* CONFIG_IOMMU_DMA */
 
 struct iommu_domain;
@@ -78,5 +81,10 @@ static inline void iommu_dma_get_resv_regions(struct device *dev, struct list_he
 {
 }
 
+static inline void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+		struct iommu_domain *domain)
+{
+}
+
 #endif	/* CONFIG_IOMMU_DMA */
 #endif	/* __DMA_IOMMU_H */
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#3 lore raw

PATCH v3 3/6 iommu: Allow the dma-iommu api to use bounce buffers

In reply to Lu Baolu

From: Tom Murphy <[email protected]>

Allow the dma-iommu api to use bounce buffers for untrusted devices. This is a copy of the intel bounce buffer code.

---
 drivers/iommu/dma-iommu.c | 163 +++++++++++++++++++++++++++++++++++---
 1 file changed, 150 insertions(+), 13 deletions(-)
drivers/iommu/dma-iommu.c +150 -13
index d06411bd5e08..1a1da22e5a5e 100644
@@ -21,9 +21,11 @@
 #include <linux/mm.h>
 #include <linux/mutex.h>
 #include <linux/pci.h>
+#include <linux/swiotlb.h>
 #include <linux/scatterlist.h>
 #include <linux/vmalloc.h>
 #include <linux/crash_dump.h>
+#include <linux/dma-direct.h>
 
 struct iommu_dma_msi_page {
 	struct list_head	list;
@@ -498,6 +500,31 @@ static void __iommu_dma_unmap(struct device *dev, dma_addr_t dma_addr,
 	iommu_dma_free_iova(cookie, dma_addr, size, iotlb_gather.freelist);
 }
 
+static void __iommu_dma_unmap_swiotlb(struct device *dev, dma_addr_t dma_addr,
+		size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	struct iommu_domain *domain = iommu_get_dma_domain(dev);
+	struct iommu_dma_cookie *cookie = domain->iova_cookie;
+	struct iova_domain *iovad = &cookie->iovad;
+	phys_addr_t phys;
+
+	phys = iommu_iova_to_phys(domain, dma_addr);
+	if (WARN_ON(!phys))
+		return;
+
+	__iommu_dma_unmap(dev, dma_addr, size);
+
+	if (unlikely(is_swiotlb_buffer(phys)))
+		swiotlb_tbl_unmap_single(dev, phys, size,
+				iova_align(iovad, size), dir, attrs);
+}
+
+static bool dev_is_untrusted(struct device *dev)
+{
+	return dev_is_pci(dev) && to_pci_dev(dev)->untrusted;
+}
+
 static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
 		size_t size, int prot, u64 dma_mask)
 {
@@ -523,6 +550,55 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
 	return iova + iova_off;
 }
 
+static dma_addr_t __iommu_dma_map_swiotlb(struct device *dev, phys_addr_t phys,
+		size_t org_size, dma_addr_t dma_mask, bool coherent,
+		enum dma_data_direction dir, unsigned long attrs)
+{
+	int prot = dma_info_to_prot(dir, coherent, attrs);
+	struct iommu_domain *domain = iommu_get_dma_domain(dev);
+	struct iommu_dma_cookie *cookie = domain->iova_cookie;
+	struct iova_domain *iovad = &cookie->iovad;
+	size_t aligned_size = org_size;
+	void *padding_start;
+	size_t padding_size;
+	dma_addr_t iova;
+
+	/*
+	 * If both the physical buffer start address and size are
+	 * page aligned, we don't need to use a bounce page.
+	 */
+	if (IS_ENABLED(CONFIG_SWIOTLB) && dev_is_untrusted(dev) &&
+	    iova_offset(iovad, phys | org_size)) {
+		aligned_size = iova_align(iovad, org_size);
+		phys = swiotlb_tbl_map_single(dev,
+				__phys_to_dma(dev, io_tlb_start),
+				phys, org_size, aligned_size, dir, attrs);
+
+		if (phys == DMA_MAPPING_ERROR)
+			return DMA_MAPPING_ERROR;
+
+		/* Cleanup the padding area. */
+		padding_start = phys_to_virt(phys);
+		padding_size = aligned_size;
+
+		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
+		    (dir == DMA_TO_DEVICE ||
+		     dir == DMA_BIDIRECTIONAL)) {
+			padding_start += org_size;
+			padding_size -= org_size;
+		}
+
+		memset(padding_start, 0, padding_size);
+	}
+
+	iova = __iommu_dma_map(dev, phys, aligned_size, prot, dma_mask);
+	if ((iova == DMA_MAPPING_ERROR) && is_swiotlb_buffer(phys))
+		swiotlb_tbl_unmap_single(dev, phys, org_size,
+				aligned_size, dir, attrs);
+
+	return iova;
+}
+
 static void __iommu_dma_free_pages(struct page **pages, int count)
 {
 	while (count--)
@@ -698,11 +774,15 @@ static void iommu_dma_sync_single_for_cpu(struct device *dev,
 {
 	phys_addr_t phys;
 
-	if (dev_is_dma_coherent(dev))
+	if (dev_is_dma_coherent(dev) && !dev_is_untrusted(dev))
 		return;
 
 	phys = iommu_iova_to_phys(iommu_get_dma_domain(dev), dma_handle);
-	arch_sync_dma_for_cpu(phys, size, dir);
+	if (!dev_is_dma_coherent(dev))
+		arch_sync_dma_for_cpu(phys, size, dir);
+
+	if (is_swiotlb_buffer(phys))
+		swiotlb_tbl_sync_single(dev, phys, size, dir, SYNC_FOR_CPU);
 }
 
 static void iommu_dma_sync_single_for_device(struct device *dev,
@@ -710,11 +790,15 @@ static void iommu_dma_sync_single_for_device(struct device *dev,
 {
 	phys_addr_t phys;
 
-	if (dev_is_dma_coherent(dev))
+	if (dev_is_dma_coherent(dev) && !dev_is_untrusted(dev))
 		return;
 
 	phys = iommu_iova_to_phys(iommu_get_dma_domain(dev), dma_handle);
-	arch_sync_dma_for_device(phys, size, dir);
+	if (is_swiotlb_buffer(phys))
+		swiotlb_tbl_sync_single(dev, phys, size, dir, SYNC_FOR_DEVICE);
+
+	if (!dev_is_dma_coherent(dev))
+		arch_sync_dma_for_device(phys, size, dir);
 }
 
 static void iommu_dma_sync_sg_for_cpu(struct device *dev,
@@ -724,11 +808,17 @@ static void iommu_dma_sync_sg_for_cpu(struct device *dev,
 	struct scatterlist *sg;
 	int i;
 
-	if (dev_is_dma_coherent(dev))
+	if (dev_is_dma_coherent(dev) && !dev_is_untrusted(dev))
 		return;
 
-	for_each_sg(sgl, sg, nelems, i)
-		arch_sync_dma_for_cpu(sg_phys(sg), sg->length, dir);
+	for_each_sg(sgl, sg, nelems, i) {
+		if (!dev_is_dma_coherent(dev))
+			arch_sync_dma_for_cpu(sg_phys(sg), sg->length, dir);
+
+		if (is_swiotlb_buffer(sg_phys(sg)))
+			swiotlb_tbl_sync_single(dev, sg_phys(sg), sg->length,
+						dir, SYNC_FOR_CPU);
+	}
 }
 
 static void iommu_dma_sync_sg_for_device(struct device *dev,
@@ -738,11 +828,17 @@ static void iommu_dma_sync_sg_for_device(struct device *dev,
 	struct scatterlist *sg;
 	int i;
 
-	if (dev_is_dma_coherent(dev))
+	if (dev_is_dma_coherent(dev) && !dev_is_untrusted(dev))
 		return;
 
-	for_each_sg(sgl, sg, nelems, i)
-		arch_sync_dma_for_device(sg_phys(sg), sg->length, dir);
+	for_each_sg(sgl, sg, nelems, i) {
+		if (is_swiotlb_buffer(sg_phys(sg)))
+			swiotlb_tbl_sync_single(dev, sg_phys(sg), sg->length,
+						dir, SYNC_FOR_DEVICE);
+
+		if (!dev_is_dma_coherent(dev))
+			arch_sync_dma_for_device(sg_phys(sg), sg->length, dir);
+	}
 }
 
 static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
@@ -751,10 +847,10 @@ static dma_addr_t iommu_dma_map_page(struct device *dev, struct page *page,
 {
 	phys_addr_t phys = page_to_phys(page) + offset;
 	bool coherent = dev_is_dma_coherent(dev);
-	int prot = dma_info_to_prot(dir, coherent, attrs);
 	dma_addr_t dma_handle;
 
-	dma_handle = __iommu_dma_map(dev, phys, size, prot, dma_get_mask(dev));
+	dma_handle = __iommu_dma_map_swiotlb(dev, phys, size, dma_get_mask(dev),
+			coherent, dir, attrs);
 	if (!coherent && !(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
 	    dma_handle != DMA_MAPPING_ERROR)
 		arch_sync_dma_for_device(phys, size, dir);
@@ -766,7 +862,7 @@ static void iommu_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
 {
 	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
 		iommu_dma_sync_single_for_cpu(dev, dma_handle, size, dir);
-	__iommu_dma_unmap(dev, dma_handle, size);
+	__iommu_dma_unmap_swiotlb(dev, dma_handle, size, dir, attrs);
 }
 
 /*
@@ -844,6 +940,39 @@ static void __invalidate_sg(struct scatterlist *sg, int nents)
 	}
 }
 
+static void iommu_dma_unmap_sg_swiotlb(struct device *dev, struct scatterlist *sg,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	struct scatterlist *s;
+	int i;
+
+	for_each_sg(sg, s, nents, i)
+		__iommu_dma_unmap_swiotlb(dev, sg_dma_address(s),
+				sg_dma_len(s), dir, attrs);
+}
+
+static int iommu_dma_map_sg_swiotlb(struct device *dev, struct scatterlist *sg,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	struct scatterlist *s;
+	int i;
+
+	for_each_sg(sg, s, nents, i) {
+		sg_dma_address(s) = __iommu_dma_map_swiotlb(dev, sg_phys(s),
+				s->length, dma_get_mask(dev),
+				dev_is_dma_coherent(dev), dir, attrs);
+		if (sg_dma_address(s) == DMA_MAPPING_ERROR)
+			goto out_unmap;
+		sg_dma_len(s) = s->length;
+	}
+
+	return nents;
+
+out_unmap:
+	iommu_dma_unmap_sg_swiotlb(dev, sg, i, dir, attrs | DMA_ATTR_SKIP_CPU_SYNC);
+	return 0;
+}
+
 /*
  * The DMA API client is passing in a scatterlist which could describe
  * any old buffer layout, but the IOMMU API requires everything to be
@@ -870,6 +999,9 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
 	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
 		iommu_dma_sync_sg_for_device(dev, sg, nents, dir);
 
+	if (dev_is_untrusted(dev))
+		return iommu_dma_map_sg_swiotlb(dev, sg, nents, dir, attrs);
+
 	/*
 	 * Work out how much IOVA space we need, and align the segments to
 	 * IOVA granules for the IOMMU driver to handle. With some clever
@@ -939,6 +1071,11 @@ static void iommu_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
 	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
 		iommu_dma_sync_sg_for_cpu(dev, sg, nents, dir);
 
+	if (dev_is_untrusted(dev)) {
+		iommu_dma_unmap_sg_swiotlb(dev, sg, nents, dir, attrs);
+		return;
+	}
+
 	/*
 	 * The scatterlist segments are mapped into a single
 	 * contiguous IOVA allocation, so this is incredibly easy.
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#4 lore raw

PATCH v3 4/6 iommu: Add quirk for Intel graphic devices in map_sg

In reply to Lu Baolu

Combining the sg segments exposes a bug in the Intel i915 driver which causes visual artifacts and the screen to freeze. This is most likely because of how the i915 handles the returned list. It probably doesn't respect the returned value specifying the number of elements in the list and instead depends on the previous behaviour of the Intel iommu driver which would return the same number of elements in the output list as in the input list.

---
 drivers/iommu/dma-iommu.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/iommu/dma-iommu.c +27 -0
index 1a1da22e5a5e..fc19f1fb9413 100644
@@ -880,6 +880,33 @@ static int __finalise_sg(struct device *dev, struct scatterlist *sg, int nents,
 	unsigned int cur_len = 0, max_len = dma_get_max_seg_size(dev);
 	int i, count = 0;
 
+	/*
+	 * The Intel graphic driver is used to assume that the returned
+	 * sg list is not combound. This blocks the efforts of converting
+	 * Intel IOMMU driver to dma-iommu api's. Add this quirk to make the
+	 * device driver work and should be removed once it's fixed in i915
+	 * driver.
+	 */
+	if (IS_ENABLED(CONFIG_DRM_I915) && dev_is_pci(dev) &&
+	    to_pci_dev(dev)->vendor == PCI_VENDOR_ID_INTEL &&
+	    (to_pci_dev(dev)->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
+		for_each_sg(sg, s, nents, i) {
+			unsigned int s_iova_off = sg_dma_address(s);
+			unsigned int s_length = sg_dma_len(s);
+			unsigned int s_iova_len = s->length;
+
+			s->offset += s_iova_off;
+			s->length = s_length;
+			sg_dma_address(s) = dma_addr + s_iova_off;
+			sg_dma_len(s) = s_length;
+			dma_addr += s_iova_len;
+
+			pr_info_once("sg combining disabled due to i915 driver\n");
+		}
+
+		return nents;
+	}
+
 	for_each_sg(sg, s, nents, i) {
 		/* Restore this segment's original unaligned fields first */
 		unsigned int s_iova_off = sg_dma_address(s);
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#5 lore raw

PATCH v3 5/6 iommu/vt-d: Convert intel iommu driver to the iommu ops

In reply to Lu Baolu

From: Tom Murphy <[email protected]>

Convert the intel iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the intel iommu driver.

---
 drivers/iommu/intel/Kconfig |   1 +
 drivers/iommu/intel/iommu.c | 742 ++----------------------------------
 2 files changed, 43 insertions(+), 700 deletions(-)
drivers/iommu/intel/Kconfig +1 -0
index 5337ee1584b0..28a3d1596c76 100644
@@ -13,6 +13,7 @@ config INTEL_IOMMU
 	select DMAR_TABLE
 	select SWIOTLB
 	select IOASID
+	select IOMMU_DMA
 	help
 	  DMA remapping (DMAR) devices support enables independent address
 	  translations for Direct Memory Access (DMA) from devices.
drivers/iommu/intel/iommu.c +42 -700

869 lines not on this page · raw message

Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#6 lore raw

PATCH v3 6/6 iommu/vt-d: Cleanup after converting to dma-iommu ops

In reply to Lu Baolu

Some cleanups after converting the driver to use dma-iommu ops.
- Remove nobounce option;
- Cleanup and simplify the path in domain mapping.

---
 .../admin-guide/kernel-parameters.txt         |  5 --
 drivers/iommu/intel/iommu.c                   | 90 ++++++-------------
 2 files changed, 28 insertions(+), 67 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +0 -5
index a1068742a6df..0d11ef43d314 100644
@@ -1866,11 +1866,6 @@
 			Note that using this option lowers the security
 			provided by tboot because it makes the system
 			vulnerable to DMA attacks.
-		nobounce [Default off]
-			Disable bounce buffer for untrusted devices such as
-			the Thunderbolt devices. This will treat the untrusted
-			devices as the trusted ones, hence might expose security
-			risks of DMA attacks.
 
 	intel_idle.max_cstate=	[KNL,HW,ACPI,X86]
 			0	disables intel_idle and fall back on acpi_idle.
drivers/iommu/intel/iommu.c +28 -62

175 lines not on this page · raw message

Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Convert the intel iommu driver to the dma-iommu api (rev2)

In reply to Lu Baolu
== Series Details ==

== Series Details ==

Series: Convert the intel iommu driver to the dma-iommu api (rev2)
URL : https://patchwork.freedesktop.org/series/71260/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
fd87dbc34e1f iommu: Handle freelists when using deferred flushing in iommu drivers
97922dbedb56 iommu: Add iommu_dma_free_cpu_cached_iovas()
-:21: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#21: FILE: drivers/iommu/dma-iommu.c:54:
+void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+		struct iommu_domain *domain)

-:41: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #41: FILE: include/linux/dma-iommu.h:41:
+void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+ struct iommu_domain *domain);

-:51: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #51: FILE: include/linux/dma-iommu.h:85:
+static inline void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+ struct iommu_domain *domain)

total: 0 errors, 0 warnings, 3 checks, 34 lines checked ad5dd468bfc2 iommu: Allow the dma-iommu api to use bounce buffers -:34: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #34: FILE: drivers/iommu/dma-iommu.c:504:
+static void __iommu_dma_unmap_swiotlb(struct device *dev, dma_addr_t dma_addr,
+ size_t size, enum dma_data_direction dir,

-:50: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #50: FILE: drivers/iommu/dma-iommu.c:520:
+ swiotlb_tbl_unmap_single(dev, phys, size,
+ iova_align(iovad, size), dir, attrs);

-:66: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #66: FILE: drivers/iommu/dma-iommu.c:554:
+static dma_addr_t __iommu_dma_map_swiotlb(struct device *dev, phys_addr_t phys,
+ size_t org_size, dma_addr_t dma_mask, bool coherent,

-:86: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #86: FILE: drivers/iommu/dma-iommu.c:574:
+ phys = swiotlb_tbl_map_single(dev,
+ __phys_to_dma(dev, io_tlb_start),

-:107: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'iova == DMA_MAPPING_ERROR' #107: FILE: drivers/iommu/dma-iommu.c:595:
+ if ((iova == DMA_MAPPING_ERROR) && is_swiotlb_buffer(phys))

-:109: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #109: FILE: drivers/iommu/dma-iommu.c:597:
+ swiotlb_tbl_unmap_single(dev, phys, org_size,
+ aligned_size, dir, attrs);

-:204: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #204: FILE: drivers/iommu/dma-iommu.c:853:
+ dma_handle = __iommu_dma_map_swiotlb(dev, phys, size, dma_get_mask(dev),
+ coherent, dir, attrs);

-:222: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #222: FILE: drivers/iommu/dma-iommu.c:944:
+static void iommu_dma_unmap_sg_swiotlb(struct device *dev, struct scatterlist *sg,
+ int nents, enum dma_data_direction dir, unsigned long attrs)

-:229: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #229: FILE: drivers/iommu/dma-iommu.c:951:
+ __iommu_dma_unmap_swiotlb(dev, sg_dma_address(s),
+ sg_dma_len(s), dir, attrs);

-:233: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #233: FILE: drivers/iommu/dma-iommu.c:955:
+static int iommu_dma_map_sg_swiotlb(struct device *dev, struct scatterlist *sg,
+ int nents, enum dma_data_direction dir, unsigned long attrs)

-:240: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #240: FILE: drivers/iommu/dma-iommu.c:962:
+ sg_dma_address(s) = __iommu_dma_map_swiotlb(dev, sg_phys(s),
+ s->length, dma_get_mask(dev),

total: 0 errors, 0 warnings, 11 checks, 250 lines checked 0401236a9134 iommu: Add quirk for Intel graphic devices in map_sg ee870127e9f4 iommu/vt-d: Convert intel iommu driver to the iommu ops 618c6431795e iommu/vt-d: Cleanup after converting to dma-iommu ops -:96: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #96: FILE: drivers/iommu/intel/iommu.c:2253:
+ largepage_lvl = hardware_largepage_caps(domain, iov_pfn,
+ phys_pfn, nr_pages);

total: 0 errors, 0 warnings, 1 checks, 186 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Convert the intel iommu driver to the dma-iommu api (rev2)

In reply to Lu Baolu
== Series Details ==

== Series Details ==

Series: Convert the intel iommu driver to the dma-iommu api (rev2)
URL : https://patchwork.freedesktop.org/series/71260/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
-
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21:    expected void const volatile [noderef] __user *ptr
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21:    got unsigned int [usertype] *
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: cast removes address space '__user' of expression
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:2332:21: warning: incorrect type in argument 1 (different address spaces)
+drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c:758:42: warning: cast removes address space '__iomem' of expression
+drivers/gpu/drm/i915/gt/intel_reset.c:1311:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block
+drivers/gpu/drm/i915/gvt/mmio.c:287:23: warning: memcpy with byte count of 279040
+drivers/gpu/drm/i915/i915_perf.c:1440:15: warning: memset with byte count of 16777216
+drivers/gpu/drm/i915/i915_perf.c:1494:15: warning: memset with byte count of 16777216
+./include/linux/seqlock.h:752:24: warning: trying to copy expression type 31
+./include/linux/seqlock.h:778:16: warning: trying to copy expression type 31
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write8' - different lock contexts for basic block

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for Convert the intel iommu driver to the dma-iommu api (rev2)

In reply to Lu Baolu
== Series Details ==

== Series Details ==

Series: Convert the intel iommu driver to the dma-iommu api (rev2)
URL : https://patchwork.freedesktop.org/series/71260/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_9003 -> Patchwork_18487
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_18487 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_18487, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_18487:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@blt:
- fi-ivb-3770: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-ivb-3770/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-ivb-3770/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@gem_contexts:
- fi-ivb-3770: [PASS][3] -> [DMESG-FAIL][4] +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-ivb-3770/igt@i915_selftest@live@gem_contexts.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-ivb-3770/igt@i915_selftest@live@gem_contexts.html

Known issues
------------

Here are the changes found in Patchwork_18487 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_flink_basic@flink-lifetime:
- fi-tgl-y: [PASS][5] -> [DMESG-WARN][6] ([i915#402]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-tgl-y/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-tgl-y/igt@[email protected]

* igt@i915_module_load@reload:
- fi-bxt-dsi: [PASS][7] -> [DMESG-WARN][8] ([i915#1635] / [i915#1982])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-bxt-dsi/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-bxt-dsi/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-glk-dsi: [PASS][9] -> [DMESG-WARN][10] ([i915#1982])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-glk-dsi/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-glk-dsi/igt@[email protected]

* igt@kms_flip@basic-flip-vs-wf_vblank@c-hdmi-a2:
- fi-skl-guc: [PASS][11] -> [DMESG-WARN][12] ([i915#2203])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-skl-guc/igt@kms_flip@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-skl-guc/igt@kms_flip@[email protected]

#### Possible fixes ####

* igt@i915_module_load@reload:
- fi-byt-j1900: [DMESG-WARN][13] ([i915#1982]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-byt-j1900/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-byt-j1900/igt@[email protected]

* igt@i915_selftest@live@gem_contexts:
- fi-tgl-u2: [INCOMPLETE][15] ([i915#2045]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-tgl-u2/igt@i915_selftest@live@gem_contexts.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-tgl-u2/igt@i915_selftest@live@gem_contexts.html

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- {fi-tgl-dsi}: [DMESG-WARN][17] ([i915#1982]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-tgl-dsi/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-tgl-dsi/igt@[email protected]

* igt@prime_vgem@basic-write:
- fi-tgl-y: [DMESG-WARN][19] ([i915#402]) -> [PASS][20] +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-tgl-y/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-tgl-y/igt@[email protected]

#### Warnings ####

* igt@gem_exec_suspend@basic-s3:
- fi-tgl-y: [DMESG-WARN][21] ([i915#2411]) -> [DMESG-WARN][22] ([i915#2411] / [i915#402])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-tgl-y/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-tgl-y/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-kbl-x1275: [DMESG-FAIL][23] ([i915#62]) -> [SKIP][24] ([fdo#109271])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-kbl-x1275/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-kbl-x1275/igt@[email protected]

* igt@kms_force_connector_basic@force-connector-state:
- fi-kbl-x1275: [DMESG-WARN][25] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][26] ([i915#62] / [i915#92]) +4 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-kbl-x1275/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-kbl-x1275/igt@[email protected]

* igt@kms_force_connector_basic@prune-stale-modes:
- fi-kbl-x1275: [DMESG-WARN][27] ([i915#62] / [i915#92]) -> [DMESG-WARN][28] ([i915#62] / [i915#92] / [i915#95]) +6 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9003/fi-kbl-x1275/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/fi-kbl-x1275/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#1635]: https://gitlab.freedesktop.org/drm/intel/issues/1635
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2045]: https://gitlab.freedesktop.org/drm/intel/issues/2045
[i915#2203]: https://gitlab.freedesktop.org/drm/intel/issues/2203
[i915#2411]: https://gitlab.freedesktop.org/drm/intel/issues/2411
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (45 -> 39)
------------------------------

Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_9003 -> Patchwork_18487

CI-20190529: 20190529
CI_DRM_9003: c3ef4b507b35e1e5260db616d5c3a80c2f70d6ec @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5781: 66766dd7cd99465d977ac07db8a2413dbbfe8d84 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_18487: 618c6431795ebc2f214e3b842d5fe8cfaf7f2b8a @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

618c6431795e iommu/vt-d: Cleanup after converting to dma-iommu ops ee870127e9f4 iommu/vt-d: Convert intel iommu driver to the iommu ops 0401236a9134 iommu: Add quirk for Intel graphic devices in map_sg ad5dd468bfc2 iommu: Allow the dma-iommu api to use bounce buffers 97922dbedb56 iommu: Add iommu_dma_free_cpu_cached_iovas() fd87dbc34e1f iommu: Handle freelists when using deferred flushing in iommu drivers

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18487/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw
In reply to Lu Baolu

Hi,

Quoted 11 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.

Last week I have copied you on an i915 series which appears to remove the need for this quirk. so if we get those i915 patches reviewed and merged, do you still want to pursue this quirk?

Quoted 3 lines

2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not sufficient for the mapped address (ffff008000)

Relevant iommu boot related messages are:

<6>[    0.184234] DMAR: Host address width 36
<6>[    0.184245] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
<6>[    0.184288] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020e60262 ecap f0101a
<6>[    0.184308] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
<6>[    0.184337] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap c9008020660262 ecap f0105a
<6>[    0.184357] DMAR: RMRR base: 0x000000d8d28000 end: 0x000000d8d46fff
<6>[    0.184377] DMAR: RMRR base: 0x000000db000000 end: 0x000000df1fffff
<6>[    0.184398] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
<6>[    0.184414] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
<6>[    0.184428] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
<6>[    0.185173] DMAR-IR: Enabled IRQ remapping in x2apic mode
<6>[    0.878934] DMAR: No ATSR found
<6>[    0.878966] DMAR: dmar0: Using Queued invalidation
<6>[    0.879007] DMAR: dmar1: Using Queued invalidation
<6>[    0.915032] DMAR: Intel(R) Virtualization Technology for Directed I/O
<6>[    0.915060] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
<6>[    0.915084] software IO TLB: mapped [mem 0xc80d4000-0xcc0d4000] (64MB)

(Full boot log at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/boot0.txt, failures at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/igt@i915_selftest@[email protected].)

Does this look familiar or at least plausible to you? Is this something your new series has fixed?

Regards,

Tvrtko

Quoted 16 lines

Please review and test.

Best regards,
baolu

Lu Baolu (2):
iommu: Add quirk for Intel graphic devices in map_sg iommu/vt-d: Cleanup after converting to dma-iommu ops

Tom Murphy (4):
iommu: Handle freelists when using deferred flushing in iommu drivers
iommu: Add iommu_dma_free_cpu_cached_iovas()
iommu: Allow the dma-iommu api to use bounce buffers iommu/vt-d: Convert intel iommu driver to the iommu ops

Quoted 8 lines
  .../admin-guide/kernel-parameters.txt         |   5 -
  drivers/iommu/dma-iommu.c                     | 229 ++++-
  drivers/iommu/intel/Kconfig                   |   1 +
  drivers/iommu/intel/iommu.c                   | 885 +++---------------
  include/linux/dma-iommu.h                     |   8 +
  include/linux/iommu.h                         |   1 +
  6 files changed, 323 insertions(+), 806 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#11 lore raw

Hi Tvrtko,

Quoted 9 lines · Tvrtko Ursulin

Hi,

Quoted 5 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Quoted 8 lines
Quoted 6 lines

Thanks a lot!

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.

Last week I have copied you on an i915 series which appears to remove the need for this quirk. so if we get those i915 patches reviewed and merged, do you still want to pursue this quirk?

It's up to the graphic guys. I don't know the details in i915 driver. I don't think my tests could cover all cases.

Quoted 27 lines
Quoted 4 lines

2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not sufficient for the mapped address (ffff008000)

Relevant iommu boot related messages are:

<6>[    0.184234] DMAR: Host address width 36
<6>[    0.184245] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
<6>[    0.184288] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020e60262 ecap f0101a
<6>[    0.184308] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
<6>[    0.184337] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap c9008020660262 ecap f0105a
<6>[    0.184357] DMAR: RMRR base: 0x000000d8d28000 end: 0x000000d8d46fff
<6>[    0.184377] DMAR: RMRR base: 0x000000db000000 end: 0x000000df1fffff
<6>[    0.184398] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
<6>[    0.184414] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
<6>[    0.184428] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping.
<6>[    0.185173] DMAR-IR: Enabled IRQ remapping in x2apic mode
<6>[    0.878934] DMAR: No ATSR found
<6>[    0.878966] DMAR: dmar0: Using Queued invalidation
<6>[    0.879007] DMAR: dmar1: Using Queued invalidation
Quoted 7 lines
<6>[    0.915032] DMAR: Intel(R) Virtualization Technology for Directed I/O
<6>[    0.915060] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
<6>[    0.915084] software IO TLB: mapped [mem 0xc80d4000-0xcc0d4000] (64MB)

(Full boot log at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/boot0.txt, failures at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/igt@i915_selftest@[email protected].)

Does this look familiar or at least plausible to you? Is this something your new series has fixed?

This happens during attaching a domain to device. It has nothing to do with this patch series. I will look into this issue, but not in this email thread context.

Best regards,
baolu

Quoted 29 lines

Regards,

Tvrtko

Quoted 24 lines

Please review and test.

Best regards,
baolu

Lu Baolu (2):
iommu: Add quirk for Intel graphic devices in map_sg iommu/vt-d: Cleanup after converting to dma-iommu ops

Tom Murphy (4):
iommu: Handle freelists when using deferred flushing in iommu drivers
iommu: Add iommu_dma_free_cpu_cached_iovas()
iommu: Allow the dma-iommu api to use bounce buffers iommu/vt-d: Convert intel iommu driver to the iommu ops

   .../admin-guide/kernel-parameters.txt         |   5 -
   drivers/iommu/dma-iommu.c                     | 229 ++++-
   drivers/iommu/intel/Kconfig                   |   1 +
   drivers/iommu/intel/iommu.c                   | 885 +++---------------
   include/linux/dma-iommu.h                     |   8 +
   include/linux/iommu.h                         |   1 +
   6 files changed, 323 insertions(+), 806 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw
Quoted 17 lines · Lu Baolu

Hi Tvrtko,

Quoted 14 lines · Tvrtko Ursulin

Hi,

Quoted 10 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

This series is a follow-up with below changes:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

1. Add a quirk for the i915 driver issue described in Tom's cover letter.

Last week I have copied you on an i915 series which appears to remove the need for this quirk. so if we get those i915 patches reviewed and merged, do you still want to pursue this quirk?

It's up to the graphic guys. I don't know the details in i915 driver. I don't think my tests could cover all cases.

I am the graphic guy. :) I just need some reviews (internally) for my series and then we can merge it, at which point you don't need the quirk patch any more. I'll try to accelerate this.

With regards to testing, you could send your series with my patches on top to our trybot mailing list ([email protected] / https://patchwork.freedesktop.org/project/intel-gfx-trybot/series/?ordering=-last_updated) which would show you if it is still hitting the DMAR issues in i915.

Quoted 31 lines
Quoted 31 lines
Quoted 4 lines

2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not sufficient for the mapped address (ffff008000)

Relevant iommu boot related messages are:

<6>[    0.184234] DMAR: Host address width 36
<6>[    0.184245] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
<6>[    0.184288] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020e60262 ecap f0101a <6>[    0.184308] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
<6>[    0.184337] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap c9008020660262 ecap f0105a <6>[    0.184357] DMAR: RMRR base: 0x000000d8d28000 end: 0x000000d8d46fff
<6>[    0.184377] DMAR: RMRR base: 0x000000db000000 end: 0x000000df1fffff
<6>[    0.184398] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
<6>[    0.184414] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
<6>[    0.184428] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping. <6>[    0.185173] DMAR-IR: Enabled IRQ remapping in x2apic mode

<6>[    0.878934] DMAR: No ATSR found
<6>[    0.878966] DMAR: dmar0: Using Queued invalidation <6>[    0.879007] DMAR: dmar1: Using Queued invalidation

<6>[    0.915032] DMAR: Intel(R) Virtualization Technology for Directed I/O <6>[    0.915060] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) <6>[    0.915084] software IO TLB: mapped [mem 0xc80d4000-0xcc0d4000] (64MB)

Quoted 8 lines
Quoted 4 lines

(Full boot log at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/boot0.txt, failures at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/igt@i915_selftest@[email protected].)

Does this look familiar or at least plausible to you? Is this something your new series has fixed?

This happens during attaching a domain to device. It has nothing to do with this patch series. I will look into this issue, but not in this email thread context.

I am not sure what step is attaching domain to device, but these type messages:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not

Quoted 1 line
Quoted 1 line

sufficient for the mapped address (ffff008000)

They definitely appear to happen at runtime, as i915 is getting exercised by userspace.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw
In reply to Lu Baolu

Hi Lu,

Quoted 7 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

Quoted 8 lines

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

I had the same issue with Tom's v2 but never saw this on his v1.

Thanks,

Logan

[   44.057877] ------------[ cut here ]------------
[   44.063167] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.073351] Modules linked in:
[   44.076882] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.087935] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.096650] Workqueue: events work_for_cpu_fn
[   44.101644] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.107225] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.128443] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.134413] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.144487] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.152613] RBP: 00000000fec00000 R08: 00000000000fec00 R09: 00000000000fedff
[   44.160733] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c39000
[   44.168861] R13: ffff888472d85ee8 R14: 0000000000080000 R15: 0000000000000000
[   44.176980] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.186198] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.192761] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   44.200871] Call Trace:
[   44.203716]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   44.209509]  iommu_dma_free+0x18/0x30
[   44.213734]  ioat_free_chan_resources+0x19e/0x300
[   44.219133]  ioat_dma_self_test+0x2a0/0x3d0
[   44.223964]  ioat_pci_probe+0x60e/0x903
[   44.228387]  local_pci_probe+0x42/0x80
[   44.232721]  work_for_cpu_fn+0x16/0x20
[   44.237037]  process_one_work+0x292/0x630
[   44.241644]  ? __schedule+0x344/0x970
[   44.245868]  worker_thread+0x227/0x3e0
[   44.250185]  ? process_one_work+0x630/0x630
[   44.254989]  kthread+0x136/0x150
[   44.258718]  ? kthread_use_mm+0x100/0x100
[   44.263334]  ret_from_fork+0x22/0x30
[   44.267474] irq event stamp: 1881262
[   44.271602] hardirqs last  enabled at (1881272): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   44.281593] hardirqs last disabled at (1881281): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   44.291588] softirqs last  enabled at (1747140): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   44.301285] softirqs last disabled at (1747144): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   44.312153] ---[ end trace ed0f88fd959a5a39 ]---
[   44.353963] ------------[ cut here ]------------
[   44.359291] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.369482] Modules linked in:
[   44.373030] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.384097] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.392825] Workqueue: events work_for_cpu_fn
[   44.397831] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.403421] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.424644] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.430627] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.438770] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.446885] RBP: 00000000ffc00000 R08: 00000000000ffc00 R09: 00000000000ffdff
[   44.455000] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   44.463119] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   44.471235] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.480440] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.487004] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   44.495128] Call Trace:
[   44.498008]  iommu_dma_free+0x18/0x30
[   44.502230]  ioat_free_chan_resources+0x19e/0x300
[   44.507631]  ioat_dma_self_test+0x2a0/0x3d0
[   44.512466]  ioat_pci_probe+0x60e/0x903
[   44.516889]  local_pci_probe+0x42/0x80
[   44.521217]  work_for_cpu_fn+0x16/0x20
[   44.525540]  process_one_work+0x292/0x630
[   44.530157]  ? __schedule+0x344/0x970
[   44.534393]  worker_thread+0x227/0x3e0
[   44.538720]  ? process_one_work+0x630/0x630
[   44.543531]  kthread+0x136/0x150
[   44.547270]  ? kthread_use_mm+0x100/0x100
[   44.551889]  ret_from_fork+0x22/0x30
[   44.556034] irq event stamp: 2145654
[   44.560161] hardirqs last  enabled at (2145664): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   44.570158] hardirqs last disabled at (2145673): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   44.580153] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   44.589854] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   44.600729] ---[ end trace ed0f88fd959a5a3a ]---
[   44.606043] ------------[ cut here ]------------
[   44.611331] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.621524] Modules linked in:
[   44.625050] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.636119] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.644834] Workqueue: events work_for_cpu_fn
[   44.649827] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.655410] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.676618] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.682588] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.690702] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.698816] RBP: 00000000ffa00000 R08: 00000000000ffa00 R09: 00000000000ffbff
[   44.706934] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   44.715054] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   44.723174] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.732384] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.738941] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   44.747060] Call Trace:
[   44.749921]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   44.755706]  iommu_dma_free+0x18/0x30
[   44.759931]  ioat_free_chan_resources+0x19e/0x300
[   44.765332]  ioat_dma_self_test+0x2a0/0x3d0
[   44.770156]  ioat_pci_probe+0x60e/0x903
[   44.774583]  local_pci_probe+0x42/0x80
[   44.778909]  work_for_cpu_fn+0x16/0x20
[   44.783232]  process_one_work+0x292/0x630
[   44.787846]  ? __schedule+0x344/0x970
[   44.792079]  worker_thread+0x227/0x3e0
[   44.796403]  ? process_one_work+0x630/0x630
[   44.801205]  kthread+0x136/0x150
[   44.804946]  ? kthread_use_mm+0x100/0x100
[   44.809563]  ret_from_fork+0x22/0x30
[   44.813704] irq event stamp: 2146044
[   44.817831] hardirqs last  enabled at (2146054): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   44.827821] hardirqs last disabled at (2146063): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   44.837810] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   44.847503] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   44.858366] ---[ end trace ed0f88fd959a5a3b ]---
[   44.863675] ------------[ cut here ]------------
[   44.868969] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.879148] Modules linked in:
[   44.882689] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.893760] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.902487] Workqueue: events work_for_cpu_fn
[   44.907493] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.913080] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.934290] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.940254] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.948379] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.956505] RBP: 00000000ff800000 R08: 00000000000ff800 R09: 00000000000ff9ff
[   44.964627] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   44.972748] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   44.980871] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.990084] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.996644] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.004759] Call Trace:
[   45.007600]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.013391]  iommu_dma_free+0x18/0x30
[   45.017609]  ioat_free_chan_resources+0x19e/0x300
[   45.022992]  ioat_dma_self_test+0x2a0/0x3d0
[   45.027809]  ioat_pci_probe+0x60e/0x903
[   45.032237]  local_pci_probe+0x42/0x80
[   45.036563]  work_for_cpu_fn+0x16/0x20
[   45.040886]  process_one_work+0x292/0x630
[   45.045500]  ? __schedule+0x344/0x970
[   45.049735]  worker_thread+0x227/0x3e0
[   45.054061]  ? process_one_work+0x630/0x630
[   45.058864]  kthread+0x136/0x150
[   45.062597]  ? kthread_use_mm+0x100/0x100
[   45.067200]  ret_from_fork+0x22/0x30
[   45.071335] irq event stamp: 2146432
[   45.075458] hardirqs last  enabled at (2146442): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.085440] hardirqs last disabled at (2146451): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.095432] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.105134] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.116004] ---[ end trace ed0f88fd959a5a3c ]---
[   45.121305] ------------[ cut here ]------------
[   45.126596] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.136772] Modules linked in:
[   45.142288] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.153351] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.162077] Workqueue: events work_for_cpu_fn
[   45.167074] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.172663] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.193874] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.199850] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.207970] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.216095] RBP: 00000000ff600000 R08: 00000000000ff600 R09: 00000000000ff7ff
[   45.224207] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   45.232327] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   45.240446] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   45.249662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   45.256225] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.264344] Call Trace:
[   45.267205]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.273003]  iommu_dma_free+0x18/0x30
[   45.277231]  ioat_free_chan_resources+0x19e/0x300
[   45.282631]  ioat_dma_self_test+0x2a0/0x3d0
[   45.287457]  ioat_pci_probe+0x60e/0x903
[   45.291894]  local_pci_probe+0x42/0x80
[   45.296217]  work_for_cpu_fn+0x16/0x20
[   45.300539]  process_one_work+0x292/0x630
[   45.305162]  ? __schedule+0x344/0x970
[   45.309399]  worker_thread+0x227/0x3e0
[   45.313724]  ? process_one_work+0x630/0x630
[   45.318535]  kthread+0x136/0x150
[   45.322274]  ? kthread_use_mm+0x100/0x100
[   45.326893]  ret_from_fork+0x22/0x30
[   45.331034] irq event stamp: 2146822
[   45.335161] hardirqs last  enabled at (2146832): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.345154] hardirqs last disabled at (2146841): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.355150] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.364850] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.375710] ---[ end trace ed0f88fd959a5a3d ]---
[   45.381018] ------------[ cut here ]------------
[   45.386308] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.396494] Modules linked in:
[   45.400020] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.411086] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.419810] Workqueue: events work_for_cpu_fn
[   45.424819] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.430406] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.451630] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.457610] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.465730] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.473853] RBP: 00000000ff400000 R08: 00000000000ff400 R09: 00000000000ff5ff
[   45.481973] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   45.490092] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   45.498211] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   45.507418] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   45.513969] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.522081] Call Trace:
[   45.524934]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.530718]  iommu_dma_free+0x18/0x30
[   45.534989]  ioat_free_chan_resources+0x19e/0x300
[   45.540378]  ioat_dma_self_test+0x2a0/0x3d0
[   45.545193]  ioat_pci_probe+0x60e/0x903
[   45.549619]  local_pci_probe+0x42/0x80
[   45.553940]  work_for_cpu_fn+0x16/0x20
[   45.558258]  process_one_work+0x292/0x630
[   45.562871]  ? __schedule+0x344/0x970
[   45.567108]  worker_thread+0x227/0x3e0
[   45.571434]  ? process_one_work+0x630/0x630
[   45.576243]  kthread+0x136/0x150
[   45.579981]  ? kthread_use_mm+0x100/0x100
[   45.584598]  ret_from_fork+0x22/0x30
[   45.588733] irq event stamp: 2147210
[   45.592860] hardirqs last  enabled at (2147220): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.602845] hardirqs last disabled at (2147229): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.612836] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.622531] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.633392] ---[ end trace ed0f88fd959a5a3e ]---
[   45.638708] ------------[ cut here ]------------
[   45.644003] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.654191] Modules linked in:
[   45.657734] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.668807] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.677534] Workqueue: events work_for_cpu_fn
[   45.682538] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.688126] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.709343] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.715321] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.723440] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.731555] RBP: 00000000ff200000 R08: 00000000000ff200 R09: 00000000000ff3ff
[   45.739665] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   45.747777] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   45.755897] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   45.765106] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   45.771661] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.779778] Call Trace:
[   45.782638]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.788439]  iommu_dma_free+0x18/0x30
[   45.792664]  ioat_free_chan_resources+0x19e/0x300
[   45.798060]  ioat_dma_self_test+0x2a0/0x3d0
[   45.802886]  ioat_pci_probe+0x60e/0x903
[   45.807306]  local_pci_probe+0x42/0x80
[   45.811633]  work_for_cpu_fn+0x16/0x20
[   45.815946]  process_one_work+0x292/0x630
[   45.820556]  ? __schedule+0x344/0x970
[   45.824791]  worker_thread+0x227/0x3e0
[   45.829117]  ? process_one_work+0x630/0x630
[   45.833969]  kthread+0x136/0x150
[   45.837706]  ? kthread_use_mm+0x100/0x100
[   45.842325]  ret_from_fork+0x22/0x30
[   45.846475] irq event stamp: 2147602
[   45.850608] hardirqs last  enabled at (2147612): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.860603] hardirqs last disabled at (2147621): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.870589] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.880293] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.891163] ---[ end trace ed0f88fd959a5a3f ]---
[   45.896473] ------------[ cut here ]------------
[   45.901762] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.911956] Modules linked in:
[   45.915503] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.926570] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.935302] Workqueue: events work_for_cpu_fn
[   45.940312] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.945905] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.967128] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.973111] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.981236] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.989363] RBP: 00000000ff000000 R08: 00000000000ff000 R09: 00000000000ff1ff
[   45.997489] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   46.005613] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   46.013738] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   46.022952] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   46.029521] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   46.037643] Call Trace:
[   46.040508]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   46.046305]  iommu_dma_free+0x18/0x30
[   46.050538]  ioat_free_chan_resources+0x19e/0x300
[   46.055941]  ioat_dma_self_test+0x2a0/0x3d0
[   46.060765]  ioat_pci_probe+0x60e/0x903
[   46.065196]  local_pci_probe+0x42/0x80
[   46.069526]  work_for_cpu_fn+0x16/0x20
[   46.073854]  process_one_work+0x292/0x630
[   46.078477]  ? __schedule+0x344/0x970
[   46.082717]  worker_thread+0x227/0x3e0
[   46.087035]  ? process_one_work+0x630/0x630
[   46.091849]  kthread+0x136/0x150
[   46.095594]  ? kthread_use_mm+0x100/0x100
[   46.100218]  ret_from_fork+0x22/0x30
[   46.104366] irq event stamp: 2147992
[   46.108499] hardirqs last  enabled at (2148002): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   46.120483] hardirqs last disabled at (2148011): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   46.130472] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   46.140171] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   46.151034] ---[ end trace ed0f88fd959a5a40 ]---
[   46.156339] ------------[ cut here ]------------
[   46.161628] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   46.171817] Modules linked in:
[   46.175365] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   46.186430] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   46.195163] Workqueue: events work_for_cpu_fn
[   46.200173] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   46.205767] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   46.226991] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   46.232976] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   46.241101] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   46.249226] RBP: 00000000fec00000 R08: 00000000000fec00 R09: 00000000000fedff
[   46.257352] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   46.265474] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   46.273602] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   46.282822] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   46.289388] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   46.297513] Call Trace:
[   46.300358]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   46.306152]  iommu_dma_free+0x18/0x30
[   46.310379]  ioat_free_chan_resources+0x19e/0x300
[   46.315776]  ioat_dma_self_test+0x2a0/0x3d0
[   46.320607]  ioat_pci_probe+0x60e/0x903
[   46.325044]  local_pci_probe+0x42/0x80
[   46.329373]  work_for_cpu_fn+0x16/0x20
[   46.333699]  process_one_work+0x292/0x630
[   46.338321]  ? __schedule+0x344/0x970
[   46.342563]  worker_thread+0x227/0x3e0
[   46.346891]  ? process_one_work+0x630/0x630
[   46.351704]  kthread+0x136/0x150
[   46.355449]  ? kthread_use_mm+0x100/0x100
[   46.360069]  ret_from_fork+0x22/0x30
[   46.364204] irq event stamp: 2148380
[   46.368338] hardirqs last  enabled at (2148390): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   46.378336] hardirqs last disabled at (2148399): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   46.388335] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   46.398040] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   46.408914] ---[ end trace ed0f88fd959a5a41 ]---

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

author maintainer
#17 lore raw

Hi Logan,

Quoted 19 lines · Logan Gunthorpe

Hi Lu,

Quoted 7 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

Quoted 8 lines

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

Quoted 5 lines

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

I had the same issue with Tom's v2 but never saw this on his v1.

Have you verified whether this could be reproduced with the lasted upstream kernel (without this patch series)?

Best regards,
baolu

#18 lore raw
Quoted 22 lines · Lu Baolu

Hi Logan,

Quoted 19 lines · Logan Gunthorpe

Hi Lu,

Quoted 15 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

Quoted 8 lines
Quoted 5 lines

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

I had the same issue with Tom's v2 but never saw this on his v1.

Have you verified whether this could be reproduced with the lasted upstream kernel (without this patch series)?

Yes. Also, it's hitting a warning in the dma-iommu code which would not be hit without this patch set.

Thanks,

Logan

author maintainer
#19 lore raw

Hi Logan,

Quoted 29 lines · Logan Gunthorpe
Quoted 26 lines · Lu Baolu

Hi Logan,

Quoted 23 lines · Logan Gunthorpe

Hi Lu,

Quoted 7 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

Quoted 8 lines

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I had the same issue with Tom's v2 but never saw this on his v1.

Have you verified whether this could be reproduced with the lasted upstream kernel (without this patch series)?

Yes.

I am sorry. Just want to make sure I understand you correctly. :-) When you say "yes", do you mean you could reproduce this with pure upstream kernel (5.9-rc6)?

Quoted 2 lines

Also, it's hitting a warning in the dma-iommu code which would not be hit without this patch set.

Without this series, DMA APIs don't go through dma-iommu. Do you mind posting the warning message?

Best regards,
baolu

maintainer
#21 lore raw
In reply to Logan Gunthorpe
Quoted 19 lines · Logan Gunthorpe

Hi Lu,

Quoted 7 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

Quoted 8 lines

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

Quoted 5 lines

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

I had the same issue with Tom's v2 but never saw this on his v1.

I think this might have more to do with ioat being totally broken - AFAICS it appears to allocate descriptors with a size of 2MB, but free them with a size of 512KB. Try throwing CONFIG_DMA_API_DEBUG at it to confirm.

Robin.

Quoted 352 lines

Thanks,

Logan

[   44.057877] ------------[ cut here ]------------
[   44.063167] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.073351] Modules linked in:
[   44.076882] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.087935] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.096650] Workqueue: events work_for_cpu_fn
[   44.101644] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.107225] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.128443] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.134413] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.144487] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.152613] RBP: 00000000fec00000 R08: 00000000000fec00 R09: 00000000000fedff
[   44.160733] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c39000
[   44.168861] R13: ffff888472d85ee8 R14: 0000000000080000 R15: 0000000000000000
[   44.176980] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.186198] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.192761] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   44.200871] Call Trace:
[   44.203716]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   44.209509]  iommu_dma_free+0x18/0x30
[   44.213734]  ioat_free_chan_resources+0x19e/0x300
[   44.219133]  ioat_dma_self_test+0x2a0/0x3d0
[   44.223964]  ioat_pci_probe+0x60e/0x903
[   44.228387]  local_pci_probe+0x42/0x80
[   44.232721]  work_for_cpu_fn+0x16/0x20
[   44.237037]  process_one_work+0x292/0x630
[   44.241644]  ? __schedule+0x344/0x970
[   44.245868]  worker_thread+0x227/0x3e0
[   44.250185]  ? process_one_work+0x630/0x630
[   44.254989]  kthread+0x136/0x150
[   44.258718]  ? kthread_use_mm+0x100/0x100
[   44.263334]  ret_from_fork+0x22/0x30
[   44.267474] irq event stamp: 1881262
[   44.271602] hardirqs last  enabled at (1881272): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   44.281593] hardirqs last disabled at (1881281): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   44.291588] softirqs last  enabled at (1747140): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   44.301285] softirqs last disabled at (1747144): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   44.312153] ---[ end trace ed0f88fd959a5a39 ]---
[   44.353963] ------------[ cut here ]------------
[   44.359291] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.369482] Modules linked in:
[   44.373030] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.384097] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.392825] Workqueue: events work_for_cpu_fn
[   44.397831] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.403421] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.424644] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.430627] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.438770] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.446885] RBP: 00000000ffc00000 R08: 00000000000ffc00 R09: 00000000000ffdff
[   44.455000] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   44.463119] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   44.471235] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.480440] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.487004] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   44.495128] Call Trace:
[   44.498008]  iommu_dma_free+0x18/0x30
[   44.502230]  ioat_free_chan_resources+0x19e/0x300
[   44.507631]  ioat_dma_self_test+0x2a0/0x3d0
[   44.512466]  ioat_pci_probe+0x60e/0x903
[   44.516889]  local_pci_probe+0x42/0x80
[   44.521217]  work_for_cpu_fn+0x16/0x20
[   44.525540]  process_one_work+0x292/0x630
[   44.530157]  ? __schedule+0x344/0x970
[   44.534393]  worker_thread+0x227/0x3e0
[   44.538720]  ? process_one_work+0x630/0x630
[   44.543531]  kthread+0x136/0x150
[   44.547270]  ? kthread_use_mm+0x100/0x100
[   44.551889]  ret_from_fork+0x22/0x30
[   44.556034] irq event stamp: 2145654
[   44.560161] hardirqs last  enabled at (2145664): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   44.570158] hardirqs last disabled at (2145673): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   44.580153] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   44.589854] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   44.600729] ---[ end trace ed0f88fd959a5a3a ]---
[   44.606043] ------------[ cut here ]------------
[   44.611331] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.621524] Modules linked in:
[   44.625050] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.636119] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.644834] Workqueue: events work_for_cpu_fn
[   44.649827] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.655410] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.676618] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.682588] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.690702] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.698816] RBP: 00000000ffa00000 R08: 00000000000ffa00 R09: 00000000000ffbff
[   44.706934] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   44.715054] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   44.723174] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.732384] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.738941] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   44.747060] Call Trace:
[   44.749921]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   44.755706]  iommu_dma_free+0x18/0x30
[   44.759931]  ioat_free_chan_resources+0x19e/0x300
[   44.765332]  ioat_dma_self_test+0x2a0/0x3d0
[   44.770156]  ioat_pci_probe+0x60e/0x903
[   44.774583]  local_pci_probe+0x42/0x80
[   44.778909]  work_for_cpu_fn+0x16/0x20
[   44.783232]  process_one_work+0x292/0x630
[   44.787846]  ? __schedule+0x344/0x970
[   44.792079]  worker_thread+0x227/0x3e0
[   44.796403]  ? process_one_work+0x630/0x630
[   44.801205]  kthread+0x136/0x150
[   44.804946]  ? kthread_use_mm+0x100/0x100
[   44.809563]  ret_from_fork+0x22/0x30
[   44.813704] irq event stamp: 2146044
[   44.817831] hardirqs last  enabled at (2146054): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   44.827821] hardirqs last disabled at (2146063): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   44.837810] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   44.847503] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   44.858366] ---[ end trace ed0f88fd959a5a3b ]---
[   44.863675] ------------[ cut here ]------------
[   44.868969] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   44.879148] Modules linked in:
[   44.882689] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   44.893760] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   44.902487] Workqueue: events work_for_cpu_fn
[   44.907493] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.913080] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.934290] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.940254] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   44.948379] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   44.956505] RBP: 00000000ff800000 R08: 00000000000ff800 R09: 00000000000ff9ff
[   44.964627] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   44.972748] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   44.980871] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   44.990084] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.996644] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.004759] Call Trace:
[   45.007600]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.013391]  iommu_dma_free+0x18/0x30
[   45.017609]  ioat_free_chan_resources+0x19e/0x300
[   45.022992]  ioat_dma_self_test+0x2a0/0x3d0
[   45.027809]  ioat_pci_probe+0x60e/0x903
[   45.032237]  local_pci_probe+0x42/0x80
[   45.036563]  work_for_cpu_fn+0x16/0x20
[   45.040886]  process_one_work+0x292/0x630
[   45.045500]  ? __schedule+0x344/0x970
[   45.049735]  worker_thread+0x227/0x3e0
[   45.054061]  ? process_one_work+0x630/0x630
[   45.058864]  kthread+0x136/0x150
[   45.062597]  ? kthread_use_mm+0x100/0x100
[   45.067200]  ret_from_fork+0x22/0x30
[   45.071335] irq event stamp: 2146432
[   45.075458] hardirqs last  enabled at (2146442): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.085440] hardirqs last disabled at (2146451): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.095432] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.105134] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.116004] ---[ end trace ed0f88fd959a5a3c ]---
[   45.121305] ------------[ cut here ]------------
[   45.126596] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.136772] Modules linked in:
[   45.142288] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.153351] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.162077] Workqueue: events work_for_cpu_fn
[   45.167074] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.172663] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.193874] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.199850] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.207970] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.216095] RBP: 00000000ff600000 R08: 00000000000ff600 R09: 00000000000ff7ff
[   45.224207] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   45.232327] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   45.240446] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   45.249662] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   45.256225] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.264344] Call Trace:
[   45.267205]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.273003]  iommu_dma_free+0x18/0x30
[   45.277231]  ioat_free_chan_resources+0x19e/0x300
[   45.282631]  ioat_dma_self_test+0x2a0/0x3d0
[   45.287457]  ioat_pci_probe+0x60e/0x903
[   45.291894]  local_pci_probe+0x42/0x80
[   45.296217]  work_for_cpu_fn+0x16/0x20
[   45.300539]  process_one_work+0x292/0x630
[   45.305162]  ? __schedule+0x344/0x970
[   45.309399]  worker_thread+0x227/0x3e0
[   45.313724]  ? process_one_work+0x630/0x630
[   45.318535]  kthread+0x136/0x150
[   45.322274]  ? kthread_use_mm+0x100/0x100
[   45.326893]  ret_from_fork+0x22/0x30
[   45.331034] irq event stamp: 2146822
[   45.335161] hardirqs last  enabled at (2146832): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.345154] hardirqs last disabled at (2146841): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.355150] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.364850] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.375710] ---[ end trace ed0f88fd959a5a3d ]---
[   45.381018] ------------[ cut here ]------------
[   45.386308] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.396494] Modules linked in:
[   45.400020] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.411086] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.419810] Workqueue: events work_for_cpu_fn
[   45.424819] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.430406] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.451630] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.457610] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.465730] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.473853] RBP: 00000000ff400000 R08: 00000000000ff400 R09: 00000000000ff5ff
[   45.481973] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   45.490092] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   45.498211] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   45.507418] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   45.513969] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.522081] Call Trace:
[   45.524934]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.530718]  iommu_dma_free+0x18/0x30
[   45.534989]  ioat_free_chan_resources+0x19e/0x300
[   45.540378]  ioat_dma_self_test+0x2a0/0x3d0
[   45.545193]  ioat_pci_probe+0x60e/0x903
[   45.549619]  local_pci_probe+0x42/0x80
[   45.553940]  work_for_cpu_fn+0x16/0x20
[   45.558258]  process_one_work+0x292/0x630
[   45.562871]  ? __schedule+0x344/0x970
[   45.567108]  worker_thread+0x227/0x3e0
[   45.571434]  ? process_one_work+0x630/0x630
[   45.576243]  kthread+0x136/0x150
[   45.579981]  ? kthread_use_mm+0x100/0x100
[   45.584598]  ret_from_fork+0x22/0x30
[   45.588733] irq event stamp: 2147210
[   45.592860] hardirqs last  enabled at (2147220): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.602845] hardirqs last disabled at (2147229): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.612836] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.622531] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.633392] ---[ end trace ed0f88fd959a5a3e ]---
[   45.638708] ------------[ cut here ]------------
[   45.644003] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.654191] Modules linked in:
[   45.657734] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.668807] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.677534] Workqueue: events work_for_cpu_fn
[   45.682538] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.688126] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.709343] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.715321] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.723440] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.731555] RBP: 00000000ff200000 R08: 00000000000ff200 R09: 00000000000ff3ff
[   45.739665] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   45.747777] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   45.755897] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   45.765106] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   45.771661] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   45.779778] Call Trace:
[   45.782638]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   45.788439]  iommu_dma_free+0x18/0x30
[   45.792664]  ioat_free_chan_resources+0x19e/0x300
[   45.798060]  ioat_dma_self_test+0x2a0/0x3d0
[   45.802886]  ioat_pci_probe+0x60e/0x903
[   45.807306]  local_pci_probe+0x42/0x80
[   45.811633]  work_for_cpu_fn+0x16/0x20
[   45.815946]  process_one_work+0x292/0x630
[   45.820556]  ? __schedule+0x344/0x970
[   45.824791]  worker_thread+0x227/0x3e0
[   45.829117]  ? process_one_work+0x630/0x630
[   45.833969]  kthread+0x136/0x150
[   45.837706]  ? kthread_use_mm+0x100/0x100
[   45.842325]  ret_from_fork+0x22/0x30
[   45.846475] irq event stamp: 2147602
[   45.850608] hardirqs last  enabled at (2147612): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   45.860603] hardirqs last disabled at (2147621): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   45.870589] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   45.880293] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   45.891163] ---[ end trace ed0f88fd959a5a3f ]---
[   45.896473] ------------[ cut here ]------------
[   45.901762] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   45.911956] Modules linked in:
[   45.915503] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   45.926570] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   45.935302] Workqueue: events work_for_cpu_fn
[   45.940312] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   45.945905] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   45.967128] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   45.973111] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   45.981236] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   45.989363] RBP: 00000000ff000000 R08: 00000000000ff000 R09: 00000000000ff1ff
[   45.997489] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   46.005613] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   46.013738] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   46.022952] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   46.029521] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   46.037643] Call Trace:
[   46.040508]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   46.046305]  iommu_dma_free+0x18/0x30
[   46.050538]  ioat_free_chan_resources+0x19e/0x300
[   46.055941]  ioat_dma_self_test+0x2a0/0x3d0
[   46.060765]  ioat_pci_probe+0x60e/0x903
[   46.065196]  local_pci_probe+0x42/0x80
[   46.069526]  work_for_cpu_fn+0x16/0x20
[   46.073854]  process_one_work+0x292/0x630
[   46.078477]  ? __schedule+0x344/0x970
[   46.082717]  worker_thread+0x227/0x3e0
[   46.087035]  ? process_one_work+0x630/0x630
[   46.091849]  kthread+0x136/0x150
[   46.095594]  ? kthread_use_mm+0x100/0x100
[   46.100218]  ret_from_fork+0x22/0x30
[   46.104366] irq event stamp: 2147992
[   46.108499] hardirqs last  enabled at (2148002): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   46.120483] hardirqs last disabled at (2148011): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   46.130472] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   46.140171] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   46.151034] ---[ end trace ed0f88fd959a5a40 ]---
[   46.156339] ------------[ cut here ]------------
[   46.161628] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496 __iommu_dma_unmap+0x115/0x130
[   46.171817] Modules linked in:
[   46.175365] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W         5.9.0-rc4-00006-g110da1e703a2 #216
[   46.186430] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS 3.0a 12/05/2013
[   46.195163] Workqueue: events work_for_cpu_fn
[   46.200173] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   46.205767] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24 18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb 8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   46.226991] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   46.232976] RAX: 0000000000200000 RBX: 0000000000080000 RCX: 0000000000000000
[   46.241101] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI: ffff888477804f30
[   46.249226] RBP: 00000000fec00000 R08: 00000000000fec00 R09: 00000000000fedff
[   46.257352] R10: 0000000000000002 R11: 0000000000000004 R12: ffff888270c55000
[   46.265474] R13: ffff888472dc7268 R14: 0000000000080000 R15: 0000000000000000
[   46.273602] FS:  0000000000000000(0000) GS:ffff888479800000(0000) knlGS:0000000000000000
[   46.282822] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   46.289388] CR2: 0000000000000000 CR3: 0000000002a20001 CR4: 00000000000606e0
[   46.297513] Call Trace:
[   46.300358]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   46.306152]  iommu_dma_free+0x18/0x30
[   46.310379]  ioat_free_chan_resources+0x19e/0x300
[   46.315776]  ioat_dma_self_test+0x2a0/0x3d0
[   46.320607]  ioat_pci_probe+0x60e/0x903
[   46.325044]  local_pci_probe+0x42/0x80
[   46.329373]  work_for_cpu_fn+0x16/0x20
[   46.333699]  process_one_work+0x292/0x630
[   46.338321]  ? __schedule+0x344/0x970
[   46.342563]  worker_thread+0x227/0x3e0
[   46.346891]  ? process_one_work+0x630/0x630
[   46.351704]  kthread+0x136/0x150
[   46.355449]  ? kthread_use_mm+0x100/0x100
[   46.360069]  ret_from_fork+0x22/0x30
[   46.364204] irq event stamp: 2148380
[   46.368338] hardirqs last  enabled at (2148390): [<ffffffff811b8465>] console_unlock+0x435/0x570
[   46.378336] hardirqs last disabled at (2148399): [<ffffffff811b845b>] console_unlock+0x42b/0x570
[   46.388335] softirqs last  enabled at (2014254): [<ffffffff817da3e5>] ioat_cleanup+0x65/0x470
[   46.398040] softirqs last disabled at (2014258): [<ffffffff817d797a>] ioat_free_chan_resources+0x6a/0x300
[   46.408914] ---[ end trace ed0f88fd959a5a41 ]---

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

maintainer
#13 lore raw
In reply to Tvrtko Ursulin
Quoted 71 lines · Tvrtko Ursulin
Quoted 17 lines · Lu Baolu

Hi Tvrtko,

Quoted 14 lines · Tvrtko Ursulin

Hi,

Quoted 10 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

This series is a follow-up with below changes:

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

1. Add a quirk for the i915 driver issue described in Tom's cover letter.

Last week I have copied you on an i915 series which appears to remove the need for this quirk. so if we get those i915 patches reviewed and merged, do you still want to pursue this quirk?

It's up to the graphic guys. I don't know the details in i915 driver. I don't think my tests could cover all cases.

I am the graphic guy. :) I just need some reviews (internally) for my series and then we can merge it, at which point you don't need the quirk patch any more. I'll try to accelerate this.

With regards to testing, you could send your series with my patches on top to our trybot mailing list ([email protected] / https://patchwork.freedesktop.org/project/intel-gfx-trybot/series/?ordering=-last_updated) which would show you if it is still hitting the DMAR issues in i915.

Quoted 31 lines
Quoted 31 lines
Quoted 4 lines

2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not sufficient for the mapped address (ffff008000)

Relevant iommu boot related messages are:

<6>[    0.184234] DMAR: Host address width 36
<6>[    0.184245] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
<6>[    0.184288] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020e60262 ecap f0101a <6>[    0.184308] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
<6>[    0.184337] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap c9008020660262 ecap f0105a <6>[    0.184357] DMAR: RMRR base: 0x000000d8d28000 end: 0x000000d8d46fff
<6>[    0.184377] DMAR: RMRR base: 0x000000db000000 end: 0x000000df1fffff
<6>[    0.184398] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
<6>[    0.184414] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
<6>[    0.184428] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping. <6>[    0.185173] DMAR-IR: Enabled IRQ remapping in x2apic mode

<6>[    0.878934] DMAR: No ATSR found
<6>[    0.878966] DMAR: dmar0: Using Queued invalidation <6>[    0.879007] DMAR: dmar1: Using Queued invalidation

<6>[    0.915032] DMAR: Intel(R) Virtualization Technology for Directed I/O <6>[    0.915060] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) <6>[    0.915084] software IO TLB: mapped [mem 0xc80d4000-0xcc0d4000] (64MB)

Quoted 8 lines
Quoted 4 lines

(Full boot log at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/boot0.txt, failures at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/igt@i915_selftest@[email protected].)

Does this look familiar or at least plausible to you? Is this something your new series has fixed?

This happens during attaching a domain to device. It has nothing to do with this patch series. I will look into this issue, but not in this email thread context.

Quoted 6 lines

I am not sure what step is attaching domain to device, but these type messages:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not

Quoted 1 line
Quoted 1 line

sufficient for the mapped address (ffff008000)

They definitely appear to happen at runtime, as i915 is getting exercised by userspace.

AFAICS this certainly might be related to this series - iommu-dma will constrain IOVA allocation based on the domain geometry that the driver reports, which in this case is set only once when first allocating the domain. Thus it looks like both the dmar_domain->gaw adjustment in prepare_domain_attach_device() and the domain_use_first_level() business in intel_alloc_iova() effectively get lost in this conversion, since the domain geometry never gets updated to reflect those additional constraints.

Robin.

Quoted 8 lines

Regards,

Tvrtko
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

#20 lore raw
In reply to Lu Baolu
Quoted 6 lines · Lu Baolu
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

I had the same issue with Tom's v2 but never saw this on his v1.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Have you verified whether this could be reproduced with the lasted upstream kernel (without this patch series)?

Yes.

I am sorry. Just want to make sure I understand you correctly. :-) When you say "yes", do you mean you could reproduce this with pure upstream kernel (5.9-rc6)?

I mean I've verified the bug does *not* exist without this patch set.

Quoted 6 lines
Quoted 3 lines

Also, it's hitting a warning in the dma-iommu code which would not be hit without this patch set.

Without this series, DMA APIs don't go through dma-iommu. Do you mind posting the warning message?

It was on my original email but here it is again:

[   44.057877] ------------[ cut here ]------------
[   44.063167] WARNING: CPU: 4 PID: 84 at drivers/iommu/dma-iommu.c:496
__iommu_dma_unmap+0x115/0x130
[   44.073351] Modules linked in:
[   44.076882] CPU: 4 PID: 84 Comm: kworker/4:1 Tainted: G        W
   5.9.0-rc4-00006-g110da1e703a2 #216
[   44.087935] Hardware name: Supermicro SYS-7047GR-TRF/X9DRG-QF, BIOS
3.0a 12/05/2013
[   44.096650] Workqueue: events work_for_cpu_fn
[   44.101644] RIP: 0010:__iommu_dma_unmap+0x115/0x130
[   44.107225] Code: 48 8b 0c 24 48 c7 44 24 10 00 00 00 00 48 c7 44 24
18 00 00 00 00 48 c7 44 24 20 00 00 00 00 48 c7 44 24 08 ff ff ff ff eb
8d <0f> 0b e9 74 ff ff ff e8 1f 36 66 00 66 66 2e 0f 1f 84 00 00 00 00
[   44.128443] RSP: 0000:ffffc90002397c38 EFLAGS: 00010206
[   44.134413] RAX: 0000000000200000 RBX: 0000000000080000 RCX:
0000000000000000
[   44.144487] RDX: 0000000000000403 RSI: ffffffff82a7fb20 RDI:
ffff888477804f30
[   44.152613] RBP: 00000000fec00000 R08: 00000000000fec00 R09:
00000000000fedff
[   44.160733] R10: 0000000000000002 R11: 0000000000000004 R12:
ffff888270c39000
[   44.168861] R13: ffff888472d85ee8 R14: 0000000000080000 R15:
0000000000000000
[   44.176980] FS:  0000000000000000(0000) GS:ffff888479800000(0000)
knlGS:0000000000000000
[   44.186198] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   44.192761] CR2: 0000000000000000 CR3: 0000000002a20001 CR4:
00000000000606e0
[   44.200871] Call Trace:
[   44.203716]  ? lockdep_hardirqs_on_prepare+0xad/0x180
[   44.209509]  iommu_dma_free+0x18/0x30
[   44.213734]  ioat_free_chan_resources+0x19e/0x300
[   44.219133]  ioat_dma_self_test+0x2a0/0x3d0
[   44.223964]  ioat_pci_probe+0x60e/0x903
[   44.228387]  local_pci_probe+0x42/0x80
[   44.232721]  work_for_cpu_fn+0x16/0x20
[   44.237037]  process_one_work+0x292/0x630
[   44.241644]  ? __schedule+0x344/0x970
[   44.245868]  worker_thread+0x227/0x3e0
[   44.250185]  ? process_one_work+0x630/0x630
[   44.254989]  kthread+0x136/0x150
[   44.258718]  ? kthread_use_mm+0x100/0x100
[   44.263334]  ret_from_fork+0x22/0x30
[   44.267474] irq event stamp: 1881262
[   44.271602] hardirqs last  enabled at (1881272): [<ffffffff811b8465>]
console_unlock+0x435/0x570
[   44.281593] hardirqs last disabled at (1881281): [<ffffffff811b845b>]
console_unlock+0x42b/0x570
[   44.291588] softirqs last  enabled at (1747140): [<ffffffff817da3e5>]
ioat_cleanup+0x65/0x470
[   44.301285] softirqs last disabled at (1747144): [<ffffffff817d797a>]
ioat_free_chan_resources+0x6a/0x300
[   44.312153] ---[ end trace ed0f88fd959a5a39 ]---
#22 lore raw
In reply to Robin Murphy
Quoted 24 lines · Robin Murphy
Quoted 23 lines · Logan Gunthorpe

Hi Lu,

Quoted 7 lines · Lu Baolu

Tom Murphy has almost done all the work. His latest patch series was posted here.

https://lore.kernel.org/linux-iommu/[email protected]/

Thanks a lot!

Quoted 8 lines

This series is a follow-up with below changes:

1. Add a quirk for the i915 driver issue described in Tom's cover letter.
2. Fix several bugs in patch "iommu: Allow the dma-iommu api to use bounce buffers" to make the bounce buffer work for untrusted devices.
3. Several cleanups in iommu/vt-d driver after the conversion.

I'm trying to test this on an old Sandy Bridge, but found that I get spammed with warnings on boot. I've put a sample of a few of them below. They all seem to be related to ioat.

Quoted 6 lines
Quoted 1 line

I had the same issue with Tom's v2 but never saw this on his v1.

I think this might have more to do with ioat being totally broken - AFAICS it appears to allocate descriptors with a size of 2MB, but free them with a size of 512KB. Try throwing CONFIG_DMA_API_DEBUG at it to confirm.

Ah, yes, nice catch. Looks like it was broken recently by the following commit, but nobody noticed and the dma-iommu patch set added a warning which caught it.

a02254f8a676 ("dmaengine: ioat: Decreasing allocation chunk size 2M->512K")

Reverting that fixes the issue. I'll try to send patch or two for this.

Logan

author maintainer
#14 lore raw
In reply to Robin Murphy
Quoted 35 lines · Robin Murphy
Quoted 35 lines
Quoted 34 lines
Quoted 22 lines

With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not sufficient for the mapped address (ffff008000)

Relevant iommu boot related messages are:

<6>[    0.184234] DMAR: Host address width 36
<6>[    0.184245] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
<6>[    0.184288] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020e60262 ecap f0101a <6>[    0.184308] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
<6>[    0.184337] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap c9008020660262 ecap f0105a <6>[    0.184357] DMAR: RMRR base: 0x000000d8d28000 end: 0x000000d8d46fff
<6>[    0.184377] DMAR: RMRR base: 0x000000db000000 end: 0x000000df1fffff
<6>[    0.184398] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
<6>[    0.184414] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
<6>[    0.184428] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping. <6>[    0.185173] DMAR-IR: Enabled IRQ remapping in x2apic mode

<6>[    0.878934] DMAR: No ATSR found
<6>[    0.878966] DMAR: dmar0: Using Queued invalidation <6>[    0.879007] DMAR: dmar1: Using Queued invalidation

Quoted 8 lines

<6>[    0.915032] DMAR: Intel(R) Virtualization Technology for Directed I/O <6>[    0.915060] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) <6>[    0.915084] software IO TLB: mapped [mem 0xc80d4000-0xcc0d4000] (64MB)

(Full boot log at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/boot0.txt, failures at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/igt@i915_selftest@[email protected].)

Does this look familiar or at least plausible to you? Is this something your new series has fixed?

This happens during attaching a domain to device. It has nothing to do with this patch series. I will look into this issue, but not in this email thread context.

Quoted 8 lines
Quoted 6 lines

I am not sure what step is attaching domain to device, but these type messages:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not >> sufficient for the mapped address (ffff008000)

They definitely appear to happen at runtime, as i915 is getting exercised by userspace.

AFAICS this certainly might be related to this series - iommu-dma will

Oh! I looked at the wrong function. prepare_domain_attach_device() prints a similar message which made me believe that it was not caused by the this patches series.

Quoted 1 line

constrain IOVA allocation based on the domain geometry that the driver reports, which in this case is set only once when first allocating the domain. Thus it looks like both the dmar_domain->gaw adjustment in prepare_domain_attach_device() and the domain_use_first_level() business in intel_alloc_iova() effectively get lost in this conversion, since the domain geometry never gets updated to reflect those additional constraints.

Sounds reasonable. I will look into the code and work out a fix.

Quoted 2 lines
Quoted 1 line

Robin.

Best regards,
baolu

author maintainer
#15 lore raw
In reply to Tvrtko Ursulin

Hi Tvrtko,

Quoted 35 lines · Tvrtko Ursulin
Quoted 26 lines
Quoted 26 lines

With the previous version of the series I hit a problem on Ivybridge where apparently the dma engine width is not respected. At least that is my layman interpretation of the errors. From the older thread:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not sufficient for the mapped address (ffff008000)

Relevant iommu boot related messages are:

<6>[    0.184234] DMAR: Host address width 36
<6>[    0.184245] DMAR: DRHD base: 0x000000fed90000 flags: 0x0
<6>[    0.184288] DMAR: dmar0: reg_base_addr fed90000 ver 1:0 cap c0000020e60262 ecap f0101a <6>[    0.184308] DMAR: DRHD base: 0x000000fed91000 flags: 0x1
<6>[    0.184337] DMAR: dmar1: reg_base_addr fed91000 ver 1:0 cap c9008020660262 ecap f0105a <6>[    0.184357] DMAR: RMRR base: 0x000000d8d28000 end: 0x000000d8d46fff
<6>[    0.184377] DMAR: RMRR base: 0x000000db000000 end: 0x000000df1fffff
<6>[    0.184398] DMAR-IR: IOAPIC id 2 under DRHD base  0xfed91000 IOMMU 1
<6>[    0.184414] DMAR-IR: HPET id 0 under DRHD base 0xfed91000
<6>[    0.184428] DMAR-IR: Queued invalidation will be enabled to support x2apic and Intr-remapping. <6>[    0.185173] DMAR-IR: Enabled IRQ remapping in x2apic mode

<6>[    0.878934] DMAR: No ATSR found
<6>[    0.878966] DMAR: dmar0: Using Queued invalidation <6>[    0.879007] DMAR: dmar1: Using Queued invalidation

<6>[    0.915032] DMAR: Intel(R) Virtualization Technology for Directed I/O <6>[    0.915060] PCI-DMA: Using software bounce buffering for IO (SWIOTLB) <6>[    0.915084] software IO TLB: mapped [mem 0xc80d4000-0xcc0d4000] (64MB)

Quoted 8 lines
Quoted 4 lines

(Full boot log at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/boot0.txt, failures at https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_7054/fi-ivb-3770/igt@i915_selftest@[email protected].)

Does this look familiar or at least plausible to you? Is this something your new series has fixed?

This happens during attaching a domain to device. It has nothing to do with this patch series. I will look into this issue, but not in this email thread context.

Quoted 6 lines

I am not sure what step is attaching domain to device, but these type messages:

<3> [209.526605] DMAR: intel_iommu_map: iommu width (39) is not

Quoted 1 line
Quoted 1 line

sufficient for the mapped address (ffff008000)

They definitely appear to happen at runtime, as i915 is getting exercised by userspace.

Can you please check whether below change helps here?

drivers/iommu/intel/iommu.c +1 -0
index c8323a9f8bde..0484c539debc 100644
@@ -724,6 +724,7 @@ static int domain_update_device_node(struct dmar_domain *domain)
 /* Some capabilities may be different across iommus */
 static void domain_update_iommu_cap(struct dmar_domain *domain)
 {
+       domain->geometry.aperture_end = __DOMAIN_MAX_ADDR(dmar_domain->gaw);
        domain_update_iommu_coherency(domain);
        domain->iommu_snooping = domain_update_iommu_snooping(NULL);
        domain->iommu_superpage = domain_update_iommu_superpage(domain, 

NULL);

Best regards,
baolu
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx