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


Groups > linux.kernel > #1465546

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

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.7 103/186] iommu/amd: Init unity mappings only for dma_ops domains
Date 2016-08-18 16:40 +0200
Message-ID <s7wEa-10D-5@gated-at.bofh.it> (permalink)
References <s7wb7-OK-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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);
 }

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[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

csiph-web