[PATCH] target/hexagon: Include missing 'cpu.h' header in 'internal.h'

Philippe Mathieu-Daudé posted 1 patch 1 month, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20251217144211.95032-1-philmd@linaro.org
Maintainers: Brian Cain <brian.cain@oss.qualcomm.com>
target/hexagon/internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] target/hexagon: Include missing 'cpu.h' header in 'internal.h'
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
Both CPUHexagonState and TOTAL_PER_THREAD_REGS are defined
in "cpu.h" which is luckily indirectly included. However when
refactoring unrelated files we get:

  In file included from target/hexagon/helper.h:18,
                   from include/exec/helper-proto.h.inc:56,
                   from include/exec/helper-proto.h:13,
                   from target/hexagon/op_helper.c:22:
  target/hexagon/internal.h: At top level:
  target/hexagon/internal.h:29:25: error: unknown type name ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
     29 | void hexagon_debug_vreg(CPUHexagonState *env, int regnum);
        |                         ^~~~~~~~~~~~~~~
        |                         CPUPluginState
  target/hexagon/internal.h:30:25: error: unknown type name ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
     30 | void hexagon_debug_qreg(CPUHexagonState *env, int regnum);
        |                         ^~~~~~~~~~~~~~~
        |                         CPUPluginState
  target/hexagon/internal.h:31:20: error: unknown type name ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
     31 | void hexagon_debug(CPUHexagonState *env);
        |                    ^~~~~~~~~~~~~~~
        |                    CPUPluginState
  target/hexagon/internal.h:33:44: error: ‘TOTAL_PER_THREAD_REGS’ undeclared here (not in a function)
     33 | extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
        |                                            ^~~~~~~~~~~~~~~~~~~~~

Fix that by including the missing header.

We don't need the "qemu/log.h" since commit 0cb73cb5a02 ("target/hexagon:
Remove HEX_DEBUG/HEX_DEBUG_LOG"): remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/hexagon/internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h
index 32e96f00d97..5fc837ae229 100644
--- a/target/hexagon/internal.h
+++ b/target/hexagon/internal.h
@@ -18,7 +18,7 @@
 #ifndef HEXAGON_INTERNAL_H
 #define HEXAGON_INTERNAL_H
 
-#include "qemu/log.h"
+#include "target/hexagon/cpu.h"
 
 int hexagon_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
 int hexagon_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
-- 
2.52.0


Re: [PATCH] target/hexagon: Include missing 'cpu.h' header in 'internal.h'
Posted by Brian Cain 1 month, 3 weeks ago
On Wed, Dec 17, 2025 at 8:42 AM Philippe Mathieu-Daudé <philmd@linaro.org>
wrote:

> Both CPUHexagonState and TOTAL_PER_THREAD_REGS are defined
> in "cpu.h" which is luckily indirectly included. However when
> refactoring unrelated files we get:
>
>   In file included from target/hexagon/helper.h:18,
>                    from include/exec/helper-proto.h.inc:56,
>                    from include/exec/helper-proto.h:13,
>                    from target/hexagon/op_helper.c:22:
>   target/hexagon/internal.h: At top level:
>   target/hexagon/internal.h:29:25: error: unknown type name
> ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
>      29 | void hexagon_debug_vreg(CPUHexagonState *env, int regnum);
>         |                         ^~~~~~~~~~~~~~~
>         |                         CPUPluginState
>   target/hexagon/internal.h:30:25: error: unknown type name
> ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
>      30 | void hexagon_debug_qreg(CPUHexagonState *env, int regnum);
>         |                         ^~~~~~~~~~~~~~~
>         |                         CPUPluginState
>   target/hexagon/internal.h:31:20: error: unknown type name
> ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
>      31 | void hexagon_debug(CPUHexagonState *env);
>         |                    ^~~~~~~~~~~~~~~
>         |                    CPUPluginState
>   target/hexagon/internal.h:33:44: error: ‘TOTAL_PER_THREAD_REGS’
> undeclared here (not in a function)
>      33 | extern const char * const
> hexagon_regnames[TOTAL_PER_THREAD_REGS];
>         |                                            ^~~~~~~~~~~~~~~~~~~~~
>
> Fix that by including the missing header.
>
> We don't need the "qemu/log.h" since commit 0cb73cb5a02 ("target/hexagon:
> Remove HEX_DEBUG/HEX_DEBUG_LOG"): remove it.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  target/hexagon/internal.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>



> diff --git a/target/hexagon/internal.h b/target/hexagon/internal.h
> index 32e96f00d97..5fc837ae229 100644
> --- a/target/hexagon/internal.h
> +++ b/target/hexagon/internal.h
> @@ -18,7 +18,7 @@
>  #ifndef HEXAGON_INTERNAL_H
>  #define HEXAGON_INTERNAL_H
>
> -#include "qemu/log.h"
> +#include "target/hexagon/cpu.h"
>
>  int hexagon_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
>  int hexagon_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
> --
> 2.52.0
>
>
Re: [PATCH] target/hexagon: Include missing 'cpu.h' header in 'internal.h'
Posted by Matheus Tavares Bernardino 1 month, 3 weeks ago
On Wed, 17 Dec 2025 15:42:11 +0100 =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org> wrote:
>
> Both CPUHexagonState and TOTAL_PER_THREAD_REGS are defined
> in "cpu.h" which is luckily indirectly included. However when
> refactoring unrelated files we get:
> 
>   In file included from target/hexagon/helper.h:18,
>                    from include/exec/helper-proto.h.inc:56,
>                    from include/exec/helper-proto.h:13,
>                    from target/hexagon/op_helper.c:22:
>   target/hexagon/internal.h: At top level:
>   target/hexagon/internal.h:29:25: error: unknown type name ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
>      29 | void hexagon_debug_vreg(CPUHexagonState *env, int regnum);
>         |                         ^~~~~~~~~~~~~~~
>         |                         CPUPluginState
>   target/hexagon/internal.h:30:25: error: unknown type name ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
>      30 | void hexagon_debug_qreg(CPUHexagonState *env, int regnum);
>         |                         ^~~~~~~~~~~~~~~
>         |                         CPUPluginState
>   target/hexagon/internal.h:31:20: error: unknown type name ‘CPUHexagonState’; did you mean ‘CPUPluginState’?
>      31 | void hexagon_debug(CPUHexagonState *env);
>         |                    ^~~~~~~~~~~~~~~
>         |                    CPUPluginState
>   target/hexagon/internal.h:33:44: error: ‘TOTAL_PER_THREAD_REGS’ undeclared here (not in a function)
>      33 | extern const char * const hexagon_regnames[TOTAL_PER_THREAD_REGS];
>         |                                            ^~~~~~~~~~~~~~~~~~~~~
> 
> Fix that by including the missing header.
> 
> We don't need the "qemu/log.h" since commit 0cb73cb5a02 ("target/hexagon:
> Remove HEX_DEBUG/HEX_DEBUG_LOG"): remove it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Acked-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>