1 /* 2 * Copyright 2020 The Hafnium Authors. 3 * 4 * Use of this source code is governed by a BSD-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/BSD-3-Clause. 7 */ 8 9 #include <stdint.h> 10 11 #include "hf/arch/other_world.h" 12 13 #include "hf/addr.h" 14 #include "hf/ffa.h" 15 #include "hf/types.h" 16 17 #include "smc.h" 18 #include "test/hftest.h" 19 20 alignas(FFA_PAGE_SIZE) static uint8_t tee_send_buffer[HF_MAILBOX_SIZE]; 21 alignas(FFA_PAGE_SIZE) static uint8_t tee_recv_buffer[HF_MAILBOX_SIZE]; 22 23 /** 24 * Make sure FFA_RXTX_MAP to EL3 works. 25 */ TEST(arch_tee,init)26TEST(arch_tee, init) 27 { 28 struct ffa_value ret = arch_other_world_call((struct ffa_value){ 29 .func = FFA_RXTX_MAP_64, 30 .arg1 = pa_addr(pa_from_va(va_from_ptr(tee_recv_buffer))), 31 .arg2 = pa_addr(pa_from_va(va_from_ptr(tee_send_buffer))), 32 .arg3 = HF_MAILBOX_SIZE / FFA_PAGE_SIZE}); 33 uint32_t func = ret.func & ~SMCCC_CONVENTION_MASK; 34 35 /* 36 * TODO(qwandor): Remove this UNKNOWN check once we have a build of TF-A 37 * which supports FF-A memory sharing. 38 */ 39 if (ret.func != SMCCC_ERROR_UNKNOWN) { 40 ASSERT_EQ(func, FFA_SUCCESS_32); 41 } 42 } 43