summaryrefslogtreecommitdiff
path: root/drivers/media/video/tiler
diff options
context:
space:
mode:
authorLajos Molnar <molnar@ti.com>2011-04-07 08:41:20 +0100
committerAndy Green <andy.green@linaro.org>2011-04-07 08:41:20 +0100
commita82e6661080f0f6f8b226d4d529e70aff92d4831 (patch)
tree26cd1609b5374ce52ea88346318a06072046f94f /drivers/media/video/tiler
parentfa4ddd0141f14d6a6ad41befc983498e1a605093 (diff)
TILER: Added Kconfig support for TILER parameters.
The following config options are added: TI_TILER - whether to include TILER module. TILER_SSPTR_ID - whether to use SSPtr as the id TILER_ALIGNMENT - default TILER alignment TILER_GRANULARITY - default TILER granularity TILER_SECURITY - default process security TILER_SECURE - hardwire secure mode TILER_EXPOSE_SSPTR - whether to expose system-space addresses to userspace programs. Signed-off-by: Lajos Molnar <molnar@ti.com>
Diffstat (limited to 'drivers/media/video/tiler')
-rw-r--r--drivers/media/video/tiler/Kconfig106
-rw-r--r--drivers/media/video/tiler/Makefile4
-rw-r--r--drivers/media/video/tiler/tcm/Makefile2
-rw-r--r--drivers/media/video/tiler/tiler.c21
4 files changed, 122 insertions, 11 deletions
diff --git a/drivers/media/video/tiler/Kconfig b/drivers/media/video/tiler/Kconfig
index fabbb59a6c8..09c2215abcf 100644
--- a/drivers/media/video/tiler/Kconfig
+++ b/drivers/media/video/tiler/Kconfig
@@ -1,6 +1,106 @@
-config TILER_OMAP
- tristate "OMAP TILER support"
+config HAVE_TI_TILER
+ bool
+ default y
+ depends on ARCH_OMAP4
+
+menuconfig TI_TILER
+ tristate "TI TILER support"
default y
+ depends on HAVE_TI_TILER
help
- TILER driver for OMAP based boards.
+ TILER driver for TI chips.
+
+config TILER_GRANULARITY
+ int "Allocation granularity (2^n)"
+ range 1 4096
+ default 128
+ depends on TI_TILER
+ help
+ This option sets the default TILER allocation granularity. It can
+ be overriden by the tiler.grain boot argument.
+
+ The allocation granularity is the smallest TILER block size (in
+ bytes) managed distinctly by the TILER driver. TILER blocks of any
+ size are managed in chunks of at least this size.
+
+ Must be a 2^n in the range of 1 to 4096; however, the TILER driver
+ may use a larger supported granularity.
+
+ Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
+ 2048, 4096.
+
+config TILER_ALIGNMENT
+ int "Allocation alignment (2^n)"
+ range 1 4096
+ default 4096
+ depends on TI_TILER
+ help
+ This option sets the default TILER allocation alignment. It can
+ be overriden by the tiler.align boot argument.
+
+ Must be a 2^n in the range of 1 to 4096; however, it is naturally
+ aligned to the TILER granularity.
+
+ Supported values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
+ 2048, 4096.
+
+config TILER_SECURITY
+ int "Process security"
+ range 0 1
+ default 1
+ depends on TI_TILER
+ help
+ This option sets the default TILER process security. It can be
+ overriden by the tiler.secure boot argument.
+
+ If process security is enabled (1), the TILER driver uses a separate
+ TILER buffer address spaces (for mmap purposes) for each process.
+ This means that one process cannot simply map another process's
+ TILER buffer into its memory, even for sharing. However, it can
+ recreate the buffer by knowing the id-s and secret keys for the
+ TILER blocks involved. This is the preferred configuration.
+
+ Disabling security (0) allows sharing buffers simply by sharing the
+ mmap offset and size. However, because buffers can potentially be
+ shared between processes, it delays resource cleanup while any
+ process has an open TILER device.
+
+config TILER_SSPTR_ID
+ int "Use SSPtr for id"
+ range 0 1
+ default 0
+ depends on TI_TILER
+ help
+ This option sets the default behavior for TILER block ids. It can
+ be overriden by the tiler.ssptr_id boot argument.
+
+ If true, TILER driver uses the system-space (physical) address
+ (SSPtr) of a TILER block as its unique id. This may help sharing
+ TILER blocks between co-processors if using a constant key for each
+ block.
+
+ Note that the SSPtr is unique for each TILER block.
+
+config TILER_SECURE
+ bool "Secure TILER build"
+ default n
+ depends on TI_TILER
+ help
+ This option forces TILER security features that bypasses module
+ parameters.
+
+ If set, process security will be hardwired and ssptr and offset
+ lookup APIs are removed.
+
+config TILER_EXPOSE_SSPTR
+ bool "Expose SSPtr to userspace"
+ default y
+ depends on TI_TILER
+ help
+ This option sets whether SSPtr-s for blocks are exposed
+ during TILIOC_GBLK ioctls (MemMgr_Alloc APIs). In a secure
+ TILER build, this may be the only way for the userspace code
+ to learn the system-space addresses of TILER blocks.
+ You can use this flag to see if the userspace is relying on
+ having access to the SSPtr.
diff --git a/drivers/media/video/tiler/Makefile b/drivers/media/video/tiler/Makefile
index e6dbe24ce9d..a3933b65743 100644
--- a/drivers/media/video/tiler/Makefile
+++ b/drivers/media/video/tiler/Makefile
@@ -1,4 +1,4 @@
-obj-$(CONFIG_TILER_OMAP) += tcm/
-obj-$(CONFIG_TILER_OMAP) += tiler_omap.o
+obj-$(CONFIG_TI_TILER) += tcm/
+obj-$(CONFIG_TI_TILER) += tiler_omap.o
tiler_omap-objs = tiler.o tiler_pack.o tiler_rot.o
diff --git a/drivers/media/video/tiler/tcm/Makefile b/drivers/media/video/tiler/tcm/Makefile
index f03f3b7c862..d0642102eb8 100644
--- a/drivers/media/video/tiler/tcm/Makefile
+++ b/drivers/media/video/tiler/tcm/Makefile
@@ -1,2 +1,2 @@
-obj-$(CONFIG_TILER_OMAP) += tcm_sita.o
+obj-$(CONFIG_TI_TILER) += tcm_sita.o
diff --git a/drivers/media/video/tiler/tiler.c b/drivers/media/video/tiler/tiler.c
index 841fd31644a..ee8943b8384 100644
--- a/drivers/media/video/tiler/tiler.c
+++ b/drivers/media/video/tiler/tiler.c
@@ -42,12 +42,12 @@
#include <linux/syscalls.h>
-static bool security = true;
-static bool ssptr_id = true;
+static bool security = CONFIG_TILER_SECURITY;
+static bool ssptr_id = CONFIG_TILER_SSPTR_ID;
static bool ssptr_lookup = true;
static bool offset_lookup = true;
-static uint default_align = PAGE_SIZE;
-static uint granularity = 128;
+static uint default_align = CONFIG_TILER_ALIGNMENT;
+static uint granularity = CONFIG_TILER_GRANULARITY;
module_param(ssptr_id, bool, 0644);
MODULE_PARM_DESC(ssptr_id, "Use ssptr as block ID");
@@ -1686,7 +1686,9 @@ static s32 tiler_ioctl(struct inode *ip, struct file *filp, u32 cmd,
if (mi) {
block_info.id = mi->blk.id;
block_info.stride = tiler_vstride(&mi->blk);
+#ifdef CONFIG_TILER_EXPOSE_SSPTR
block_info.ssptr = mi->blk.phys;
+#endif
}
if (copy_to_user((void __user *)arg, &block_info,
sizeof(block_info)))
@@ -1739,12 +1741,15 @@ static s32 tiler_ioctl(struct inode *ip, struct file *filp, u32 cmd,
if (mi) {
block_info.id = mi->blk.id;
block_info.stride = tiler_vstride(&mi->blk);
+#ifdef CONFIG_TILER_EXPOSE_SSPTR
block_info.ssptr = mi->blk.phys;
+#endif
}
if (copy_to_user((void __user *)arg, &block_info,
sizeof(block_info)))
return -EFAULT;
break;
+#ifndef CONFIG_TILER_SECURE
case TILIOC_QBUF:
if (!offset_lookup)
return -EPERM;
@@ -1770,6 +1775,7 @@ static s32 tiler_ioctl(struct inode *ip, struct file *filp, u32 cmd,
mutex_unlock(&mtx);
return -EFAULT;
break;
+#endif
case TILIOC_RBUF:
_b = kmalloc(sizeof(*_b), GFP_KERNEL);
if (!_b)
@@ -1835,6 +1841,7 @@ static s32 tiler_ioctl(struct inode *ip, struct file *filp, u32 cmd,
case TILIOC_URBLK:
unreserve_blocks(pi, arg);
break;
+#ifndef CONFIG_TILER_SECURE
case TILIOC_QBLK:
if (!ssptr_lookup)
return -EPERM;
@@ -1850,6 +1857,7 @@ static s32 tiler_ioctl(struct inode *ip, struct file *filp, u32 cmd,
sizeof(block_info)))
return -EFAULT;
break;
+#endif
default:
return -EINVAL;
}
@@ -2037,7 +2045,10 @@ static s32 __init tiler_init(void)
granularity < 1 || granularity > PAGE_SIZE ||
granularity & (granularity - 1))
return -EINVAL;
-
+#ifdef CONFIG_TILER_SECURE
+ security = true;
+ offset_lookup = ssptr_lookup = false;
+#endif
/* Allocate tiler container manager (we share 1 on OMAP4) */
div_pt.x = TILER_WIDTH; /* hardcoded default */
div_pt.y = (3 * TILER_HEIGHT) / 4;