blob: cff2f00cb1bcac99dbacd93ef826d4a9a3863ab8 [file] [log] [blame]
J-Alves3388b0b2021-04-13 10:39:38 +01001/*
2 * Copyright 2021 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 <stdalign.h>
10#include <stdint.h>
11
12#include "hf/ffa.h"
13#include "hf/mm.h"
14#include "hf/std.h"
15
16#include "vmapi/hf/call.h"
17
J-Alves35e61922021-05-06 10:01:05 +010018#include "test/abort.h"
J-Alves3388b0b2021-04-13 10:39:38 +010019#include "test/hftest.h"
20
Olivier Deprez175161a2021-11-23 18:41:09 +010021alignas(4096) uint8_t kstack[MAX_CPUS][4096];
J-Alves3388b0b2021-04-13 10:39:38 +010022
Olivier Deprez175161a2021-11-23 18:41:09 +010023void test_main_sp(bool);
J-Alves3388b0b2021-04-13 10:39:38 +010024
J-Alves3388b0b2021-04-13 10:39:38 +010025noreturn void kmain(void)
26{
Olivier Deprez175161a2021-11-23 18:41:09 +010027 extern void secondary_ep_entry(void);
28 struct ffa_value res;
29
J-Alves3388b0b2021-04-13 10:39:38 +010030 /*
31 * Initialize the stage-1 MMU and identity-map the entire address space.
32 */
33 if (!hftest_mm_init()) {
34 HFTEST_LOG_FAILURE();
35 HFTEST_LOG(HFTEST_LOG_INDENT "Memory initialization failed");
36 abort();
37 }
38
Olivier Deprez175161a2021-11-23 18:41:09 +010039 /* Register entry point for secondary vCPUs. */
40 res = ffa_secondary_ep_register((uintptr_t)secondary_ep_entry);
41 EXPECT_EQ(res.func, FFA_SUCCESS_32);
42
43 test_main_sp(true);
J-Alves3388b0b2021-04-13 10:39:38 +010044
45 /* Do not expect to get to this point, so abort. */
46 abort();
47}