iommu: msm: Move iommu_domains out of mach-msm
The iommu_domain code isn't really MSM specific and is better suited to live in the iommu directory. Move it accordingly. Change-Id: Ie88b4aba6901722166bb180275d352b745821772 Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
parent
14fe3df9ab
commit
3bd8ec73d4
|
@ -141,8 +141,6 @@ obj-$(CONFIG_MSM_TZ_LOG) += tz_log.o
|
|||
obj-$(CONFIG_MSM_BUS_SCALING) += msm_bus/
|
||||
obj-$(CONFIG_MSM_BUSPM_DEV) += msm-buspm-dev.o
|
||||
|
||||
obj-$(CONFIG_MSM_IOMMU) += iommu_domains.o
|
||||
|
||||
obj-$(CONFIG_MSM_EVENT_TIMER) += event_timer.o
|
||||
|
||||
obj-$(CONFIG_MSM_OCMEM) += ocmem.o ocmem_allocator.o ocmem_notifier.o
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include <mach/board.h>
|
||||
#include <media/msm_camera.h>
|
||||
#include <linux/msm_ion.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#define CONFIG_MSM_CAMERA_DEBUG
|
||||
#ifdef CONFIG_MSM_CAMERA_DEBUG
|
||||
|
|
|
@ -13,205 +13,6 @@
|
|||
#ifndef _ARCH_IOMMU_DOMAINS_H
|
||||
#define _ARCH_IOMMU_DOMAINS_H
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/genalloc.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
#define MSM_IOMMU_DOMAIN_SECURE 0x1
|
||||
|
||||
struct mem_pool {
|
||||
struct mutex pool_mutex;
|
||||
struct gen_pool *gpool;
|
||||
phys_addr_t paddr;
|
||||
unsigned long size;
|
||||
unsigned long free;
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
enum {
|
||||
VIDEO_DOMAIN,
|
||||
CAMERA_DOMAIN,
|
||||
DISPLAY_READ_DOMAIN,
|
||||
DISPLAY_WRITE_DOMAIN,
|
||||
ROTATOR_SRC_DOMAIN,
|
||||
ROTATOR_DST_DOMAIN,
|
||||
MAX_DOMAINS
|
||||
};
|
||||
|
||||
enum {
|
||||
VIDEO_FIRMWARE_POOL,
|
||||
VIDEO_MAIN_POOL,
|
||||
GEN_POOL,
|
||||
};
|
||||
|
||||
struct msm_iommu_domain_name {
|
||||
char *name;
|
||||
int domain;
|
||||
};
|
||||
|
||||
struct msm_iommu_domain {
|
||||
/* iommu domain to map in */
|
||||
struct iommu_domain *domain;
|
||||
/* total number of allocations from this domain */
|
||||
atomic_t allocation_cnt;
|
||||
/* number of iova pools */
|
||||
int npools;
|
||||
/*
|
||||
* array of gen_pools for allocating iovas.
|
||||
* behavior is undefined if these overlap
|
||||
*/
|
||||
struct mem_pool *iova_pools;
|
||||
};
|
||||
|
||||
struct iommu_domains_pdata {
|
||||
struct msm_iommu_domain *domains;
|
||||
int ndomains;
|
||||
struct msm_iommu_domain_name *domain_names;
|
||||
int nnames;
|
||||
unsigned int domain_alloc_flags;
|
||||
};
|
||||
|
||||
|
||||
struct msm_iova_partition {
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
struct msm_iova_layout {
|
||||
struct msm_iova_partition *partitions;
|
||||
int npartitions;
|
||||
const char *client_name;
|
||||
unsigned int domain_flags;
|
||||
unsigned int is_secure;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_MSM_IOMMU)
|
||||
|
||||
extern void msm_iommu_set_client_name(struct iommu_domain *domain,
|
||||
char const *name);
|
||||
extern struct iommu_domain *msm_get_iommu_domain(int domain_num);
|
||||
extern int msm_find_domain_no(const struct iommu_domain *domain);
|
||||
|
||||
extern int msm_allocate_iova_address(unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long *iova);
|
||||
|
||||
extern void msm_free_iova_address(unsigned long iova,
|
||||
unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size);
|
||||
|
||||
extern int msm_use_iommu(void);
|
||||
|
||||
extern int msm_iommu_map_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
phys_addr_t phys_addr,
|
||||
unsigned long size,
|
||||
unsigned long page_size,
|
||||
int cached);
|
||||
|
||||
extern void msm_iommu_unmap_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
unsigned long size,
|
||||
unsigned long page_size);
|
||||
|
||||
extern int msm_iommu_map_contig_buffer(phys_addr_t phys,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long cached,
|
||||
dma_addr_t *iova_val);
|
||||
|
||||
|
||||
extern void msm_iommu_unmap_contig_buffer(dma_addr_t iova,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size);
|
||||
|
||||
extern int msm_register_domain(struct msm_iova_layout *layout);
|
||||
extern int msm_unregister_domain(struct iommu_domain *domain);
|
||||
|
||||
#else
|
||||
static inline void msm_iommu_set_client_name(struct iommu_domain *domain,
|
||||
char const *name)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct iommu_domain
|
||||
*msm_get_iommu_domain(int subsys_id) { return NULL; }
|
||||
|
||||
|
||||
static inline int msm_find_domain_no(const struct iommu_domain *domain)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int msm_allocate_iova_address(unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long *iova) { return -ENOMEM; }
|
||||
|
||||
static inline void msm_free_iova_address(unsigned long iova,
|
||||
unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size) { return; }
|
||||
|
||||
static inline int msm_use_iommu(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int msm_iommu_map_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
phys_addr_t phys_addr,
|
||||
unsigned long size,
|
||||
unsigned long page_size,
|
||||
int cached)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void msm_iommu_unmap_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
unsigned long size,
|
||||
unsigned long page_size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int msm_iommu_map_contig_buffer(phys_addr_t phys,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long cached,
|
||||
dma_addr_t *iova_val)
|
||||
{
|
||||
*iova_val = phys;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void msm_iommu_unmap_contig_buffer(dma_addr_t iova,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int msm_register_domain(struct msm_iova_layout *layout)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int msm_unregister_domain(struct iommu_domain *domain)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <asm/sizes.h>
|
||||
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/subsystem_restart.h>
|
||||
#include <mach/msm_bus_board.h>
|
||||
#include <mach/msm_bus.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <linux/msm_audio_ion.h>
|
||||
|
||||
#include <linux/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
struct msm_audio_ion_private {
|
||||
bool smmu_enabled;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <linux/hash.h>
|
||||
#include <linux/msm_ion.h>
|
||||
#include <mach/msm_smd.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <linux/scatterlist.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
enum {
|
||||
DI_PARTITION_NUM = 0,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <mach/socinfo.h>
|
||||
#include <mach/msm_iomap.h>
|
||||
#include <mach/board.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "kgsl.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
obj-$(CONFIG_IOMMU_API) += iommu.o
|
||||
obj-$(CONFIG_OF_IOMMU) += of_iommu.o
|
||||
obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o
|
||||
obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_domains.o
|
||||
obj-$(CONFIG_MSM_IOMMU_V0) += msm_iommu-v0.o msm_iommu_dev-v0.o
|
||||
obj-$(CONFIG_MSM_IOMMU_V1) += msm_iommu-v1.o msm_iommu_dev-v1.o msm_iommu_sec.o
|
||||
obj-$(CONFIG_MSM_IOMMU_PMON) += msm_iommu_perfmon.o
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <asm/sizes.h>
|
||||
#include <asm/page.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_iommu_priv.h>
|
||||
#include <mach/socinfo.h>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/fs.h>
|
||||
#include <linux/completion.h> /* for completion signaling after interrupts */
|
||||
#include <linux/uaccess.h> /* for copy from/to user in the ioctls */
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/of.h> /* parsing device tree data */
|
||||
#include <linux/of_gpio.h>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <linux/workqueue.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_bus.h>
|
||||
#include <mach/msm_tspp2.h>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define _MSM_ISP_BUF_H_
|
||||
|
||||
#include <media/msmb_isp.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include "msm_sd.h"
|
||||
|
||||
/* Buffer type could be userspace / HAL.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -16,7 +16,7 @@
|
|||
#include <media/msm_jpeg.h>
|
||||
#include "msm_jpeg_hw_reg.h"
|
||||
#include <linux/ion.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
struct msm_jpeg_hw_buf {
|
||||
struct msm_jpeg_buf vbuf;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/io.h>
|
||||
|
||||
#include <mach/camera.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_bus.h>
|
||||
#include <mach/msm_bus_board.h>
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <mach/clk.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/vreg.h>
|
||||
#include <media/msm_isp.h>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <linux/videodev2.h>
|
||||
#include <linux/msm_ion.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <media/v4l2-dev.h>
|
||||
#include <media/v4l2-event.h>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <linux/dvb/video.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/timer.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <media/msm_vidc.h>
|
||||
#include "dvbdev.h"
|
||||
#include "mpq_adapter.h"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/msm_ion.h>
|
||||
#include <linux/types.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include "msm_vidc_resources.h"
|
||||
#include "msm_vidc_debug.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <mach/board.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <media/msm_vidc.h>
|
||||
#include "msm_vidc_internal.h"
|
||||
#include "msm_vidc_debug.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/qdsp6v2/apr.h>
|
||||
#include <mach/subsystem_restart.h>
|
||||
#include "hfi_packetization.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/of.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/ocmem.h>
|
||||
#include <mach/scm.h>
|
||||
#include <mach/subsystem_restart.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <mach/ocmem.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include "vidc_hfi_api.h"
|
||||
#include "vidc_hfi_helper.h"
|
||||
#include "vidc_hfi_api.h"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <linux/msm_ion.h>
|
||||
#include <linux/iommu.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_bus_board.h>
|
||||
#include <asm-generic/sizes.h>
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define _H_VPU_RESOURCES_H_
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_bus.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <linux/wait.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <media/msm_vidc.h>
|
||||
#include <media/v4l2-subdev.h>
|
||||
#include "enc-subdev.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
#include <linux/msm_mdp.h>
|
||||
#include <linux/slab.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include "enc-subdev.h"
|
||||
#include "mdp-subdev.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <media/msm_camera.h>
|
||||
#include <mach/memory.h>
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#define MAGIC_PMEM 0x0733ac64
|
||||
#define MAGIC_CHECK(is, should) \
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <mach/msm_bus.h>
|
||||
#include <mach/msm_bus_board.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_memtypes.h>
|
||||
|
||||
#include "mdp3.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include "mdp3_dma.h"
|
||||
#include "mdss_fb.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/workqueue.h>
|
||||
#include <linux/irqreturn.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include "mdss_panel.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/iopoll.h>
|
||||
#include <linux/kthread.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include "mdss_dsi_cmd.h"
|
||||
#include "mdss_dsi.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/iopoll.h>
|
||||
#include <linux/kthread.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include "mdss.h"
|
||||
#include "mdss_dsi.h"
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <mach/board.h>
|
||||
#include <mach/memory.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/msm_memtypes.h>
|
||||
|
||||
#include "mdss_fb.h"
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include <mach/msm_bus.h>
|
||||
#include <mach/msm_bus_board.h>
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/memory.h>
|
||||
#include <mach/msm_memtypes.h>
|
||||
#include <mach/rpm-regulator-smd.h>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <linux/msm_mdp.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <mach/event_timer.h>
|
||||
#include <mach/msm_bus.h>
|
||||
#include <mach/scm.h>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <linux/major.h>
|
||||
#include <media/msm_media_info.h>
|
||||
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include "mdss_fb.h"
|
||||
#include "mdss_mdp.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <linux/iommu.h>
|
||||
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include "mdss_mdp.h"
|
||||
#include "mdss_fb.h"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <mach/board.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/string.h>
|
||||
|
|
|
@ -0,0 +1,217 @@
|
|||
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only 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.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_MSM_IOMMU_DOMAINS_H
|
||||
#define _LINUX_MSM_IOMMU_DOMAINS_H
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/genalloc.h>
|
||||
#include <linux/rbtree.h>
|
||||
|
||||
#define MSM_IOMMU_DOMAIN_SECURE 0x1
|
||||
|
||||
struct mem_pool {
|
||||
struct mutex pool_mutex;
|
||||
struct gen_pool *gpool;
|
||||
phys_addr_t paddr;
|
||||
unsigned long size;
|
||||
unsigned long free;
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
enum {
|
||||
VIDEO_DOMAIN,
|
||||
CAMERA_DOMAIN,
|
||||
DISPLAY_READ_DOMAIN,
|
||||
DISPLAY_WRITE_DOMAIN,
|
||||
ROTATOR_SRC_DOMAIN,
|
||||
ROTATOR_DST_DOMAIN,
|
||||
MAX_DOMAINS
|
||||
};
|
||||
|
||||
enum {
|
||||
VIDEO_FIRMWARE_POOL,
|
||||
VIDEO_MAIN_POOL,
|
||||
GEN_POOL,
|
||||
};
|
||||
|
||||
struct msm_iommu_domain_name {
|
||||
char *name;
|
||||
int domain;
|
||||
};
|
||||
|
||||
struct msm_iommu_domain {
|
||||
/* iommu domain to map in */
|
||||
struct iommu_domain *domain;
|
||||
/* total number of allocations from this domain */
|
||||
atomic_t allocation_cnt;
|
||||
/* number of iova pools */
|
||||
int npools;
|
||||
/*
|
||||
* array of gen_pools for allocating iovas.
|
||||
* behavior is undefined if these overlap
|
||||
*/
|
||||
struct mem_pool *iova_pools;
|
||||
};
|
||||
|
||||
struct iommu_domains_pdata {
|
||||
struct msm_iommu_domain *domains;
|
||||
int ndomains;
|
||||
struct msm_iommu_domain_name *domain_names;
|
||||
int nnames;
|
||||
unsigned int domain_alloc_flags;
|
||||
};
|
||||
|
||||
|
||||
struct msm_iova_partition {
|
||||
unsigned long start;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
struct msm_iova_layout {
|
||||
struct msm_iova_partition *partitions;
|
||||
int npartitions;
|
||||
const char *client_name;
|
||||
unsigned int domain_flags;
|
||||
unsigned int is_secure;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_MSM_IOMMU)
|
||||
|
||||
extern void msm_iommu_set_client_name(struct iommu_domain *domain,
|
||||
char const *name);
|
||||
extern struct iommu_domain *msm_get_iommu_domain(int domain_num);
|
||||
extern int msm_find_domain_no(const struct iommu_domain *domain);
|
||||
|
||||
extern int msm_allocate_iova_address(unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long *iova);
|
||||
|
||||
extern void msm_free_iova_address(unsigned long iova,
|
||||
unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size);
|
||||
|
||||
extern int msm_use_iommu(void);
|
||||
|
||||
extern int msm_iommu_map_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
phys_addr_t phys_addr,
|
||||
unsigned long size,
|
||||
unsigned long page_size,
|
||||
int cached);
|
||||
|
||||
extern void msm_iommu_unmap_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
unsigned long size,
|
||||
unsigned long page_size);
|
||||
|
||||
extern int msm_iommu_map_contig_buffer(phys_addr_t phys,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long cached,
|
||||
dma_addr_t *iova_val);
|
||||
|
||||
|
||||
extern void msm_iommu_unmap_contig_buffer(dma_addr_t iova,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size);
|
||||
|
||||
extern int msm_register_domain(struct msm_iova_layout *layout);
|
||||
extern int msm_unregister_domain(struct iommu_domain *domain);
|
||||
|
||||
#else
|
||||
static inline void msm_iommu_set_client_name(struct iommu_domain *domain,
|
||||
char const *name)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct iommu_domain
|
||||
*msm_get_iommu_domain(int subsys_id) { return NULL; }
|
||||
|
||||
|
||||
static inline int msm_find_domain_no(const struct iommu_domain *domain)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline int msm_allocate_iova_address(unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long *iova) { return -ENOMEM; }
|
||||
|
||||
static inline void msm_free_iova_address(unsigned long iova,
|
||||
unsigned int iommu_domain,
|
||||
unsigned int partition_no,
|
||||
unsigned long size) { return; }
|
||||
|
||||
static inline int msm_use_iommu(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int msm_iommu_map_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
phys_addr_t phys_addr,
|
||||
unsigned long size,
|
||||
unsigned long page_size,
|
||||
int cached)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void msm_iommu_unmap_extra(struct iommu_domain *domain,
|
||||
unsigned long start_iova,
|
||||
unsigned long size,
|
||||
unsigned long page_size)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int msm_iommu_map_contig_buffer(phys_addr_t phys,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long cached,
|
||||
dma_addr_t *iova_val)
|
||||
{
|
||||
*iova_val = phys;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void msm_iommu_unmap_contig_buffer(dma_addr_t iova,
|
||||
unsigned int domain_no,
|
||||
unsigned int partition_no,
|
||||
unsigned long size)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int msm_register_domain(struct msm_iova_layout *layout)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int msm_unregister_domain(struct iommu_domain *domain)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -16,7 +16,7 @@
|
|||
#define _VIDEOBUF2_PMEM_CONTIG_H
|
||||
|
||||
#include <media/videobuf2-core.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <linux/msm_iommu_domains.h>
|
||||
#include <linux/msm_ion.h>
|
||||
|
||||
struct videobuf2_mapping {
|
||||
|
|
Loading…
Reference in New Issue