| 1 | /* |
| 2 | * QEMU Hypervisor.framework (HVF) support |
| 3 | * |
| 4 | * Copyright Google Inc., 2017 |
| 5 | * |
| 6 | * This work is licensed under the terms of the GNU GPL, version 2 or later. |
| 7 | * See the COPYING file in the top-level directory. |
| 8 | * |
| 9 | */ |
| 10 | |
| 11 | /* header to be included in non-HVF-specific code */ |
| 12 | |
| 13 | #ifndef HVF_H |
| 14 | #define HVF_H |
| 15 | |
| 16 | #include "qemu/accel.h" |
| 17 | |
| 18 | #ifdef COMPILING_PER_TARGET |
| 19 | # ifdef CONFIG_HVF |
| 20 | # define CONFIG_HVF_IS_POSSIBLE |
| 21 | # endif /* !CONFIG_HVF */ |
| 22 | #else |
| 23 | # define CONFIG_HVF_IS_POSSIBLE |
| 24 | #endif /* COMPILING_PER_TARGET */ |
| 25 | |
| 26 | #ifdef CONFIG_HVF_IS_POSSIBLE |
| 27 | extern bool hvf_allowed; |
| 28 | #define hvf_enabled() (hvf_allowed) |
| 29 | extern bool hvf_kernel_irqchip; |
| 30 | #define hvf_irqchip_in_kernel() (hvf_kernel_irqchip) |
| 31 | extern bool hvf_nested_virt; |
| 32 | #define hvf_nested_virt_enabled() (hvf_nested_virt) |
| 33 | #else /* !CONFIG_HVF_IS_POSSIBLE */ |
| 34 | #define hvf_enabled() 0 |
| 35 | #define hvf_irqchip_in_kernel() 0 |
| 36 | #define hvf_nested_virt_enabled() 0 |
| 37 | #endif /* !CONFIG_HVF_IS_POSSIBLE */ |
| 38 | |
| 39 | void hvf_nested_virt_enable(bool nested_virt); |
| 40 | |
| 41 | #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf") |
| 42 | |
| 43 | typedef struct HVFState HVFState; |
| 44 | DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE, |
| 45 | TYPE_HVF_ACCEL) |
| 46 | |
| 47 | #endif |