#include <linux/atomic.h>
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/io-64-nonatomic-hi-lo.h>
#include <linux/io-pgtable.h>
#include <linux/iommu.h>
#include <linux/iopoll.h>
#include <linux/kconfig.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/firmware/qcom/qcom_scm.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include "arm-smmu.h"
#define SMMU_INTR_SEL_NS …
enum qcom_iommu_clk { … };
struct qcom_iommu_ctx;
struct qcom_iommu_dev { … };
struct qcom_iommu_ctx { … };
struct qcom_iommu_domain { … };
static struct qcom_iommu_domain *to_qcom_iommu_domain(struct iommu_domain *dom)
{ … }
static const struct iommu_ops qcom_iommu_ops;
static struct qcom_iommu_ctx * to_ctx(struct qcom_iommu_domain *d, unsigned asid)
{ … }
static inline void
iommu_writel(struct qcom_iommu_ctx *ctx, unsigned reg, u32 val)
{ … }
static inline void
iommu_writeq(struct qcom_iommu_ctx *ctx, unsigned reg, u64 val)
{ … }
static inline u32
iommu_readl(struct qcom_iommu_ctx *ctx, unsigned reg)
{ … }
static inline u64
iommu_readq(struct qcom_iommu_ctx *ctx, unsigned reg)
{ … }
static void qcom_iommu_tlb_sync(void *cookie)
{ … }
static void qcom_iommu_tlb_inv_context(void *cookie)
{ … }
static void qcom_iommu_tlb_inv_range_nosync(unsigned long iova, size_t size,
size_t granule, bool leaf, void *cookie)
{ … }
static void qcom_iommu_tlb_flush_walk(unsigned long iova, size_t size,
size_t granule, void *cookie)
{ … }
static void qcom_iommu_tlb_add_page(struct iommu_iotlb_gather *gather,
unsigned long iova, size_t granule,
void *cookie)
{ … }
static const struct iommu_flush_ops qcom_flush_ops = …;
static irqreturn_t qcom_iommu_fault(int irq, void *dev)
{ … }
static int qcom_iommu_init_domain(struct iommu_domain *domain,
struct qcom_iommu_dev *qcom_iommu,
struct device *dev)
{ … }
static struct iommu_domain *qcom_iommu_domain_alloc_paging(struct device *dev)
{ … }
static void qcom_iommu_domain_free(struct iommu_domain *domain)
{ … }
static int qcom_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
{ … }
static int qcom_iommu_identity_attach(struct iommu_domain *identity_domain,
struct device *dev)
{ … }
static struct iommu_domain_ops qcom_iommu_identity_ops = …;
static struct iommu_domain qcom_iommu_identity_domain = …;
static int qcom_iommu_map(struct iommu_domain *domain, unsigned long iova,
phys_addr_t paddr, size_t pgsize, size_t pgcount,
int prot, gfp_t gfp, size_t *mapped)
{ … }
static size_t qcom_iommu_unmap(struct iommu_domain *domain, unsigned long iova,
size_t pgsize, size_t pgcount,
struct iommu_iotlb_gather *gather)
{ … }
static void qcom_iommu_flush_iotlb_all(struct iommu_domain *domain)
{ … }
static void qcom_iommu_iotlb_sync(struct iommu_domain *domain,
struct iommu_iotlb_gather *gather)
{ … }
static phys_addr_t qcom_iommu_iova_to_phys(struct iommu_domain *domain,
dma_addr_t iova)
{ … }
static bool qcom_iommu_capable(struct device *dev, enum iommu_cap cap)
{ … }
static struct iommu_device *qcom_iommu_probe_device(struct device *dev)
{ … }
static int qcom_iommu_of_xlate(struct device *dev,
const struct of_phandle_args *args)
{ … }
static const struct iommu_ops qcom_iommu_ops = …;
static int qcom_iommu_sec_ptbl_init(struct device *dev)
{ … }
static int get_asid(const struct device_node *np)
{ … }
static int qcom_iommu_ctx_probe(struct platform_device *pdev)
{ … }
static void qcom_iommu_ctx_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id ctx_of_match[] = …;
static struct platform_driver qcom_iommu_ctx_driver = …;
static bool qcom_iommu_has_secure_context(struct qcom_iommu_dev *qcom_iommu)
{ … }
static int qcom_iommu_device_probe(struct platform_device *pdev)
{ … }
static void qcom_iommu_device_remove(struct platform_device *pdev)
{ … }
static int __maybe_unused qcom_iommu_resume(struct device *dev)
{ … }
static int __maybe_unused qcom_iommu_suspend(struct device *dev)
{ … }
static const struct dev_pm_ops qcom_iommu_pm_ops = …;
static const struct of_device_id qcom_iommu_of_match[] = …;
static struct platform_driver qcom_iommu_driver = …;
static int __init qcom_iommu_init(void)
{ … }
device_initcall(qcom_iommu_init);