On Tue, Dec 03, 2024 at 10:59:24AM +0100, Philippe Mathieu-Daudé wrote: > 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.
I meant it in the sense of physical machines. I can use the word "hosts" instead if you think that's less ambiguous. > > 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... All of this is flying way over my head, sorry :) qemu-user-riscv32 already works great on riscv64 as far as I can tell. I tested it by chrooting into a riscv32 Gentoo rootfs from a riscv64 Fedora installation. We just need the configuration file to be generated. > > 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... Having this in 9.2 would be great. -- Andrea Bolognani / Red Hat / Virtualization