[PATCH 0/2] target/arm: Don't use HELPER_H in non-tcg files

Peter Maydell posted 2 patches 1 month, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260216160349.3079657-1-peter.maydell@linaro.org
Maintainers: Peter Maydell <peter.maydell@linaro.org>
target/arm/debug_helper.c                  | 769 ---------------------
target/arm/helper.c                        |   5 +-
target/arm/{debug_helper.c => tcg/debug.c} | 542 +--------------
target/arm/tcg/meson.build                 |   2 +
4 files changed, 4 insertions(+), 1314 deletions(-)
copy target/arm/{debug_helper.c => tcg/debug.c} (53%)
[PATCH 0/2] target/arm: Don't use HELPER_H in non-tcg files
Posted by Peter Maydell 1 month, 3 weeks ago
This patchset gets rid of a couple of uses of HELPER_H to pull in the
TCG helper function prototypes in files that aren't in
target/arm/tcg:

 - debug_helper.c has a lot of TCG only code that can
   happily live in a new tcg/debug.c file instead, and only
   the CONFIG_TCG code was using the helper prototypes
 - helper.c was calling exactly one TCG helper function
   directly, and can be made to call a different function
   instead for the same effect

Pierrick: these might be helpful for you with getting the target/arm
single-binary series to compile when TCG is disabled.  I think it
might be best to avoid having a single helper.h that gives both the
helper_foo and the gen_helper_foo prototypes, though: even if it
doesn't cause compilation failures, only translate*.c need all the
inline definitions of gen_helper_foo. If you take that approach
then it would fix the compile errors without needing these patches.

(I did wonder if we could move target/arm/helper.h into the
tcg/ subdirectory, since it really is TCG-specific, but it looks
like the machinery in include/exec/helper* assumes that the target
has a helper.h in its top level directory.)

thanks
-- PMM

Peter Maydell (2):
  target/arm: Move TCG-specific code out of debug_helper.c
  target/arm: Don't require helper prototypes in helper.c

 target/arm/debug_helper.c                  | 769 ---------------------
 target/arm/helper.c                        |   5 +-
 target/arm/{debug_helper.c => tcg/debug.c} | 542 +--------------
 target/arm/tcg/meson.build                 |   2 +
 4 files changed, 4 insertions(+), 1314 deletions(-)
 copy target/arm/{debug_helper.c => tcg/debug.c} (53%)

-- 
2.43.0
Re: [PATCH 0/2] target/arm: Don't use HELPER_H in non-tcg files
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2/16/26 8:03 AM, Peter Maydell wrote:
> This patchset gets rid of a couple of uses of HELPER_H to pull in the
> TCG helper function prototypes in files that aren't in
> target/arm/tcg:
> 
>   - debug_helper.c has a lot of TCG only code that can
>     happily live in a new tcg/debug.c file instead, and only
>     the CONFIG_TCG code was using the helper prototypes
>   - helper.c was calling exactly one TCG helper function
>     directly, and can be made to call a different function
>     instead for the same effect
> 
> Pierrick: these might be helpful for you with getting the target/arm
> single-binary series to compile when TCG is disabled.  I think it
> might be best to avoid having a single helper.h that gives both the
> helper_foo and the gen_helper_foo prototypes, though: even if it
> doesn't cause compilation failures, only translate*.c need all the
> inline definitions of gen_helper_foo. If you take that approach
> then it would fix the compile errors without needing these patches.
>

As mentioned in original commit, having helper_foo and gen_helper_foo 
was done for convenience. If we want to duplicate that in two different 
sets of headers, feel free to add a comment on concerned thread, I'll be 
happy to do it.

It's just include machinery, so it's not really important to be honest, 
as long as everything compiles fine.

> (I did wonder if we could move target/arm/helper.h into the
> tcg/ subdirectory, since it really is TCG-specific, but it looks
> like the machinery in include/exec/helper* assumes that the target
> has a helper.h in its top level directory.)
> 
> thanks
> -- PMM
> 
> Peter Maydell (2):
>    target/arm: Move TCG-specific code out of debug_helper.c
>    target/arm: Don't require helper prototypes in helper.c
> 
>   target/arm/debug_helper.c                  | 769 ---------------------
>   target/arm/helper.c                        |   5 +-
>   target/arm/{debug_helper.c => tcg/debug.c} | 542 +--------------
>   target/arm/tcg/meson.build                 |   2 +
>   4 files changed, 4 insertions(+), 1314 deletions(-)
>   copy target/arm/{debug_helper.c => tcg/debug.c} (53%)
>
Re: [PATCH 0/2] target/arm: Don't use HELPER_H in non-tcg files
Posted by Richard Henderson 1 month, 3 weeks ago
On 2/17/26 02:03, Peter Maydell wrote:
> This patchset gets rid of a couple of uses of HELPER_H to pull in the
> TCG helper function prototypes in files that aren't in
> target/arm/tcg:
> 
>   - debug_helper.c has a lot of TCG only code that can
>     happily live in a new tcg/debug.c file instead, and only
>     the CONFIG_TCG code was using the helper prototypes
>   - helper.c was calling exactly one TCG helper function
>     directly, and can be made to call a different function
>     instead for the same effect
> 
> Pierrick: these might be helpful for you with getting the target/arm
> single-binary series to compile when TCG is disabled.  I think it
> might be best to avoid having a single helper.h that gives both the
> helper_foo and the gen_helper_foo prototypes, though: even if it
> doesn't cause compilation failures, only translate*.c need all the
> inline definitions of gen_helper_foo. If you take that approach
> then it would fix the compile errors without needing these patches.
> 
> (I did wonder if we could move target/arm/helper.h into the
> tcg/ subdirectory, since it really is TCG-specific, but it looks
> like the machinery in include/exec/helper* assumes that the target
> has a helper.h in its top level directory.)
> 
> thanks
> -- PMM
> 
> Peter Maydell (2):
>    target/arm: Move TCG-specific code out of debug_helper.c
>    target/arm: Don't require helper prototypes in helper.c
> 
>   target/arm/debug_helper.c                  | 769 ---------------------
>   target/arm/helper.c                        |   5 +-
>   target/arm/{debug_helper.c => tcg/debug.c} | 542 +--------------
>   target/arm/tcg/meson.build                 |   2 +
>   4 files changed, 4 insertions(+), 1314 deletions(-)
>   copy target/arm/{debug_helper.c => tcg/debug.c} (53%)
> 

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~