This source file includes following definitions.
- get_reg
- set_reg
1
2
3
4
5
6
7 #ifndef SELFTEST_KVM_PROCESSOR_H
8 #define SELFTEST_KVM_PROCESSOR_H
9
10 #include "kvm_util.h"
11
12
13 #define ARM64_CORE_REG(x) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \
14 KVM_REG_ARM_CORE | KVM_REG_ARM_CORE_REG(x))
15
16 #define CPACR_EL1 3, 0, 1, 0, 2
17 #define TCR_EL1 3, 0, 2, 0, 2
18 #define MAIR_EL1 3, 0, 10, 2, 0
19 #define TTBR0_EL1 3, 0, 2, 0, 0
20 #define SCTLR_EL1 3, 0, 1, 0, 0
21
22
23
24
25
26
27
28
29
30
31
32 #define DEFAULT_MAIR_EL1 ((0x00ul << (0 * 8)) | \
33 (0x04ul << (1 * 8)) | \
34 (0x0cul << (2 * 8)) | \
35 (0x44ul << (3 * 8)) | \
36 (0xfful << (4 * 8)) | \
37 (0xbbul << (5 * 8)))
38
39 static inline void get_reg(struct kvm_vm *vm, uint32_t vcpuid, uint64_t id, uint64_t *addr)
40 {
41 struct kvm_one_reg reg;
42 reg.id = id;
43 reg.addr = (uint64_t)addr;
44 vcpu_ioctl(vm, vcpuid, KVM_GET_ONE_REG, ®);
45 }
46
47 static inline void set_reg(struct kvm_vm *vm, uint32_t vcpuid, uint64_t id, uint64_t val)
48 {
49 struct kvm_one_reg reg;
50 reg.id = id;
51 reg.addr = (uint64_t)&val;
52 vcpu_ioctl(vm, vcpuid, KVM_SET_ONE_REG, ®);
53 }
54
55 void aarch64_vcpu_setup(struct kvm_vm *vm, int vcpuid, struct kvm_vcpu_init *init);
56 void aarch64_vcpu_add_default(struct kvm_vm *vm, uint32_t vcpuid,
57 struct kvm_vcpu_init *init, void *guest_code);
58
59 #endif