qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Brian Cain <brian.cain@oss.qualcomm.com>,
	qemu-devel@nongnu.org, ale@rev.ng, anjo@rev.ng
Cc: richard.henderson@linaro.org, quic_mathbern@quicinc.com,
	quic_mliebel@quicinc.com, ltaylorsimpson@gmail.com,
	alex.bennee@linaro.org, quic_mburton@quicinc.com,
	sidneym@quicinc.com, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 6/8] target/hexagon: add build config for softmmu
Date: Tue, 4 Mar 2025 16:25:55 +0100	[thread overview]
Message-ID: <d95ebf5d-c1f6-42c5-8aeb-65764fa87125@linaro.org> (raw)
In-Reply-To: <20250301172045.1295412-7-brian.cain@oss.qualcomm.com>

Hi Brian,

On 1/3/25 18:20, Brian Cain wrote:
> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
> ---
>   MAINTAINERS                                 | 1 +
>   configs/devices/hexagon-softmmu/default.mak | 7 +++++++
>   configs/targets/hexagon-softmmu.mak         | 6 ++++++
>   target/Kconfig                              | 1 +
>   target/hexagon/Kconfig                      | 2 ++
>   target/hexagon/meson.build                  | 9 +++++++++
>   6 files changed, 26 insertions(+)
>   create mode 100644 configs/devices/hexagon-softmmu/default.mak
>   create mode 100644 configs/targets/hexagon-softmmu.mak
>   create mode 100644 target/hexagon/Kconfig
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0fb5711184..deeb7878c8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -241,6 +241,7 @@ F: linux-user/hexagon/
>   F: tests/tcg/hexagon/
>   F: disas/hexagon.c
>   F: configs/targets/hexagon-linux-user/default.mak
> +F: configs/devices/hexagon-softmmu/default.mak
>   F: docker/dockerfiles/debian-hexagon-cross.docker
>   F: gdb-xml/hexagon*.xml
>   F: docs/system/target-hexagon.rst
> diff --git a/configs/devices/hexagon-softmmu/default.mak b/configs/devices/hexagon-softmmu/default.mak
> new file mode 100644
> index 0000000000..08e709aea7
> --- /dev/null
> +++ b/configs/devices/hexagon-softmmu/default.mak
> @@ -0,0 +1,7 @@
> +# Default configuration for hexagon-softmmu
> +
> +# Uncomment the following lines to disable these optional devices:
> +
> +# Boards are selected by default, uncomment to keep out of the build.
> +# CONFIG_HEX_DSP=y
> +# CONFIG_L2VIC=y
> diff --git a/configs/targets/hexagon-softmmu.mak b/configs/targets/hexagon-softmmu.mak
> new file mode 100644
> index 0000000000..8c208bf468
> --- /dev/null
> +++ b/configs/targets/hexagon-softmmu.mak
> @@ -0,0 +1,6 @@
> +# Default configuration for hexagon-softmmu
> +
> +TARGET_ARCH=hexagon
> +TARGET_SUPPORTS_MTTCG=y
> +TARGET_XML_FILES=gdb-xml/hexagon-core.xml gdb-xml/hexagon-hvx.xml gdb-xml/hexagon-sys.xml
> +TARGET_LONG_BITS=32
> diff --git a/target/Kconfig b/target/Kconfig
> index d0c7b59d9c..37781146b9 100644
> --- a/target/Kconfig
> +++ b/target/Kconfig
> @@ -16,6 +16,7 @@ source sh4/Kconfig
>   source sparc/Kconfig
>   source tricore/Kconfig
>   source xtensa/Kconfig
> +source hexagon/Kconfig
>   
>   config TARGET_BIG_ENDIAN
>       bool
> diff --git a/target/hexagon/Kconfig b/target/hexagon/Kconfig
> new file mode 100644
> index 0000000000..7e556f3506
> --- /dev/null
> +++ b/target/hexagon/Kconfig
> @@ -0,0 +1,2 @@
> +config HEXAGON
> +    bool
> diff --git a/target/hexagon/meson.build b/target/hexagon/meson.build
> index aa729a3683..d2b56b9e65 100644
> --- a/target/hexagon/meson.build
> +++ b/target/hexagon/meson.build
> @@ -245,6 +245,7 @@ decodetree_trans_funcs_generated = custom_target(
>       command: [python, files('gen_trans_funcs.py'), semantics_generated, '@OUTPUT@'],
>   )
>   hexagon_ss.add(decodetree_trans_funcs_generated)
> +hexagon_softmmu_ss = ss.source_set()
>   
>   hexagon_ss.add(files(
>       'cpu.c',
> @@ -264,6 +265,13 @@ hexagon_ss.add(files(
>       'mmvec/system_ext_mmvec.c',
>   ))
>   
> +hexagon_softmmu_ss.add(files(
> +    'hex_mmu.c',
> +    'hex_interrupts.c',
> +    'hexswi.c',
> +    'machine.c',
> +))
> +
>   #
>   # Step 4.5
>   # We use flex/bison based idef-parser to generate TCG code for a lot

Expanding diff:

     bison = generator(
         find_program('bison', version: '>=3.0'),
         output: ['@BASENAME@.tab.c', '@BASENAME@.tab.h'],
         arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']
     )

On default macOS I get:

   Program bison found: NO found 2.3 but need: '>=3.0' (/usr/bin/bison)

Fixed by installing via brew and:

   export PATH=/opt/homebrew/opt/bison/bin:$PATH

> @@ -401,3 +409,4 @@ analyze_funcs_generated = custom_target(
>   hexagon_ss.add(analyze_funcs_generated)
>   
>   target_arch += {'hexagon': hexagon_ss}
> +target_system_arch += {'hexagon': hexagon_softmmu_ss}

But then I get:
[1/1980] Generating target/hexagon/idef_parser_input.preprocessed.h.inc 
with a custom command
FAILED: target/hexagon/idef_parser_input.preprocessed.h.inc
target/hexagon/idef-parser/prepare 
target/hexagon/idef_parser_input.h.inc -Itarget/hexagon/idef-parser -o 
target/hexagon/idef_parser_input.preprocessed.h.inc
target/hexagon/idef_parser_input.h.inc:1:10: fatal error: 'macros.h.inc' 
file not found
     1 | #include "macros.h.inc"
       |          ^~~~~~~~~~~~~~
# 1 "target/hexagon/idef_parser_input.h.inc"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 423 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "target/hexagon/idef_parser_input.h.inc" 2


J4_hintjumpr(in RsV) {
     {fHINTJR(RsV);}
}

J2_loop0r(in RsV, riV) {
     { fIMMEXT(riV); fPCALIGN(riV); fWRITE_LOOP_REGS0( fREAD_PC()+riV, 
RsV); fSET_LPCFG(0); }
}
[...]

$ find . -name macros.h.inc
./target/hexagon/idef-parser/macros.h.inc

$ cat target/hexagon/idef-parser/prepare
#!/usr/bin/env bash
...
# Run the preprocessor and drop comments
cpp "$@"

$ which cpp
/usr/bin/cpp

$ cpp --version
Apple clang version 16.0.0 (clang-1600.0.26.6)

Since this works on Linux for user emulation, I suppose this is a
macOS vs Linux issue with default cpp command line arguments...


  reply	other threads:[~2025-03-04 15:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-01 17:20 [PATCH 0/8] hexagon system emu, part 3/3 Brian Cain
2025-03-01 17:20 ` [PATCH 1/8] hw/intc: Add l2vic interrupt controller Brian Cain
2025-03-03 12:26   ` Philippe Mathieu-Daudé
2025-04-02  1:07     ` Brian Cain
2025-04-03 17:41     ` Brian Cain
2025-03-24 19:40   ` ltaylorsimpson
2025-03-24 20:47     ` Brian Cain
2025-09-02  2:46     ` Brian Cain
2025-03-01 17:20 ` [PATCH 2/8] hw/hexagon: Add machine configs for sysemu Brian Cain
2025-03-04  6:27   ` Markus Armbruster
2025-03-04 13:12     ` Brian Cain
2025-03-24 19:48   ` ltaylorsimpson
2025-03-01 17:20 ` [PATCH 3/8] hw/hexagon: Add v68, sa8775-cdsp0 defs Brian Cain
2025-03-24 19:50   ` ltaylorsimpson
2025-03-01 17:20 ` [PATCH 4/8] hw/hexagon: Add support for cfgbase Brian Cain
2025-03-24 20:01   ` ltaylorsimpson
2025-03-01 17:20 ` [PATCH 5/8] hw/hexagon: Modify "Standalone" symbols Brian Cain
2025-03-24 20:04   ` ltaylorsimpson
2025-03-01 17:20 ` [PATCH 6/8] target/hexagon: add build config for softmmu Brian Cain
2025-03-04 15:25   ` Philippe Mathieu-Daudé [this message]
2025-03-04 15:59     ` Anton Johansson via
2025-03-24 20:12   ` ltaylorsimpson
2025-03-01 17:20 ` [PATCH 7/8] hw/hexagon: Define hexagon "virt" machine Brian Cain
2025-03-04 15:38   ` Philippe Mathieu-Daudé
2025-03-01 17:20 ` [PATCH 8/8] tests/functional: Add a hexagon minivm test Brian Cain
2025-03-04 15:46   ` Philippe Mathieu-Daudé
2025-03-04 16:07     ` Brian Cain
2025-03-04 16:15     ` Brian Cain
2025-03-04 20:34       ` Brian Cain
2025-03-05  8:05     ` Thomas Huth
2025-03-05 14:35       ` Brian Cain
2025-09-02  2:52     ` Brian Cain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d95ebf5d-c1f6-42c5-8aeb-65764fa87125@linaro.org \
    --to=philmd@linaro.org \
    --cc=ale@rev.ng \
    --cc=alex.bennee@linaro.org \
    --cc=anjo@rev.ng \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=ltaylorsimpson@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_mathbern@quicinc.com \
    --cc=quic_mburton@quicinc.com \
    --cc=quic_mliebel@quicinc.com \
    --cc=richard.henderson@linaro.org \
    --cc=sidneym@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).