Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | * SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | */ |
| 5 | |
| 6 | #include <host_rmi_wrappers.h> |
| 7 | |
| 8 | /* Declaring SMC handler */ |
| 9 | void handle_ns_smc(unsigned long function_id, |
| 10 | unsigned long arg0, |
| 11 | unsigned long arg1, |
| 12 | unsigned long arg2, |
| 13 | unsigned long arg3, |
| 14 | unsigned long arg4, |
| 15 | unsigned long arg5, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 16 | struct smc_result *res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 17 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 18 | void host_rmi_granule_delegate(void *granule_address, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 19 | { |
| 20 | handle_ns_smc(SMC_RMM_GRANULE_DELEGATE, |
| 21 | (uintptr_t)granule_address, |
| 22 | 0, 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 23 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 24 | } |
| 25 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 26 | void host_rmi_granule_undelegate(void *granule_address, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 27 | { |
| 28 | handle_ns_smc(SMC_RMM_GRANULE_UNDELEGATE, |
| 29 | (uintptr_t)granule_address, |
| 30 | 0, 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 31 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 32 | } |
| 33 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 34 | void host_rmi_realm_create(void *rd, void *params_ptr, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 35 | { |
| 36 | handle_ns_smc(SMC_RMM_REALM_CREATE, |
| 37 | (uintptr_t)rd, |
| 38 | (uintptr_t)params_ptr, |
| 39 | 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 40 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 41 | } |
| 42 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 43 | void host_rmi_realm_destroy(void *rd, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 44 | { |
| 45 | handle_ns_smc(SMC_RMM_REALM_DESTROY, |
| 46 | (uintptr_t)rd, |
| 47 | 0, 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 48 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 49 | } |
| 50 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 51 | void host_rmi_rtt_create(void *rd, void *rtt, void *ipa, unsigned int level, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 52 | { |
| 53 | handle_ns_smc(SMC_RMM_RTT_CREATE, |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 54 | (uintptr_t)rd, |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 55 | (uintptr_t)rtt, |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 56 | (uintptr_t)ipa, |
| 57 | level, |
| 58 | 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 59 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 60 | } |
| 61 | |
AlexeiFedorov | e2002be | 2023-04-19 17:20:12 +0100 | [diff] [blame] | 62 | void host_rmi_rtt_destroy(void *rd, void *ipa, unsigned int level, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 63 | struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 64 | { |
| 65 | handle_ns_smc(SMC_RMM_RTT_DESTROY, |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 66 | (uintptr_t)rd, |
| 67 | (uintptr_t)ipa, |
| 68 | level, |
AlexeiFedorov | e2002be | 2023-04-19 17:20:12 +0100 | [diff] [blame] | 69 | 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 70 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 71 | } |
| 72 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 73 | void host_rmi_rec_aux_count(void *rd, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 74 | { |
| 75 | handle_ns_smc(SMC_RMM_REC_AUX_COUNT, |
| 76 | (uintptr_t)rd, |
| 77 | 0, 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 78 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 79 | } |
| 80 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 81 | void host_rmi_rec_create(void *rd, void *rec, void *params_ptr, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 82 | { |
| 83 | handle_ns_smc(SMC_RMM_REC_CREATE, |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 84 | (uintptr_t)rd, |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 85 | (uintptr_t)rec, |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 86 | (uintptr_t)params_ptr, |
| 87 | 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 88 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 89 | } |
| 90 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 91 | void host_rmi_rec_destroy(void *rec, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 92 | { |
| 93 | handle_ns_smc(SMC_RMM_REC_DESTROY, |
| 94 | (uintptr_t)rec, |
| 95 | 0, 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 96 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 97 | } |
| 98 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 99 | void host_rmi_realm_activate(void *rd, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 100 | { |
| 101 | handle_ns_smc(SMC_RMM_REALM_ACTIVATE, |
| 102 | (uintptr_t)rd, |
| 103 | 0, 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 104 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 105 | } |
| 106 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 107 | void host_rmi_rec_enter(void *rec, void *run_ptr, struct smc_result *res) |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 108 | { |
| 109 | handle_ns_smc(SMC_RMM_REC_ENTER, |
| 110 | (uintptr_t)rec, |
| 111 | (uintptr_t)run_ptr, |
| 112 | 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 113 | res); |
Mate Toth-Pal | 2611c55 | 2023-02-28 10:28:32 +0100 | [diff] [blame] | 114 | } |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 115 | |
| 116 | void host_rmi_data_create(uintptr_t data, void *rd, uintptr_t ipa, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 117 | uintptr_t src, struct smc_result *res) |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 118 | { |
| 119 | handle_ns_smc(SMC_RMM_DATA_CREATE, |
| 120 | (uintptr_t)data, |
| 121 | (uintptr_t)rd, ipa, src, |
| 122 | 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 123 | res); |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 124 | } |
| 125 | |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 126 | void host_rmi_data_create_unknown(void *rd, uintptr_t data, uintptr_t ipa, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 127 | struct smc_result *res) |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 128 | { |
| 129 | handle_ns_smc(SMC_RMM_DATA_CREATE_UNKNOWN, |
AlexeiFedorov | ac923c8 | 2023-04-06 15:12:04 +0100 | [diff] [blame] | 130 | (uintptr_t)rd, |
| 131 | (uintptr_t)data, ipa, |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 132 | 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 133 | res); |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 134 | } |
| 135 | |
AlexeiFedorov | 960d161 | 2023-04-25 13:23:39 +0100 | [diff] [blame] | 136 | void host_rmi_rtt_init_ripas(void *rd, uintptr_t base, uintptr_t top, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 137 | struct smc_result *res) |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 138 | { |
| 139 | handle_ns_smc(SMC_RMM_RTT_INIT_RIPAS, |
| 140 | (uintptr_t)rd, |
AlexeiFedorov | 960d161 | 2023-04-25 13:23:39 +0100 | [diff] [blame] | 141 | base, top, |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 142 | 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 143 | res); |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 144 | } |
| 145 | |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 146 | void host_rmi_data_destroy(void *rd, uintptr_t ipa, struct smc_result *res) |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 147 | { |
| 148 | handle_ns_smc(SMC_RMM_DATA_DESTROY, |
| 149 | (uintptr_t)rd, ipa, |
| 150 | 0, 0, 0, 0, |
AlexeiFedorov | ccce3ad | 2023-04-28 18:29:47 +0100 | [diff] [blame^] | 151 | res); |
Soby Mathew | 76e9b45 | 2023-05-16 15:11:34 +0100 | [diff] [blame] | 152 | } |