diff options
| author | Gerrit Code Review <gerrit2@nvidia.com> | 2018-08-10 09:53:36 -0400 |
|---|---|---|
| committer | Gerrit Code Review <gerrit2@nvidia.com> | 2018-08-10 09:53:36 -0400 |
| commit | 1794f2c43e09e80f2dd5961811d3f7318a7f3609 (patch) | |
| tree | 54f0c544f1290444fd0870655394ee602bc50d34 | |
| parent | 5eacad37f31658aa672f52d955cb5e3ca7b173d7 (diff) | |
| parent | e0babe691ca6dd3ce6f68e80b9f699f0c438f78a (diff) | |
Merge "Merge remote-tracking branch 'origin/dev/swolfe_trustyporting_kernel-nvidia_20180728' into HEAD" into dev-kernel
| -rw-r--r-- | drivers/trusty/Kconfig | 52 | ||||
| -rw-r--r-- | drivers/trusty/Makefile | 16 | ||||
| -rw-r--r-- | drivers/trusty/trusty-fiq-arm.c | 42 | ||||
| -rw-r--r-- | drivers/trusty/trusty-fiq-arm64-glue.S | 54 | ||||
| -rw-r--r-- | drivers/trusty/trusty-fiq-arm64.c | 172 | ||||
| -rw-r--r-- | drivers/trusty/trusty-fiq.c | 85 | ||||
| -rw-r--r-- | drivers/trusty/trusty-fiq.h | 16 | ||||
| -rw-r--r-- | drivers/trusty/trusty-ipc.c | 1706 | ||||
| -rw-r--r-- | drivers/trusty/trusty-irq.c | 653 | ||||
| -rw-r--r-- | drivers/trusty/trusty-log.c | 289 | ||||
| -rw-r--r-- | drivers/trusty/trusty-log.h | 22 | ||||
| -rw-r--r-- | drivers/trusty/trusty-mem.c | 140 | ||||
| -rw-r--r-- | drivers/trusty/trusty-ote.c | 489 | ||||
| -rw-r--r-- | drivers/trusty/trusty-ote.h | 136 | ||||
| -rw-r--r-- | drivers/trusty/trusty-otf-iface.c | 53 | ||||
| -rw-r--r-- | drivers/trusty/trusty-virtio.c | 841 | ||||
| -rw-r--r-- | drivers/trusty/trusty-workitem.h | 61 | ||||
| -rw-r--r-- | drivers/trusty/trusty.c | 723 | ||||
| -rw-r--r-- | include/linux/trusty/sm_err.h | 45 | ||||
| -rw-r--r-- | include/linux/trusty/smcall.h | 138 | ||||
| -rw-r--r-- | include/linux/trusty/trusty.h | 105 | ||||
| -rw-r--r-- | include/linux/trusty/trusty_ipc.h | 122 |
22 files changed, 5960 insertions, 0 deletions
diff --git a/drivers/trusty/Kconfig b/drivers/trusty/Kconfig new file mode 100644 index 000000000..cb32fbbb0 --- /dev/null +++ b/drivers/trusty/Kconfig | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | # | ||
| 2 | # Trusty | ||
| 3 | # | ||
| 4 | |||
| 5 | menu "Trusty" | ||
| 6 | |||
| 7 | config TRUSTY | ||
| 8 | tristate "Trusty" | ||
| 9 | default n | ||
| 10 | |||
| 11 | config TRUSTY_FIQ | ||
| 12 | tristate | ||
| 13 | depends on TRUSTY | ||
| 14 | |||
| 15 | config TRUSTY_FIQ_ARM | ||
| 16 | tristate | ||
| 17 | depends on TRUSTY | ||
| 18 | depends on ARM | ||
| 19 | select FIQ_GLUE | ||
| 20 | select TRUSTY_FIQ | ||
| 21 | default y | ||
| 22 | |||
| 23 | config TRUSTY_FIQ_ARM64 | ||
| 24 | tristate | ||
| 25 | depends on TRUSTY | ||
| 26 | depends on ARM64 | ||
| 27 | select FIQ_GLUE | ||
| 28 | select TRUSTY_FIQ | ||
| 29 | default n | ||
| 30 | |||
| 31 | config TRUSTY_LOG | ||
| 32 | tristate | ||
| 33 | depends on TRUSTY | ||
| 34 | default y | ||
| 35 | |||
| 36 | config TRUSTY_VIRTIO | ||
| 37 | tristate "Trusty virtio support" | ||
| 38 | depends on TRUSTY | ||
| 39 | select VIRTIO | ||
| 40 | default y | ||
| 41 | |||
| 42 | config TRUSTY_VIRTIO_IPC | ||
| 43 | tristate "Trusty Virtio IPC driver" | ||
| 44 | depends on TRUSTY_VIRTIO | ||
| 45 | default y | ||
| 46 | help | ||
| 47 | This module adds support for communications with Trusty Services | ||
| 48 | |||
| 49 | If you choose to build a module, it'll be called trusty-ipc. | ||
| 50 | Say N if unsure. | ||
| 51 | |||
| 52 | endmenu | ||
diff --git a/drivers/trusty/Makefile b/drivers/trusty/Makefile new file mode 100644 index 000000000..0c838d28e --- /dev/null +++ b/drivers/trusty/Makefile | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | # | ||
| 2 | # Makefile for trusty components | ||
| 3 | # | ||
| 4 | subdir-ccflags-y += -Werror | ||
| 5 | |||
| 6 | obj-$(CONFIG_TRUSTY) += trusty.o | ||
| 7 | obj-$(CONFIG_TRUSTY) += trusty-irq.o | ||
| 8 | obj-$(CONFIG_TRUSTY_FIQ) += trusty-fiq.o | ||
| 9 | obj-$(CONFIG_TRUSTY_FIQ_ARM) += trusty-fiq-arm.o | ||
| 10 | obj-$(CONFIG_TRUSTY_FIQ_ARM64) += trusty-fiq-arm64.o trusty-fiq-arm64-glue.o | ||
| 11 | obj-$(CONFIG_TRUSTY_LOG) += trusty-log.o | ||
| 12 | obj-$(CONFIG_TRUSTY) += trusty-mem.o | ||
| 13 | obj-$(CONFIG_TRUSTY_VIRTIO) += trusty-virtio.o | ||
| 14 | obj-$(CONFIG_TRUSTY_VIRTIO_IPC) += trusty-ipc.o | ||
| 15 | obj-$(CONFIG_TRUSTY) += trusty-ote.o | ||
| 16 | obj-$(CONFIG_TRUSTY) += trusty-otf-iface.o | ||
diff --git a/drivers/trusty/trusty-fiq-arm.c b/drivers/trusty/trusty-fiq-arm.c new file mode 100644 index 000000000..8c62a00bb --- /dev/null +++ b/drivers/trusty/trusty-fiq-arm.c | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013 Google, Inc. | ||
| 3 | * | ||
| 4 | * This software is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2, as published by the Free Software Foundation, and | ||
| 6 | * may be copied, distributed, and modified under those terms. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <asm/fiq_glue.h> | ||
| 16 | #include <linux/platform_device.h> | ||
| 17 | #include <linux/trusty/smcall.h> | ||
| 18 | #include <linux/trusty/trusty.h> | ||
| 19 | |||
| 20 | #include "trusty-fiq.h" | ||
| 21 | |||
| 22 | #define _STRINGIFY(x) #x | ||
| 23 | #define STRINGIFY(x) _STRINGIFY(x) | ||
| 24 | |||
| 25 | static void __naked trusty_fiq_return(void) | ||
| 26 | { | ||
| 27 | asm volatile( | ||
| 28 | ".arch_extension sec\n" | ||
| 29 | "mov r12, r0\n" | ||
| 30 | "ldr r0, =" STRINGIFY(SMC_FC_FIQ_EXIT) "\n" | ||
| 31 | "smc #0"); | ||
| 32 | } | ||
| 33 | |||
| 34 | int trusty_fiq_arch_probe(struct platform_device *pdev) | ||
| 35 | { | ||
| 36 | return fiq_glue_set_return_handler(trusty_fiq_return); | ||
| 37 | } | ||
| 38 | |||
| 39 | void trusty_fiq_arch_remove(struct platform_device *pdev) | ||
| 40 | { | ||
| 41 | fiq_glue_clear_return_handler(trusty_fiq_return); | ||
| 42 | } | ||
diff --git a/drivers/trusty/trusty-fiq-arm64-glue.S b/drivers/trusty/trusty-fiq-arm64-glue.S new file mode 100644 index 000000000..6994b3a94 --- /dev/null +++ b/drivers/trusty/trusty-fiq-arm64-glue.S | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013 Google, Inc. | ||
| 3 | * | ||
| 4 | * This software is licensed under the terms of the GNU General Public | ||
| 5 | * License version 2, as published by the Free Software Foundation, and | ||
| 6 | * may be copied, distributed, and modified under those terms. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <asm/asm-offsets.h> | ||
| 16 | #include <asm/ptrace.h> | ||
| 17 | #include <linux/linkage.h> | ||
| 18 | #include <linux/trusty/smcall.h> | ||
| 19 | |||
| 20 | .macro push reg1,reg2,remregs:vararg | ||
| 21 | .ifnb \remregs | ||
| 22 | push \remregs | ||
| 23 | .endif | ||
| 24 | stp \reg1, \reg2, [sp, #-16]! | ||
| 25 | .endm | ||
| 26 | |||
| 27 | .macro pop reg1,reg2,remregs:vararg | ||
| 28 | ldp \reg1, \reg2, [sp], #16 | ||
| 29 | .ifnb \remregs | ||
| 30 | pop \remregs | ||
| 31 | .endif | ||
| 32 | .endm | ||
| 33 | |||
| 34 | ENTRY(trusty_fiq_glue_arm64) | ||
| 35 | sub sp, sp, #S_FRAME_SIZE - S_LR | ||
| 36 | push x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, \ | ||
| 37 | x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, \ | ||
| 38 | x26, x27, x28, x29 | ||
| 39 | ldr x0, =SMC_FC64_GET_FIQ_REGS | ||
| 40 | smc #0 | ||
| 41 | stp x0, x1, [sp, #S_PC] /* original pc, cpsr */ | ||
| 42 | tst x1, PSR_MODE_MASK | ||
| 43 | csel x2, x2, x3, eq /* sp el0, sp el1 */ | ||
| 44 | stp x30, x2, [sp, #S_LR] /* lr, original sp */ | ||
| 45 | mov x0, sp | ||
| 46 | mov x1, x3 | ||
| 47 | bl trusty_fiq_handler | ||
| 48 | pop x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, \ | ||
| 49 | x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, \ | ||
| 50 | x26, x27, x28, x29 | ||
| 51 | ldr x30, [sp], #S_FRAME_SIZE - S_LR /* load LR and restore SP */ | ||
| 52 | ldr x0, =SMC_FC_FIQ_EXIT | ||
| 53 | smc #0 | ||
| 54 | b . /* should not get here */ | ||
diff --git a/drivers/trusty/trusty-fiq-arm64.c b/drivers/trusty/trusty-fiq-arm64.c new file mode 100644 index 000000000..8b9a40887 --- /dev/null +++ b/drivers/trusty/trusty-fiq-arm64.c | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2013 Google, Inc. | ||
| 3 | * | ||
| < | |||
