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

Commit 9b76f03f authored by Swathi Sridhar's avatar Swathi Sridhar Committed by Saravana Kannan
Browse files

ANDROID: GKI: iommu: dma-mapping-fast: Fast ARMv7/v8 Long Descriptor Format



Snapshot of vendor added support for Fast ARMv7/v8 Long Descriptor
Format.

Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
Signed-off-by: default avatarPrakash Gupta <guptap@codeaurora.org>
Signed-off-by: default avatarQingqing Zhou <qqzhou@codeaurora.org>
Signed-off-by: default avatarRishabh Bhatnagar <rishabhb@codeaurora.org>
Signed-off-by: default avatarShiraz Hashim <shashim@codeaurora.org>
Signed-off-by: default avatarSudarshan Rajagopalan <sudaraja@codeaurora.org>
Signed-off-by: default avatarSwathi Sridhar <swatsrid@codeaurora.org>
Signed-off-by: default avatarVinayak Menon <vinmenon@codeaurora.org>
Bug: 155522481
Signed-off-by: default avatarMark Salyzyn <salyzyn@google.com>
[saravanak snapshot from commit 79efc458af96 and disabled for ARM]
Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
Change-Id: Ifae8f889737f25cd8a9729101cd8251974109842
parent 0f671ed8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ struct dma_iommu_mapping {
	void			*bitmap;
	size_t			bits;
	dma_addr_t		base;

	struct dma_fast_smmu_mapping *fast;
};

#ifdef CONFIG_ARM64_DMA_USE_IOMMU
+5 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
#include <asm/dma-iommu.h>
#include <linux/dma-mapping-fast.h>

static int swiotlb __ro_after_init;

@@ -1009,16 +1010,19 @@ iommu_init_mapping(struct device *dev, struct dma_iommu_mapping *mapping)
static int arm_iommu_get_dma_cookie(struct device *dev,
				    struct dma_iommu_mapping *mapping)
{
	int s1_bypass = 0;
	int s1_bypass = 0, is_fast = 0;
	int err = 0;

	mutex_lock(&iommu_dma_init_mutex);

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

	if (s1_bypass)
		mapping->ops = &arm64_swiotlb_dma_ops;
	else if (is_fast)
		err = fast_smmu_init_mapping(dev, mapping);
	else
		err = iommu_init_mapping(dev, mapping);

+12 −0
Original line number Diff line number Diff line
@@ -58,6 +58,18 @@ config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST

	  If unsure, say N here.

config IOMMU_IO_PGTABLE_FAST
	bool "Fast ARMv7/v8 Long Descriptor Format"
	depends on ARM64_DMA_USE_IOMMU && IOMMU_DMA
	help
          Enable support for a subset of the ARM long descriptor pagetable
	  format.  This allocator achieves fast performance by
	  pre-allocating and pre-populating page table memory up front.
	  only supports a 32 bit virtual address space.

          This implementation is mainly optimized for use cases where the
          buffers are small (<= 64K) since it only supports 4K page sizes.

endmenu

config IOMMU_DEBUGFS
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o
obj-$(CONFIG_IOMMU_IO_PGTABLE_ARMV7S) += io-pgtable-arm-v7s.o
obj-$(CONFIG_IOMMU_IO_PGTABLE_LPAE) += io-pgtable-arm.o
obj-$(CONFIG_IOMMU_IOVA) += iova.o
obj-$(CONFIG_IOMMU_IO_PGTABLE_FAST) += io-pgtable-fast.o dma-mapping-fast.o
obj-$(CONFIG_OF_IOMMU)	+= of_iommu.o
obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o
obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o amd_iommu_quirks.o
+1249 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading