4 years ago[FOSS_TLK]security: tlk_driver: fix sys_munlock issue
Scott Long [Wed, 7 Jan 2015 05:08:25 +0000]
[FOSS_TLK]security: tlk_driver: fix sys_munlock issue

Only call sys_munlock if current->mm is non-null to avoid
race condition where mm cleanup happens before tlk_device_release
is invoked.

Change-Id: I0ec2f9ba5cdf4f380d79aea86bc11b67adbada51
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/755008
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: lock/fault userspace pages
Mahesh Lagadapati [Fri, 31 Oct 2014 03:36:17 +0000]
[FOSS_TLK]security: tlk_driver: lock/fault userspace pages

When AF bit is zero for an user space buffer, access faults are observed
during address translation in the secure world.

Lock userspace buffers using sys_mlock to ensure that AF bit is not
cleared once they are passed to the secure world. Also invoke
fixup_user_fault API to set AF bit to 1 to handle the case when AF bit
is zero even before calling sys_mlock.

Change-Id: If1a70f7e9d8fb0e1d03a837d277e068c8ce22042
Signed-off-by: Mahesh Lagadapati <mlagadapati@nvidia.com>
Reviewed-on: http://git-master/r/755007
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk: common function to switch to CPU0
Varun Wadekar [Thu, 11 Dec 2014 01:16:40 +0000]
[FOSS_TLK]security: tlk: common function to switch to CPU0

TLK runs only on CPU0 so we have to switch CPUs before we
issue any request to the secure world. There are instances
when the requests are sent from workqueues which need some
extra code before we can run on CPU0. Previously, we used
this code only for resizing VPR regions. But it seems that
the requests for TAs can also benefit from this approach.

Encapsulate the logic in a common function, send_smc(), and
remove tlk_generic_smc(), tlk_extended_smc() functions. For
non-PF_NO_SETAFFINITY scnearios, check we can switch the
CPU mask to run on CPU0. If for some reason the CPU switch
fails, then we schedule work on CPU0 instead. This takes care
of the previous corner cases when the CPU switch failed and
we continued on the same CPU.

Change-Id: I3797bb50acbf379a4ddc49c90206d6d697549471
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/755006
Reviewed-by: Automatic_Commit_Validation_User

4 years ago[FOSS_TLK]security: tlk: add device tree support
Varun Wadekar [Mon, 17 Nov 2014 05:10:40 +0000]
[FOSS_TLK]security: tlk: add device tree support

Control the driver loading sequence from the device tree. Logger
and storage can also be controlled from the device tree now. There
is no need for CONFIG_OTE_LOGGER moving on.

Change-Id: I91de33462d6df288265c810af9cf3eab66c27c2d
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/755005
Reviewed-by: Automatic_Commit_Validation_User

4 years ago[FOSS_TLK]security: tlk_driver: Enable Werror flag
Sumit Singh [Tue, 4 Nov 2014 07:06:02 +0000]
[FOSS_TLK]security: tlk_driver: Enable Werror flag

Enable Werror flag for all the files under
security/tlk_driver directory.

Change-Id: I7fec1b83ae9e5743e6bc390afbe57405e8d6d19f
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/755004
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: get_cpu() in place of smp_processor_id()
Vandana Salve [Fri, 7 Nov 2014 11:15:52 +0000]
[FOSS_TLK]security: tlk_driver: get_cpu() in place of smp_processor_id()

if DEBUG_PREEMPT is enabled, smp_processor_id() "helpfully"
screams when called outside preemptible, so making use of
get_cpu/put_cpu in place of smp_processor_id

<3>[  168.572811] BUG: using smp_processor_id() in preemptible [00000000] code: vpr-shrink_thre/67
<4>[  168.582061] caller is te_set_vpr_params+0x44/0x100
<4>[  168.586998] CPU: 0 PID: 67 Comm: vpr-shrink_thre Tainted: G        W    3.10.49-g5870b28 #1
<4>[  168.595633] Call trace:
<4>[  168.598439] [<ffffffc000089c78>] dump_backtrace+0x0/0xf4
<4>[  168.603917] [<ffffffc000089f70>] show_stack+0x10/0x1c
<4>[  168.609187] [<ffffffc00035cb90>] dump_stack+0x1c/0x28
<4>[  168.614364] [<ffffffc000371a08>] debug_smp_processor_id+0xd4/0xfc
<4>[  168.620647] [<ffffffc00032f634>] te_set_vpr_params+0x40/0x100
<4>[  168.626413] [<ffffffc0008c6e90>] tegra_update_resize_cfg+0x50/0xa8
<4>[  168.632609] [<ffffffc00050d778>] shrink_chunk_locked+0x1b0/0x288
<4>[  168.638640] [<ffffffc00050d8fc>] shrink_resizable_heap+0xac/0xd8
<4>[  168.644681] [<ffffffc00050ded8>] shrink_thread+0x64/0x90

Change-Id: Ief7da2098080b764d1946da088cc4d72634f572d
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Reviewed-on: http://git-master/r/755003
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: add session tracking
Scott Long [Tue, 16 Sep 2014 19:54:23 +0000]
[FOSS_TLK]security: tlk_driver: add session tracking

Previously, if a client application exits w/o
closing any open session(s) the session and
its resources would be lost.

With this change we now track open sessions so
that any that remain open when tlk_device_release
is called can be properly closed.

This allows memory buffer tracking to be simplified
as well since the various lists can be tracked
per-session instead of globally as before.

Change-Id: I134ab7f2a963dc9afba41f5411187d61dc3b6539
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/755002
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: add FIQ glue
Varun Wadekar [Mon, 4 Aug 2014 05:53:13 +0000]
[FOSS_TLK]security: tlk_driver: add FIQ glue

Add FIQ glue for ARM64 cpus and register a handler with the secure world (TLK).
TLK handles the FIQ interrupts and calls our handler after it is done saving
the context. We then get the FIQ context via a SMC call and pass it to the
FIQ handler registered by the kernel (using fiq_glue_register_handler).

The FIQ debugger calls fiq_glue_register_handler() to register its handler
which we in turn call whenever a FIQ fires. The glue saves all the registers,
elr/spsr values and SP, which is then used by tlk_fiq_handler() to pass on to
the actual handler.

Change-Id: I6711c25892284dd82c9042479381eca5f707c9b4
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/755001
Reviewed-by: Automatic_Commit_Validation_User

4 years ago[FOSS_TLK]security: tlk_driver: remove non-compat support
Scott Long [Fri, 5 Sep 2014 22:48:03 +0000]
[FOSS_TLK]security: tlk_driver: remove non-compat support

Now that OTE lib and TLK kernel have shifted over to 64bit
support the non-compat support in tlk_driver is no longer
needed.

This change removes the non-compat structs/routines and
removes "_compat" from the 64bit structs/routines to make
it clear they are being used.

Change-Id: I74ef915d6f1ec95ade10b075e5d0e0028ce2c9d4
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/755000
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: remove legacy ss support
Scott Long [Tue, 2 Sep 2014 20:11:10 +0000]
[FOSS_TLK]security: tlk_driver: remove legacy ss support

Remove TE_IOCTL_SS_NEW_REQ/TE_IOCTL_SS_REQ_COMPLETE
support as these ioctls are no longer used.

Change-Id: I1cc54ec94e24985ba6de28c24422a363d239cbab
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/754999
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: free tmp memrefs
Scott Long [Fri, 29 Aug 2014 23:18:18 +0000]
[FOSS_TLK]security: tlk_driver: free tmp memrefs

Release temporary memory parameter references at the conclusion
of a launch operation to ensure pages are unpinned and
other resources are properly cleaned up.

Change-Id: I584e2580be487fe281a88cb16d41aa241763561d
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/754998
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: remove legacy IRQ/SS support
Varun Wadekar [Mon, 21 Jul 2014 06:57:43 +0000]
[FOSS_TLK]security: tlk_driver: remove legacy IRQ/SS support

- Delete the legacy IRQ handler registration
- Delete the legacy SS handler registration

Change-Id: I852ed100ebe8257d922645ae53824ba885ab4436
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/754997
Reviewed-by: Automatic_Commit_Validation_User

4 years ago[FOSS_TLK]security: tlk_driver: new ss protocol support
Scott Long [Tue, 8 Jul 2014 18:43:10 +0000]
[FOSS_TLK]security: tlk_driver: new ss protocol support

The new secure storage protocol design allows the tlk daemon
to exchange data directly with the secure storage TA.

The only role the tlk_driver now plays is in the scheduling path
between the tlk daemon and the secure storage TA.

A summary of the corresponding changes:

 * add support for persistent mem buffer parameter type (the
   mapping to these buffers persist for the duration of the
   session); persistent mem buffers are kept on a separate
   shared memory descriptor list and are tracked by session id

 * modified ioctl interface between tlk daemon and tlk_driver to
   involve only a single command; the integer value passed down
   by the tlk daemon indicates whether it is ready for a new
   request or has just completed the last request

 * fixed up various warnings

Note that support for old protocol will be left intact until the
corresponding changes are applied to the TLK components.

Change-Id: Ibcaad4f0e00c8b1f107af5c1e82ea0aa4dd57398
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: http://git-master/r/754996
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk_driver: Pin user space page(s).
Sharif Inamdar [Tue, 3 Jun 2014 11:09:58 +0000]
[FOSS_TLK]security: tlk_driver: Pin user space page(s).

Pin user space pages based on the type of memory i.e.
read or write.

TE_PARAM_TYPE_MEM_RO or TE_PARAM_TYPE_MEM_RW param
indicates whether the TLK kernel will setup a RO/RW
mapping for the TA to this buffer.

Based on the type of memory we should pin the pages
using get_user_pages() as RO/RW.

Change-Id: Ib937433b64602f10cd1114f19845e9f6b4f8bf06
Signed-off-by: Sharif Inamdar <isharif@nvidia.com>
Reviewed-on: http://git-master/r/754995
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]Revert "security: tlk_driver: delete te_pin_user_pages() and its usage"
Sharif Inamdar [Tue, 3 Jun 2014 04:48:11 +0000]
[FOSS_TLK]Revert "security: tlk_driver: delete te_pin_user_pages() and its usage"

We are reverting this as we want to add support of
te_pin_user_pages(). TA can have dynamic mappings
created as part of an OpenSession or LaunchOperation
command.

If either of these specify a buffer as an argument
(with virt addr and length as params), the TLK kernel
will create a mapping to it. This happens for things
that go between TAs (no pin issue there) and between
the NS and S worlds.

In the case of NS buffers being passed in, we need
phys memory to stay where it is, because the secure
world has a mapping to it that Linux is unaware of,
which is why we pin it.

This reverts commit f4a063081552617e72cbdda5596ae7bd537696f7.

Change-Id: I7676f7786cef469f6cbb39a76a05541b417dc5f7
Signed-off-by: Sharif Inamdar <isharif@nvidia.com>
Reviewed-on: http://git-master/r/754994
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

4 years ago[FOSS_TLK]security: tlk: delete TEGRA_USE_SECURE_KERNEL flag usage
Varun Wadekar [Tue, 30 Sep 2014 11:02:26 +0000]
[FOSS_TLK]security: tlk: delete TEGRA_USE_SECURE_KERNEL flag usage

We no longer use this flag in the kernel.

Change-Id: I6ef2f4eb080f39b09bd79e37739463c5446b59ce
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/754993
Reviewed-by: Automatic_Commit_Validation_User

4 years ago[FOSS_TLK]tlk_driver: Move all files to security/tlk_driver
Sharif Inamdar [Tue, 9 Jun 2015 05:41:45 +0000]
[FOSS_TLK]tlk_driver: Move all files to security/tlk_driver

Signed-off-by: Sharif Inamdar <isharif@nvidia.com>
Change-Id: Ibd778a4a5f563e187cdf32d953809748be6c256f
Reviewed-on: http://git-master/r/754992
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Tested-by: Varun Wadekar <vwadekar@nvidia.com>

5 years agotlk_driver: 5/22 update daily-2014.06.20.0_release-tlk daily-2014.07.14.1_release-tlk daily-2014.07.17.0_release-tlk
Dennis Huang [Thu, 22 May 2014 23:57:28 +0000]
tlk_driver: 5/22 update

- ensure VPR SMC occurs on CPU0
- modify secure storage glue

Change-Id: I309733af47a1fbd4fbf6bdba618f2b1de6c83eb2
Reviewed-on: http://git-master/r/413472
Reviewed-by: Dennis Huang <denhuang@nvidia.com>
Tested-by: Dennis Huang <denhuang@nvidia.com>

5 years agoFirst version
Dennis Huang [Wed, 23 Apr 2014 02:24:15 +0000]
First version

- from: 95fe1e01264bc124b5a60ca6f26261f2660a686e

Change-Id: I4723979fb4c5337ad9aaf4c970a231ab1a3e3a05
Reviewed-on: http://git-master/r/400522
Reviewed-by: Dennis Huang <denhuang@nvidia.com>
Tested-by: Dennis Huang <denhuang@nvidia.com>

5 years agoInitial empty repository
Varun Colbert [Fri, 18 Apr 2014 05:57:39 +0000]
Initial empty repository