Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465546 > unrolled thread

[PATCH 4.7 103/186] iommu/amd: Init unity mappings only for dma_ops domains

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2016-08-18 16:40 +0200
Last post2016-08-18 16:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.7 103/186] iommu/amd: Init unity mappings only for dma_ops domains Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-18 16:40 +0200

#1465546 — [PATCH 4.7 103/186] iommu/amd: Init unity mappings only for dma_ops domains

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2016-08-18 16:40 +0200
Subject[PATCH 4.7 103/186] iommu/amd: Init unity mappings only for dma_ops domains
Message-ID<s7wEa-10D-5@gated-at.bofh.it>
4.7-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joerg Roedel <jroedel@suse.de>

commit b548e786ce47017107765bbeb0f100202525ea83 upstream.

The default domain for a device might also be
identity-mapped. In this case the kernel would crash when
unity mappings are defined for the device. Fix that by
making sure the domain is a dma_ops domain.

Fixes: 0bb6e243d7fb ('iommu/amd: Support IOMMU_DOMAIN_DMA type allocation')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/amd_iommu.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -466,9 +466,11 @@ static void init_iommu_group(struct devi
 	if (!domain)
 		goto out;
 
-	dma_domain = to_pdomain(domain)->priv;
+	if (to_pdomain(domain)->flags == PD_DMA_OPS_MASK) {
+		dma_domain = to_pdomain(domain)->priv;
+		init_unity_mappings_for_device(dev, dma_domain);
+	}
 
-	init_unity_mappings_for_device(dev, dma_domain);
 out:
 	iommu_group_put(group);
 }

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web