diff options
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/Kconfig | 11 | ||||
-rw-r--r-- | drivers/iommu/tegra-smmu.c | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 3bd9fff5c589..b736809102df 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -162,4 +162,15 @@ config TEGRA_IOMMU_SMMU space through the SMMU (System Memory Management Unit) hardware included on Tegra SoCs. +config TEGRA_IOMMU_SMMU_LINEAR + bool "Physical RAM IOVA Liner Mapping Support" + depends on TEGRA_IOMMU_SMMU + default y + help + Enables support for linear mapping between physical address + and IO virtual address for RAM. With this enabled, H/W can + expect virt_to_phys() to work even if it's behined the + IOMMU'able bus. Otherwise DMA API should be used correctly + in device drivers. + endif # IOMMU_SUPPORT diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 915763c748f1..780a77b8a219 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -183,10 +183,17 @@ enum { #define _PDE_ATTR (_READABLE | _WRITABLE | _NONSECURE) #define _PDE_ATTR_N (_PDE_ATTR | _PDE_NEXT) -#define _PDE_VACANT(pdn) (((pdn) << 10) | _PDE_ATTR) +#define _PDE_VACANT(pdn) (0) #define _PTE_ATTR (_READABLE | _WRITABLE | _NONSECURE) -#define _PTE_VACANT(addr) (((addr) >> SMMU_PAGE_SHIFT) | _PTE_ATTR) +#define _PTE_VACANT(addr) (0) + +#ifdef CONFIG_TEGRA_IOMMU_SMMU_LINEAR +#undef _PDE_VACANT(pdn) +#undef _PTE_VACANT(addr) +#define _PDE_VACANT(pdn) (((pdn) << 10) | _PDE_ATTR) +#define _PTE_VACANT(addr) (((addr) >> SMMU_PAGE_SHIFT) | _PTE_ATTR) +#endif #define SMMU_MK_PDIR(page, attr) \ ((page_to_phys(page) >> SMMU_PDIR_SHIFT) | (attr)) |