diff options
author | Joerg Roedel <jroedel@suse.de> | 2016-07-13 12:35:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-20 18:09:21 +0200 |
commit | df8eaed22590a484a64e4a6f2af266f59a692aed (patch) | |
tree | 496a4b09801ffc7fee7a56aa3937d4e2075fdffc | |
parent | 51e94ff8d90804ec1912fd71b2c7e22902a61585 (diff) | |
download | linux-stable-df8eaed22590a484a64e4a6f2af266f59a692aed.tar.gz linux-stable-df8eaed22590a484a64e4a6f2af266f59a692aed.tar.bz2 linux-stable-df8eaed22590a484a64e4a6f2af266f59a692aed.zip |
iommu/amd: Init unity mappings only for dma_ops domains
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>
-rw-r--r-- | drivers/iommu/amd_iommu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index a2d054f96fda..e54e335d082b 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -352,9 +352,11 @@ static void init_iommu_group(struct device *dev) 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); } |