forked from Minki/linux
caab277b1d
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not see http www gnu org licenses extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 503 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Enrico Weigelt <info@metux.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190602204653.811534538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (C) 2013 Red Hat
|
|
* Author: Rob Clark <robdclark@gmail.com>
|
|
*/
|
|
|
|
#ifndef __MSM_MMU_H__
|
|
#define __MSM_MMU_H__
|
|
|
|
#include <linux/iommu.h>
|
|
|
|
struct msm_mmu_funcs {
|
|
int (*attach)(struct msm_mmu *mmu, const char * const *names, int cnt);
|
|
void (*detach)(struct msm_mmu *mmu, const char * const *names, int cnt);
|
|
int (*map)(struct msm_mmu *mmu, uint64_t iova, struct sg_table *sgt,
|
|
unsigned len, int prot);
|
|
int (*unmap)(struct msm_mmu *mmu, uint64_t iova, unsigned len);
|
|
void (*destroy)(struct msm_mmu *mmu);
|
|
};
|
|
|
|
struct msm_mmu {
|
|
const struct msm_mmu_funcs *funcs;
|
|
struct device *dev;
|
|
int (*handler)(void *arg, unsigned long iova, int flags);
|
|
void *arg;
|
|
};
|
|
|
|
static inline void msm_mmu_init(struct msm_mmu *mmu, struct device *dev,
|
|
const struct msm_mmu_funcs *funcs)
|
|
{
|
|
mmu->dev = dev;
|
|
mmu->funcs = funcs;
|
|
}
|
|
|
|
struct msm_mmu *msm_iommu_new(struct device *dev, struct iommu_domain *domain);
|
|
struct msm_mmu *msm_gpummu_new(struct device *dev, struct msm_gpu *gpu);
|
|
|
|
static inline void msm_mmu_set_fault_handler(struct msm_mmu *mmu, void *arg,
|
|
int (*handler)(void *arg, unsigned long iova, int flags))
|
|
{
|
|
mmu->arg = arg;
|
|
mmu->handler = handler;
|
|
}
|
|
|
|
void msm_gpummu_params(struct msm_mmu *mmu, dma_addr_t *pt_base,
|
|
dma_addr_t *tran_error);
|
|
|
|
#endif /* __MSM_MMU_H__ */
|