blob: 16db55c46454408d48858f22c387a8d21085d7b9 [file] [log] [blame]
Alexandru Gagniuc0ea61632021-07-15 14:19:25 -05001/* 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
13enum 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
20struct 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
28int tzc_configure(uintptr_t tzc, const struct tzc_region *cfg);
29int tzc_disable_filters(uintptr_t tzc, uint16_t filters_mask);
30int tzc_enable_filters(uintptr_t tzc, uint16_t filters_mask);
31void tzc_dump_config(uintptr_t tzc);
32
33#endif /* MACH_TZC_H */