Skip to content

Commit d3c7c92

Browse files
committed
init ghost_control dynamically
1 parent 2438cee commit d3c7c92

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

arch/arm64/kvm/hyp/ghost_control.c

+13-11
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
Currently the checks also produce (fairly noisy) logging output - we might add separate switches for that
66
*/
77

8-
struct ghost_control ghost_control = {
9-
.check_handle_host_mem_abort = false,
10-
.check_host_stage2_idmap = false,
11-
.check___pkvm_host_donate_guest = false,
12-
.check___kvm_pgtable_walk = false,
13-
.check__kvm_pgtable_walk = false,
14-
.check_kvm_pgtable_stage2_map = false,
15-
.dump_handle_trap = true,
16-
.dump_handle_host_hcall = true,
17-
.dump_handle_host_hcall_verbose = false
18-
};
8+
struct ghost_control ghost_control;
9+
10+
void init_ghost_control(void) {
11+
ghost_control.check_handle_host_mem_abort = false;
12+
ghost_control.check_host_stage2_idmap = false;
13+
ghost_control.check___pkvm_host_donate_guest = false;
14+
ghost_control.check___kvm_pgtable_walk = false;
15+
ghost_control.check__kvm_pgtable_walk = false;
16+
ghost_control.check_kvm_pgtable_stage2_map = false;
17+
ghost_control.dump_handle_trap = true;
18+
ghost_control.dump_handle_host_hcall = true;
19+
ghost_control.dump_handle_host_hcall_verbose = false;
20+
}

arch/arm64/kvm/hyp/ghost_control.h

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ struct ghost_control {
1616

1717
extern struct ghost_control ghost_control;
1818

19+
void init_ghost_control(void);
20+
1921
#define GHOST_EXEC_SPEC false
2022

2123
#endif // _GHOST_CONTROL_H

arch/arm64/kvm/hyp/nvhe/setup.c

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <nvhe/ghost_misc.h>
2727
#include "./ghost_compute_abstraction.h"
2828
#include <../ghost_pgtable.h>
29+
#include "../ghost_control.h"
2930
// /GHOST
3031

3132
unsigned long hyp_nr_cpus;
@@ -432,6 +433,8 @@ int __pkvm_init(phys_addr_t phys, unsigned long size, unsigned long nr_cpus,
432433
int ret;
433434

434435
// GHOST
436+
init_ghost_control();
437+
435438
hyp_puts("\n__pkvm_init:");
436439
hyp_puts("arguments:");
437440
hyp_putsxnl("phys", phys, 64);

0 commit comments

Comments
 (0)