On 22/6/25 05:28, Richard Henderson wrote:
On 6/20/25 10:27, Philippe Mathieu-Daudé wrote:
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
  target/arm/hvf/hvf.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 3907ea8791e..a4f823f834d 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -17,6 +17,7 @@
  #include "system/hvf.h"
  #include "system/hvf_int.h"
  #include "system/hw_accel.h"
+#include "system/tcg.h"
  #include "hvf_arm.h"
  #include "cpregs.h"
@@ -1117,6 +1118,8 @@ static void hvf_raise_exception(CPUState *cpu, uint32_t excp,
      env->exception.syndrome = syndrome;
      arm_cpu_do_interrupt(cpu);
+    cpu->interrupt_request &= ~CPU_INTERRUPT_EXITTB;

Why is this needed?

Left-over from previous intents, indeed unneeded.


r~

+    cpu->exception_index = -1;
  }
  static void hvf_psci_cpu_off(ARMCPU *arm_cpu)
@@ -2090,6 +2093,9 @@ int hvf_vcpu_exec(CPUState *cpu)
                  /* SMCCC 1.3 section 5.2 says every unknown SMCCC call returns -1 */
                  env->xregs[0] = -1;
              }
+        } else if (tcg_enabled()) {

As you noted you last night during an epic debugging session, since HVF
doesn't execute the instructions but we get here being trapped, if we
are going to resume under TCG we need to skip the HVC call (otherwise
we keep looping over it) with:

                env->pc += 4;

(Same applies to "Emulate SMC at EL3" patch).

+            /* FIXME check we are called from EL1 (so EL0 -> UDEF) ? */
+            hvf_raise_exception(cpu, EXCP_HVC, syn_aa64_hvc(0), 2);
          } else {
              trace_hvf_unknown_hvc(env->pc, env->xregs[0]);
              hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized(), 1);



Reply via email to