From 6fcc5021a8f8eaef1a2a8e2c342728d1a6ff35d0 Mon Sep 17 00:00:00 2001 From: Preetham Chandru Ramchandra Date: Tue, 18 May 2021 20:11:05 +0530 Subject: tegra: safety: Add client registration Add client registration and deregistration calls. The clients registers with a callback function which gets called when ivc ready is received from L2SS. Bug 200700404 Change-Id: I358f4ad7ada547dfb81bb60c990b2f84235a9651 Signed-off-by: Preetham Chandru Ramchandra Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2531217 Reviewed-by: Bibek Basu Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- include/linux/tegra_l1ss_ioctl.h | 7 +++++ include/linux/tegra_l1ss_kernel_interface.h | 46 +++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) (limited to 'include/linux') diff --git a/include/linux/tegra_l1ss_ioctl.h b/include/linux/tegra_l1ss_ioctl.h index 195ef04d2..f42697499 100644 --- a/include/linux/tegra_l1ss_ioctl.h +++ b/include/linux/tegra_l1ss_ioctl.h @@ -232,6 +232,13 @@ typedef struct { }; } nv_guard_request_t; +/* + * Identifies a client + */ +typedef uint32_t nv_guard_client_id_t; + +#define NVGUARD_INVALID_CLIENTID (0U) +#define NVGUARD_MAX_CLIENT_CONNECTIONS (4U * NVGUARD_GROUPID_MAX) #define L1SS_CLIENT_REQUEST _IOR(L1SS_IOCTL_MAGIC, 1, nv_guard_request_t) diff --git a/include/linux/tegra_l1ss_kernel_interface.h b/include/linux/tegra_l1ss_kernel_interface.h index 62e34592b..105f487a5 100644 --- a/include/linux/tegra_l1ss_kernel_interface.h +++ b/include/linux/tegra_l1ss_kernel_interface.h @@ -17,7 +17,53 @@ #ifndef _L1SS_INTERFACE_H #define _L1SS_INTERFACE_H +#include #include +typedef enum { + L1SS_NOT_READY, + L1SS_READY, + L1SS_ALIVE_CHECK, +} l1ss_cli_callback_param; + +typedef int (*client_callback)(l1ss_cli_callback_param, void *); + +typedef struct { + nv_guard_client_id_t id; + client_callback cli_callback; + void *data; +} client_param_t; + +struct l1ss_client_param_node { + struct list_head cli_list; + client_param_t *p; +}; + +#ifdef CONFIG_TEGRA_SAFETY int l1ss_submit_rq(nv_guard_request_t *req, bool can_sleep); +int l1ss_register_client(client_param_t *p); +int l1ss_deregister_client(nv_guard_client_id_t id); +int l1ss_notify_client(l1ss_cli_callback_param val); +void l1ss_set_ivc_ready(void); +#else +inline int l1ss_register_client(client_param_t *p) +{ + return -ENODEV; +} + +inline int l1ss_deregister_client(nv_guard_client_id_t id) +{ + return 0; +} + +inline int l1ss_notify_client(l1ss_cli_callback_param val) +{ + return 0; +} + +inline int l1ss_submit_rq(nv_guard_request_t *req, bool can_sleep) +{ + return 0; +} +#endif #endif -- cgit v1.2.2