From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Andrea Bolognani <abologna@redhat.com>,
qemu-devel@nongnu.org, qemu-riscv <qemu-riscv@nongnu.org>
Cc: "Laurent Vivier" <laurent@vivier.eu>,
"David Abdurachmanov" <davidlt@rivosinc.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Mark Corbin" <mark@dibsco.co.uk>
Subject: Re: [PATCH] binfmt: Don't consider riscv{32,64} part of the same family
Date: Tue, 3 Dec 2024 10:59:24 +0100 [thread overview]
Message-ID: <cb079b65-e5fc-4667-aa63-9ff347666b6e@linaro.org> (raw)
In-Reply-To: <20241203094702.124748-1-abologna@redhat.com>
Hi Andrea,
On 3/12/24 10:47, Andrea Bolognani wrote:
> Currently the script won't generate a configuration file that
> sets up qemu-user-riscv32 on riscv64, likely under the
> assumption that 64-bit RISC-V machines can natively run 32-bit
I'm confused by the "machines" description used for user emulation.
> RISC-V code.
>
> However this functionality, while theoretically possible, in
> practice is missing from most commonly available RISC-V hardware
> and not enabled at the distro level. So qemu-user-riscv32 really
> is the only option to run riscv32 binaries on riscv64.
We have definitions such ELF_ARCH/ELF_PLATFORM/ELF_MACHINE to
parse ELF header and select the best CPU / flags. Maybe RISC-V
lacks them?
BTW we should expose that for linux-user as target_arch_elf.h,
like bsd-user does, that would reduce all these #ifdef'ry in
linux-user/elfload.c...
>
> Make riscv32 and riscv64 each its own family, so that the
> configuration file we need to make 32-on-64 userspace emulation
> work gets generated.
Does this patch aim for 9.2? Otherwise FYI I'm working on unifying
32/64-bit targets, maybe for 10.0...
>
> Link: https://src.fedoraproject.org/rpms/qemu/pull-request/72
> Thanks: David Abdurachmanov <davidlt@rivosinc.com>
> Thanks: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
> scripts/qemu-binfmt-conf.sh | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
> index 6ef9f118d9..e38b767c24 100755
> --- a/scripts/qemu-binfmt-conf.sh
> +++ b/scripts/qemu-binfmt-conf.sh
> @@ -110,11 +110,11 @@ hppa_family=hppa
>
> riscv32_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'
> riscv32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> -riscv32_family=riscv
> +riscv32_family=riscv32
>
> riscv64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'
> riscv64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> -riscv64_family=riscv
> +riscv64_family=riscv64
>
> xtensa_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00'
> xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
> @@ -168,9 +168,6 @@ qemu_get_family() {
> sparc*)
> echo "sparc"
> ;;
> - riscv*)
> - echo "riscv"
> - ;;
> loongarch*)
> echo "loongarch"
> ;;
next prev parent reply other threads:[~2024-12-03 10:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 9:47 [PATCH] binfmt: Don't consider riscv{32,64} part of the same family Andrea Bolognani
2024-12-03 9:59 ` Philippe Mathieu-Daudé [this message]
2024-12-03 10:12 ` [PATCH] binfmt: Don't consider riscv{32, 64} " Andrea Bolognani
2024-12-03 10:18 ` [PATCH] binfmt: Don't consider riscv{32,64} " Daniel P. Berrangé
2024-12-03 10:35 ` [PATCH] binfmt: Don't consider riscv{32, 64} " Peter Maydell
2024-12-03 13:57 ` [PATCH] binfmt: Don't consider riscv{32,64} " Richard Henderson
2024-12-04 10:17 ` Daniel P. Berrangé
2024-12-05 17:15 ` Laurent Vivier
2024-12-04 10:03 ` Laurent Vivier
2025-01-02 16:02 ` [PATCH] binfmt: Don't consider riscv{32, 64} " Andrea Bolognani
2025-01-06 1:27 ` Alistair Francis
2025-01-06 11:47 ` Peter Maydell
2025-01-06 11:57 ` Daniel P. Berrangé
2025-01-06 12:01 ` Peter Maydell
2025-01-06 17:54 ` Andrea Bolognani
2025-01-07 1:29 ` Alistair Francis
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=cb079b65-e5fc-4667-aa63-9ff347666b6e@linaro.org \
--to=philmd@linaro.org \
--cc=abologna@redhat.com \
--cc=berrange@redhat.com \
--cc=davidlt@rivosinc.com \
--cc=laurent@vivier.eu \
--cc=mark@dibsco.co.uk \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).