Commit df8eaed2 authored by Joerg Roedel's avatar Joerg Roedel Committed by Greg Kroah-Hartman

iommu/amd: Init unity mappings only for dma_ops domains

commit b548e786 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: 0bb6e243 ('iommu/amd: Support IOMMU_DOMAIN_DMA type allocation')
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 51e94ff8
...@@ -352,9 +352,11 @@ static void init_iommu_group(struct device *dev) ...@@ -352,9 +352,11 @@ static void init_iommu_group(struct device *dev)
if (!domain) if (!domain)
goto out; goto out;
if (to_pdomain(domain)->flags == PD_DMA_OPS_MASK) {
dma_domain = to_pdomain(domain)->priv; dma_domain = to_pdomain(domain)->priv;
init_unity_mappings_for_device(dev, dma_domain); init_unity_mappings_for_device(dev, dma_domain);
}
out: out:
iommu_group_put(group); iommu_group_put(group);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment