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 "vmapi/hf/call.h"
10 
11 #include "test/hftest.h"
12 
13 /**
14  * Checks that VM entry is being passed the allocated memory size, rather than a
15  * pointer to the FDT.
16  */
test_memory_size(size_t mem_size)17 static void test_memory_size(size_t mem_size)
18 {
19 	/*
20 	 * The memory size this test expects to be allocated for the VM.
21 	 * This is defined in the manifest (manifest_no_fdt.dts).
22 	 */
23 	const size_t expected_mem_size = 0x100000;
24 
25 	if (mem_size != expected_mem_size) {
26 		FAIL("Memory size passed to VM entry %u is not expected size of"
27 		     "%u.",
28 		     mem_size, expected_mem_size);
29 	}
30 }
31 
test_main_secondary(size_t mem_size)32 void test_main_secondary(size_t mem_size)
33 {
34 	test_memory_size(mem_size);
35 
36 	/* Yield back to the primary if all tests pass. */
37 	ffa_yield();
38 }
39