On 7/3/26 17:21, Mohamed Mediouni wrote:
On 7. Mar 2026, at 16:48, Philippe Mathieu-Daudé <[email protected]> wrote:
On 7/3/26 16:31, Mohamed Mediouni wrote:
Signed-off-by: Mohamed Mediouni <[email protected]>
---
accel/hvf/hvf-all.c | 1 +
accel/stubs/hvf-stub.c | 1 +
hw/arm/virt.c | 5 +++++
include/system/hvf.h | 5 +++++
target/arm/hvf/hvf.c | 42 ++++++++++++++++++++++++++++++++++++++++--
5 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/include/system/hvf.h b/include/system/hvf.h
index dc8da85979..0f0632f7ae 100644
--- a/include/system/hvf.h
+++ b/include/system/hvf.h
@@ -28,9 +28,14 @@ extern bool hvf_allowed;
#define hvf_enabled() (hvf_allowed)
extern bool hvf_kernel_irqchip;
#define hvf_irqchip_in_kernel() (hvf_kernel_irqchip)
+extern bool hvf_nested_virt;
+#define hvf_nested_virt_enabled() (hvf_nested_virt)
+#define hvf_nested_virt_enable(enable) hvf_nested_virt = enable
Unsafe macro. Better expose the method and add a stub.
Does this look saner? If so can send a rev with it…
LGTM!
diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index 1c1437b467..66c3b48608 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -26,6 +26,10 @@ bool hvf_allowed;
bool hvf_kernel_irqchip;
bool hvf_nested_virt;
+void hvf_nested_virt_enable(bool nested_virt) {
+ hvf_nested_virt = nested_virt;
+}
+
const char *hvf_return_string(hv_return_t ret)
{
switch (ret) {
diff --git a/accel/stubs/hvf-stub.c b/accel/stubs/hvf-stub.c
index cec1cbb056..dc365c5307 100644
--- a/accel/stubs/hvf-stub.c
+++ b/accel/stubs/hvf-stub.c
@@ -12,3 +12,12 @@
bool hvf_allowed;
bool hvf_kernel_irqchip;
bool hvf_nested_virt;
+
+void hvf_nested_virt_enable(bool nested_virt) {
+ /*
+ * This is called unconditionally from hw/arm/virt.c
+ * because we don't know if HVF is going to be used
+ * as that step of initialisation happens later.
+ * As such, do nothing here instead of marking as unreachable.
+ */
+}
diff --git a/include/system/hvf.h b/include/system/hvf.h
index 0f0632f7ae..a961df8b95 100644
--- a/include/system/hvf.h
+++ b/include/system/hvf.h
@@ -30,14 +30,14 @@ extern bool hvf_kernel_irqchip;
#define hvf_irqchip_in_kernel() (hvf_kernel_irqchip)
extern bool hvf_nested_virt;
#define hvf_nested_virt_enabled() (hvf_nested_virt)
-#define hvf_nested_virt_enable(enable) hvf_nested_virt = enable
#else /* !CONFIG_HVF_IS_POSSIBLE */
#define hvf_enabled() 0
#define hvf_irqchip_in_kernel() 0
#define hvf_nested_virt_enabled() 0
-#define hvf_nested_virt_enable(enable) 0
#endif /* !CONFIG_HVF_IS_POSSIBLE */
+void hvf_nested_virt_enable(bool nested_virt);
+
#define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
typedef struct HVFState HVFState;
#else /* !CONFIG_HVF_IS_POSSIBLE */
#define hvf_enabled() 0
#define hvf_irqchip_in_kernel() 0
+#define hvf_nested_virt_enabled() 0
+#define hvf_nested_virt_enable(enable) 0
#endif /* !CONFIG_HVF_IS_POSSIBLE */