Alexandru Gagniuc | 0ea6163 | 2021-07-15 14:19:25 -0500 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Simple API for configuring TrustZone memory regions |
| 4 | * |
| 5 | * The premise is that the desired TZC layout is known beforehand, and it can |
| 6 | * be configured in one step. tzc_configure() provides this functionality. |
| 7 | */ |
| 8 | #ifndef MACH_TZC_H |
| 9 | #define MACH_TZC_H |
| 10 | |
| 11 | #include <linux/types.h> |
| 12 | |
| 13 | enum tzc_sec_mode { |
| 14 | TZC_ATTR_SEC_NONE = 0, |
| 15 | TZC_ATTR_SEC_R = 1, |
| 16 | TZC_ATTR_SEC_W = 2, |
| 17 | TZC_ATTR_SEC_RW = 3 |
| 18 | }; |
| 19 | |
| 20 | struct tzc_region { |
| 21 | uintptr_t base; |
| 22 | uintptr_t top; |
| 23 | enum tzc_sec_mode sec_mode; |
| 24 | uint16_t nsec_id; |
| 25 | uint16_t filters_mask; |
| 26 | }; |
| 27 | |
| 28 | int tzc_configure(uintptr_t tzc, const struct tzc_region *cfg); |
| 29 | int tzc_disable_filters(uintptr_t tzc, uint16_t filters_mask); |
| 30 | int tzc_enable_filters(uintptr_t tzc, uint16_t filters_mask); |
| 31 | void tzc_dump_config(uintptr_t tzc); |
| 32 | |
| 33 | #endif /* MACH_TZC_H */ |