[PATCH] target/arm/hvf: Include missing "cpregs.h"

Philippe Mathieu-Daudé posted 1 patch 1 year, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220525161926.34233-1-philmd@fungible.com
Maintainers: Alexander Graf <agraf@csgraf.de>, Peter Maydell <peter.maydell@linaro.org>
target/arm/hvf/hvf.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] target/arm/hvf: Include missing "cpregs.h"
Posted by Philippe Mathieu-Daudé 1 year, 11 months ago
From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Fix when building HVF on macOS Aarch64:

  target/arm/hvf/hvf.c:586:15: error: unknown type name 'ARMCPRegInfo'; did you mean 'ARMCPUInfo'?
          const ARMCPRegInfo *ri;
                ^~~~~~~~~~~~
                ARMCPUInfo
  target/arm/cpu-qom.h:38:3: note: 'ARMCPUInfo' declared here
  } ARMCPUInfo;
    ^
  target/arm/hvf/hvf.c:589:14: error: implicit declaration of function 'get_arm_cp_reginfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
          ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key);
               ^
  target/arm/hvf/hvf.c:589:12: warning: incompatible integer to pointer conversion assigning to 'const ARMCPUInfo *' (aka 'const struct ARMCPUInfo *') from 'int' [-Wint-conversion]
          ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key);
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  target/arm/hvf/hvf.c:591:26: error: no member named 'type' in 'struct ARMCPUInfo'
              assert(!(ri->type & ARM_CP_NO_RAW));
                       ~~  ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert'
      (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0)
                          ^
  target/arm/hvf/hvf.c:591:33: error: use of undeclared identifier 'ARM_CP_NO_RAW'
              assert(!(ri->type & ARM_CP_NO_RAW));
                                  ^
  1 warning and 4 errors generated.

Fixes: cf7c6d1004 ("target/arm: Split out cpregs.h")
Reported-by: Duncan Bayne <duncan@bayne.id.au>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1029
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 target/arm/hvf/hvf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 86710509d2..1fdc5eef92 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -17,6 +17,7 @@
 #include "sysemu/hvf_int.h"
 #include "sysemu/hw_accel.h"
 #include "hvf_arm.h"
+#include "cpregs.h"
 
 #include <mach/mach_time.h>
 
-- 
2.36.1


Re: [PATCH] target/arm/hvf: Include missing "cpregs.h"
Posted by Peter Maydell 1 year, 11 months ago
On Wed, 25 May 2022 at 17:19, Philippe Mathieu-Daudé
<philmd@fungible.com> wrote:
>
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Fix when building HVF on macOS Aarch64:
>



Applied to target-arm.next, thanks.

-- PMM
Re: [PATCH] target/arm/hvf: Include missing "cpregs.h"
Posted by Zenghui Yu via 1 year, 11 months ago
On 2022/5/26 0:19, Philippe Mathieu-Daudé wrote:
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index 86710509d2..1fdc5eef92 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -17,6 +17,7 @@
>  #include "sysemu/hvf_int.h"
>  #include "sysemu/hw_accel.h"
>  #include "hvf_arm.h"
> +#include "cpregs.h"

Compile tested on my MacBook, thanks.

P.S., Looks like we don't need to include "target/arm/cpu.h"
explicitly in hvf.c.

Re: [PATCH] target/arm/hvf: Include missing "cpregs.h"
Posted by Richard Henderson 1 year, 11 months ago
On 5/25/22 09:19, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> Fix when building HVF on macOS Aarch64:
> 
>    target/arm/hvf/hvf.c:586:15: error: unknown type name 'ARMCPRegInfo'; did you mean 'ARMCPUInfo'?
>            const ARMCPRegInfo *ri;
>                  ^~~~~~~~~~~~
>                  ARMCPUInfo
>    target/arm/cpu-qom.h:38:3: note: 'ARMCPUInfo' declared here
>    } ARMCPUInfo;
>      ^
>    target/arm/hvf/hvf.c:589:14: error: implicit declaration of function 'get_arm_cp_reginfo' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>            ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key);
>                 ^
>    target/arm/hvf/hvf.c:589:12: warning: incompatible integer to pointer conversion assigning to 'const ARMCPUInfo *' (aka 'const struct ARMCPUInfo *') from 'int' [-Wint-conversion]
>            ri = get_arm_cp_reginfo(arm_cpu->cp_regs, key);
>               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    target/arm/hvf/hvf.c:591:26: error: no member named 'type' in 'struct ARMCPUInfo'
>                assert(!(ri->type & ARM_CP_NO_RAW));
>                         ~~  ^
>    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/assert.h:99:25: note: expanded from macro 'assert'
>        (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __ASSERT_FILE_NAME, __LINE__, #e) : (void)0)
>                            ^
>    target/arm/hvf/hvf.c:591:33: error: use of undeclared identifier 'ARM_CP_NO_RAW'
>                assert(!(ri->type & ARM_CP_NO_RAW));
>                                    ^
>    1 warning and 4 errors generated.
> 
> Fixes: cf7c6d1004 ("target/arm: Split out cpregs.h")
> Reported-by: Duncan Bayne <duncan@bayne.id.au>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1029
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Oops, sorry about that.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~