1 /* 2 * Copyright (c) 2022, Google, Inc. All rights reserved 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files 6 * (the "Software"), to deal in the Software without restriction, 7 * including without limitation the rights to use, copy, modify, merge, 8 * publish, distribute, sublicense, and/or sell copies of the Software, 9 * and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be 13 * included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 24 /* 25 * This header file defines the SMC API and the shared data info between 26 * Linux and Trusty. 27 * 28 * IMPORTANT: Copy of this header file is used in the Linux Trusty-Driver. 29 * Linux header file: trusty/external/linux/drivers/trusty/trusy-sched-share.h 30 * Please keep the copies in sync. 31 */ 32 #ifndef _TRUSTY_SCHED_SHARE_H_ 33 #define _TRUSTY_SCHED_SHARE_H_ 34 35 #include <lib/sm/smcall.h> 36 37 /* 38 * trusty-shadow-priority valid values 39 */ 40 #define TRUSTY_SHADOW_PRIORITY_LOW 1 41 #define TRUSTY_SHADOW_PRIORITY_NORMAL 2 42 #define TRUSTY_SHADOW_PRIORITY_HIGH 3 43 44 /** 45 * struct trusty_percpu_data - per-cpu trusty shared data 46 * @cur_shadow_priority: set by Trusty-Driver/Linux 47 * @ask_shadow_priority: set by Trusty Kernel 48 */ 49 struct trusty_percpu_shared_data { 50 uint32_t cur_shadow_priority; 51 uint32_t ask_shadow_priority; 52 }; 53 54 /** 55 * struct trusty_sched_shared_mem - information in the shared memory. 56 * @hdr_size: size of the trusty_sched_shared data-structure. 57 * An instance of this data-structure is embedded at 58 * the very beginning of the shared-memory block. 59 * @cpu_count: max number of available CPUs in the system. 60 * @percpu_data_size: size of the per-cpu data structure. 61 * The shared-memory block contains an array 62 * of per-cpu instances of a data-structure that 63 * can be indexed by cpu_id. 64 * NOTE: At the end of this data-structure, additional space is 65 * allocated to accommodate a variable length array as follows: 66 * 'struct trusty_percpu_data percpu_data_table[]', 67 * with 'cpu_count' as its number of elements. 68 69 */ 70 struct trusty_sched_shared_mem { 71 uint32_t hdr_size; 72 uint32_t cpu_count; 73 uint32_t percpu_data_size; 74 /* Additional space is allocated here, as noted above. */ 75 }; 76 77 #endif /* _TRUSTY_SCHED_SHARE_H_ */ 78