From 9b415b21b13c94f26269dfb97f648be59f931ef8 Mon Sep 17 00:00:00 2001 From: Amith Nuggehalli Date: Wed, 6 Sep 2017 22:19:16 -0700 Subject: Add polling thread to poll TX vq *** This change is needed for multi-guest trusty use-case only *** Trusty (TOS) splits the incoming requests into kernel and user threads. These threads are blocked on events, run when their event is released. Trusty also has an idle thread whose priority is lower than all other threads in the OS. It runs when there is no other active thread to run and it takes the cpu back to the NS world (idle return). In multi-guest configuration, TOS can receive requests from multiple guests concurrently. While some requests are exclusive rest others access shared system resources such as SE engine keyslots and so on. Infact, trusted applications can also be considered to be shared resources as they are single threaded and only one instance of each TA runs on the system. Threads waiting on shared resources or service from a server, go to sleep if the wait is not released immediately. In such cases, the incoming guest returns back to the kernel, while its requests are still waiting in TOS.This guest kernel would need some kind of a callback or an asynchronous event or rudimentary polling to inform its requests are completed. The cpu running in trusty runs all the waiting threads before it returns back to its guest. This fix checks the VQ for any new buffers at every second. So at the end of each interval, there is a guarantee that the kernel looks at its Rx queues and notifies the clients waiting on their channels for any new messages. JIRA: SEC-412 TESTS: Ran 10,000 iterations of sample_client1 calling crypto, secure storage, secure RTC and nvcrypto APIs concurrently on both guest VMs in a linux-linux configuration. Tests complete successfully. Change-Id: I7e336c79cac0ebb36a81921553243c09c98a6568 Signed-off-by: Amith Nuggehalli Reviewed-on: https://git-master.nvidia.com/r/1550450 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Mihir Joshi Reviewed-by: Varun Wadekar --- include/linux/trusty/trusty.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/trusty/trusty.h b/include/linux/trusty/trusty.h index bd7c91313..a203e6943 100644 --- a/include/linux/trusty/trusty.h +++ b/include/linux/trusty/trusty.h @@ -60,6 +60,9 @@ struct notifier_block; enum { TRUSTY_CALL_PREPARE, TRUSTY_CALL_RETURNED, +#ifdef CONFIG_TEGRA_VIRTUALIZATION + TRUSTY_CALL_VQ_POLLING, +#endif }; int trusty_call_notifier_register(struct device *dev, struct notifier_block *n); -- cgit v1.2.2