Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 094f19f7 authored by Patrick Daly's avatar Patrick Daly
Browse files

arm64: dma_mapping: Support DOMAIN_ATTR_S1_BYPASS



For iommus which do not use stage1 translation, stage2 may not be aware
of the device's dma_mask requirements. Choose the dma_ops such that
allocations are made within the dma_mask region and bounce buffers are
used as necessary.

Change-Id: If2ae2021ae9ce10bd22f424967cfcd9c3f94534e
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 17e13281
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1581,13 +1581,18 @@ int arm_iommu_attach_device(struct device *dev,
			    struct dma_iommu_mapping *mapping)
{
	int err;
	int s1_bypass = 0;

	err = iommu_attach_device(mapping->domain, dev);
	if (err)
		return err;

	iommu_domain_get_attr(mapping->domain, DOMAIN_ATTR_S1_BYPASS,
					&s1_bypass);

	kref_get(&mapping->kref);
	dev->archdata.mapping = mapping;
	if (!s1_bypass)
		set_dma_ops(dev, &iommu_ops);

	pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));