From 27e57ad67ae0b76cdf94e323c07b6db90f11bea4 Mon Sep 17 00:00:00 2001 From: Michael Ryleev Date: Tue, 11 Oct 2016 11:01:14 -0700 Subject: trusty: add support for parameterized NOP ops Parameterized NOPs are introduced by Trusty secure side to facilitate better SMP concurrency. They are effectively NOP calls with parameters that will be routed to appropriate handlers on secure side which can be executed concurrently on multiple CPUs. Parameterized NOPs are represented by trusty_nop structure that has to be initialized by calling trusty_nop_init call. This patch creates queue for such items, adds per CPU work queue to invoke them and adds API to enqueue and dequeue them. Change-Id: I4c450c3d6cc18b246dfd0ca4526ef8703c1c2d64 Signed-off-by: Michael Ryleev --- include/linux/trusty/smcall.h | 3 ++- include/linux/trusty/trusty.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/trusty/smcall.h b/include/linux/trusty/smcall.h index 2e43803d9..4e03a97ee 100644 --- a/include/linux/trusty/smcall.h +++ b/include/linux/trusty/smcall.h @@ -120,7 +120,8 @@ */ #define TRUSTY_API_VERSION_RESTART_FIQ (1) #define TRUSTY_API_VERSION_SMP (2) -#define TRUSTY_API_VERSION_CURRENT (2) +#define TRUSTY_API_VERSION_SMP_NOP (3) +#define TRUSTY_API_VERSION_CURRENT (3) #define SMC_FC_API_VERSION SMC_FASTCALL_NR (SMC_ENTITY_SECURE_MONITOR, 11) /* TRUSTED_OS entity calls */ diff --git a/include/linux/trusty/trusty.h b/include/linux/trusty/trusty.h index 24fe2101a..742c09e9e 100644 --- a/include/linux/trusty/trusty.h +++ b/include/linux/trusty/trusty.h @@ -69,4 +69,20 @@ int trusty_call32_mem_buf(struct device *dev, u32 smcnr, struct page *page, u32 size, pgprot_t pgprot); +struct trusty_nop { + struct list_head node; + u32 args[3]; +}; + +static inline void trusty_nop_init(struct trusty_nop *nop, + u32 arg0, u32 arg1, u32 arg2) { + INIT_LIST_HEAD(&nop->node); + nop->args[0] = arg0; + nop->args[1] = arg1; + nop->args[2] = arg2; +} + +void trusty_enqueue_nop(struct device *dev, struct trusty_nop *nop); +void trusty_dequeue_nop(struct device *dev, struct trusty_nop *nop); + #endif -- cgit v1.2.2