diff mbox series

[RFC,RESEND,36/42] target/arm: Have ERET switch to hw accel for EL0/EL1

Message ID 20250620172751.94231-37-philmd@linaro.org
State New
Headers show
Series accel/split/arm: Run EL2 using TCG and EL1/EL0 in hardware with HVF | expand

Commit Message

Philippe Mathieu-Daudé June 20, 2025, 5:27 p.m. UTC
When hardware accelerator available, use it to
directly run EL0 and EL1.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/tcg/helper-a64.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Richard Henderson June 22, 2025, 3:27 a.m. UTC | #1
On 6/20/25 10:27, Philippe Mathieu-Daudé wrote:
> When hardware accelerator available, use it to
> directly run EL0 and EL1.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/arm/tcg/helper-a64.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
> index 4f618ae390e..5962cff4e7a 100644
> --- a/target/arm/tcg/helper-a64.c
> +++ b/target/arm/tcg/helper-a64.c
> @@ -29,6 +29,7 @@
>   #include "internals.h"
>   #include "qemu/crc32c.h"
>   #include "exec/cpu-common.h"
> +#include "system/hw_accel.h"
>   #include "accel/tcg/cpu-ldst.h"
>   #include "accel/tcg/helper-retaddr.h"
>   #include "accel/tcg/probe.h"
> @@ -761,6 +762,14 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
>       arm_call_el_change_hook(cpu);
>       bql_unlock();
>   
> +    if (new_el < 2 && hwaccel_enabled()) {

Because you're raising EXCP_HWACCEL, I really think this should be

   if (split_enabled() && arm_cpu_can_accelerate(cs))


r~

> +        CPUState *cs = env_cpu(env);
> +
> +        cs->exception_index = EXCP_HWACCEL;
> +        cs->exit_request = 1;
> +        cpu_loop_exit(cs);
> +        /* never returns */
> +    }
>       return;
>   
>   illegal_return:
diff mbox series

Patch

diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index 4f618ae390e..5962cff4e7a 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -29,6 +29,7 @@ 
 #include "internals.h"
 #include "qemu/crc32c.h"
 #include "exec/cpu-common.h"
+#include "system/hw_accel.h"
 #include "accel/tcg/cpu-ldst.h"
 #include "accel/tcg/helper-retaddr.h"
 #include "accel/tcg/probe.h"
@@ -761,6 +762,14 @@  void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc)
     arm_call_el_change_hook(cpu);
     bql_unlock();
 
+    if (new_el < 2 && hwaccel_enabled()) {
+        CPUState *cs = env_cpu(env);
+
+        cs->exception_index = EXCP_HWACCEL;
+        cs->exit_request = 1;
+        cpu_loop_exit(cs);
+        /* never returns */
+    }
     return;
 
 illegal_return: