summaryrefslogtreecommitdiff
path: root/security/tlk_driver
AgeCommit message (Collapse)Author
2014-05-14Revert "security: tlk_driver: Allow affinity changing"Arto Merilainen
This reverts commit 7f6caab3a015a82c3f5b8842a5bd461d61d34af1. The commit introduced a modification that made threads to change affinity to ensure that the CPU can be changed. However, this approach was not bullet proof and it was fixed in a separate patch. Bug 1506585 Change-Id: I3e280a5fae1f63015032f62b45c333344411e5da Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/408076 Reviewed-by: Riham Haidar <rhaidar@nvidia.com> Tested-by: Riham Haidar <rhaidar@nvidia.com>
2014-05-14security: tlk_driver: Run kthreads on CPU0Arto Merilainen
Currently, the driver assumes that smc requests come either from workqueue or from a thread that has possibility to set cpu affinity. However, kernel threads by default do not have this possibility and in principle the flag can be set in middle of operation. Turning on devices is sometimes done in kernel threads and in GPU case we may need to change i.e. the VPR parameters. Therefore, ensure that the communication is done on CPU0. Bug 1506585 Change-Id: I0cbd8b841a07c8400310167fa8800eaae9de21f2 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/408075 Reviewed-by: Riham Haidar <rhaidar@nvidia.com> Tested-by: Riham Haidar <rhaidar@nvidia.com>
2014-05-14security: tlk_driver: modify secure storage glueVarun Wadekar
The secure world now sends a PREEMPT_BY_FS error code as a result of OpenSession/LaunchOp call. This indicates a pending FS request from the secure world which we need to handle and send the FS_COMPLETION SMC on completion. Until the secure firmware and the linux driver get in sync, we keep legacy SS handling alive to avoid incomaptibility issues. Once the secure firmware switches to the new handling, we would remove the legacy support from the linux driver as well. Bug 1500621 Change-Id: I9e84cd5a87d820107b1c2279c9d89dcd5c31b44b Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/375994 (cherry picked from commit 433d8d1687725ab7db23eef27e5a073e8d88e862) Reviewed-on: http://git-master/r/406769 Reviewed-by: Riham Haidar <rhaidar@nvidia.com> Tested-by: Riham Haidar <rhaidar@nvidia.com>
2014-05-13security: tlk_driver: ensure VPR SMC occurs on CPU0Chris Johnson
The te_set_vpr_params routine is called both by normal user mode threads and worker threads as part of a free/shrink of VPR. The calls from worker threads, will fail in sched_setaffinity() because they have PF_NO_SETAFFINITY set, so previously no switch occurred and the SMC issued on something other than CPU0. This change detects the worker thread case, and if needed, issues a work_on_cpu() instead for the VPR programming. Bug 1473456 Change-Id: I76fa71c577e243b073cabb93928e688fdf7833ec Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: http://git-master/r/385924 (cherry picked from commit 30fed4ced5517c8c78b34d3a8db734263cf5d798) Reviewed-on: http://git-master/r/406698 Reviewed-by: Arto Merilainen <amerilainen@nvidia.com> Tested-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
2014-05-12security: tlk_driver: Allow affinity changingArto Merilainen
Currently the driver assumes that smc requests come from a thread that already has possibility to set cpu affinity, however, kernel threads by default do not have this possibility. Turning on devices is sometimes done in kernel threads and in GPU case we may need to change i.e. the VPR parameters. Therefore, ensure that the thread can change affinity. Bug 1506585 Change-Id: Ie879f6b2f7d8cb3bc324b5d7a391dd6e8cf9b3cf Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/405915 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2014-04-09security: tlk: move ote_print_logs to common codeVarun Wadekar
Move ote_print_logs() calls to tlk_generic_smc and tlk_extended_smc so that it gets called after every secure firmware call. Change-Id: I1603a55440ebaf10cc727a442686e1ced8b18729 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/393219 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2014-04-09security: tlk: abort driver init if dev->req_param_buf is NULLVarun Wadekar
During driver init, we allocate memory for dev->req_param_buf if the secure firmware supports the new way of accessing request params. We need to check that dev->req_param_buf was allocated before using it. Change-Id: I796255274937f46fe01aeb1f5372c23bae830b85 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/393218 GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2014-04-09security: tlk: enable logging only if secure firmware supports itVarun Wadekar
We send an SMC to the secure firmware to see if it supports logging. If it returns failure, then we disable it from the kernel too. Change-Id: Icc59fc221f6f59d1806815333f3e71a35a45ea90 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/393217 GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2014-03-18security: tlk: Move program VPR smc to SIP callAaron Gamble
Change-Id: Ibd1dcd64c990b284926a15891902d2364df66c8e Signed-off-by: Aaron Gamble <jgamble@nvidia.com> Reviewed-on: http://git-master/r/380437 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
2014-03-12security: tlk_driver: fix memory leak from tlk loggingHyung Taek Ryoo
This change to fix memory leak from tlk logging. Bug 1467162 Change-Id: I81d520ed4637861cbaab3bd7dcda063ecce9a123 Signed-off-by: Hyung Taek Ryoo <hryoo@nvidia.com> Reviewed-on: http://git-master/r/378071 (cherry picked from commit 50810a36bf0726c3df7f3d25f886e9852d43e13b) Reviewed-on: http://git-master/r/380740 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2014-03-03security: tlk_driver: remove legacy ss supportScott Long
Remove support for legacy secure storage protocol now that the rest of TLK is using new protocol. Bug 1397251 Change-Id: Idbc99e46a58d77934d6c6dce41d1dcf0d175b8cc Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: http://git-master/r/369107 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Chris Johnson <cwj@nvidia.com> Tested-by: Chris Johnson <cwj@nvidia.com>
2014-02-20security: tlk_driver: support for secure ARM64 buildsChris Johnson
The only remaining warnings are in the non-compat path, which will be removed, once we get the ote/lib change to use the new structs. Bug 1432005 Change-Id: Ie0bc95a76a8d5ace91ca0b0bf69ac15852007dc7 Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: http://git-master/r/369403 Reviewed-by: Scott Long <scottl@nvidia.com>
2014-02-09Revert "ARM: tegra: trustzone: Single kernel to work in both secure and ↵Varun Wadekar
non-secure mode." This reverts commit 7f93a0dddf39f372c064f772f9af6903e91aaacf as the t132ref builds break with the following errors - <android>/kernel/drivers/platform/tegra/../../../arch/arm/mach-tegra/reset.c:45: undefined reference to `is_secure_mode' <android>/kernel/drivers/platform/tegra/../../../arch/arm/mach-tegra/reset.c:57: undefined reference to `is_secure_mode' <android>/kernel/drivers/platform/tegra/../../../arch/arm/mach-tegra/reset.c:58: undefined reference to `tegra_generic_smc' Change-Id: I4e44c2ffba4e1c013213e543b67f2d49a928b764 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/365347
2014-02-09ARM: tegra: trustzone: Single kernel to work in both secure and non-secure mode.Nitin Sehgal
- Remove CONFIG_TEGRA_USE_SECURE_KERNEL config option - Use DBGDSCR.NS bit to dynamically get secure/non-secure mode - Replace ifdefs with dynamic code. - Keep CONFIG_TRUSTED_LITTLE_KERNEL to enable secure os bug 1411345 Change-Id: I75ddfed7a35fcb30e2772bb43057ae022bcf09b3 Signed-off-by: Nitin Sehgal <nsehgal@nvidia.com> Reviewed-on: http://git-master/r/353155 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Varun Wadekar <vwadekar@nvidia.com>
2014-02-07security: tlk_driver: stage new interface structsChris Johnson
The current structs passed between the client lib and kernel aren't sized to allow 64bit pointers to work. This code stages ioctls based on structs that can handle 32bit or 64bit references. Once the supporting TLK library and kernel changes are checked in, we'll flip over to using these code paths. Bug 1432005 Change-Id: I7fd1b479c6ddf436ea4e380607cbb5dcfce1b2c2 Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: http://git-master/r/364252 Reviewed-by: Scott Long <scottl@nvidia.com>
2014-02-03security: tlk_driver: add new storage supportScott Long
The existing storage protocol support will remain enabled until tlk can be switched over to the new protocol. Bug 1397251 Change-Id: I7186774e6fd6072f8260780b82203ce5d9ddf820 Signed-off-by: Scott Long <scottl@nvidia.com> Reviewed-on: http://git-master/r/361797 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Chris Johnson <cwj@nvidia.com>
2014-01-08security: tlk_driver: delete TLK_{GENERIC|EXTENDED}_SMC macrosVarun Wadekar
Generic cleanup to remove unnecessary macros. Change-Id: Ia5d8c89622b9689c0c0a2658495cb4d33a2da7f5 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/351304
2014-01-03security: tlk_driver: delete te_pin_user_pages() and its usageSharif Inamdar
te_pin_user_pages() maps user pages, but the mapped pages never get used. Bug 1430582 Change-Id: I2d815f1d970e491058cf89cc9fef0f78b8e9764c Signed-off-by: Sharif Inamdar <isharif@nvidia.com> Reviewed-on: http://git-master/r/351021 (cherry picked from commit 7ac517f2203a41ffa4f703d9b18c46a8558873e0) Reviewed-on: http://git-master/r/351670 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Varun Wadekar <vwadekar@nvidia.com>
2013-12-07security: tlk_driver: allocate uncached memory for FS operationsVarun Wadekar
Bug 1412144 Bug 1176001 Change-Id: If68806ee44a7009354efdda3d5cbf9e0e1f5f47f Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/339205
2013-12-07security: tlk_driver: forcibly map user pages if default mapping failsVarun Wadekar
There are instances when te_pin_user_pages() fails due to failure in get_user_pages(). We use default mapping policy to get user pages before pinning. But if default fails, then try using "force" option to map user pages. Bug 1412144 Bug 1176001 Change-Id: I661a15c86846816a8050ddfda7b58711c31f7aa5 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/338755
2013-12-03security: tlk_driver: use ARM's DEN0028 v0.9 spec to define SMCsVarun Wadekar
Use Trusted Application calls (0x30000000-0x31000000) and Trusted OS calls (0x32000000-0x3F000000) from the spec. Trusted App calls are used to Open/Close session and launch a new operation. Trusted OS calls are used to talk with the TLK for IRQ handling, FS handling, VPR settings, logger init, etc. SMCs that are interrupted return a special status code to the NS world. Modify our tlk_driver to look for that status and send a restart SMC (value = 60 << 24) when received. Also removed save/restore of registers across SMC calls. This restore buffer was stored in r3 and expected to persist across the SMC. This saving/restoring isn't necessary and adds undesired overhead. Change-Id: I0b59604dfe2c4e3f4673797d756422cd7d5b64a3 Signed-off-by: Scott Long <scottl@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/332791 GVS: Gerrit_Virtual_Submit
2013-11-06security: tlk_driver: interface to program VPR base/lenJames Zhao
Add interface for the kernel to program vpr base address through TLK. Expect phys addr of vpr base, and vpr size. bug 1279160 Change-Id: I0ff6ef9783ac2bb6438afa0552f57a84e84bf567 Signed-off-by: James Zhao <jamesz@nvidia.com> Reviewed-on: http://git-master/r/302404 Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>
2013-10-24security: tlk_driver: remove tegra_read_cycle()Varun Wadekar
Tegra kernel now implements this function in a common place. Bug 1389113 Change-Id: Ie9bcd4267d0098136c18877ef67dd0da2fedbb4c Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/303290
2013-10-11security: tlk_driver: shared buffer loggingVarun Wadekar
Changes to TLK driver to allow logging for TLK via the linux kmsg file. Bug 1332411 Original author: Jay Patel <japatel@nvidia.com> Change-Id: I14d23d2598b391a98ca9e693ae47982da24e17cb Signed-off-by: Sharif Inamdar <isharif@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/289035
2013-10-03security: tlk_driver: serialize calls to tlkJames Zhao
Add mutex lock to serialize all ioctls that will result in a smc call to tlk. bug 1340442 bug 1340471 Change-Id: Ie2cc1e21dcff0a78c971aad0c230f71d1f2b1c49 Signed-off-by: James Zhao <jamesz@nvidia.com> (cherry picked from commit 2a9da9d1c1e717d7f44befb0ca84cbca413b9e3f) Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
2013-09-16security: tlk_driver: shared req/param reg SMCChris Johnson
Add support for attempting to register the req/param buffers with TLK. If it fails, we know we're on an older TLK and have to use phys address to indicate where the buffers are. If the SMC succeeds, we pass the virtual pointers to the buffers knowing TLK will map them in and use them directly. This takes care of the coherency and reduces our dependence on phys addrs. Once both TLK and kernel changes have been synced up, we'll remove the legacy support. Bug 1353314 Change-Id: I1a73ddc66f002f966e80579ac49bbbd3e64a1f72 Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: http://git-master/r/269802 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
2013-09-16security: tlk_driver: rejig switch-to-cpu0 codeVarun Wadekar
* Try to encompass the duplicate cpu affinity code in a macro which can be used at multiple places without code duplication. * Avoid over-writing saved_regs, while re-entering the secure world with a FS-complete smc call. * Remove the fs_ready logic as it is buggy and is not working as expected. Change-Id: I916e5ae53d87285e3e3be14647446a22ae795c1c Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/269118 Reviewed-by: James Zhao <jamesz@nvidia.com>
2013-09-14security: tlk_driver: Use CPU0 for smc callsJames Zhao
- All smc calls need to be done through CPU0. - Add the sched_setaffinity logic to tlk_generic_smc(), will solve the occasional prefetch abort. - Also adding sched_setaffinity logic to tlk_extended_smc(). bug 1322280 Change-Id: I67716bec49aec1f1c9a2e33ec3de90aec2048870 Signed-off-by: James Zhao <jamesz@nvidia.com> Signed-off-by: Aaron Gamble <jgamble@nvidia.com> Reviewed-on: http://git-master/r/264177 Tested-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Chris Johnson <cwj@nvidia.com> Tested-by: Chris Johnson <cwj@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
2013-09-14security: tlk_driver: result_origin consistencyAaron Gamble
For the sake of consistency with other projects, change: OTE_ERROR_ORIGIN_* return_origin error_origin to match result_origin Change-Id: I571c81a387ab35ed05cc3002371bc5d6ae606178 Signed-off-by: Aaron Gamble <jgamble@nvidia.com> Reviewed-on: http://git-master/r/243549 (cherry picked from commit 1a1e6ac1e74a2594662f4601f7a37baf4d4b78bd) Reviewed-on: http://git-master/r/256381 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: James Zhao <jamesz@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
2013-09-14tlk_driver: use dma_alloc_coherent for uncached memChris Johnson
Instead of relying on change page attribute calls, instead use DMA routines to get uncached mem. This will go away in the near future when we can map these buffers directly in the kernel. Change-Id: I6a375f2b1b09f987deae8a61e0907209b90c870e Signed-off-by: Chris Johnson <cwj@nvidia.com> Reviewed-on: http://git-master/r/252523 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Aaron Gamble <jgamble@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Aaron Gamble <jgamble@nvidia.com>
2013-09-14security: tlk_driver: return failure for IOCTL_FILE_NEW_REQ during suspendVarun Wadekar
The user space daemon will retry 3 times whenever it receives errors for new requests. Bug 1314244 Change-Id: I57f1740d7b24d2f3f3f97e7e83a5434f54d05bdb Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/244187 (cherry picked from commit 639efa238a01be8fd9debf4c8511c9eac942fc46) Reviewed-on: http://git-master/r/249874 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Aaron Gamble <jgamble@nvidia.com>
2013-09-14security: tlk_driver: use local stack for context save/restoreVarun Wadekar
With secure storage there is a situation when we getback from the SMC call, but find that the stack is completely corrupted due to SVC handling in the kernel. To avoid such scenarios, use a local stack to save/restore our context. Bug 1291402 Change-Id: If7d4c336aa0cc664b7c7f7134becb68d03e22ece Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/241681 (cherry picked from commit 4fb8a5f59ce565cb684d9aaa816a465d7c3a5d04) Reviewed-on: http://git-master/r/249872 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Aaron Gamble <jgamble@nvidia.com>
2013-09-14tlk: New API changes for tlkJames Zhao
- add new parameter passing support for variable number of parameter - some clean up of naming conventions Bug 1310292 Change-Id: Ie9669456682fe2b85eb79a3d9cb4cbac9eba8d54 Signed-off-by: James Zhao <jamesz@nvidia.com> Reviewed-on: http://git-master/r/239104 (cherry picked from commit da4ee985be76b4f02284510d2eb7e851fb50bc0b) Reviewed-on: http://git-master/r/249870 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Varun Wadekar <vwadekar@nvidia.com> Tested-by: Aaron Gamble <jgamble@nvidia.com>