AArch64 EL2 hypervisor for QEMU virt that boots at EL2
1#ifndef HV_STAGE2_H
2#define HV_STAGE2_H
3
4#include "hv/types.h"
5
6enum stage2_mem_type {
7 S2_MEM_NORMAL = 0,
8 S2_MEM_DEVICE = 1,
9};
10
11enum stage2_perm {
12 S2_PERM_R = 1u,
13 S2_PERM_W = 2u,
14 S2_PERM_X = 4u,
15};
16
17struct stage2_translation {
18 bool mapped;
19 ipa_t ipa_base;
20 paddr_t pa_base;
21 uint64_t size;
22 uint64_t desc;
23 uint32_t perms;
24 enum stage2_mem_type type;
25};
26
27struct trap_frame;
28struct vcpu;
29
30void stage2_init(void);
31bool stage2_map_range(ipa_t ipa, paddr_t pa, uint64_t size, enum stage2_mem_type type, uint32_t perms);
32bool stage2_unmap_range(ipa_t ipa, uint64_t size);
33bool stage2_translate(ipa_t ipa, struct stage2_translation *out);
34ipa_t stage2_ipa_from_abort(uint64_t far_el2, uint64_t hpfar_el2);
35bool stage2_handle_abort(struct vcpu *vcpu, const struct trap_frame *frame, bool instruction);
36uint64_t stage2_vttbr(void);
37uint64_t stage2_vtcr(void);
38void stage2_dump(void);
39bool stage2_selftest(void);
40
41#endif