xref: /openbmc/qemu/include/sysemu/hvf.h (revision 044431cf)
1c97d6d2cSSergio Andres Gomez Del Real /*
2c97d6d2cSSergio Andres Gomez Del Real  * QEMU Hypervisor.framework (HVF) support
3c97d6d2cSSergio Andres Gomez Del Real  *
4c97d6d2cSSergio Andres Gomez Del Real  * Copyright Google Inc., 2017
5c97d6d2cSSergio Andres Gomez Del Real  *
6c97d6d2cSSergio Andres Gomez Del Real  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7c97d6d2cSSergio Andres Gomez Del Real  * See the COPYING file in the top-level directory.
8c97d6d2cSSergio Andres Gomez Del Real  *
9c97d6d2cSSergio Andres Gomez Del Real  */
10c97d6d2cSSergio Andres Gomez Del Real 
11c97d6d2cSSergio Andres Gomez Del Real /* header to be included in non-HVF-specific code */
12a8b991b5SMarkus Armbruster 
13a8b991b5SMarkus Armbruster #ifndef HVF_H
14a8b991b5SMarkus Armbruster #define HVF_H
15c97d6d2cSSergio Andres Gomez Del Real 
16940e43aaSClaudio Fontana #include "qemu/accel.h"
17db1015e9SEduardo Habkost #include "qom/object.h"
18d48ad737SEduardo Habkost 
1913b48fb0SThomas Huth #ifdef NEED_CPU_H
20f4152040SFrancesco Cagnin #include "cpu.h"
2113b48fb0SThomas Huth 
22c97d6d2cSSergio Andres Gomez Del Real #ifdef CONFIG_HVF
23f291cf54SPhilippe Mathieu-Daudé extern bool hvf_allowed;
2492cc3aaaSRoman Bolshakov #define hvf_enabled() (hvf_allowed)
25f291cf54SPhilippe Mathieu-Daudé #else /* !CONFIG_HVF */
26c97d6d2cSSergio Andres Gomez Del Real #define hvf_enabled() 0
27f291cf54SPhilippe Mathieu-Daudé #endif /* !CONFIG_HVF */
28c97d6d2cSSergio Andres Gomez Del Real 
2913b48fb0SThomas Huth #endif /* NEED_CPU_H */
3013b48fb0SThomas Huth 
31c97d6d2cSSergio Andres Gomez Del Real #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
32c97d6d2cSSergio Andres Gomez Del Real 
333932885aSEduardo Habkost typedef struct HVFState HVFState;
348110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
358110fa1dSEduardo Habkost                          TYPE_HVF_ACCEL)
36c97d6d2cSSergio Andres Gomez Del Real 
37f4152040SFrancesco Cagnin #ifdef NEED_CPU_H
38f4152040SFrancesco Cagnin struct hvf_sw_breakpoint {
39fcfe7616SAnton Johansson     vaddr pc;
40fcfe7616SAnton Johansson     vaddr saved_insn;
41f4152040SFrancesco Cagnin     int use_count;
42f4152040SFrancesco Cagnin     QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
43f4152040SFrancesco Cagnin };
44f4152040SFrancesco Cagnin 
45f4152040SFrancesco Cagnin struct hvf_sw_breakpoint *hvf_find_sw_breakpoint(CPUState *cpu,
46fcfe7616SAnton Johansson                                                  vaddr pc);
47f4152040SFrancesco Cagnin int hvf_sw_breakpoints_active(CPUState *cpu);
48f4152040SFrancesco Cagnin 
49f4152040SFrancesco Cagnin int hvf_arch_insert_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
50f4152040SFrancesco Cagnin int hvf_arch_remove_sw_breakpoint(CPUState *cpu, struct hvf_sw_breakpoint *bp);
51*d447a624SAnton Johansson int hvf_arch_insert_hw_breakpoint(vaddr addr, vaddr len, int type);
52*d447a624SAnton Johansson int hvf_arch_remove_hw_breakpoint(vaddr addr, vaddr len, int type);
53f4152040SFrancesco Cagnin void hvf_arch_remove_all_hw_breakpoints(void);
54eb2edc42SFrancesco Cagnin 
55eb2edc42SFrancesco Cagnin /*
56eb2edc42SFrancesco Cagnin  * hvf_update_guest_debug:
57eb2edc42SFrancesco Cagnin  * @cs: CPUState for the CPU to update
58eb2edc42SFrancesco Cagnin  *
59eb2edc42SFrancesco Cagnin  * Update guest to enable or disable debugging. Per-arch specifics will be
60eb2edc42SFrancesco Cagnin  * handled by calling down to hvf_arch_update_guest_debug.
61eb2edc42SFrancesco Cagnin  */
62eb2edc42SFrancesco Cagnin int hvf_update_guest_debug(CPUState *cpu);
63eb2edc42SFrancesco Cagnin void hvf_arch_update_guest_debug(CPUState *cpu);
64eb2edc42SFrancesco Cagnin 
65eb2edc42SFrancesco Cagnin /*
66eb2edc42SFrancesco Cagnin  * Return whether the guest supports debugging.
67eb2edc42SFrancesco Cagnin  */
68eb2edc42SFrancesco Cagnin bool hvf_arch_supports_guest_debug(void);
69f4152040SFrancesco Cagnin #endif /* NEED_CPU_H */
70f4152040SFrancesco Cagnin 
71c97d6d2cSSergio Andres Gomez Del Real #endif
72