[PATCH 2/2] target/arm: Don't require helper prototypes in helper.c

Peter Maydell posted 2 patches 1 month, 3 weeks ago
Maintainers: Peter Maydell <peter.maydell@linaro.org>
[PATCH 2/2] target/arm: Don't require helper prototypes in helper.c
Posted by Peter Maydell 1 month, 3 weeks ago
In arm_cpu_do_interrupt_aarch64() we call the TCG helper function
helper_rebuild_hflags_a64(), which requires helper.c to include the
TCG helper function prototypes even when this file is being compiled
with TCG disabled.

We don't actually need to do this -- because we have already written
the new EL into pstate and updated env->aarch64, we can call
aarch64_rebuild_hflags() to achieve the same effect. This is the
function we use everywhere else in this file to update hflags.

Switch to aarch64_rebuild_hflags() and drop the include of the
TCG helper headers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 8c5769477c..033baf7e71 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -36,9 +36,6 @@
 #include "target/arm/gtimer.h"
 #include "qemu/plugin.h"
 
-#define HELPER_H "tcg/helper.h"
-#include "exec/helper-proto.h.inc"
-
 static void switch_mode(CPUARMState *env, int mode);
 
 int compare_u64(const void *a, const void *b)
@@ -9473,7 +9470,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
     aarch64_restore_sp(env, new_el);
 
     if (tcg_enabled()) {
-        helper_rebuild_hflags_a64(env, new_el);
+        arm_rebuild_hflags(env);
     }
 
     env->pc = addr;
-- 
2.43.0
Re: [PATCH 2/2] target/arm: Don't require helper prototypes in helper.c
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2/16/26 8:03 AM, Peter Maydell wrote:
> In arm_cpu_do_interrupt_aarch64() we call the TCG helper function
> helper_rebuild_hflags_a64(), which requires helper.c to include the
> TCG helper function prototypes even when this file is being compiled
> with TCG disabled.
> 
> We don't actually need to do this -- because we have already written
> the new EL into pstate and updated env->aarch64, we can call
> aarch64_rebuild_hflags() to achieve the same effect. This is the
> function we use everywhere else in this file to update hflags.
> 
> Switch to aarch64_rebuild_hflags() and drop the include of the
> TCG helper headers.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   target/arm/helper.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Re: [PATCH 2/2] target/arm: Don't require helper prototypes in helper.c
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
On 16/2/26 17:03, Peter Maydell wrote:
> In arm_cpu_do_interrupt_aarch64() we call the TCG helper function
> helper_rebuild_hflags_a64(), which requires helper.c to include the
> TCG helper function prototypes even when this file is being compiled
> with TCG disabled.
> 
> We don't actually need to do this -- because we have already written
> the new EL into pstate and updated env->aarch64, we can call
> aarch64_rebuild_hflags() to achieve the same effect. This is the
> function we use everywhere else in this file to update hflags.
> 
> Switch to aarch64_rebuild_hflags() and drop the include of the
> TCG helper headers.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   target/arm/helper.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>