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

Commit 246647d1 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu: Remove config dependency"

parents 224acb50 778f546f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -988,6 +988,7 @@ static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu,
		}
		udelay(delay);
	}
	trace_tlbsync_timeout(smmu->dev, 0);
	dev_err_ratelimited(smmu->dev,
			    "TLB sync timed out -- SMMU may be deadlocked\n");
}
@@ -1026,10 +1027,14 @@ static void arm_smmu_tlb_sync_vmid(void *cookie)
static void arm_smmu_tlb_inv_context_s1(void *cookie)
{
	struct arm_smmu_domain *smmu_domain = cookie;
	struct device *dev = smmu_domain->dev;
	struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
	struct arm_smmu_device *smmu = smmu_domain->smmu;
	void __iomem *base = ARM_SMMU_CB(smmu_domain->smmu, cfg->cbndx);
	bool use_tlbiall = smmu->options & ARM_SMMU_OPT_NO_ASID_RETENTION;
	ktime_t cur = ktime_get();

	trace_tlbi_start(dev, 0);

	if (!use_tlbiall)
		writel_relaxed(cfg->asid, base + ARM_SMMU_CB_S1_TLBIASID);
@@ -1037,6 +1042,7 @@ static void arm_smmu_tlb_inv_context_s1(void *cookie)
		writel_relaxed(0, base + ARM_SMMU_CB_S1_TLBIALL);

	arm_smmu_tlb_sync_context(cookie);
	trace_tlbi_end(dev, ktime_us_delta(ktime_get(), cur));
}

static void arm_smmu_tlb_inv_context_s2(void *cookie)
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/pci.h>
#include <trace/events/iommu.h>

#include <soc/qcom/secure_buffer.h>
#include <linux/arm-smmu-errata.h>
@@ -405,6 +406,8 @@ static dma_addr_t fast_smmu_map_page(struct device *dev, struct page *page,
	fast_dmac_clean_range(mapping, pmd, pmd + nptes);

	spin_unlock_irqrestore(&mapping->lock, flags);

	trace_map(mapping->domain, iova, phys_to_map, len, prot);
	return iova + offset_from_phys_to_map;

fail_free_iova:
@@ -436,6 +439,8 @@ static void fast_smmu_unmap_page(struct device *dev, dma_addr_t iova,
	fast_dmac_clean_range(mapping, pmd, pmd + nptes);
	__fast_smmu_free_iova(mapping, iova - offset, len);
	spin_unlock_irqrestore(&mapping->lock, flags);

	trace_unmap(mapping->domain, iova - offset, len, len);
}

static void fast_smmu_sync_single_for_cpu(struct device *dev,
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#include <asm/cacheflush.h>
#include <asm/dma-iommu.h>

#if defined(CONFIG_IOMMU_DEBUG_TRACKING) || defined(CONFIG_IOMMU_TESTS)
#if defined(CONFIG_IOMMU_TESTS)

static const char *iommu_debug_attr_to_string(enum iommu_attr attr)
{
+21 −2
Original line number Diff line number Diff line
@@ -598,6 +598,7 @@ int iommu_group_add_device(struct iommu_group *group, struct device *dev)
	if (ret)
		goto err_put_group;


	/* Notify any listeners about change to group. */
	blocking_notifier_call_chain(&group->notifier,
				     IOMMU_GROUP_NOTIFY_ADD_DEVICE, dev);
@@ -1267,6 +1268,7 @@ static struct iommu_domain *__iommu_domain_alloc(struct bus_type *bus,
	/* Assume all sizes by default; the driver may override this later */
	domain->pgsize_bitmap  = bus->iommu_ops->pgsize_bitmap;
	domain->is_debug_domain = false;
	memset(domain->name, 0, IOMMU_DOMAIN_NAME_LEN);

	return domain;
}
@@ -1299,6 +1301,11 @@ static int __iommu_attach_device(struct iommu_domain *domain,
	if (!ret) {
		trace_attach_device_to_domain(dev);
		iommu_debug_attach_device(domain, dev);

		if (!strnlen(domain->name, IOMMU_DOMAIN_NAME_LEN)) {
			strlcpy(domain->name, dev_name(dev),
				IOMMU_DOMAIN_NAME_LEN);
		}
	}
	return ret;
}
@@ -1588,7 +1595,7 @@ int iommu_map(struct iommu_domain *domain, unsigned long iova,
	if (ret)
		iommu_unmap(domain, orig_iova, orig_size - size);
	else
		trace_map(orig_iova, orig_paddr, orig_size);
		trace_map(domain, orig_iova, orig_paddr, orig_size, prot);

	return ret;
}
@@ -1650,7 +1657,7 @@ static size_t __iommu_unmap(struct iommu_domain *domain,
	if (sync && ops->iotlb_sync)
		ops->iotlb_sync(domain);

	trace_unmap(orig_iova, size, unmapped);
	trace_unmap(domain, orig_iova, size, unmapped);
	return unmapped;
}

@@ -1668,6 +1675,18 @@ size_t iommu_unmap_fast(struct iommu_domain *domain,
}
EXPORT_SYMBOL_GPL(iommu_unmap_fast);

size_t iommu_map_sg(struct iommu_domain *domain,
				  unsigned long iova, struct scatterlist *sg,
				  unsigned int nents, int prot)
{
	size_t mapped;

	mapped = domain->ops->map_sg(domain, iova, sg, nents, prot);
	trace_map_sg(domain, iova, mapped, prot);
	return mapped;
}
EXPORT_SYMBOL(iommu_map_sg);

size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
			 struct scatterlist *sg, unsigned int nents, int prot)
{
+6 −7
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ struct iommu_pgtbl_info {
#define IOMMU_DOMAIN_DMA	(__IOMMU_DOMAIN_PAGING |	\
				 __IOMMU_DOMAIN_DMA_API)


#define IOMMU_DOMAIN_NAME_LEN 32
struct iommu_domain {
	unsigned type;
	const struct iommu_ops *ops;
@@ -110,6 +112,7 @@ struct iommu_domain {
	struct iommu_domain_geometry geometry;
	void *iova_cookie;
	bool is_debug_domain;
	char name[IOMMU_DOMAIN_NAME_LEN];
};

enum iommu_cap {
@@ -363,6 +366,9 @@ extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
			  size_t size);
extern size_t iommu_unmap_fast(struct iommu_domain *domain,
			       unsigned long iova, size_t size);
extern size_t iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
				struct scatterlist *sg, unsigned int nents,
				int prot);
extern size_t default_iommu_map_sg(struct iommu_domain *domain, unsigned long iova,
				struct scatterlist *sg,unsigned int nents,
				int prot);
@@ -445,13 +451,6 @@ static inline void iommu_tlb_sync(struct iommu_domain *domain)
		domain->ops->iotlb_sync(domain);
}

static inline size_t iommu_map_sg(struct iommu_domain *domain,
				  unsigned long iova, struct scatterlist *sg,
				  unsigned int nents, int prot)
{
	return domain->ops->map_sg(domain, iova, sg, nents, prot);
}

extern void iommu_trigger_fault(struct iommu_domain *domain,
				unsigned long flags);

Loading