qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 000/281] arm_load_dtb cleanups
@ 2025-09-04  8:06 Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 001/281] target/i386: Add support for save/load of exception error code Alex Bennée
                   ` (33 more replies)
  0 siblings, 34 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

This was prompted by a slop PR that came in via github and while
looking at it I thought what arm_load_dtb really needed was to be
modernised to:

  - use autofree to avoid goto fail
  - use error_setg to report errors
  - use error_fatal rather than open coding exit()

For v2

  - applied review tags
  - tweak to handle fdt != ms->fdt
  - put GStrv in a block
  - re-base fixes

Alex.

Alex Bennée (4):
  hw/arm: use g_autofree for filename in arm_load_dtb
  hw/arm: use g_autofree for fdt in arm_load_dtb
  hw/arm: use g_auto(GStrv) for node_path in arm_load_dtb
  hw/arm: expose Error * to arm_load_dtb

Ani Sinha (1):
  kvm/kvm-all: make kvm_park/unpark_vcpu local to kvm-all.c

Bibo Mao (14):
  target/loongarch: Move some function definition to kvm directory
  target/loongarch: Define function loongarch_cpu_post_init as static
  target/loongarch: Set page size in TLB entry with STLB
  target/loongarch: Add header file cpu-mmu.h
  target/loongarch: Add enum type TLBRet definition
  target/loongarch: Use vaddr in get_physical_address()
  target/loongarch: Use MMUAccessType in loongarch_map_tlb_entry()
  target/loongarch: Add common function loongarch_check_pte()
  target/loongarch: Use loongarch_check_pte in
    loongarch_page_table_walker
  target/loongarch: Use MMUConext in loongarch_map_tlb_entry()
  target/loongarch: Use MMUContext in loongarch_get_addr_from_tlb
  target/loongarch: Use MMUContext in loongarch_map_address()
  target/loongarch: Use MMUContext in get_physical_address()
  target/loongarch: Use correct address when flush tlb

Cornelia Huck (1):
  hw: add compat machines for 10.2

Denis V. Lunev (1):
  qga: fix potentially not initialized nr_volumes in qga_vss_fsfreeze()

Gustavo Romero (5):
  tests/functional: Fix reverse_debugging asset precaching
  tests/functional: Mark main in QemuBaseTest class as a static method
  target/arm: Clean up of register field definitions
  target/arm: Implement FEAT_SCTLR2 and enable with -cpu max
  target/arm: Implement FEAT_TCR2 and enable with -cpu max

Igor Mammedov (8):
  add cpu_test_interrupt()/cpu_set_interrupt() helpers and use them tree
    wide
  memory: reintroduce BQL-free fine-grained PIO/MMIO
  acpi: mark PMTIMER as unlocked
  hpet: switch to fine-grained device locking
  hpet: move out main counter read into a separate block
  hpet: make main counter read lock-less
  kvm: i386: irqchip: take BQL only if there is an interrupt
  tcg: move interrupt caching and single step masking closer to user

Joel Stanley (1):
  linux-user: Add strace for rseq

Kostiantyn Kostiuk (6):
  qga-vss: Replace asserts with condition and report error
  qga-vss: Remove unused dependencies
  qga: Fix channel initialization check in run_agent_once
  qga: ignore channel_init() fail if 'retry_path' is set
  qga-vss: Write hex value of error in log
  qga/installer: Remove QGA VSS if QGA installation failed

Manos Pitsidianakis (4):
  scripts/minikconf.py: fix invalid attribute access
  scripts/minikconf.py: s/Error/KconfigParserError
  rust: declare self as qemu_api for proc-macros
  hw/arm: add static NVDIMMs in device tree

Marc-André Lureau (1):
  rust/qemu-api-macros: make derive(Object) friendly when missing parent

Mark Cave-Ayland (19):
  hw/i386/pc_piix.c: restrict isapc machine to 32-bit CPUs
  hw/i386/pc_piix.c: restrict isapc machine to 3.5G memory
  hw/i386/pc_piix.c: remove include for loader.h
  hw/i386/pc_piix.c: inline pc_xen_hvm_init_pci() into pc_xen_hvm_init()
  hw/i386/pc_piix.c: duplicate pc_init1() into pc_isa_init()
  hw/i386/pc_piix.c: remove pcmc->pci_enabled dependent initialisation
    from pc_init_isa()
  hw/i386/pc_piix.c: remove igvm initialisation from pc_init_isa()
  hw/i386/pc_piix.c: remove SMI and piix4_pm initialisation from
    pc_init_isa()
  hw/i386/pc_piix.c: remove SGX initialisation from pc_init_isa()
  hw/i386/pc_piix.c: remove nvdimm initialisation from pc_init_isa()
  hw/i386/pc_piix.c: simplify RAM size logic in pc_init_isa()
  hw/i386/pc_piix.c: hardcode hole64_size to 0 in pc_init_isa()
  hw/i386/pc_piix.c: remove pc_system_flash_cleanup_unused() from
    pc_init_isa()
  hw/i386/pc_piix.c: always initialise ISA IDE drives in pc_init_isa()
  hw/i386/pc_piix.c: assume pcmc->pci_enabled is always true in
    pc_init1()
  hw/i386: move isapc machine to separate isapc.c file
  hw/i386/pc_piix.c: remove unused headers after isapc machine split
  hw/i386/pc_piix.c: replace rom_memory with pci_memory
  hw/i386/isapc.c: replace rom_memory with system_memory

Markus Armbruster (8):
  ui/keymaps: Avoid trace crash and improve error messages
  i386/kvm/vmsr_energy: Plug memory leak on failure to connect socket
  vfio scsi ui: Error-check qio_channel_socket_connect_sync() the same
    way
  qtest/qom-test: Shallow testing of qom-list / qom-get
  qtest/qom-test: Traverse entire QOM tree
  qtest/qom-test: Don't bother to execute QMP command quit
  MAINTAINERS: Cover tests/qtest/qom-test.c
  Revert "tests/qtest: use qos_printf instead of g_test_message"

Paolo Bonzini (7):
  python: mkvenv: fix messages printed by mkvenv
  MAINTAINERS: add a few more files to "Top Level Makefile and
    configure"
  rust: disable borrow_as_ptr warning
  rust: qemu-api-macros: support matching more than one error
  subprojects: update proc-macro2 and syn
  rust: move dependencies to rust/Cargo.toml
  user-exec: ensure interrupt_request is not used

Peter Maydell (14):
  tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't
    initialize
  linux-user: Drop deprecated -p option
  target/arm: Implement CTZ, CNT, ABS
  scripts/kernel-doc: Avoid new Perl precedence warning
  docs/sphinx/kerneldoc.py: Handle new LINENO syntax
  tests/qtest/libqtest.h: Remove stray space from doc comment
  scripts: Import Python kerneldoc from Linux kernel
  scripts/kernel-doc: strip QEMU_ from function definitions
  scripts/kernel-doc: tweak for QEMU coding standards
  scripts/kerneldoc: Switch to the Python kernel-doc script
  scripts/kernel-doc: Delete the old Perl kernel-doc script
  MAINTAINERS: Put kernel-doc under the "docs build machinery" section
  target/arm: Correct condition of aa64_atomics feature function
  hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects

Pierrick Bouvier (2):
  tests/functional/test_aarch64_device_passthrough: update image
  tests/functional/test_aarch64_rme: update image

Richard Henderson (146):
  semihosting: Retrieve stack top from image_info
  semihosting: Initialize heap once per process
  linux-user: Create target/elfload.c files
  linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h
  linux-user: Move get_elf_cpu_model to target/elfload.c
  linux-user: Move get_elf_hwcap to {i386,x86_64}/elfload.c
  linux-user: Move hwcap functions to {arm,aarch64}/elfload.c
  linux-user: Move get_elf_hwcap to sparc/elfload.c
  linux-user: Move hwcap functions to ppc/elfload.c
  linux-user: Move get_elf_hwcap to loongarch64/elfload.c
  linux-user: Move get_elf_hwcap to mips/elfload.c
  linux-user: Move get_elf_hwcap to sh4/elfload.c
  linux-user: Move hwcap functions to s390x/elfload.c
  linux-user: Move get_elf_hwcap to riscv/elfload.c
  linux-user: Remove ELF_HWCAP
  linux-user: Remove ELF_HWCAP2
  linux-user: Move get_elf_platform to {i386,x86_64}/elfload.c
  linux-user/i386: Return const data from get_elf_platform
  linux-user: Move get_elf_platform to arm/elfload.c
  linux-user/loongarch64: Create get_elf_platform
  linux-user/hppa: Create get_elf_platform
  linux-user: Remove ELF_PLATFORM
  linux-user: Move get_elf_base_platform to mips/elfload.c
  linux-user: Move target_cpu_copy_regs decl to qemu.h
  linux-user: Create do_init_main_thread
  linux-user/i386: Create init_main_thread
  linux-user/arm: Create init_main_thread
  linux-user/arm: Remove a.out startup remenents
  linux-user/aarch64: Create init_main_thread
  linux-user/sparc: Create init_main_thread
  linux-user/ppc: Create init_main_thread
  linux-user/loongarch64: Create init_main_thread
  linux-user/mips: Create init_main_thread
  linux-user/microblaze: Create init_main_thread
  linux-user/openrisc: Create init_main_thread
  linux-user/sh4: Create init_main_thread
  linux-user/m68k: Create init_main_thread
  linux-user/alpha: Create init_main_thread
  linux-user/s390x: Create init_main_thread
  linux-user/riscv: Create init_main_thread
  linux-user/hppa: Create init_main_thread
  linux-user/xtensa: Create init_main_thread
  linux-user/hexagon: Create init_main_thread
  linux-user: Remove do_init_main_thread
  hw/core: Dump cpu_reset in the reset.exit phase
  hw/core: Use qemu_log_trylock/unlock in cpu_common_reset_exit
  linux-user: Tidy print_socket_protocol
  linux-user/x86_64: Convert target_elf_gregset_t to a struct
  linux-user/i386: Convert target_elf_gregset_t to a struct
  linux-user/arm: Convert target_elf_gregset_t to a struct
  linux-user/aarch64: Convert target_elf_gregset_t to a struct
  linux-user/ppc: Convert target_elf_gregset_t to a struct
  linux-user/loongarch64: Convert target_elf_gregset_t to a struct
  linux-user/mips: Convert target_elf_gregset_t to a struct
  linux-user/microblaze: Convert target_elf_gregset_t to a struct
  linux-user/openrisc: Convert target_elf_gregset_t to a struct
  linux-user/sh4: Convert target_elf_gregset_t to a struct
  linux-user/m68k: Convert target_elf_gregset_t to a struct
  linux-user/s390x: Convert target_elf_gregset_t to a struct
  linux-user/xtensa: Convert target_elf_gregset_t to a struct
  linux-user: Update comment for target_elf_gregset_t
  linux-user: Declare elf_core_copy_regs in loader.h
  linux-user: Rename USE_ELF_CORE_DUMP to HAVE_ELF_CORE_DUMP
  linux-user: Move elf_core_copy_regs to {i386,x86_64}/elfload.c
  linux-user: Move elf_core_copy_regs to arm/elfload.c
  linux-user: Move elf_core_copy_regs to aarch64/elfload.c
  linux-user: Move elf_core_copy_regs to ppc/elfload.c
  linux-user: Move elf_core_copy_regs to loongarch64/elfload.c
  linux-user: Move elf_core_copy_regs to mips/elfload.c
  linux-user: Move elf_core_copy_regs to microblaze/elfload.c
  linux-user: Move elf_core_copy_regs to openrisc/elfload.c
  linux-user: Move elf_core_copy_regs to sh4/elfload.c
  linux-user: Move elf_core_copy_regs to m68k/elfload.c
  linux-user: Move elf_core_copy_regs to s390x/elfload.c
  linux-user: Move elf_core_copy_regs to xtensa/elfload.c
  linux-user: Remove target_elf_greg_t, tswapreg from elfload.c
  linux-user/i386: Create target_ptrace.h
  linux-user/i386: Expand target_elf_gregset_t
  linux-user/x86_64: Create target_ptrace.h
  linux-user/x86_64: Expand target_elf_gregset_t
  linux-user/x86_64: Fix dump of fs_base, gs_base
  linux-user/aarch64: Create target_ptrace.h
  linux-user/aarch64: Expand target_elf_gregset_t
  linux-user/arm: Create target_ptrace.h
  linux-user/arm: Expand target_elf_gregset_t
  linux-user/loongarch64: Create target_ptrace.h
  linux-user/loongarch64: Expand target_elf_gregset_t
  linux-user/m68k: Expand target_elf_gregset_t
  linux-user/microblaze: Create target_ptrace.h
  linux-user/microblaze: Fold target_pt_regs.r* to an array
  linux-user/microblaze: Expand target_elf_gregset_t
  linux-user/mips: Create target_ptrace.h
  linux-user/mips: Use target_ulong for target_elf_greg_t
  linux-user/openrisc: Create target_ptrace.h
  linux-user/openrisc: Expand target_elf_gregset_t
  linux-user/ppc: Create target_ptrace.h
  linux-user/ppc: Expand target_elf_gregset_t
  linux-user/s390x: Create target_ptrace.h
  linux-user/s390x: Expand target_elf_gregset_t
  linux-user/sh4: Create target_ptrace.h
  linux-user/sh4: Expand target_elf_gregset_t
  linux-user/xtensa: Create target_ptrace.h
  linux-user/xtensa: Expand target_elf_gregset_t
  linux-user: Move init_guest_commpage to x86_64/elfload.c
  linux-user: Move init_guest_commpage to arm/elfload.c
  linux-user: Move init_guest_commpage to hppa/elfload.c
  linux-user: Replace init_guest_commpage macro with function
  linux-user: Move get_vdso_image_info to arm/elfload.c
  linux-user: Remove ELF_EXEC_PAGESIZE
  linux-user: Remove redundant ELF_DATA definitons
  linux-user: Move elf parameters to {i386,x86_64}/target_elf.h
  linux-user: Move elf parameters to {arm,aarch64}/target_elf.h
  linux-user: Move elf parameters to sparc/target_elf.h
  linux-user: Move elf parameters to ppc/target_elf.h
  linux-user: Move elf parameters to loongarch64/target_elf.h
  linux-user: Move elf parameters to {mips,mips64}/target_elf.h
  linux-user: Move elf parameters to microblaze/target_elf.h
  linux-user: Move elf parameters to openrisc/target_elf.h
  linux-user: Move elf parameters to sh4/target_elf.h
  linux-user: Move elf parameters to m68k/target_elf.h
  linux-user: Move elf parameters to alpha/target_elf.h
  linux-user: Move elf parameters to s390x/target_elf.h
  linux-user: Move elf parameters to riscv/target_elf.h
  linux-user: Move elf parameters to hppa/target_elf.h
  linux-user: Move elf parameters to xtensa/target_elf.h
  linux-user: Move elf parameters to hexagon/target_elf.h
  linux-user: Standardize on ELF_MACHINE not ELF_ARCH
  linux-user: Rename elf_check_arch
  linux-user: Remove ELIBBAD from elfload.c
  linux-user: Remove MAP_DENYWRITE from elfload.c
  linux-user: Move arch_parse_elf_property to aarch64/elfload.c
  linux-user: Remove a.out declarations from elfload.c
  linux-user/sparc: Create target_ptrace.h
  linux-user: Remove target_pt_regs from target_syscall.h
  target/arm: Add feature predicate for FEAT_CSSC
  target/arm: Implement MIN/MAX (immediate)
  target/arm: Implement MIN/MAX (register)
  target/arm: Split out gen_wrap2_i32 helper
  target/arm: Enable FEAT_CSSC for -cpu max
  qemu/atomic: Finish renaming atomic128-cas.h headers
  qemu/atomic: Add atomic16 primitives for xchg, fetch_and, fetch_or
  accel/tcg: Add cpu_atomic_*_mmu for 16-byte xchg, fetch_and, fetch_or
  tcg: Add tcg_gen_atomic_{xchg,fetch_and,fetch_or}_i128
  target/arm: Rename isar_feature_aa64_atomics
  target/arm: Implement FEAT_LSE128
  target/arm: Enable FEAT_LSE128 for -cpu max

Smail AIDER (1):
  target/arm: Trap PMCR when MDCR_EL2.TPMCR is set

Stefan Hajnoczi (2):
  Update version for the v10.1.0 release
  Open 10.2 development tree

Stefan Weil (1):
  CI: Use mingw-w64-x86_64-curl-winssl instead of mingw-w64-x86_64-curl
    for Windows build

Steve Sistare (1):
  hw/intc/arm_gicv3_kvm: preserve pending interrupts during cpr

Thomas Huth (28):
  tests/functional: Use more fine-grained locking when looking for free
    ports
  tests/functional: Rework the migration test to have target-specific
    files
  tests/functional: Rework the multiprocess test to have target-specific
    files
  tests/functional/meson.build: Split timeout settings by target
  tests/functional/meson.build: Allow tests to reside in subfolders
  tests/functional: Move aarch64 tests into architecture specific folder
  tests/functional: Move alpha tests into architecture specific folder
  tests/functional: Move arm tests into architecture specific folder
  tests/functional: Move avr tests into architecture specific folder
  tests/functional: Move hppa tests into architecture specific folder
  tests/functional: Move i386 tests into architecture specific folder
  tests/functional: Move loongarch64 tests into architecture specific
    folder
  tests/functional: Move m68k tests into architecture specific folder
  tests/functional: Move microblaze tests into architecture specific
    folder
  tests/functional: Move mips tests into target-specific folders
  tests/functional: Move or1k tests into target-specific folders
  tests/functional: Move ppc/ppc64 tests into target-specific folders
  tests/functional: Move riscv32/riscv64 tests into target-specific
    folders
  tests/functional: Move rx test into target-specific folders
  tests/functional: Move s390x tests into target-specific folders
  tests/functional: Move sh4/sh4eb tests into target-specific folders
  tests/functional: Move sparc/sparc64 tests into target-specific
    folders
  tests/functional: Move x86_64 tests into target-specific folder
  tests/functional: Move xtensa tests into target-specific folder
  tests/functional: Move the generic tests to a subfolder
  MAINTAINERS: Adjust wildcards for the migration, multiprocess and
    replay tests
  hw/intc/loongarch_pch_pic: Fix ubsan warning and endianness issue
  qga: Fix ubsan warning

WANG Rui (1):
  target/loongarch: Guard 64-bit-only insn translation with TRANS64
    macro

Xiaoyao Li (1):
  x86/loader: Don't update kernel header for CoCo VMs

Xin Wang (1):
  target/i386: Add support for save/load of exception error code

Zero Tang (1):
  i386/tcg/svm: fix incorrect canonicalization

minglei.liu (1):
  qga: Fix truncated output handling in guest-exec status reporting

Łukasz Stelmach (1):
  linux-user: do not print IP socket options by default

-- 
2.47.2



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH v2 001/281] target/i386: Add support for save/load of exception error code
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04 12:08   ` Igor Mammedov
  2025-09-04  8:06 ` [PATCH v2 002/281] scripts/minikconf.py: fix invalid attribute access Alex Bennée
                   ` (32 subsequent siblings)
  33 siblings, 1 reply; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Xin Wang

From: Xin Wang <wangxinxin.wang@huawei.com>

For now, qemu save/load CPU exception info(such as exception_nr and
has_error_code), while the exception error_code is ignored. This will
cause the dest hypervisor reinject a vCPU exception with error_code(0),
potentially causing a guest kernel panic.

For instance, if src VM stopped with an user-mode write #PF (error_code 6),
the dest hypervisor will reinject an #PF with error_code(0) when vCPU resume,
then guest kernel panic as:
  BUG: unable to handle page fault for address: 00007f80319cb010
  #PF: supervisor read access in user mode
  #PF: error_code(0x0000) - not-present page
  RIP: 0033:0x40115d

To fix it, support save/load exception error_code.

Signed-off-by: Xin Wang <wangxinxin.wang@huawei.com>
Link: https://lore.kernel.org/r/20250819145834.3998-1-wangxinxin.wang@huawei.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/target/i386/machine.c b/target/i386/machine.c
index dd2dac1d443..45b7cea80aa 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -462,6 +462,24 @@ static const VMStateDescription vmstate_exception_info = {
     }
 };
 
+static bool cpu_errcode_needed(void *opaque)
+{
+    X86CPU *cpu = opaque;
+
+    return cpu->env.has_error_code != 0;
+}
+
+static const VMStateDescription vmstate_error_code = {
+    .name = "cpu/error_code",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = cpu_errcode_needed,
+    .fields = (const VMStateField[]) {
+        VMSTATE_INT32(env.error_code, X86CPU),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 /* Poll control MSR enabled by default */
 static bool poll_control_msr_needed(void *opaque)
 {
@@ -1746,6 +1764,7 @@ const VMStateDescription vmstate_x86_cpu = {
     },
     .subsections = (const VMStateDescription * const []) {
         &vmstate_exception_info,
+        &vmstate_error_code,
         &vmstate_async_pf_msr,
         &vmstate_async_pf_int_msr,
         &vmstate_pv_eoi_msr,
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 002/281] scripts/minikconf.py: fix invalid attribute access
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 001/281] target/i386: Add support for save/load of exception error code Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 003/281] scripts/minikconf.py: s/Error/KconfigParserError Alex Bennée
                   ` (31 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

Fix parse method to use `defconfig` global variable instead of the
non-existent KconfigParser class attribute

Fixes: f349474920d80838ecea3d421531fdb0660b8740 ("minikconfig: implement allnoconfig and defconfig modes")
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/r/20250820-scripts-minikconf-fixes-v1-1-252041a9125e@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/minikconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/minikconf.py b/scripts/minikconf.py
index 6f7f43b2918..2a4694fb6a3 100644
--- a/scripts/minikconf.py
+++ b/scripts/minikconf.py
@@ -340,7 +340,7 @@ class KconfigParser:
 
     @classmethod
     def parse(self, fp, mode=None):
-        data = KconfigData(mode or KconfigParser.defconfig)
+        data = KconfigData(mode or defconfig)
         parser = KconfigParser(data)
         parser.parse_file(fp)
         return data
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 003/281] scripts/minikconf.py: s/Error/KconfigParserError
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 001/281] target/i386: Add support for save/load of exception error code Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 002/281] scripts/minikconf.py: fix invalid attribute access Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 004/281] python: mkvenv: fix messages printed by mkvenv Alex Bennée
                   ` (30 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>

Error is not defined in this script, raise KconfigParserError instead.

Fixes: 82f5181777ebe04b550fd94a1d04c49dd3f012dc ("kconfig: introduce kconfig files")
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Link: https://lore.kernel.org/r/20250820-scripts-minikconf-fixes-v1-2-252041a9125e@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/minikconf.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/minikconf.py b/scripts/minikconf.py
index 2a4694fb6a3..4de5aeed11a 100644
--- a/scripts/minikconf.py
+++ b/scripts/minikconf.py
@@ -363,7 +363,9 @@ def parse_file(self, fp):
 
     def do_assignment(self, var, val):
         if not var.startswith("CONFIG_"):
-            raise Error('assigned variable should start with CONFIG_')
+            raise KconfigParserError(
+                self, "assigned variable should start with CONFIG_"
+            )
         var = self.data.do_var(var[7:])
         self.data.do_assignment(var, val)
 
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 004/281] python: mkvenv: fix messages printed by mkvenv
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (2 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 003/281] scripts/minikconf.py: s/Error/KconfigParserError Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 005/281] MAINTAINERS: add a few more files to "Top Level Makefile and configure" Alex Bennée
                   ` (29 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, qemu-stable

From: Paolo Bonzini <pbonzini@redhat.com>

The new Matcher class does not have a __str__ implementation, and therefore
it prints the debugging representation of the internal object:

  $ ../configure --enable-rust && make qemu-system-arm --enable-download
  python determined to be '/usr/bin/python3'
  python version: Python 3.13.6
  mkvenv: Creating non-isolated virtual environment at 'pyvenv'
  mkvenv: checking for LegacyMatcher('meson>=1.5.0')
  mkvenv: checking for LegacyMatcher('pycotap>=1.1.0')

Add the method to print the nicer

  mkvenv: checking for meson>=1.5.0
  mkvenv: checking for pycotap>=1.1.0

Cc: qemu-stable@nongnu.org
Cc: John Snow <jsnow@redhat.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 python/scripts/mkvenv.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/python/scripts/mkvenv.py b/python/scripts/mkvenv.py
index f102527c4de..9aed266df1b 100644
--- a/python/scripts/mkvenv.py
+++ b/python/scripts/mkvenv.py
@@ -184,6 +184,10 @@ def match(self, version_str: str) -> bool:
             )
         )
 
+    def __str__(self) -> str:
+        """String representation delegated to the backend."""
+        return str(self._m)
+
     def __repr__(self) -> str:
         """Stable debug representation delegated to the backend."""
         return repr(self._m)
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 005/281] MAINTAINERS: add a few more files to "Top Level Makefile and configure"
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (3 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 004/281] python: mkvenv: fix messages printed by mkvenv Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 006/281] Update version for the v10.1.0 release Alex Bennée
                   ` (28 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=true, Size: 915 bytes --]

From: Paolo Bonzini <pbonzini@redhat.com>

A few files in scripts, and the list of packages in pythondeps.toml, are
strictly related to the toplevel build scripts.  Add them to the
MAINTAINERS file stanza.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a07086ed762..0f3e55b51e8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4392,7 +4392,6 @@ R: Philippe Mathieu-Daudé <philmd@linaro.org>
 S: Maintained
 F: meson.build
 F: meson_options.txt
-F: scripts/meson-buildoptions.*
 F: scripts/check_sparse.py
 F: scripts/symlink-install-tree.py
 
@@ -4403,6 +4402,9 @@ R: Thomas Huth <thuth@redhat.com>
 S: Maintained
 F: Makefile
 F: configure
+F: pythondeps.toml
+F: scripts/git-submodule.sh
+F: scripts/meson-buildoptions.*
 F: scripts/mtest2make.py
 F: tests/Makefile.include
 
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 006/281] Update version for the v10.1.0 release
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (4 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 005/281] MAINTAINERS: add a few more files to "Top Level Makefile and configure" Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 007/281] Open 10.2 development tree Alex Bennée
                   ` (27 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Stefan Hajnoczi

From: Stefan Hajnoczi <stefanha@redhat.com>

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index dadcbd47d3c..4149c39eec6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.0.94
+10.1.0
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 007/281] Open 10.2 development tree
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (5 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 006/281] Update version for the v10.1.0 release Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 008/281] hw: add compat machines for 10.2 Alex Bennée
                   ` (26 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Stefan Hajnoczi

From: Stefan Hajnoczi <stefanha@redhat.com>

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 4149c39eec6..9856be5dd98 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.1.0
+10.1.50
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 008/281] hw: add compat machines for 10.2
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (6 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 007/281] Open 10.2 development tree Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 010/281] tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't initialize Alex Bennée
                   ` (25 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Cornelia Huck

From: Cornelia Huck <cohuck@redhat.com>

Add 10.2 machine types for arm/i440fx/m68k/q35/s390x/spapr.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20250805095616.1168905-1-cohuck@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/hw/boards.h        |  3 +++
 include/hw/i386/pc.h       |  3 +++
 hw/arm/virt.c              |  9 ++++++++-
 hw/core/machine.c          |  3 +++
 hw/i386/pc.c               |  3 +++
 hw/i386/pc_piix.c          | 13 +++++++++++--
 hw/i386/pc_q35.c           | 13 +++++++++++--
 hw/m68k/virt.c             |  9 ++++++++-
 hw/ppc/spapr.c             | 15 +++++++++++++--
 hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++-
 10 files changed, 76 insertions(+), 9 deletions(-)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index f94713e6e29..665b6201214 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -779,6 +779,9 @@ struct MachineState {
     } \
     type_init(machine_initfn##_register_types)
 
+extern GlobalProperty hw_compat_10_1[];
+extern const size_t hw_compat_10_1_len;
+
 extern GlobalProperty hw_compat_10_0[];
 extern const size_t hw_compat_10_0_len;
 
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 79b72c54dd3..e83157ab358 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -214,6 +214,9 @@ void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size_t flash_size);
 /* sgx.c */
 void pc_machine_init_sgx_epc(PCMachineState *pcms);
 
+extern GlobalProperty pc_compat_10_1[];
+extern const size_t pc_compat_10_1_len;
+
 extern GlobalProperty pc_compat_10_0[];
 extern const size_t pc_compat_10_0_len;
 
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index ef6be3660f5..9326cfc895f 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -3455,10 +3455,17 @@ static void machvirt_machine_init(void)
 }
 type_init(machvirt_machine_init);
 
+static void virt_machine_10_2_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE_AS_LATEST(10, 2)
+
 static void virt_machine_10_1_options(MachineClass *mc)
 {
+    virt_machine_10_2_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_10_1, hw_compat_10_1_len);
 }
-DEFINE_VIRT_MACHINE_AS_LATEST(10, 1)
+DEFINE_VIRT_MACHINE(10, 1)
 
 static void virt_machine_10_0_options(MachineClass *mc)
 {
diff --git a/hw/core/machine.c b/hw/core/machine.c
index bd47527479a..38c949c4f2c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -37,6 +37,9 @@
 #include "hw/virtio/virtio-iommu.h"
 #include "audio/audio.h"
 
+GlobalProperty hw_compat_10_1[] = {};
+const size_t hw_compat_10_1_len = G_N_ELEMENTS(hw_compat_10_1);
+
 GlobalProperty hw_compat_10_0[] = {
     { "scsi-hd", "dpofua", "off" },
     { "vfio-pci", "x-migration-load-config-after-iter", "off" },
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2f58e73d334..bc048a6d137 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -81,6 +81,9 @@
     { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
     { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
 
+GlobalProperty pc_compat_10_1[] = {};
+const size_t pc_compat_10_1_len = G_N_ELEMENTS(pc_compat_10_1);
+
 GlobalProperty pc_compat_10_0[] = {
     { TYPE_X86_CPU, "x-consistent-cache", "false" },
     { TYPE_X86_CPU, "x-vendor-cpuid-only-v2", "false" },
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index c03324281bd..d165ac72ed7 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -504,12 +504,21 @@ static void pc_i440fx_machine_options(MachineClass *m)
                      pc_piix_compat_defaults, pc_piix_compat_defaults_len);
 }
 
-static void pc_i440fx_machine_10_1_options(MachineClass *m)
+static void pc_i440fx_machine_10_2_options(MachineClass *m)
 {
     pc_i440fx_machine_options(m);
 }
 
-DEFINE_I440FX_MACHINE_AS_LATEST(10, 1);
+DEFINE_I440FX_MACHINE_AS_LATEST(10, 2);
+
+static void pc_i440fx_machine_10_1_options(MachineClass *m)
+{
+    pc_i440fx_machine_10_2_options(m);
+    compat_props_add(m->compat_props, hw_compat_10_1, hw_compat_10_1_len);
+    compat_props_add(m->compat_props, pc_compat_10_1, pc_compat_10_1_len);
+}
+
+DEFINE_I440FX_MACHINE(10, 1);
 
 static void pc_i440fx_machine_10_0_options(MachineClass *m)
 {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index b309b2b378d..e89951285e5 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -374,12 +374,21 @@ static void pc_q35_machine_options(MachineClass *m)
                      pc_q35_compat_defaults, pc_q35_compat_defaults_len);
 }
 
-static void pc_q35_machine_10_1_options(MachineClass *m)
+static void pc_q35_machine_10_2_options(MachineClass *m)
 {
     pc_q35_machine_options(m);
 }
 
-DEFINE_Q35_MACHINE_AS_LATEST(10, 1);
+DEFINE_Q35_MACHINE_AS_LATEST(10, 2);
+
+static void pc_q35_machine_10_1_options(MachineClass *m)
+{
+    pc_q35_machine_10_2_options(m);
+    compat_props_add(m->compat_props, hw_compat_10_1, hw_compat_10_1_len);
+    compat_props_add(m->compat_props, pc_compat_10_1, pc_compat_10_1_len);
+}
+
+DEFINE_Q35_MACHINE(10, 1);
 
 static void pc_q35_machine_10_0_options(MachineClass *m)
 {
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 875fd00ef8d..98cfe43c73a 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -367,10 +367,17 @@ type_init(virt_machine_register_types)
 #define DEFINE_VIRT_MACHINE(major, minor) \
     DEFINE_VIRT_MACHINE_IMPL(false, major, minor)
 
+static void virt_machine_10_2_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE_AS_LATEST(10, 2)
+
 static void virt_machine_10_1_options(MachineClass *mc)
 {
+    virt_machine_10_2_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_10_1, hw_compat_10_1_len);
 }
-DEFINE_VIRT_MACHINE_AS_LATEST(10, 1)
+DEFINE_VIRT_MACHINE(10, 1)
 
 static void virt_machine_10_0_options(MachineClass *mc)
 {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 1855a3cd8d0..eb22333404d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4761,15 +4761,26 @@ static void spapr_machine_latest_class_options(MachineClass *mc)
 #define DEFINE_SPAPR_MACHINE(major, minor) \
     DEFINE_SPAPR_MACHINE_IMPL(false, major, minor)
 
+/*
+ * pseries-10.2
+ */
+static void spapr_machine_10_2_class_options(MachineClass *mc)
+{
+    /* Defaults for the latest behaviour inherited from the base class */
+}
+
+DEFINE_SPAPR_MACHINE_AS_LATEST(10, 2);
+
 /*
  * pseries-10.1
  */
 static void spapr_machine_10_1_class_options(MachineClass *mc)
 {
-    /* Defaults for the latest behaviour inherited from the base class */
+    spapr_machine_10_2_class_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_10_1, hw_compat_10_1_len);
 }
 
-DEFINE_SPAPR_MACHINE_AS_LATEST(10, 1);
+DEFINE_SPAPR_MACHINE(10, 1);
 
 /*
  * pseries-10.0
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index a79bd13275b..d0c6e80cb05 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -911,14 +911,26 @@ static const TypeInfo ccw_machine_info = {
     DEFINE_CCW_MACHINE_IMPL(false, major, minor)
 
 
+static void ccw_machine_10_2_instance_options(MachineState *machine)
+{
+}
+
+static void ccw_machine_10_2_class_options(MachineClass *mc)
+{
+}
+DEFINE_CCW_MACHINE_AS_LATEST(10, 2);
+
 static void ccw_machine_10_1_instance_options(MachineState *machine)
 {
+    ccw_machine_10_2_instance_options(machine);
 }
 
 static void ccw_machine_10_1_class_options(MachineClass *mc)
 {
+    ccw_machine_10_2_class_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_10_1, hw_compat_10_1_len);
 }
-DEFINE_CCW_MACHINE_AS_LATEST(10, 1);
+DEFINE_CCW_MACHINE(10, 1);
 
 static void ccw_machine_10_0_instance_options(MachineState *machine)
 {
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 010/281] tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't initialize
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (7 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 008/281] hw: add compat machines for 10.2 Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 011/281] tests/functional: Fix reverse_debugging asset precaching Alex Bennée
                   ` (24 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Dmitry Osipenko

From: Peter Maydell <peter.maydell@linaro.org>

If you are using the Nvidia drivers and have installed new versions
of those packages but have not yet rebooted the host kernel,
attempting to use the egl-headless display will cause QEMU to fail to
start with

$ qemu-system-aarch64 -M virt -display egl-headless
qemu-system-aarch64: egl: eglInitialize failed: EGL_NOT_INITIALIZED
qemu-system-aarch64: egl: render node init failed

together with this complaint in the host kernel dmesg:

[7874777.555649] NVRM: API mismatch: the client has the version 535.247.01, but
                 NVRM: this kernel module has the version 535.230.02.  Please
                 NVRM: make sure that this kernel module and all NVIDIA driver
                 NVRM: components have the same version.

This isn't a problem with QEMU itself, so reporting this as a test
failure is misleading.  Instead skip the tests, as we already do for
various other kinds of "host system can't actually run the EGL
display" situation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20250826123455.2856988-1-peter.maydell@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/test_aarch64_virt_gpu.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/functional/test_aarch64_virt_gpu.py b/tests/functional/test_aarch64_virt_gpu.py
index 38447278579..4e50887c3e9 100755
--- a/tests/functional/test_aarch64_virt_gpu.py
+++ b/tests/functional/test_aarch64_virt_gpu.py
@@ -76,6 +76,8 @@ def _launch_virt_gpu(self, gpu_device):
                 self.skipTest("egl-headless support is not available")
             elif "'type' does not accept value 'dbus'" in excp.output:
                 self.skipTest("dbus display support is not available")
+            elif "eglInitialize failed: EGL_NOT_INITIALIZED" in excp.output:
+                self.skipTest("EGL failed to initialize on this host")
             else:
                 self.log.info("unhandled launch failure: %s", excp.output)
                 raise excp
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 011/281] tests/functional: Fix reverse_debugging asset precaching
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (8 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 010/281] tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't initialize Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 015/281] tests/functional/meson.build: Split timeout settings by target Alex Bennée
                   ` (23 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Gustavo Romero

From: Gustavo Romero <gustavo.romero@linaro.org>

This commit fixes the asset precaching in the reverse_debugging test on
aarch64.

QemuBaseTest.main() precaches assets (kernel, rootfs, DT blobs, etc.)
that are defined in variables with the ASSET_ prefix. This works because
it ultimately calls Asset.precache_test(), which relies on introspection
to locate these variables.

If an asset variable is not named with the ASSET_ prefix, precache_test
cannot find the asset and precaching silently fails. Hence, fix the
asset precaching by fixing the asset variable name.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-ID: <20250827001008.22112-1-gustavo.romero@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/test_aarch64_reverse_debug.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/functional/test_aarch64_reverse_debug.py b/tests/functional/test_aarch64_reverse_debug.py
index 58d45328350..8bc91ccfde7 100755
--- a/tests/functional/test_aarch64_reverse_debug.py
+++ b/tests/functional/test_aarch64_reverse_debug.py
@@ -21,7 +21,7 @@ class ReverseDebugging_AArch64(ReverseDebugging):
 
     REG_PC = 32
 
-    KERNEL_ASSET = Asset(
+    ASSET_KERNEL = Asset(
         ('https://archives.fedoraproject.org/pub/archive/fedora/linux/'
          'releases/29/Everything/aarch64/os/images/pxeboot/vmlinuz'),
         '7e1430b81c26bdd0da025eeb8fbd77b5dc961da4364af26e771bd39f379cbbf7')
@@ -30,7 +30,7 @@ class ReverseDebugging_AArch64(ReverseDebugging):
     def test_aarch64_virt(self):
         self.set_machine('virt')
         self.cpu = 'cortex-a53'
-        kernel_path = self.KERNEL_ASSET.fetch()
+        kernel_path = self.ASSET_KERNEL.fetch()
         self.reverse_debugging(args=('-kernel', kernel_path))
 
 
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 015/281] tests/functional/meson.build: Split timeout settings by target
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (9 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 011/281] tests/functional: Fix reverse_debugging asset precaching Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 016/281] tests/functional/meson.build: Allow tests to reside in subfolders Alex Bennée
                   ` (22 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

We are going to move these settings into target-specific subfolders.
As a first step, split the big test_timeouts array up into individual
ones.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-4-thuth@redhat.com>
---
 tests/functional/meson.build | 50 +++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 6 deletions(-)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 38ae0d6cd3b..356aad12dee 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -10,7 +10,7 @@ if get_option('tcg_interpreter')
 endif
 
 # Timeouts for individual tests that can be slow e.g. with debugging enabled
-test_timeouts = {
+test_aarch64_timeouts = {
   'aarch64_aspeed_ast2700' : 600,
   'aarch64_aspeed_ast2700fc' : 600,
   'aarch64_device_passthrough' : 720,
@@ -25,7 +25,9 @@ test_timeouts = {
   'aarch64_tuxrun' : 240,
   'aarch64_virt' : 360,
   'aarch64_virt_gpu' : 480,
-  'acpi_bits' : 420,
+}
+
+test_arm_timeouts = {
   'arm_aspeed_palmetto' : 120,
   'arm_aspeed_romulus' : 120,
   'arm_aspeed_witherspoon' : 120,
@@ -44,24 +46,55 @@ test_timeouts = {
   'arm_replay' : 240,
   'arm_tuxrun' : 240,
   'arm_sx1' : 360,
-  'intel_iommu': 300,
+}
+
+test_mips_timeouts = {
   'mips_malta' : 480,
+}
+
+test_mipsel_timeouts = {
   'mipsel_malta' : 420,
   'mipsel_replay' : 480,
+}
+
+test_mips64_timeouts = {
   'mips64_malta' : 240,
+}
+
+test_mips64el_timeouts = {
   'mips64el_malta' : 420,
   'mips64el_replay' : 180,
-  'netdev_ethtool' : 180,
+}
+
+test_ppc_timeouts = {
   'ppc_40p' : 240,
+}
+
+test_ppc64_timeouts = {
   'ppc64_hv' : 1000,
   'ppc64_powernv' : 480,
   'ppc64_pseries' : 480,
   'ppc64_replay' : 210,
   'ppc64_tuxrun' : 420,
   'ppc64_mac99' : 120,
+}
+
+test_riscv64_timeouts = {
   'riscv64_tuxrun' : 120,
+}
+
+test_s390x_timeouts = {
   's390x_ccw_virtio' : 420,
+}
+
+test_sh4_timeouts = {
   'sh4_tuxrun' : 240,
+}
+
+test_x86_64_timeouts = {
+  'acpi_bits' : 420,
+  'intel_iommu': 300,
+  'netdev_ethtool' : 180,
   'virtio_balloon': 120,
   'x86_64_kvm_xen' : 180,
   'x86_64_replay' : 480,
@@ -404,6 +437,11 @@ foreach speed : ['quick', 'thorough']
                                build_by_default: false,
                                env: test_precache_env)
       precache_all += precache
+      if is_variable('test_' + target_base + '_timeouts')
+        time_out = get_variable('test_' + target_base + '_timeouts').get(test, 90)
+      else
+        time_out = 90
+      endif
 
       # Ideally we would add 'precache' to 'depends' here, such that
       # 'build_by_default: false' lets the pre-caching automatically
@@ -419,8 +457,8 @@ foreach speed : ['quick', 'thorough']
            env: test_env,
            args: [testpath],
            protocol: 'tap',
-           timeout: test_timeouts.get(test, 90),
-           priority: test_timeouts.get(test, 90),
+           timeout: time_out,
+           priority: time_out,
            suite: suites)
     endforeach
   endforeach
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 016/281] tests/functional/meson.build: Allow tests to reside in subfolders
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (10 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 015/281] tests/functional/meson.build: Split timeout settings by target Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 018/281] tests/functional: Move alpha tests into architecture specific folder Alex Bennée
                   ` (21 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

We are going to move target-specific tests to subfolders that are
named after the target (and generic tests will be put into a "generic"
folder), so prepare the meson.build file to allow such locations, too.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-5-thuth@redhat.com>
---
 tests/functional/meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 356aad12dee..8c24ac1cc2d 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -423,7 +423,13 @@ foreach speed : ['quick', 'thorough']
 
     foreach test : target_tests
       testname = '@0@-@1@'.format(target_base, test)
-      testfile = 'test_' + test + '.py'
+      if fs.exists('test_' + test + '.py')
+        testfile = 'test_' + test + '.py'
+      elif fs.exists('generic' / 'test_' + test + '.py')
+        testfile = 'generic' / 'test_' + test + '.py'
+      else
+        testfile = target_base / 'test_' + test + '.py'
+      endif
       testpath = meson.current_source_dir() / testfile
       teststamp = testname + '.tstamp'
       test_precache_env = environment()
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 018/281] tests/functional: Move alpha tests into architecture specific folder
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (11 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 016/281] tests/functional/meson.build: Allow tests to reside in subfolders Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 021/281] tests/functional: Move hppa " Alex Bennée
                   ` (20 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

The tests/functional folder has become quite crowded already, some
restructuring would be helpful here. Thus move the alpha tests into
a target-specific subfolder.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-7-thuth@redhat.com>
---
 MAINTAINERS                                            |  3 ++-
 tests/functional/alpha/meson.build                     | 10 ++++++++++
 .../{test_alpha_clipper.py => alpha/test_clipper.py}   |  0
 .../test_migration.py}                                 |  0
 .../{test_alpha_replay.py => alpha/test_replay.py}     |  0
 tests/functional/meson.build                           | 10 +---------
 6 files changed, 13 insertions(+), 10 deletions(-)
 create mode 100644 tests/functional/alpha/meson.build
 rename tests/functional/{test_alpha_clipper.py => alpha/test_clipper.py} (100%)
 rename tests/functional/{test_alpha_migration.py => alpha/test_migration.py} (100%)
 rename tests/functional/{test_alpha_replay.py => alpha/test_replay.py} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index a2a5ccea7b6..8115aae6183 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -189,6 +189,7 @@ M: Richard Henderson <richard.henderson@linaro.org>
 S: Maintained
 F: target/alpha/
 F: tests/tcg/alpha/
+F: tests/functional/alpha/
 F: disas/alpha.c
 
 ARM TCG CPUs
@@ -656,7 +657,7 @@ S: Maintained
 F: hw/alpha/
 F: hw/isa/smc37c669-superio.c
 F: tests/tcg/alpha/system/
-F: tests/functional/test_alpha_clipper.py
+F: tests/functional/alpha/test_clipper.py
 
 ARM Machines
 ------------
diff --git a/tests/functional/alpha/meson.build b/tests/functional/alpha/meson.build
new file mode 100644
index 00000000000..26a5b3f2e4b
--- /dev/null
+++ b/tests/functional/alpha/meson.build
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_alpha_system_quick = [
+  'migration',
+]
+
+tests_alpha_system_thorough = [
+  'clipper',
+  'replay',
+]
diff --git a/tests/functional/test_alpha_clipper.py b/tests/functional/alpha/test_clipper.py
similarity index 100%
rename from tests/functional/test_alpha_clipper.py
rename to tests/functional/alpha/test_clipper.py
diff --git a/tests/functional/test_alpha_migration.py b/tests/functional/alpha/test_migration.py
similarity index 100%
rename from tests/functional/test_alpha_migration.py
rename to tests/functional/alpha/test_migration.py
diff --git a/tests/functional/test_alpha_replay.py b/tests/functional/alpha/test_replay.py
similarity index 100%
rename from tests/functional/test_alpha_replay.py
rename to tests/functional/alpha/test_replay.py
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 9cb6325360f..a7f8c88a078 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -10,6 +10,7 @@ if get_option('tcg_interpreter')
 endif
 
 subdir('aarch64')
+subdir('alpha')
 
 test_arm_timeouts = {
   'arm_aspeed_palmetto' : 120,
@@ -96,15 +97,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_alpha_system_quick = [
-  'alpha_migration',
-]
-
-tests_alpha_system_thorough = [
-  'alpha_clipper',
-  'alpha_replay',
-]
-
 tests_arm_system_quick = [
   'arm_migration',
 ]
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 021/281] tests/functional: Move hppa tests into architecture specific folder
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (12 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 018/281] tests/functional: Move alpha tests into architecture specific folder Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:06 ` [PATCH v2 024/281] tests/functional: Move m68k " Alex Bennée
                   ` (19 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

The tests/functional folder has become quite crowded, thus move the
avr tests into a target-specific subfolder.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-10-thuth@redhat.com>
---
 MAINTAINERS                                                  | 2 +-
 tests/functional/hppa/meson.build                            | 5 +++++
 .../{test_hppa_seabios.py => hppa/test_seabios.py}           | 0
 tests/functional/meson.build                                 | 5 +----
 4 files changed, 7 insertions(+), 5 deletions(-)
 create mode 100644 tests/functional/hppa/meson.build
 rename tests/functional/{test_hppa_seabios.py => hppa/test_seabios.py} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index d01afcbea6d..2e1754912f6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1273,7 +1273,7 @@ F: include/hw/pci-host/astro.h
 F: include/hw/pci-host/dino.h
 F: pc-bios/hppa-firmware.img
 F: roms/seabios-hppa/
-F: tests/functional/test_hppa_seabios.py
+F: tests/functional/hppa/test_seabios.py
 
 LoongArch Machines
 ------------------
diff --git a/tests/functional/hppa/meson.build b/tests/functional/hppa/meson.build
new file mode 100644
index 00000000000..a3348370884
--- /dev/null
+++ b/tests/functional/hppa/meson.build
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_hppa_system_quick = [
+  'seabios',
+]
diff --git a/tests/functional/test_hppa_seabios.py b/tests/functional/hppa/test_seabios.py
similarity index 100%
rename from tests/functional/test_hppa_seabios.py
rename to tests/functional/hppa/test_seabios.py
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 81eaa9c218c..8f85c13d3d1 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -13,6 +13,7 @@ subdir('aarch64')
 subdir('alpha')
 subdir('arm')
 subdir('avr')
+subdir('hppa')
 
 test_mips_timeouts = {
   'mips_malta' : 480,
@@ -78,10 +79,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_hppa_system_quick = [
-  'hppa_seabios',
-]
-
 tests_i386_system_quick = [
   'i386_migration',
 ]
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 024/281] tests/functional: Move m68k tests into architecture specific folder
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (13 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 021/281] tests/functional: Move hppa " Alex Bennée
@ 2025-09-04  8:06 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 031/281] tests/functional: Move s390x tests into target-specific folders Alex Bennée
                   ` (18 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

The tests/functional folder has become quite crowded, thus move the
m68k tests into a target-specific subfolder.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-13-thuth@redhat.com>
---
 MAINTAINERS                                              | 8 ++++----
 tests/functional/m68k/meson.build                        | 9 +++++++++
 .../{test_m68k_mcf5208evb.py => m68k/test_mcf5208evb.py} | 0
 .../{test_m68k_nextcube.py => m68k/test_nextcube.py}     | 0
 .../functional/{test_m68k_q800.py => m68k/test_q800.py}  | 0
 .../{test_m68k_replay.py => m68k/test_replay.py}         | 0
 .../{test_m68k_tuxrun.py => m68k/test_tuxrun.py}         | 0
 tests/functional/meson.build                             | 9 +--------
 8 files changed, 14 insertions(+), 12 deletions(-)
 create mode 100644 tests/functional/m68k/meson.build
 rename tests/functional/{test_m68k_mcf5208evb.py => m68k/test_mcf5208evb.py} (100%)
 rename tests/functional/{test_m68k_nextcube.py => m68k/test_nextcube.py} (100%)
 rename tests/functional/{test_m68k_q800.py => m68k/test_q800.py} (100%)
 rename tests/functional/{test_m68k_replay.py => m68k/test_replay.py} (100%)
 rename tests/functional/{test_m68k_tuxrun.py => m68k/test_tuxrun.py} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 716127e831d..e188de813fb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1312,7 +1312,7 @@ F: hw/m68k/mcf_intc.c
 F: hw/char/mcf_uart.c
 F: hw/net/mcf_fec.c
 F: include/hw/m68k/mcf*.h
-F: tests/functional/test_m68k_mcf5208evb.py
+F: tests/functional/m68k/test_mcf5208evb.py
 
 NeXTcube
 M: Thomas Huth <huth@tuxfamily.org>
@@ -1320,7 +1320,7 @@ S: Odd Fixes
 F: hw/m68k/next-*.c
 F: hw/display/next-fb.c
 F: include/hw/m68k/next-cube.h
-F: tests/functional/test_m68k_nextcube.py
+F: tests/functional/m68k/test_nextcube.py
 
 q800
 M: Laurent Vivier <laurent@vivier.eu>
@@ -1346,7 +1346,7 @@ F: include/hw/m68k/q800-glue.h
 F: include/hw/misc/djmemc.h
 F: include/hw/misc/iosb.h
 F: include/hw/audio/asc.h
-F: tests/functional/test_m68k_q800.py
+F: tests/functional/m68k/test_q800.py
 
 virt
 M: Laurent Vivier <laurent@vivier.eu>
@@ -1361,7 +1361,7 @@ F: include/hw/intc/goldfish_pic.h
 F: include/hw/intc/m68k_irqc.h
 F: include/hw/misc/virt_ctrl.h
 F: docs/specs/virt-ctlr.rst
-F: tests/functional/test_m68k_tuxrun.py
+F: tests/functional/m68k/test_tuxrun.py
 
 MicroBlaze Machines
 -------------------
diff --git a/tests/functional/m68k/meson.build b/tests/functional/m68k/meson.build
new file mode 100644
index 00000000000..e29044a6d73
--- /dev/null
+++ b/tests/functional/m68k/meson.build
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_m68k_system_thorough = [
+  'mcf5208evb',
+  'nextcube',
+  'replay',
+  'q800',
+  'tuxrun',
+]
diff --git a/tests/functional/test_m68k_mcf5208evb.py b/tests/functional/m68k/test_mcf5208evb.py
similarity index 100%
rename from tests/functional/test_m68k_mcf5208evb.py
rename to tests/functional/m68k/test_mcf5208evb.py
diff --git a/tests/functional/test_m68k_nextcube.py b/tests/functional/m68k/test_nextcube.py
similarity index 100%
rename from tests/functional/test_m68k_nextcube.py
rename to tests/functional/m68k/test_nextcube.py
diff --git a/tests/functional/test_m68k_q800.py b/tests/functional/m68k/test_q800.py
similarity index 100%
rename from tests/functional/test_m68k_q800.py
rename to tests/functional/m68k/test_q800.py
diff --git a/tests/functional/test_m68k_replay.py b/tests/functional/m68k/test_replay.py
similarity index 100%
rename from tests/functional/test_m68k_replay.py
rename to tests/functional/m68k/test_replay.py
diff --git a/tests/functional/test_m68k_tuxrun.py b/tests/functional/m68k/test_tuxrun.py
similarity index 100%
rename from tests/functional/test_m68k_tuxrun.py
rename to tests/functional/m68k/test_tuxrun.py
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index e2e66dcf523..d32dd4a371f 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -16,6 +16,7 @@ subdir('avr')
 subdir('hppa')
 subdir('i386')
 subdir('loongarch64')
+subdir('m68k')
 
 test_mips_timeouts = {
   'mips_malta' : 480,
@@ -81,14 +82,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_m68k_system_thorough = [
-  'm68k_mcf5208evb',
-  'm68k_nextcube',
-  'm68k_replay',
-  'm68k_q800',
-  'm68k_tuxrun',
-]
-
 tests_microblaze_system_thorough = [
   'microblaze_replay',
   'microblaze_s3adsp1800'
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 031/281] tests/functional: Move s390x tests into target-specific folders
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (14 preceding siblings ...)
  2025-09-04  8:06 ` [PATCH v2 024/281] tests/functional: Move m68k " Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 032/281] tests/functional: Move sh4/sh4eb " Alex Bennée
                   ` (17 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

The tests/functional folder has become quite crowded, thus move the
s390x tests into a target-specific subfolder.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-20-thuth@redhat.com>
---
 MAINTAINERS                                         |  6 +++---
 tests/functional/meson.build                        | 13 +------------
 tests/functional/s390x/meson.build                  | 13 +++++++++++++
 .../test_ccw_virtio.py}                             |  0
 .../test_pxelinux.py}                               |  0
 .../{test_s390x_replay.py => s390x/test_replay.py}  |  0
 .../test_topology.py}                               |  0
 .../{test_s390x_tuxrun.py => s390x/test_tuxrun.py}  |  0
 8 files changed, 17 insertions(+), 15 deletions(-)
 create mode 100644 tests/functional/s390x/meson.build
 rename tests/functional/{test_s390x_ccw_virtio.py => s390x/test_ccw_virtio.py} (100%)
 rename tests/functional/{test_s390x_pxelinux.py => s390x/test_pxelinux.py} (100%)
 rename tests/functional/{test_s390x_replay.py => s390x/test_replay.py} (100%)
 rename tests/functional/{test_s390x_topology.py => s390x/test_topology.py} (100%)
 rename tests/functional/{test_s390x_tuxrun.py => s390x/test_tuxrun.py} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index c6410a5f5fd..4a55a20f6a5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1797,7 +1797,7 @@ S: Supported
 F: hw/s390x/
 F: include/hw/s390x/
 F: configs/devices/s390x-softmmu/default.mak
-F: tests/functional/test_s390x_*
+F: tests/functional/s390x
 T: git https://github.com/borntraeger/qemu.git s390-next
 L: qemu-s390x@nongnu.org
 
@@ -1811,7 +1811,7 @@ F: hw/s390x/ipl.*
 F: pc-bios/s390-ccw/
 F: pc-bios/s390-ccw.img
 F: docs/devel/s390-dasd-ipl.rst
-F: tests/functional/test_s390x_pxelinux.py
+F: tests/functional/s390x/test_pxelinux.py
 T: git https://github.com/borntraeger/qemu.git s390-next
 L: qemu-s390x@nongnu.org
 
@@ -1865,7 +1865,7 @@ F: hw/s390x/cpu-topology.c
 F: target/s390x/kvm/stsi-topology.c
 F: docs/devel/s390-cpu-topology.rst
 F: docs/system/s390x/cpu-topology.rst
-F: tests/functional/test_s390x_topology.py
+F: tests/functional/s390x/test_topology.py
 
 X86 Machines
 ------------
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 7e7a6aa0c93..abaa4e00fca 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -29,10 +29,7 @@ subdir('ppc64')
 subdir('riscv32')
 subdir('riscv64')
 subdir('rx')
-
-test_s390x_timeouts = {
-  's390x_ccw_virtio' : 420,
-}
+subdir('s390x')
 
 test_sh4_timeouts = {
   'sh4_tuxrun' : 240,
@@ -59,14 +56,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_s390x_system_thorough = [
-  's390x_ccw_virtio',
-  's390x_pxelinux',
-  's390x_replay',
-  's390x_topology',
-  's390x_tuxrun',
-]
-
 tests_sh4_system_thorough = [
   'sh4_r2d',
   'sh4_tuxrun',
diff --git a/tests/functional/s390x/meson.build b/tests/functional/s390x/meson.build
new file mode 100644
index 00000000000..030b116039c
--- /dev/null
+++ b/tests/functional/s390x/meson.build
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+test_s390x_timeouts = {
+  'ccw_virtio' : 420,
+}
+
+tests_s390x_system_thorough = [
+  'ccw_virtio',
+  'pxelinux',
+  'replay',
+  'topology',
+  'tuxrun',
+]
diff --git a/tests/functional/test_s390x_ccw_virtio.py b/tests/functional/s390x/test_ccw_virtio.py
similarity index 100%
rename from tests/functional/test_s390x_ccw_virtio.py
rename to tests/functional/s390x/test_ccw_virtio.py
diff --git a/tests/functional/test_s390x_pxelinux.py b/tests/functional/s390x/test_pxelinux.py
similarity index 100%
rename from tests/functional/test_s390x_pxelinux.py
rename to tests/functional/s390x/test_pxelinux.py
diff --git a/tests/functional/test_s390x_replay.py b/tests/functional/s390x/test_replay.py
similarity index 100%
rename from tests/functional/test_s390x_replay.py
rename to tests/functional/s390x/test_replay.py
diff --git a/tests/functional/test_s390x_topology.py b/tests/functional/s390x/test_topology.py
similarity index 100%
rename from tests/functional/test_s390x_topology.py
rename to tests/functional/s390x/test_topology.py
diff --git a/tests/functional/test_s390x_tuxrun.py b/tests/functional/s390x/test_tuxrun.py
similarity index 100%
rename from tests/functional/test_s390x_tuxrun.py
rename to tests/functional/s390x/test_tuxrun.py
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 032/281] tests/functional: Move sh4/sh4eb tests into target-specific folders
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (15 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 031/281] tests/functional: Move s390x tests into target-specific folders Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 034/281] tests/functional: Move x86_64 tests into target-specific folder Alex Bennée
                   ` (16 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

The tests/functional folder has become quite crowded, thus move the
sh4 tests into a target-specific subfolder.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-21-thuth@redhat.com>
---
 MAINTAINERS                                       |  4 ++--
 tests/functional/meson.build                      | 15 ++-------------
 tests/functional/sh4/meson.build                  | 10 ++++++++++
 .../{test_sh4_r2d.py => sh4/test_r2d.py}          |  0
 .../{test_sh4_tuxrun.py => sh4/test_tuxrun.py}    |  0
 tests/functional/sh4eb/meson.build                |  5 +++++
 .../{test_sh4eb_r2d.py => sh4eb/test_r2d.py}      |  0
 7 files changed, 19 insertions(+), 15 deletions(-)
 create mode 100644 tests/functional/sh4/meson.build
 rename tests/functional/{test_sh4_r2d.py => sh4/test_r2d.py} (100%)
 rename tests/functional/{test_sh4_tuxrun.py => sh4/test_tuxrun.py} (100%)
 create mode 100644 tests/functional/sh4eb/meson.build
 rename tests/functional/{test_sh4eb_r2d.py => sh4eb/test_r2d.py} (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4a55a20f6a5..eddec0058e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1736,8 +1736,8 @@ F: hw/pci-host/sh_pci.c
 F: hw/timer/sh_timer.c
 F: include/hw/sh4/sh_intc.h
 F: include/hw/timer/tmu012.h
-F: tests/functional/test_sh4*_r2d.py
-F: tests/functional/test_sh4_tuxrun.py
+F: tests/functional/sh4*/test_r2d.py
+F: tests/functional/sh4/test_tuxrun.py
 
 SPARC Machines
 --------------
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index abaa4e00fca..ce713509e32 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -30,10 +30,8 @@ subdir('riscv32')
 subdir('riscv64')
 subdir('rx')
 subdir('s390x')
-
-test_sh4_timeouts = {
-  'sh4_tuxrun' : 240,
-}
+subdir('sh4')
+subdir('sh4eb')
 
 test_x86_64_timeouts = {
   'acpi_bits' : 420,
@@ -56,15 +54,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_sh4_system_thorough = [
-  'sh4_r2d',
-  'sh4_tuxrun',
-]
-
-tests_sh4eb_system_thorough = [
-  'sh4eb_r2d',
-]
-
 tests_sparc_system_quick = [
   'sparc_migration',
 ]
diff --git a/tests/functional/sh4/meson.build b/tests/functional/sh4/meson.build
new file mode 100644
index 00000000000..56f824e1e71
--- /dev/null
+++ b/tests/functional/sh4/meson.build
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+test_sh4_timeouts = {
+  'tuxrun' : 240,
+}
+
+tests_sh4_system_thorough = [
+  'r2d',
+  'tuxrun',
+]
diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/sh4/test_r2d.py
similarity index 100%
rename from tests/functional/test_sh4_r2d.py
rename to tests/functional/sh4/test_r2d.py
diff --git a/tests/functional/test_sh4_tuxrun.py b/tests/functional/sh4/test_tuxrun.py
similarity index 100%
rename from tests/functional/test_sh4_tuxrun.py
rename to tests/functional/sh4/test_tuxrun.py
diff --git a/tests/functional/sh4eb/meson.build b/tests/functional/sh4eb/meson.build
new file mode 100644
index 00000000000..25e9a6e4041
--- /dev/null
+++ b/tests/functional/sh4eb/meson.build
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_sh4eb_system_thorough = [
+  'r2d',
+]
diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/sh4eb/test_r2d.py
similarity index 100%
rename from tests/functional/test_sh4eb_r2d.py
rename to tests/functional/sh4eb/test_r2d.py
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 034/281] tests/functional: Move x86_64 tests into target-specific folder
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (16 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 032/281] tests/functional: Move sh4/sh4eb " Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 045/281] rust/qemu-api-macros: make derive(Object) friendly when missing parent Alex Bennée
                   ` (15 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon, Pierrick Bouvier

From: Thomas Huth <thuth@redhat.com>

The tests/functional folder has become quite crowded, thus move the
x86_64 tests into a target-specific subfolder.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250819112403.432587-23-thuth@redhat.com>
---
 MAINTAINERS                                   | 32 ++++++++--------
 tests/functional/meson.build                  | 37 +------------------
 tests/functional/x86_64/meson.build           | 37 +++++++++++++++++++
 .../functional/{ => x86_64}/test_acpi_bits.py |  0
 .../test_cpu_model_versions.py}               |  0
 .../{ => x86_64}/test_cpu_queries.py          |  0
 .../test_hotplug_blk.py}                      |  0
 .../test_hotplug_cpu.py}                      |  0
 .../{ => x86_64}/test_intel_iommu.py          |  0
 .../test_kvm_xen.py}                          |  0
 .../{ => x86_64}/test_linux_initrd.py         |  0
 .../{ => x86_64}/test_mem_addr_space.py       |  0
 tests/functional/{ => x86_64}/test_memlock.py |  0
 .../test_migration.py}                        |  0
 .../test_multiprocess.py}                     |  0
 .../{ => x86_64}/test_netdev_ethtool.py       |  0
 .../{ => x86_64}/test_pc_cpu_hotplug_props.py |  0
 .../test_replay.py}                           |  0
 .../test_reverse_debug.py}                    |  0
 .../test_tuxrun.py}                           |  0
 .../{ => x86_64}/test_virtio_balloon.py       |  0
 .../{ => x86_64}/test_virtio_gpu.py           |  0
 .../{ => x86_64}/test_virtio_version.py       |  0
 23 files changed, 55 insertions(+), 51 deletions(-)
 create mode 100644 tests/functional/x86_64/meson.build
 rename tests/functional/{ => x86_64}/test_acpi_bits.py (100%)
 rename tests/functional/{test_x86_cpu_model_versions.py => x86_64/test_cpu_model_versions.py} (100%)
 rename tests/functional/{ => x86_64}/test_cpu_queries.py (100%)
 rename tests/functional/{test_x86_64_hotplug_blk.py => x86_64/test_hotplug_blk.py} (100%)
 rename tests/functional/{test_x86_64_hotplug_cpu.py => x86_64/test_hotplug_cpu.py} (100%)
 rename tests/functional/{ => x86_64}/test_intel_iommu.py (100%)
 rename tests/functional/{test_x86_64_kvm_xen.py => x86_64/test_kvm_xen.py} (100%)
 rename tests/functional/{ => x86_64}/test_linux_initrd.py (100%)
 rename tests/functional/{ => x86_64}/test_mem_addr_space.py (100%)
 rename tests/functional/{ => x86_64}/test_memlock.py (100%)
 rename tests/functional/{test_x86_64_migration.py => x86_64/test_migration.py} (100%)
 rename tests/functional/{test_x86_64_multiprocess.py => x86_64/test_multiprocess.py} (100%)
 rename tests/functional/{ => x86_64}/test_netdev_ethtool.py (100%)
 rename tests/functional/{ => x86_64}/test_pc_cpu_hotplug_props.py (100%)
 rename tests/functional/{test_x86_64_replay.py => x86_64/test_replay.py} (100%)
 rename tests/functional/{test_x86_64_reverse_debug.py => x86_64/test_reverse_debug.py} (100%)
 rename tests/functional/{test_x86_64_tuxrun.py => x86_64/test_tuxrun.py} (100%)
 rename tests/functional/{ => x86_64}/test_virtio_balloon.py (100%)
 rename tests/functional/{ => x86_64}/test_virtio_gpu.py (100%)
 rename tests/functional/{ => x86_64}/test_virtio_version.py (100%)

diff --git a/MAINTAINERS b/MAINTAINERS
index b46445ff5c0..7b1a94f696c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -147,6 +147,7 @@ F: target/i386/Kconfig
 F: target/i386/meson.build
 F: tools/i386/
 F: tests/functional/i386/
+F: tests/functional/x86_64/
 
 Guest CPU cores (TCG)
 ---------------------
@@ -483,7 +484,7 @@ F: docs/system/i386/sgx.rst
 F: target/i386/kvm/
 F: target/i386/sev*
 F: scripts/kvm/vmxcap
-F: tests/functional/test_x86_64_hotplug_cpu.py
+F: tests/functional/x86_64/test_hotplug_cpu.py
 
 Xen emulation on X86 KVM CPUs
 M: David Woodhouse <dwmw2@infradead.org>
@@ -492,7 +493,7 @@ S: Supported
 F: include/system/kvm_xen.h
 F: target/i386/kvm/xen*
 F: hw/i386/kvm/xen*
-F: tests/functional/test_x86_64_kvm_xen.py
+F: tests/functional/x86_64/test_kvm_xen.py
 
 Guest CPU Cores (other accelerators)
 ------------------------------------
@@ -1894,11 +1895,11 @@ F: include/hw/isa/apm.h
 F: tests/unit/test-x86-topo.c
 F: tests/qtest/test-x86-cpuid-compat.c
 F: tests/functional/i386/test_tuxrun.py
-F: tests/functional/test_linux_initrd.py
-F: tests/functional/test_mem_addr_space.py
-F: tests/functional/test_pc_cpu_hotplug_props.py
-F: tests/functional/test_x86_64_tuxrun.py
-F: tests/functional/test_x86_cpu_model_versions.py
+F: tests/functional/x86_64/test_linux_initrd.py
+F: tests/functional/x86_64/test_mem_addr_space.py
+F: tests/functional/x86_64/test_pc_cpu_hotplug_props.py
+F: tests/functional/x86_64/test_tuxrun.py
+F: tests/functional/x86_64/test_cpu_model_versions.py
 
 PC Chipset
 M: Michael S. Tsirkin <mst@redhat.com>
@@ -1974,7 +1975,7 @@ F: include/hw/boards.h
 F: include/hw/core/cpu.h
 F: include/hw/cpu/cluster.h
 F: include/system/numa.h
-F: tests/functional/test_cpu_queries.py
+F: tests/functional/x86_64/test_cpu_queries.py
 F: tests/functional/test_empty_cpu_model.py
 F: tests/unit/test-smp-parse.c
 T: git https://gitlab.com/ehabkost/qemu.git machine-next
@@ -2159,7 +2160,7 @@ M: Ani Sinha <anisinha@redhat.com>
 M: Michael S. Tsirkin <mst@redhat.com>
 S: Supported
 F: tests/functional/acpi-bits/*
-F: tests/functional/test_acpi_bits.py
+F: tests/functional/x86_64/test_acpi_bits.py
 F: docs/devel/testing/acpi-bits.rst
 
 ACPI/HEST/GHES
@@ -2345,7 +2346,7 @@ F: net/vhost-user.c
 F: include/hw/virtio/
 F: docs/devel/virtio*
 F: docs/devel/migration/virtio.rst
-F: tests/functional/test_virtio_version.py
+F: tests/functional/x86_64/test_virtio_version.py
 
 virtio-balloon
 M: Michael S. Tsirkin <mst@redhat.com>
@@ -2357,7 +2358,7 @@ F: include/hw/virtio/virtio-balloon.h
 F: system/balloon.c
 F: include/system/balloon.h
 F: tests/qtest/virtio-balloon-test.c
-F: tests/functional/test_virtio_balloon.py
+F: tests/functional/x86_64/test_virtio_balloon.py
 
 virtio-9p
 M: Christian Schoenebeck <qemu_oss@crudebyte.com>
@@ -2380,7 +2381,7 @@ F: hw/block/virtio-blk.c
 F: hw/block/dataplane/*
 F: include/hw/virtio/virtio-blk-common.h
 F: tests/qtest/virtio-blk-test.c
-F: tests/functional/test_x86_64_hotplug_blk.py
+F: tests/functional/x86_64/test_hotplug_blk.py
 T: git https://github.com/stefanha/qemu.git block
 
 virtio-ccw
@@ -2604,7 +2605,7 @@ R: Sriram Yagnaraman <sriram.yagnaraman@ericsson.com>
 S: Odd Fixes
 F: docs/system/devices/igb.rst
 F: hw/net/igb*
-F: tests/functional/test_netdev_ethtool.py
+F: tests/functional/x86_64/test_netdev_ethtool.py
 F: tests/qtest/igb-test.c
 F: tests/qtest/libqos/igb.c
 
@@ -2713,6 +2714,7 @@ F: hw/display/virtio-vga.*
 F: include/hw/virtio/virtio-gpu.h
 F: docs/system/devices/virtio-gpu.rst
 F: tests/functional/aarch64/test_virt_gpu.py
+F: tests/functional/x86_64/test_virtio_gpu.py
 
 vhost-user-blk
 M: Raphael Norwitz <raphael@enfabrica.net>
@@ -3856,7 +3858,7 @@ S: Supported
 F: hw/i386/intel_iommu.c
 F: hw/i386/intel_iommu_internal.h
 F: include/hw/i386/intel_iommu.h
-F: tests/functional/test_intel_iommu.py
+F: tests/functional/x86_64/test_intel_iommu.py
 F: tests/qtest/intel-iommu-test.c
 
 AMD-Vi Emulation
@@ -4330,7 +4332,7 @@ F: scripts/ci/
 F: tests/docker/
 F: tests/vm/
 F: tests/lcitool/
-F: tests/functional/test_*_tuxrun.py
+F: tests/functional/*/test_tuxrun.py
 F: scripts/archive-source.sh
 F: docs/devel/testing/ci*
 F: docs/devel/testing/main.rst
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index 00d18dba3ce..34e30239a6b 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -34,15 +34,7 @@ subdir('sh4')
 subdir('sh4eb')
 subdir('sparc')
 subdir('sparc64')
-
-test_x86_64_timeouts = {
-  'acpi_bits' : 420,
-  'intel_iommu': 300,
-  'netdev_ethtool' : 180,
-  'virtio_balloon': 120,
-  'x86_64_kvm_xen' : 180,
-  'x86_64_replay' : 480,
-}
+subdir('x86_64')
 
 tests_generic_system = [
   'empty_cpu_model',
@@ -56,33 +48,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_x86_64_system_quick = [
-  'cpu_queries',
-  'mem_addr_space',
-  'x86_64_migration',
-  'pc_cpu_hotplug_props',
-  'virtio_version',
-  'x86_cpu_model_versions',
-  'vnc',
-  'memlock',
-]
-
-tests_x86_64_system_thorough = [
-  'acpi_bits',
-  'intel_iommu',
-  'linux_initrd',
-  'x86_64_multiprocess',
-  'netdev_ethtool',
-  'virtio_balloon',
-  'virtio_gpu',
-  'x86_64_hotplug_blk',
-  'x86_64_hotplug_cpu',
-  'x86_64_kvm_xen',
-  'x86_64_replay',
-  'x86_64_reverse_debug',
-  'x86_64_tuxrun',
-]
-
 tests_xtensa_system_thorough = [
   'xtensa_lx60',
   'xtensa_replay',
diff --git a/tests/functional/x86_64/meson.build b/tests/functional/x86_64/meson.build
new file mode 100644
index 00000000000..696a9ecab42
--- /dev/null
+++ b/tests/functional/x86_64/meson.build
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+test_x86_64_timeouts = {
+  'acpi_bits' : 420,
+  'intel_iommu': 300,
+  'kvm_xen' : 180,
+  'netdev_ethtool' : 180,
+  'replay' : 480,
+  'virtio_balloon': 120,
+}
+
+tests_x86_64_system_quick = [
+  'cpu_model_versions',
+  'cpu_queries',
+  'mem_addr_space',
+  'migration',
+  'pc_cpu_hotplug_props',
+  'virtio_version',
+  'vnc',
+  'memlock',
+]
+
+tests_x86_64_system_thorough = [
+  'acpi_bits',
+  'hotplug_blk',
+  'hotplug_cpu',
+  'intel_iommu',
+  'kvm_xen',
+  'linux_initrd',
+  'multiprocess',
+  'netdev_ethtool',
+  'replay',
+  'reverse_debug',
+  'tuxrun',
+  'virtio_balloon',
+  'virtio_gpu',
+]
diff --git a/tests/functional/test_acpi_bits.py b/tests/functional/x86_64/test_acpi_bits.py
similarity index 100%
rename from tests/functional/test_acpi_bits.py
rename to tests/functional/x86_64/test_acpi_bits.py
diff --git a/tests/functional/test_x86_cpu_model_versions.py b/tests/functional/x86_64/test_cpu_model_versions.py
similarity index 100%
rename from tests/functional/test_x86_cpu_model_versions.py
rename to tests/functional/x86_64/test_cpu_model_versions.py
diff --git a/tests/functional/test_cpu_queries.py b/tests/functional/x86_64/test_cpu_queries.py
similarity index 100%
rename from tests/functional/test_cpu_queries.py
rename to tests/functional/x86_64/test_cpu_queries.py
diff --git a/tests/functional/test_x86_64_hotplug_blk.py b/tests/functional/x86_64/test_hotplug_blk.py
similarity index 100%
rename from tests/functional/test_x86_64_hotplug_blk.py
rename to tests/functional/x86_64/test_hotplug_blk.py
diff --git a/tests/functional/test_x86_64_hotplug_cpu.py b/tests/functional/x86_64/test_hotplug_cpu.py
similarity index 100%
rename from tests/functional/test_x86_64_hotplug_cpu.py
rename to tests/functional/x86_64/test_hotplug_cpu.py
diff --git a/tests/functional/test_intel_iommu.py b/tests/functional/x86_64/test_intel_iommu.py
similarity index 100%
rename from tests/functional/test_intel_iommu.py
rename to tests/functional/x86_64/test_intel_iommu.py
diff --git a/tests/functional/test_x86_64_kvm_xen.py b/tests/functional/x86_64/test_kvm_xen.py
similarity index 100%
rename from tests/functional/test_x86_64_kvm_xen.py
rename to tests/functional/x86_64/test_kvm_xen.py
diff --git a/tests/functional/test_linux_initrd.py b/tests/functional/x86_64/test_linux_initrd.py
similarity index 100%
rename from tests/functional/test_linux_initrd.py
rename to tests/functional/x86_64/test_linux_initrd.py
diff --git a/tests/functional/test_mem_addr_space.py b/tests/functional/x86_64/test_mem_addr_space.py
similarity index 100%
rename from tests/functional/test_mem_addr_space.py
rename to tests/functional/x86_64/test_mem_addr_space.py
diff --git a/tests/functional/test_memlock.py b/tests/functional/x86_64/test_memlock.py
similarity index 100%
rename from tests/functional/test_memlock.py
rename to tests/functional/x86_64/test_memlock.py
diff --git a/tests/functional/test_x86_64_migration.py b/tests/functional/x86_64/test_migration.py
similarity index 100%
rename from tests/functional/test_x86_64_migration.py
rename to tests/functional/x86_64/test_migration.py
diff --git a/tests/functional/test_x86_64_multiprocess.py b/tests/functional/x86_64/test_multiprocess.py
similarity index 100%
rename from tests/functional/test_x86_64_multiprocess.py
rename to tests/functional/x86_64/test_multiprocess.py
diff --git a/tests/functional/test_netdev_ethtool.py b/tests/functional/x86_64/test_netdev_ethtool.py
similarity index 100%
rename from tests/functional/test_netdev_ethtool.py
rename to tests/functional/x86_64/test_netdev_ethtool.py
diff --git a/tests/functional/test_pc_cpu_hotplug_props.py b/tests/functional/x86_64/test_pc_cpu_hotplug_props.py
similarity index 100%
rename from tests/functional/test_pc_cpu_hotplug_props.py
rename to tests/functional/x86_64/test_pc_cpu_hotplug_props.py
diff --git a/tests/functional/test_x86_64_replay.py b/tests/functional/x86_64/test_replay.py
similarity index 100%
rename from tests/functional/test_x86_64_replay.py
rename to tests/functional/x86_64/test_replay.py
diff --git a/tests/functional/test_x86_64_reverse_debug.py b/tests/functional/x86_64/test_reverse_debug.py
similarity index 100%
rename from tests/functional/test_x86_64_reverse_debug.py
rename to tests/functional/x86_64/test_reverse_debug.py
diff --git a/tests/functional/test_x86_64_tuxrun.py b/tests/functional/x86_64/test_tuxrun.py
similarity index 100%
rename from tests/functional/test_x86_64_tuxrun.py
rename to tests/functional/x86_64/test_tuxrun.py
diff --git a/tests/functional/test_virtio_balloon.py b/tests/functional/x86_64/test_virtio_balloon.py
similarity index 100%
rename from tests/functional/test_virtio_balloon.py
rename to tests/functional/x86_64/test_virtio_balloon.py
diff --git a/tests/functional/test_virtio_gpu.py b/tests/functional/x86_64/test_virtio_gpu.py
similarity index 100%
rename from tests/functional/test_virtio_gpu.py
rename to tests/functional/x86_64/test_virtio_gpu.py
diff --git a/tests/functional/test_virtio_version.py b/tests/functional/x86_64/test_virtio_version.py
similarity index 100%
rename from tests/functional/test_virtio_version.py
rename to tests/functional/x86_64/test_virtio_version.py
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 045/281] rust/qemu-api-macros: make derive(Object) friendly when missing parent
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (17 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 034/281] tests/functional: Move x86_64 tests into target-specific folder Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 048/281] semihosting: Retrieve stack top from image_info Alex Bennée
                   ` (14 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20250826133132.4064478-5-marcandre.lureau@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/qemu-api-macros/src/lib.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/rust/qemu-api-macros/src/lib.rs b/rust/qemu-api-macros/src/lib.rs
index b525d89c09e..a6147418891 100644
--- a/rust/qemu-api-macros/src/lib.rs
+++ b/rust/qemu-api-macros/src/lib.rs
@@ -85,7 +85,15 @@ fn derive_object_or_error(input: DeriveInput) -> Result<proc_macro2::TokenStream
     is_c_repr(&input, "#[derive(Object)]")?;
 
     let name = &input.ident;
-    let parent = &get_fields(&input, "#[derive(Object)]")?[0].ident;
+    let parent = &get_fields(&input, "#[derive(Object)]")?
+        .get(0)
+        .ok_or_else(|| {
+            Error::new(
+                input.ident.span(),
+                "#[derive(Object)] requires a parent field",
+            )
+        })?
+        .ident;
 
     Ok(quote! {
         ::qemu_api::assert_field_type!(#name, #parent,
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 048/281] semihosting: Retrieve stack top from image_info
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (18 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 045/281] rust/qemu-api-macros: make derive(Object) friendly when missing parent Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 049/281] semihosting: Initialize heap once per process Alex Bennée
                   ` (13 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Remove the write-once field TaskState.stack_base, and use the
same value from struct image_info.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/qemu.h             | 1 -
 linux-user/aarch64/cpu_loop.c | 1 -
 linux-user/arm/cpu_loop.c     | 1 -
 linux-user/m68k/cpu_loop.c    | 1 -
 linux-user/riscv/cpu_loop.c   | 1 -
 semihosting/arm-compat-semi.c | 6 +++++-
 6 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 0b19fa43e65..b6621536b36 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -127,7 +127,6 @@ struct TaskState {
     abi_ulong heap_base;
     abi_ulong heap_limit;
 #endif
-    abi_ulong stack_base;
     int used; /* non zero if used */
     struct image_info *info;
     struct linux_binprm *bprm;
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index fea43cefa6b..b65999a75bf 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -168,7 +168,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
         qemu_guest_getrandom_nofail(&env->keys, sizeof(env->keys));
     }
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index 33f63951a95..e40d6beafa2 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -504,7 +504,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     arm_rebuild_hflags(env);
 #endif
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c
index 5da91b997ae..3aaaf02ca4e 100644
--- a/linux-user/m68k/cpu_loop.c
+++ b/linux-user/m68k/cpu_loop.c
@@ -117,7 +117,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     env->aregs[7] = regs->usp;
     env->sr = regs->sr;
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index 3ac8bbfec1f..541de765ffa 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -109,7 +109,6 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
         exit(EXIT_FAILURE);
     }
 
-    ts->stack_base = info->start_stack;
     ts->heap_base = info->brk;
     /* This will be filled in on the first SYS_HEAPINFO call.  */
     ts->heap_limit = 0;
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 86e5260e504..bc04b02eba8 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -696,7 +696,11 @@ void do_common_semihosting(CPUState *cs)
 
             retvals[0] = ts->heap_base;
             retvals[1] = ts->heap_limit;
-            retvals[2] = ts->stack_base;
+            /*
+             * Note that semihosting is *not* thread aware.
+             * Always return the stack base of the main thread.
+             */
+            retvals[2] = ts->info->start_stack;
             retvals[3] = 0; /* Stack limit.  */
 #else
             retvals[0] = info.heapbase;  /* Heap Base */
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 049/281] semihosting: Initialize heap once per process
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (19 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 048/281] semihosting: Retrieve stack top from image_info Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 051/281] linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h Alex Bennée
                   ` (12 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

While semihosting isn't really thread aware, the current
implementation allocates space for the heap per-thread.

Remove the heap_base and heap_limit fields from TaskState.
Replace with static variables within do_common_semihosting.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/qemu.h             |  5 -----
 linux-user/aarch64/cpu_loop.c |  7 -------
 linux-user/arm/cpu_loop.c     | 25 +++++++++++--------------
 linux-user/m68k/cpu_loop.c    |  8 --------
 linux-user/riscv/cpu_loop.c   |  4 ----
 semihosting/arm-compat-semi.c | 22 +++++++++-------------
 6 files changed, 20 insertions(+), 51 deletions(-)

diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index b6621536b36..4d6fad28c63 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -121,11 +121,6 @@ struct TaskState {
     abi_ulong child_tidptr;
 #ifdef TARGET_M68K
     abi_ulong tp_value;
-#endif
-#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_RISCV)
-    /* Extra fields for semihosted binaries.  */
-    abi_ulong heap_base;
-    abi_ulong heap_limit;
 #endif
     int used; /* non zero if used */
     struct image_info *info;
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index b65999a75bf..030a630c936 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -140,9 +140,6 @@ void cpu_loop(CPUARMState *env)
 void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
 {
     ARMCPU *cpu = env_archcpu(env);
-    CPUState *cs = env_cpu(env);
-    TaskState *ts = get_task_state(cs);
-    struct image_info *info = ts->info;
     int i;
 
     if (!(arm_feature(env, ARM_FEATURE_AARCH64))) {
@@ -167,8 +164,4 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     if (cpu_isar_feature(aa64_pauth, cpu)) {
         qemu_guest_getrandom_nofail(&env->keys, sizeof(env->keys));
     }
-
-    ts->heap_base = info->brk;
-    /* This will be filled in on the first SYS_HEAPINFO call.  */
-    ts->heap_limit = 0;
 }
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index e40d6beafa2..9d54422736c 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -492,19 +492,16 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     for(i = 0; i < 16; i++) {
         env->regs[i] = regs->uregs[i];
     }
-#if TARGET_BIG_ENDIAN
-    /* Enable BE8.  */
-    if (EF_ARM_EABI_VERSION(info->elf_flags) >= EF_ARM_EABI_VER4
-        && (info->elf_flags & EF_ARM_BE8)) {
-        env->uncached_cpsr |= CPSR_E;
-        env->cp15.sctlr_el[1] |= SCTLR_E0E;
-    } else {
-        env->cp15.sctlr_el[1] |= SCTLR_B;
-    }
-    arm_rebuild_hflags(env);
-#endif
 
-    ts->heap_base = info->brk;
-    /* This will be filled in on the first SYS_HEAPINFO call.  */
-    ts->heap_limit = 0;
+    if (TARGET_BIG_ENDIAN) {
+        /* Enable BE8.  */
+        if (EF_ARM_EABI_VERSION(info->elf_flags) >= EF_ARM_EABI_VER4
+            && (info->elf_flags & EF_ARM_BE8)) {
+            env->uncached_cpsr |= CPSR_E;
+            env->cp15.sctlr_el[1] |= SCTLR_E0E;
+        } else {
+            env->cp15.sctlr_el[1] |= SCTLR_B;
+        }
+        arm_rebuild_hflags(env);
+    }
 }
diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c
index 3aaaf02ca4e..23693f33582 100644
--- a/linux-user/m68k/cpu_loop.c
+++ b/linux-user/m68k/cpu_loop.c
@@ -94,10 +94,6 @@ void cpu_loop(CPUM68KState *env)
 
 void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
 {
-    CPUState *cpu = env_cpu(env);
-    TaskState *ts = get_task_state(cpu);
-    struct image_info *info = ts->info;
-
     env->pc = regs->pc;
     env->dregs[0] = regs->d0;
     env->dregs[1] = regs->d1;
@@ -116,8 +112,4 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
     env->aregs[6] = regs->a6;
     env->aregs[7] = regs->usp;
     env->sr = regs->sr;
-
-    ts->heap_base = info->brk;
-    /* This will be filled in on the first SYS_HEAPINFO call.  */
-    ts->heap_limit = 0;
 }
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index 541de765ffa..2dd30c7b288 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -108,8 +108,4 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
         error_report("Incompatible ELF: RVE cpu requires RVE ABI binary");
         exit(EXIT_FAILURE);
     }
-
-    ts->heap_base = info->brk;
-    /* This will be filled in on the first SYS_HEAPINFO call.  */
-    ts->heap_limit = 0;
 }
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index bc04b02eba8..bcd13cd6dfd 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -666,7 +666,7 @@ void do_common_semihosting(CPUState *cs)
             int i;
 #ifdef CONFIG_USER_ONLY
             TaskState *ts = get_task_state(cs);
-            target_ulong limit;
+            static abi_ulong heapbase, heaplimit;
 #else
             LayoutInfo info = common_semi_find_bases(cs);
 #endif
@@ -678,24 +678,20 @@ void do_common_semihosting(CPUState *cs)
              * Some C libraries assume the heap immediately follows .bss, so
              * allocate it using sbrk.
              */
-            if (!ts->heap_limit) {
-                abi_ulong ret;
-
-                ts->heap_base = do_brk(0);
-                limit = ts->heap_base + COMMON_SEMI_HEAP_SIZE;
+            if (!heaplimit) {
+                heapbase = do_brk(0);
                 /* Try a big heap, and reduce the size if that fails.  */
-                for (;;) {
-                    ret = do_brk(limit);
+                for (abi_ulong size = COMMON_SEMI_HEAP_SIZE; ; size >>= 1) {
+                    abi_ulong limit = heapbase + size;
+                    abi_ulong ret = do_brk(limit);
                     if (ret >= limit) {
+                        heaplimit = limit;
                         break;
                     }
-                    limit = (ts->heap_base >> 1) + (limit >> 1);
                 }
-                ts->heap_limit = limit;
             }
-
-            retvals[0] = ts->heap_base;
-            retvals[1] = ts->heap_limit;
+            retvals[0] = heapbase;
+            retvals[1] = heaplimit;
             /*
              * Note that semihosting is *not* thread aware.
              * Always return the stack base of the main thread.
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 051/281] linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (20 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 049/281] semihosting: Initialize heap once per process Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 055/281] linux-user: Move get_elf_hwcap to sparc/elfload.c Alex Bennée
                   ` (11 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Move the workaround out of linux-user/elfload.c, so that
we don't have to replicate it in many places.  Place it
immediately after the include of <signal.h>, which draws
in the relevant symbols.

Note that ARCH_DLINFO is not defined by the kernel header,
and so there's no need to undef it either.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/qemu/osdep.h |  8 ++++++++
 hw/core/loader.c     |  4 ----
 linux-user/elfload.c | 10 ----------
 3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 96fe51bc390..be3460b32f2 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -133,6 +133,14 @@ QEMU_EXTERN_C int daemon(int, int);
 #include <setjmp.h>
 #include <signal.h>
 
+/*
+ * Avoid conflict with linux/arch/powerpc/include/uapi/asm/elf.h, included
+ * from <asm/sigcontext.h>, but we might as well do this unconditionally.
+ */
+#undef ELF_CLASS
+#undef ELF_DATA
+#undef ELF_ARCH
+
 #ifdef CONFIG_IOVEC
 #include <sys/uio.h>
 #endif
diff --git a/hw/core/loader.c b/hw/core/loader.c
index e7056ba4bd3..524af6f14a0 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -295,10 +295,6 @@ static void *load_at(int fd, off_t offset, size_t size)
     return ptr;
 }
 
-#ifdef ELF_CLASS
-#undef ELF_CLASS
-#endif
-
 #define ELF_CLASS   ELFCLASS32
 #include "elf.h"
 
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index ea214105ff8..4ca8c39dc26 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -35,16 +35,6 @@
 #include "target/arm/cpu-features.h"
 #endif
 
-#ifdef _ARCH_PPC64
-#undef ARCH_DLINFO
-#undef ELF_PLATFORM
-#undef ELF_HWCAP
-#undef ELF_HWCAP2
-#undef ELF_CLASS
-#undef ELF_DATA
-#undef ELF_ARCH
-#endif
-
 #ifndef TARGET_ARCH_HAS_SIGTRAMP_PAGE
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 0
 #endif
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 055/281] linux-user: Move get_elf_hwcap to sparc/elfload.c
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (21 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 051/281] linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 057/281] linux-user: Move get_elf_hwcap to loongarch64/elfload.c Alex Bennée
                   ` (10 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Change the return type to abi_ulong, and pass in the cpu.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/loader.h           |  3 ++-
 linux-user/sparc/target_elf.h |  2 ++
 linux-user/elfload.c          | 30 +-----------------------------
 linux-user/sparc/elfload.c    | 27 +++++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/linux-user/loader.h b/linux-user/loader.h
index 151a06f5db5..2c8414e0e53 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -101,7 +101,8 @@ extern unsigned long guest_stack_size;
 /* Note that Elf32 and Elf64 use uint32_t for e_flags. */
 const char *get_elf_cpu_model(uint32_t eflags);
 
-#if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_ARM)
+#if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_ARM) \
+    || defined(TARGET_SPARC)
 abi_ulong get_elf_hwcap(CPUState *cs);
 abi_ulong get_elf_hwcap2(CPUState *cs);
 #endif
diff --git a/linux-user/sparc/target_elf.h b/linux-user/sparc/target_elf.h
index 7e46748d261..b7544db0a1c 100644
--- a/linux-user/sparc/target_elf.h
+++ b/linux-user/sparc/target_elf.h
@@ -8,4 +8,6 @@
 #ifndef SPARC_TARGET_ELF_H
 #define SPARC_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 149d1313c0a..16709865f78 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -565,35 +565,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 # define ELF_ARCH   EM_SPARCV9
 #endif
 
-#include "elf.h"
-
-#define ELF_HWCAP get_elf_hwcap()
-
-static uint32_t get_elf_hwcap(void)
-{
-    /* There are not many sparc32 hwcap bits -- we have all of them. */
-    uint32_t r = HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
-                 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV;
-
-#ifdef TARGET_SPARC64
-    CPUSPARCState *env = cpu_env(thread_cpu);
-    uint32_t features = env->def.features;
-
-    r |= HWCAP_SPARC_V9 | HWCAP_SPARC_V8PLUS;
-    /* 32x32 multiply and divide are efficient. */
-    r |= HWCAP_SPARC_MUL32 | HWCAP_SPARC_DIV32;
-    /* We don't have an internal feature bit for this. */
-    r |= HWCAP_SPARC_POPC;
-    r |= features & CPU_FEATURE_FSMULD ? HWCAP_SPARC_FSMULD : 0;
-    r |= features & CPU_FEATURE_VIS1 ? HWCAP_SPARC_VIS : 0;
-    r |= features & CPU_FEATURE_VIS2 ? HWCAP_SPARC_VIS2 : 0;
-    r |= features & CPU_FEATURE_FMAF ? HWCAP_SPARC_FMAF : 0;
-    r |= features & CPU_FEATURE_VIS3 ? HWCAP_SPARC_VIS3 : 0;
-    r |= features & CPU_FEATURE_IMA ? HWCAP_SPARC_IMA : 0;
-#endif
-
-    return r;
-}
+#define ELF_HWCAP get_elf_hwcap(thread_cpu)
 
 static inline void init_thread(struct target_pt_regs *regs,
                                struct image_info *infop)
diff --git a/linux-user/sparc/elfload.c b/linux-user/sparc/elfload.c
index 243e6f9b66a..32ca1b05b1a 100644
--- a/linux-user/sparc/elfload.c
+++ b/linux-user/sparc/elfload.c
@@ -3,6 +3,7 @@
 #include "qemu/osdep.h"
 #include "qemu.h"
 #include "loader.h"
+#include "elf.h"
 
 
 const char *get_elf_cpu_model(uint32_t eflags)
@@ -13,3 +14,29 @@ const char *get_elf_cpu_model(uint32_t eflags)
     return "Fujitsu MB86904";
 #endif
 }
+
+abi_ulong get_elf_hwcap(CPUState *cs)
+{
+    /* There are not many sparc32 hwcap bits -- we have all of them. */
+    uint32_t r = HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR |
+                 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV;
+
+#ifdef TARGET_SPARC64
+    CPUSPARCState *env = cpu_env(cs);
+    uint32_t features = env->def.features;
+
+    r |= HWCAP_SPARC_V9 | HWCAP_SPARC_V8PLUS;
+    /* 32x32 multiply and divide are efficient. */
+    r |= HWCAP_SPARC_MUL32 | HWCAP_SPARC_DIV32;
+    /* We don't have an internal feature bit for this. */
+    r |= HWCAP_SPARC_POPC;
+    r |= features & CPU_FEATURE_FSMULD ? HWCAP_SPARC_FSMULD : 0;
+    r |= features & CPU_FEATURE_VIS1 ? HWCAP_SPARC_VIS : 0;
+    r |= features & CPU_FEATURE_VIS2 ? HWCAP_SPARC_VIS2 : 0;
+    r |= features & CPU_FEATURE_FMAF ? HWCAP_SPARC_FMAF : 0;
+    r |= features & CPU_FEATURE_VIS3 ? HWCAP_SPARC_VIS3 : 0;
+    r |= features & CPU_FEATURE_IMA ? HWCAP_SPARC_IMA : 0;
+#endif
+
+    return r;
+}
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 057/281] linux-user: Move get_elf_hwcap to loongarch64/elfload.c
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (22 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 055/281] linux-user: Move get_elf_hwcap to sparc/elfload.c Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 058/281] linux-user: Move get_elf_hwcap to mips/elfload.c Alex Bennée
                   ` (9 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Change the return type to abi_ulong, and pass in the cpu.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/loader.h                 |  3 +-
 linux-user/loongarch64/target_elf.h |  2 ++
 linux-user/elfload.c                | 49 +----------------------------
 linux-user/loongarch64/elfload.c    | 47 +++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 49 deletions(-)

diff --git a/linux-user/loader.h b/linux-user/loader.h
index 818c5e6d7d7..92b6d41145e 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -102,7 +102,8 @@ extern unsigned long guest_stack_size;
 const char *get_elf_cpu_model(uint32_t eflags);
 
 #if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_ARM) \
-    || defined(TARGET_SPARC) || defined(TARGET_PPC)
+    || defined(TARGET_SPARC) || defined(TARGET_PPC) \
+    || defined(TARGET_LOONGARCH64)
 abi_ulong get_elf_hwcap(CPUState *cs);
 abi_ulong get_elf_hwcap2(CPUState *cs);
 #endif
diff --git a/linux-user/loongarch64/target_elf.h b/linux-user/loongarch64/target_elf.h
index 39a08d35d9b..037740d36f2 100644
--- a/linux-user/loongarch64/target_elf.h
+++ b/linux-user/loongarch64/target_elf.h
@@ -6,4 +6,6 @@
 #ifndef LOONGARCH_TARGET_ELF_H
 #define LOONGARCH_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 843b1f7b6cc..574b37a22c1 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -725,54 +725,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE        4096
 
-#define ELF_HWCAP get_elf_hwcap()
-
-/* See arch/loongarch/include/uapi/asm/hwcap.h */
-enum {
-    HWCAP_LOONGARCH_CPUCFG   = (1 << 0),
-    HWCAP_LOONGARCH_LAM      = (1 << 1),
-    HWCAP_LOONGARCH_UAL      = (1 << 2),
-    HWCAP_LOONGARCH_FPU      = (1 << 3),
-    HWCAP_LOONGARCH_LSX      = (1 << 4),
-    HWCAP_LOONGARCH_LASX     = (1 << 5),
-    HWCAP_LOONGARCH_CRC32    = (1 << 6),
-    HWCAP_LOONGARCH_COMPLEX  = (1 << 7),
-    HWCAP_LOONGARCH_CRYPTO   = (1 << 8),
-    HWCAP_LOONGARCH_LVZ      = (1 << 9),
-    HWCAP_LOONGARCH_LBT_X86  = (1 << 10),
-    HWCAP_LOONGARCH_LBT_ARM  = (1 << 11),
-    HWCAP_LOONGARCH_LBT_MIPS = (1 << 12),
-};
-
-static uint32_t get_elf_hwcap(void)
-{
-    LoongArchCPU *cpu = LOONGARCH_CPU(thread_cpu);
-    uint32_t hwcaps = 0;
-
-    hwcaps |= HWCAP_LOONGARCH_CRC32;
-
-    if (FIELD_EX32(cpu->env.cpucfg[1], CPUCFG1, UAL)) {
-        hwcaps |= HWCAP_LOONGARCH_UAL;
-    }
-
-    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, FP)) {
-        hwcaps |= HWCAP_LOONGARCH_FPU;
-    }
-
-    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LAM)) {
-        hwcaps |= HWCAP_LOONGARCH_LAM;
-    }
-
-    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LSX)) {
-        hwcaps |= HWCAP_LOONGARCH_LSX;
-    }
-
-    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LASX)) {
-        hwcaps |= HWCAP_LOONGARCH_LASX;
-    }
-
-    return hwcaps;
-}
+#define ELF_HWCAP get_elf_hwcap(thread_cpu)
 
 #define ELF_PLATFORM "loongarch"
 
diff --git a/linux-user/loongarch64/elfload.c b/linux-user/loongarch64/elfload.c
index 874dc4c2304..ee4a85b8d6c 100644
--- a/linux-user/loongarch64/elfload.c
+++ b/linux-user/loongarch64/elfload.c
@@ -9,3 +9,50 @@ const char *get_elf_cpu_model(uint32_t eflags)
 {
     return "la464";
 }
+
+/* See arch/loongarch/include/uapi/asm/hwcap.h */
+enum {
+    HWCAP_LOONGARCH_CPUCFG   = (1 << 0),
+    HWCAP_LOONGARCH_LAM      = (1 << 1),
+    HWCAP_LOONGARCH_UAL      = (1 << 2),
+    HWCAP_LOONGARCH_FPU      = (1 << 3),
+    HWCAP_LOONGARCH_LSX      = (1 << 4),
+    HWCAP_LOONGARCH_LASX     = (1 << 5),
+    HWCAP_LOONGARCH_CRC32    = (1 << 6),
+    HWCAP_LOONGARCH_COMPLEX  = (1 << 7),
+    HWCAP_LOONGARCH_CRYPTO   = (1 << 8),
+    HWCAP_LOONGARCH_LVZ      = (1 << 9),
+    HWCAP_LOONGARCH_LBT_X86  = (1 << 10),
+    HWCAP_LOONGARCH_LBT_ARM  = (1 << 11),
+    HWCAP_LOONGARCH_LBT_MIPS = (1 << 12),
+};
+
+abi_ulong get_elf_hwcap(CPUState *cs)
+{
+    LoongArchCPU *cpu = LOONGARCH_CPU(cs);
+    abi_ulong hwcaps = 0;
+
+    hwcaps |= HWCAP_LOONGARCH_CRC32;
+
+    if (FIELD_EX32(cpu->env.cpucfg[1], CPUCFG1, UAL)) {
+        hwcaps |= HWCAP_LOONGARCH_UAL;
+    }
+
+    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, FP)) {
+        hwcaps |= HWCAP_LOONGARCH_FPU;
+    }
+
+    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LAM)) {
+        hwcaps |= HWCAP_LOONGARCH_LAM;
+    }
+
+    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LSX)) {
+        hwcaps |= HWCAP_LOONGARCH_LSX;
+    }
+
+    if (FIELD_EX32(cpu->env.cpucfg[2], CPUCFG2, LASX)) {
+        hwcaps |= HWCAP_LOONGARCH_LASX;
+    }
+
+    return hwcaps;
+}
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 058/281] linux-user: Move get_elf_hwcap to mips/elfload.c
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (23 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 057/281] linux-user: Move get_elf_hwcap to loongarch64/elfload.c Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 059/281] linux-user: Move get_elf_hwcap to sh4/elfload.c Alex Bennée
                   ` (8 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Change the return type to abi_ulong, and pass in the cpu.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/loader.h            |  2 +-
 linux-user/mips/target_elf.h   |  2 ++
 linux-user/mips64/target_elf.h |  2 ++
 linux-user/elfload.c           | 52 +---------------------------------
 linux-user/mips/elfload.c      | 50 ++++++++++++++++++++++++++++++++
 5 files changed, 56 insertions(+), 52 deletions(-)

diff --git a/linux-user/loader.h b/linux-user/loader.h
index 92b6d41145e..04457737dd4 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -103,7 +103,7 @@ const char *get_elf_cpu_model(uint32_t eflags);
 
 #if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_ARM) \
     || defined(TARGET_SPARC) || defined(TARGET_PPC) \
-    || defined(TARGET_LOONGARCH64)
+    || defined(TARGET_LOONGARCH64) || defined(TARGET_MIPS)
 abi_ulong get_elf_hwcap(CPUState *cs);
 abi_ulong get_elf_hwcap2(CPUState *cs);
 #endif
diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h
index febf710c7ae..877f8347d70 100644
--- a/linux-user/mips/target_elf.h
+++ b/linux-user/mips/target_elf.h
@@ -8,4 +8,6 @@
 #ifndef MIPS_TARGET_ELF_H
 #define MIPS_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
diff --git a/linux-user/mips64/target_elf.h b/linux-user/mips64/target_elf.h
index 02e6d14840a..c0347e5cb6e 100644
--- a/linux-user/mips64/target_elf.h
+++ b/linux-user/mips64/target_elf.h
@@ -8,4 +8,6 @@
 #ifndef MIPS64_TARGET_ELF_H
 #define MIPS64_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 574b37a22c1..dc3f502277a 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -834,57 +834,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMIPSState *e
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE        4096
 
-/* See arch/mips/include/uapi/asm/hwcap.h.  */
-enum {
-    HWCAP_MIPS_R6           = (1 << 0),
-    HWCAP_MIPS_MSA          = (1 << 1),
-    HWCAP_MIPS_CRC32        = (1 << 2),
-    HWCAP_MIPS_MIPS16       = (1 << 3),
-    HWCAP_MIPS_MDMX         = (1 << 4),
-    HWCAP_MIPS_MIPS3D       = (1 << 5),
-    HWCAP_MIPS_SMARTMIPS    = (1 << 6),
-    HWCAP_MIPS_DSP          = (1 << 7),
-    HWCAP_MIPS_DSP2         = (1 << 8),
-    HWCAP_MIPS_DSP3         = (1 << 9),
-    HWCAP_MIPS_MIPS16E2     = (1 << 10),
-    HWCAP_LOONGSON_MMI      = (1 << 11),
-    HWCAP_LOONGSON_EXT      = (1 << 12),
-    HWCAP_LOONGSON_EXT2     = (1 << 13),
-    HWCAP_LOONGSON_CPUCFG   = (1 << 14),
-};
-
-#define ELF_HWCAP get_elf_hwcap()
-
-#define GET_FEATURE_INSN(_flag, _hwcap) \
-    do { if (cpu->env.insn_flags & (_flag)) { hwcaps |= _hwcap; } } while (0)
-
-#define GET_FEATURE_REG_SET(_reg, _mask, _hwcap) \
-    do { if (cpu->env._reg & (_mask)) { hwcaps |= _hwcap; } } while (0)
-
-#define GET_FEATURE_REG_EQU(_reg, _start, _length, _val, _hwcap) \
-    do { \
-        if (extract32(cpu->env._reg, (_start), (_length)) == (_val)) { \
-            hwcaps |= _hwcap; \
-        } \
-    } while (0)
-
-static uint32_t get_elf_hwcap(void)
-{
-    MIPSCPU *cpu = MIPS_CPU(thread_cpu);
-    uint32_t hwcaps = 0;
-
-    GET_FEATURE_REG_EQU(CP0_Config0, CP0C0_AR, CP0C0_AR_LENGTH,
-                        2, HWCAP_MIPS_R6);
-    GET_FEATURE_REG_SET(CP0_Config3, 1 << CP0C3_MSAP, HWCAP_MIPS_MSA);
-    GET_FEATURE_INSN(ASE_LMMI, HWCAP_LOONGSON_MMI);
-    GET_FEATURE_INSN(ASE_LEXT, HWCAP_LOONGSON_EXT);
-
-    return hwcaps;
-}
-
-#undef GET_FEATURE_REG_EQU
-#undef GET_FEATURE_REG_SET
-#undef GET_FEATURE_INSN
+#define ELF_HWCAP get_elf_hwcap(thread_cpu)
 
 #endif /* TARGET_MIPS */
 
diff --git a/linux-user/mips/elfload.c b/linux-user/mips/elfload.c
index 04e3b767401..739f71c21b1 100644
--- a/linux-user/mips/elfload.c
+++ b/linux-user/mips/elfload.c
@@ -42,3 +42,53 @@ const char *get_elf_cpu_model(uint32_t eflags)
     return "24Kf";
 #endif
 }
+
+/* See arch/mips/include/uapi/asm/hwcap.h.  */
+enum {
+    HWCAP_MIPS_R6           = (1 << 0),
+    HWCAP_MIPS_MSA          = (1 << 1),
+    HWCAP_MIPS_CRC32        = (1 << 2),
+    HWCAP_MIPS_MIPS16       = (1 << 3),
+    HWCAP_MIPS_MDMX         = (1 << 4),
+    HWCAP_MIPS_MIPS3D       = (1 << 5),
+    HWCAP_MIPS_SMARTMIPS    = (1 << 6),
+    HWCAP_MIPS_DSP          = (1 << 7),
+    HWCAP_MIPS_DSP2         = (1 << 8),
+    HWCAP_MIPS_DSP3         = (1 << 9),
+    HWCAP_MIPS_MIPS16E2     = (1 << 10),
+    HWCAP_LOONGSON_MMI      = (1 << 11),
+    HWCAP_LOONGSON_EXT      = (1 << 12),
+    HWCAP_LOONGSON_EXT2     = (1 << 13),
+    HWCAP_LOONGSON_CPUCFG   = (1 << 14),
+};
+
+#define GET_FEATURE_INSN(_flag, _hwcap) \
+    do { if (cpu->env.insn_flags & (_flag)) { hwcaps |= _hwcap; } } while (0)
+
+#define GET_FEATURE_REG_SET(_reg, _mask, _hwcap) \
+    do { if (cpu->env._reg & (_mask)) { hwcaps |= _hwcap; } } while (0)
+
+#define GET_FEATURE_REG_EQU(_reg, _start, _length, _val, _hwcap) \
+    do { \
+        if (extract32(cpu->env._reg, (_start), (_length)) == (_val)) { \
+            hwcaps |= _hwcap; \
+        } \
+    } while (0)
+
+abi_ulong get_elf_hwcap(CPUState *cs)
+{
+    MIPSCPU *cpu = MIPS_CPU(cs);
+    abi_ulong hwcaps = 0;
+
+    GET_FEATURE_REG_EQU(CP0_Config0, CP0C0_AR, CP0C0_AR_LENGTH,
+                        2, HWCAP_MIPS_R6);
+    GET_FEATURE_REG_SET(CP0_Config3, 1 << CP0C3_MSAP, HWCAP_MIPS_MSA);
+    GET_FEATURE_INSN(ASE_LMMI, HWCAP_LOONGSON_MMI);
+    GET_FEATURE_INSN(ASE_LEXT, HWCAP_LOONGSON_EXT);
+
+    return hwcaps;
+}
+
+#undef GET_FEATURE_REG_EQU
+#undef GET_FEATURE_REG_SET
+#undef GET_FEATURE_INSN
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 059/281] linux-user: Move get_elf_hwcap to sh4/elfload.c
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (24 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 058/281] linux-user: Move get_elf_hwcap to mips/elfload.c Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 069/281] linux-user: Remove ELF_PLATFORM Alex Bennée
                   ` (7 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Change the return type to abi_ulong, and pass in the cpu.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/loader.h         |  3 ++-
 linux-user/sh4/target_elf.h |  2 ++
 linux-user/elfload.c        | 29 +----------------------------
 linux-user/sh4/elfload.c    | 27 +++++++++++++++++++++++++++
 4 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/linux-user/loader.h b/linux-user/loader.h
index 04457737dd4..d8a93998076 100644
--- a/linux-user/loader.h
+++ b/linux-user/loader.h
@@ -103,7 +103,8 @@ const char *get_elf_cpu_model(uint32_t eflags);
 
 #if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_ARM) \
     || defined(TARGET_SPARC) || defined(TARGET_PPC) \
-    || defined(TARGET_LOONGARCH64) || defined(TARGET_MIPS)
+    || defined(TARGET_LOONGARCH64) || defined(TARGET_MIPS) \
+    || defined(TARGET_SH4)
 abi_ulong get_elf_hwcap(CPUState *cs);
 abi_ulong get_elf_hwcap2(CPUState *cs);
 #endif
diff --git a/linux-user/sh4/target_elf.h b/linux-user/sh4/target_elf.h
index d17011bd752..badd0f5371f 100644
--- a/linux-user/sh4/target_elf.h
+++ b/linux-user/sh4/target_elf.h
@@ -8,4 +8,6 @@
 #ifndef SH4_TARGET_ELF_H
 #define SH4_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index dc3f502277a..7e1c11c39f2 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -963,34 +963,7 @@ static inline void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE        4096
 
-enum {
-    SH_CPU_HAS_FPU            = 0x0001, /* Hardware FPU support */
-    SH_CPU_HAS_P2_FLUSH_BUG   = 0x0002, /* Need to flush the cache in P2 area */
-    SH_CPU_HAS_MMU_PAGE_ASSOC = 0x0004, /* SH3: TLB way selection bit support */
-    SH_CPU_HAS_DSP            = 0x0008, /* SH-DSP: DSP support */
-    SH_CPU_HAS_PERF_COUNTER   = 0x0010, /* Hardware performance counters */
-    SH_CPU_HAS_PTEA           = 0x0020, /* PTEA register */
-    SH_CPU_HAS_LLSC           = 0x0040, /* movli.l/movco.l */
-    SH_CPU_HAS_L2_CACHE       = 0x0080, /* Secondary cache / URAM */
-    SH_CPU_HAS_OP32           = 0x0100, /* 32-bit instruction support */
-    SH_CPU_HAS_PTEAEX         = 0x0200, /* PTE ASID Extension support */
-};
-
-#define ELF_HWCAP get_elf_hwcap()
-
-static uint32_t get_elf_hwcap(void)
-{
-    SuperHCPU *cpu = SUPERH_CPU(thread_cpu);
-    uint32_t hwcap = 0;
-
-    hwcap |= SH_CPU_HAS_FPU;
-
-    if (cpu->env.features & SH_FEATURE_SH4A) {
-        hwcap |= SH_CPU_HAS_LLSC;
-    }
-
-    return hwcap;
-}
+#define ELF_HWCAP get_elf_hwcap(thread_cpu)
 
 #endif
 
diff --git a/linux-user/sh4/elfload.c b/linux-user/sh4/elfload.c
index 546034ec07e..99ad4f6334c 100644
--- a/linux-user/sh4/elfload.c
+++ b/linux-user/sh4/elfload.c
@@ -9,3 +9,30 @@ const char *get_elf_cpu_model(uint32_t eflags)
 {
     return "sh7785";
 }
+
+enum {
+    SH_CPU_HAS_FPU            = 0x0001, /* Hardware FPU support */
+    SH_CPU_HAS_P2_FLUSH_BUG   = 0x0002, /* Need to flush the cache in P2 area */
+    SH_CPU_HAS_MMU_PAGE_ASSOC = 0x0004, /* SH3: TLB way selection bit support */
+    SH_CPU_HAS_DSP            = 0x0008, /* SH-DSP: DSP support */
+    SH_CPU_HAS_PERF_COUNTER   = 0x0010, /* Hardware performance counters */
+    SH_CPU_HAS_PTEA           = 0x0020, /* PTEA register */
+    SH_CPU_HAS_LLSC           = 0x0040, /* movli.l/movco.l */
+    SH_CPU_HAS_L2_CACHE       = 0x0080, /* Secondary cache / URAM */
+    SH_CPU_HAS_OP32           = 0x0100, /* 32-bit instruction support */
+    SH_CPU_HAS_PTEAEX         = 0x0200, /* PTE ASID Extension support */
+};
+
+abi_ulong get_elf_hwcap(CPUState *cs)
+{
+    SuperHCPU *cpu = SUPERH_CPU(cs);
+    abi_ulong hwcap = 0;
+
+    hwcap |= SH_CPU_HAS_FPU;
+
+    if (cpu->env.features & SH_FEATURE_SH4A) {
+        hwcap |= SH_CPU_HAS_LLSC;
+    }
+
+    return hwcap;
+}
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 069/281] linux-user: Remove ELF_PLATFORM
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (25 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 059/281] linux-user: Move get_elf_hwcap to sh4/elfload.c Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 071/281] linux-user: Move target_cpu_copy_regs decl to qemu.h Alex Bennée
                   ` (6 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

All real definitions of ELF_PLATFORM are now identical, and the stub
definitions are NULL.  Use HAVE_ELF_PLATFORM and provide a stub as a
fallback definition of get_elf_platform.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 83cb6731ec8..d2d73b06fc0 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -149,8 +149,6 @@ typedef abi_int         target_pid_t;
 
 #ifdef TARGET_I386
 
-#define ELF_PLATFORM get_elf_platform(thread_cpu)
-
 #ifdef TARGET_X86_64
 #define ELF_CLASS      ELFCLASS64
 #define ELF_ARCH       EM_X86_64
@@ -309,8 +307,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUX86State *en
 
 #ifdef TARGET_ARM
 
-#define ELF_PLATFORM get_elf_platform(thread_cpu)
-
 #ifndef TARGET_AARCH64
 /* 32 bit ARM definitions */
 
@@ -665,8 +661,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE        4096
 
-#define ELF_PLATFORM get_elf_platform(thread_cpu)
-
 #endif /* TARGET_LOONGARCH64 */
 
 #ifdef TARGET_MIPS
@@ -846,8 +840,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
     (*regs)[33] = tswapreg(cpu_get_sr(env));
 }
 
-#define ELF_PLATFORM NULL
-
 #endif /* TARGET_OPENRISC */
 
 #ifdef TARGET_SH4
@@ -1046,7 +1038,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #define ELF_CLASS       ELFCLASS32
 #define ELF_ARCH        EM_PARISC
-#define ELF_PLATFORM    get_elf_platform(thread_cpu)
 #define STACK_GROWS_DOWN 0
 #define STACK_ALIGNMENT  64
 
@@ -1182,10 +1173,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 #define ELF_BASE_PLATFORM (NULL)
 #endif
 
-#ifndef ELF_PLATFORM
-#define ELF_PLATFORM (NULL)
-#endif
-
 #ifndef ELF_MACHINE
 #define ELF_MACHINE ELF_ARCH
 #endif
@@ -1229,6 +1216,9 @@ abi_ulong get_elf_hwcap(CPUState *cs) { return 0; }
 abi_ulong get_elf_hwcap2(CPUState *cs) { g_assert_not_reached(); }
 #define HAVE_ELF_HWCAP2 0
 #endif
+#ifndef HAVE_ELF_PLATFORM
+const char *get_elf_platform(CPUState *cs) { return NULL; }
+#endif
 
 #include "elf.h"
 
@@ -1699,7 +1689,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     }
 
     u_platform = 0;
-    k_platform = ELF_PLATFORM;
+    k_platform = get_elf_platform(thread_cpu);
     if (k_platform) {
         size_t len = strlen(k_platform) + 1;
         if (STACK_GROWS_DOWN) {
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 071/281] linux-user: Move target_cpu_copy_regs decl to qemu.h
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (26 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 069/281] linux-user: Remove ELF_PLATFORM Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 076/281] linux-user/aarch64: Create init_main_thread Alex Bennée
                   ` (5 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

The function is not used by bsd-user, so placement
within include/user/cpu_loop.h is not ideal.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/user/cpu_loop.h | 4 ----
 linux-user/qemu.h       | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/user/cpu_loop.h b/include/user/cpu_loop.h
index ad8a1d711f0..346e37ede8b 100644
--- a/include/user/cpu_loop.h
+++ b/include/user/cpu_loop.h
@@ -81,8 +81,4 @@ void target_exception_dump(CPUArchState *env, const char *fmt, int code);
 #define EXCP_DUMP(env, fmt, code) \
     target_exception_dump(env, fmt, code)
 
-typedef struct target_pt_regs target_pt_regs;
-
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs);
-
 #endif
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 4d6fad28c63..0c3cfe93a14 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -359,4 +359,7 @@ void *lock_user_string(abi_ulong guest_addr);
 /* Clone cpu state */
 CPUArchState *cpu_copy(CPUArchState *env);
 
+typedef struct target_pt_regs target_pt_regs;
+void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs);
+
 #endif /* QEMU_H */
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 076/281] linux-user/aarch64: Create init_main_thread
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (27 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 071/281] linux-user: Move target_cpu_copy_regs decl to qemu.h Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 080/281] linux-user/mips: " Alex Bennée
                   ` (4 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/aarch64/cpu_loop.c | 14 ++++++--------
 linux-user/elfload.c          | 10 +---------
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index 030a630c936..4c4921152e8 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -137,10 +137,10 @@ void cpu_loop(CPUARMState *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
+    CPUARMState *env = cpu_env(cs);
     ARMCPU *cpu = env_archcpu(env);
-    int i;
 
     if (!(arm_feature(env, ARM_FEATURE_AARCH64))) {
         fprintf(stderr,
@@ -148,14 +148,12 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
         exit(EXIT_FAILURE);
     }
 
-    for (i = 0; i < 31; i++) {
-        env->xregs[i] = regs->regs[i];
-    }
-    env->pc = regs->pc;
-    env->xregs[31] = regs->sp;
+    env->pc = info->entry & ~0x3ULL;
+    env->xregs[31] = info->start_stack;
+
 #if TARGET_BIG_ENDIAN
     env->cp15.sctlr_el[1] |= SCTLR_E0E;
-    for (i = 1; i < 4; ++i) {
+    for (int i = 1; i < 4; ++i) {
         env->cp15.sctlr_el[i] |= SCTLR_EE;
     }
     arm_rebuild_hflags(env);
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 95868739546..f93afbdcea3 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -395,15 +395,7 @@ static const VdsoImageInfo *vdso_image_info(uint32_t elf_flags)
 #define ELF_ARCH        EM_AARCH64
 #define ELF_CLASS       ELFCLASS64
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    abi_long stack = infop->start_stack;
-    memset(regs, 0, sizeof(*regs));
-
-    regs->pc = infop->entry & ~0x3ULL;
-    regs->sp = stack;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 #define ELF_NREG    34
 typedef target_elf_greg_t  target_elf_gregset_t[ELF_NREG];
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 080/281] linux-user/mips: Create init_main_thread
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (28 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 076/281] linux-user/aarch64: Create init_main_thread Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 082/281] linux-user/openrisc: " Alex Bennée
                   ` (3 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Note that init_thread had set cp0_status in target_pt_regs, but
target_cpu_copy_regs did not copy to env.  This turns out to be
ok because mips_cpu_reset_hold initializes CP0_Status properly.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c       |  8 +-------
 linux-user/mips/cpu_loop.c | 16 ++++++----------
 2 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0feccfbe916..ac96755b06c 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -581,13 +581,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define elf_check_abi(x) (!((x) & EF_MIPS_ABI2))
 #endif
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    regs->cp0_status = 2 << CP0St_KSU;
-    regs->cp0_epc = infop->entry;
-    regs->regs[29] = infop->start_stack;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 /* See linux kernel: arch/mips/include/asm/elf.h.  */
 #define ELF_NREG 45
diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index 6405806eb02..e67b8a2e463 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -211,12 +211,9 @@ done_syscall:
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    CPUState *cpu = env_cpu(env);
-    TaskState *ts = get_task_state(cpu);
-    struct image_info *info = ts->info;
-    int i;
+    CPUArchState *env = cpu_env(cs);
 
     struct mode_req {
         bool single;
@@ -245,12 +242,11 @@ void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
 
     struct mode_req prog_req;
     struct mode_req interp_req;
+    target_ulong entry = info->entry;
 
-    for(i = 0; i < 32; i++) {
-        env->active_tc.gpr[i] = regs->regs[i];
-    }
-    env->active_tc.PC = regs->cp0_epc & ~(target_ulong)1;
-    if (regs->cp0_epc & 1) {
+    env->active_tc.gpr[29] = info->start_stack;
+    env->active_tc.PC = entry & ~(target_ulong)1;
+    if (entry & 1) {
         env->hflags |= MIPS_HFLAG_M16;
     }
 
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 082/281] linux-user/openrisc: Create init_main_thread
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (29 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 080/281] linux-user/mips: " Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 083/281] linux-user/sh4: " Alex Bennée
                   ` (2 subsequent siblings)
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c           |  7 +------
 linux-user/openrisc/cpu_loop.c | 11 ++++-------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 3f9ec493595..03c95397744 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -673,12 +673,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs, const CPUMBState *env
 #define ELF_CLASS ELFCLASS32
 #define ELF_DATA  ELFDATA2MSB
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    regs->pc = infop->entry;
-    regs->gpr[1] = infop->start_stack;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE 8192
diff --git a/linux-user/openrisc/cpu_loop.c b/linux-user/openrisc/cpu_loop.c
index 306b4f8eb43..8c72347a99a 100644
--- a/linux-user/openrisc/cpu_loop.c
+++ b/linux-user/openrisc/cpu_loop.c
@@ -83,13 +83,10 @@ void cpu_loop(CPUOpenRISCState *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    int i;
+    CPUArchState *env = cpu_env(cs);
 
-    for (i = 0; i < 32; i++) {
-        cpu_set_gpr(env, i, regs->gpr[i]);
-    }
-    env->pc = regs->pc;
-    cpu_set_sr(env, regs->sr);
+    env->pc = info->entry;
+    cpu_set_gpr(env, 1, info->start_stack);
 }
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 083/281] linux-user/sh4: Create init_main_thread
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (30 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 082/281] linux-user/openrisc: " Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:07 ` [PATCH v2 084/281] linux-user/m68k: " Alex Bennée
  2025-09-04  8:08 ` [PATCH v2 087/281] linux-user/riscv: " Alex Bennée
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c      |  8 +-------
 linux-user/sh4/cpu_loop.c | 10 ++++------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 03c95397744..8604308a310 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -701,13 +701,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define ELF_CLASS ELFCLASS32
 #define ELF_ARCH  EM_SH
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    /* Check other registers XXXXX */
-    regs->pc = infop->entry;
-    regs->regs[15] = infop->start_stack;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 /* See linux kernel: arch/sh/include/asm/elf.h.  */
 #define ELF_NREG 23
diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c
index ee9eff3428a..259ea1cc8bb 100644
--- a/linux-user/sh4/cpu_loop.c
+++ b/linux-user/sh4/cpu_loop.c
@@ -81,12 +81,10 @@ void cpu_loop(CPUSH4State *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    int i;
+    CPUArchState *env = cpu_env(cs);
 
-    for(i = 0; i < 16; i++) {
-        env->gregs[i] = regs->regs[i];
-    }
-    env->pc = regs->pc;
+    env->pc = info->entry;
+    env->gregs[15] = info->start_stack;
 }
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 084/281] linux-user/m68k: Create init_main_thread
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (31 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 083/281] linux-user/sh4: " Alex Bennée
@ 2025-09-04  8:07 ` Alex Bennée
  2025-09-04  8:08 ` [PATCH v2 087/281] linux-user/riscv: " Alex Bennée
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c       | 11 +----------
 linux-user/m68k/cpu_loop.c | 25 ++++++-------------------
 2 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 8604308a310..46150586aff 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -746,16 +746,7 @@ static inline void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define ELF_CLASS       ELFCLASS32
 #define ELF_ARCH        EM_68K
 
-/* ??? Does this need to do anything?
-   #define ELF_PLAT_INIT(_r) */
-
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    regs->usp = infop->start_stack;
-    regs->sr = 0;
-    regs->pc = infop->entry;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 /* See linux kernel: arch/m68k/include/asm/elf.h.  */
 #define ELF_NREG 20
diff --git a/linux-user/m68k/cpu_loop.c b/linux-user/m68k/cpu_loop.c
index 23693f33582..aca0bf23dc6 100644
--- a/linux-user/m68k/cpu_loop.c
+++ b/linux-user/m68k/cpu_loop.c
@@ -92,24 +92,11 @@ void cpu_loop(CPUM68KState *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    env->pc = regs->pc;
-    env->dregs[0] = regs->d0;
-    env->dregs[1] = regs->d1;
-    env->dregs[2] = regs->d2;
-    env->dregs[3] = regs->d3;
-    env->dregs[4] = regs->d4;
-    env->dregs[5] = regs->d5;
-    env->dregs[6] = regs->d6;
-    env->dregs[7] = regs->d7;
-    env->aregs[0] = regs->a0;
-    env->aregs[1] = regs->a1;
-    env->aregs[2] = regs->a2;
-    env->aregs[3] = regs->a3;
-    env->aregs[4] = regs->a4;
-    env->aregs[5] = regs->a5;
-    env->aregs[6] = regs->a6;
-    env->aregs[7] = regs->usp;
-    env->sr = regs->sr;
+    CPUArchState *env = cpu_env(cs);
+
+    env->pc = info->entry;
+    env->aregs[7] = info->start_stack;
+    env->sr = 0;
 }
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 087/281] linux-user/riscv: Create init_main_thread
  2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
                   ` (32 preceding siblings ...)
  2025-09-04  8:07 ` [PATCH v2 084/281] linux-user/m68k: " Alex Bennée
@ 2025-09-04  8:08 ` Alex Bennée
  33 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-04  8:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Reinoud Zandijk, Cédric Le Goater, Huacai Chen, Zhao Liu,
	Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman,
	Igor Mammedov, Brian Cain, Phil Dennis-Jordan, devel, Mads Ynddal,
	Elena Ufimtseva, Peter Xu, Jason Herne, Michael Rolnik, Weiwei Li,
	Laurent Vivier, Ilya Leoshkevich, qemu-block, Peter Maydell,
	Kostiantyn Kostiuk, Kyle Evans, David Hildenbrand,
	Edgar E. Iglesias, Warner Losh, Daniel Henrique Barboza,
	John Snow, Yoshinori Sato, Aleksandar Rikalo, Alistair Francis,
	Marcelo Tosatti, Yonggang Luo, Radoslaw Biernacki,
	Artyom Tarasenko, Yanan Wang, Eduardo Habkost, Aurelien Jarno,
	Richard Henderson, qemu-s390x, Alex Williamson,
	Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Alex Bennée, Nicholas Piggin, John Levon

From: Richard Henderson <richard.henderson@linaro.org>

Merge init_thread and target_cpu_copy_regs.
There's no point going through a target_pt_regs intermediate.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c        |  7 +------
 linux-user/riscv/cpu_loop.c | 10 ++++------
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 16aa09214e8..556f11d720d 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -849,12 +849,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define VDSO_HEADER "vdso-64.c.inc"
 #endif
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    regs->sepc = infop->entry;
-    regs->sp = infop->start_stack;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 #define ELF_EXEC_PAGESIZE 4096
 
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index 2dd30c7b288..b3162815320 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -94,14 +94,12 @@ void cpu_loop(CPURISCVState *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    CPUState *cpu = env_cpu(env);
-    TaskState *ts = get_task_state(cpu);
-    struct image_info *info = ts->info;
+    CPUArchState *env = cpu_env(cs);
 
-    env->pc = regs->sepc;
-    env->gpr[xSP] = regs->sp;
+    env->pc = info->entry;
+    env->gpr[xSP] = info->start_stack;
     env->elf_flags = info->elf_flags;
 
     if ((env->misa_ext & RVE) && !(env->elf_flags & EF_RISCV_RVE)) {
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 001/281] target/i386: Add support for save/load of exception error code
  2025-09-04  8:06 ` [PATCH v2 001/281] target/i386: Add support for save/load of exception error code Alex Bennée
@ 2025-09-04 12:08   ` Igor Mammedov
  2025-09-05 12:36     ` Alex Bennée
  0 siblings, 1 reply; 37+ messages in thread
From: Igor Mammedov @ 2025-09-04 12:08 UTC (permalink / raw)
  To: Alex Bennée, Peter Xu
  Cc: qemu-devel, Reinoud Zandijk, Cédric Le Goater, Huacai Chen,
	Zhao Liu, Paolo Bonzini, Alistair Francis, qemu-arm, Fam Zheng,
	Helge Deller, Matthew Rosato, Fabiano Rosas, qemu-rust, Bibo Mao,
	qemu-riscv, Thanos Makatos, Liu Zhiwei, Riku Voipio,
	Cameron Esfahani, Alexander Graf, Laurent Vivier,
	Harsh Prateek Bora, Daniel P. Berrangé, qemu-ppc,
	Stafford Horne, Sunil Muthuswamy, Jagannathan Raman, Brian Cain,
	Phil Dennis-Jordan, devel, Mads Ynddal, Elena Ufimtseva,
	Jason Herne, Michael Rolnik, Weiwei Li, Laurent Vivier,
	Ilya Leoshkevich, qemu-block, Peter Maydell, Kostiantyn Kostiuk,
	Kyle Evans, David Hildenbrand, Edgar E. Iglesias, Warner Losh,
	Daniel Henrique Barboza, John Snow, Yoshinori Sato,
	Aleksandar Rikalo, Alistair Francis, Marcelo Tosatti,
	Yonggang Luo, Radoslaw Biernacki, Artyom Tarasenko, Yanan Wang,
	Eduardo Habkost, Aurelien Jarno, Richard Henderson, qemu-s390x,
	Alex Williamson, Michael S. Tsirkin, Ani Sinha, Roman Bolshakov,
	Manos Pitsidianakis, Chinmay Rath, Thomas Huth, Cleber Rosa, kvm,
	Song Gao, Philippe Mathieu-Daudé, Halil Pasic, Eric Farman,
	Palmer Dabbelt, Leif Lindholm, Christian Borntraeger,
	Michael Roth, Mauro Carvalho Chehab, Jiaxun Yang,
	Marc-André Lureau, Mark Cave-Ayland, Marcel Apfelbaum,
	Nicholas Piggin, John Levon, Xin Wang

On Thu,  4 Sep 2025 09:06:35 +0100
Alex Bennée <alex.bennee@linaro.org> wrote:

> From: Xin Wang <wangxinxin.wang@huawei.com>
> 
> For now, qemu save/load CPU exception info(such as exception_nr and
> has_error_code), while the exception error_code is ignored. This will
> cause the dest hypervisor reinject a vCPU exception with error_code(0),
> potentially causing a guest kernel panic.
> 
> For instance, if src VM stopped with an user-mode write #PF (error_code 6),
> the dest hypervisor will reinject an #PF with error_code(0) when vCPU resume,
> then guest kernel panic as:
>   BUG: unable to handle page fault for address: 00007f80319cb010
>   #PF: supervisor read access in user mode
>   #PF: error_code(0x0000) - not-present page
>   RIP: 0033:0x40115d
> 
> To fix it, support save/load exception error_code.

this potentially will break migration between new/old QEMU versions
due to presence new subsection. But then according to commit message
the guest might panic (on dst) when resumed anyways.

So patch changes how guest will fail
(panic: old => old, old => new
 vs migration error: new => old ).

Peter,
do we care and do we need a compat knob to make existing
machine type behave old way?

> 
> Signed-off-by: Xin Wang <wangxinxin.wang@huawei.com>
> Link: https://lore.kernel.org/r/20250819145834.3998-1-wangxinxin.wang@huawei.com
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  target/i386/machine.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index dd2dac1d443..45b7cea80aa 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -462,6 +462,24 @@ static const VMStateDescription vmstate_exception_info = {
>      }
>  };
>  
> +static bool cpu_errcode_needed(void *opaque)
> +{
> +    X86CPU *cpu = opaque;
> +
> +    return cpu->env.has_error_code != 0;
> +}
> +
> +static const VMStateDescription vmstate_error_code = {
> +    .name = "cpu/error_code",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .needed = cpu_errcode_needed,
> +    .fields = (const VMStateField[]) {
> +        VMSTATE_INT32(env.error_code, X86CPU),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> +
>  /* Poll control MSR enabled by default */
>  static bool poll_control_msr_needed(void *opaque)
>  {
> @@ -1746,6 +1764,7 @@ const VMStateDescription vmstate_x86_cpu = {
>      },
>      .subsections = (const VMStateDescription * const []) {
>          &vmstate_exception_info,
> +        &vmstate_error_code,
>          &vmstate_async_pf_msr,
>          &vmstate_async_pf_int_msr,
>          &vmstate_pv_eoi_msr,



^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 001/281] target/i386: Add support for save/load of exception error code
  2025-09-04 12:08   ` Igor Mammedov
@ 2025-09-05 12:36     ` Alex Bennée
  0 siblings, 0 replies; 37+ messages in thread
From: Alex Bennée @ 2025-09-05 12:36 UTC (permalink / raw)
  To: Igor Mammedov; +Cc: qemu-devel, Paolo Bonzini, Peter Xu, Xin Wang

Igor Mammedov <imammedo@redhat.com> writes:

(trim the CC list somewhat)

> On Thu,  4 Sep 2025 09:06:35 +0100
> Alex Bennée <alex.bennee@linaro.org> wrote:
>
>> From: Xin Wang <wangxinxin.wang@huawei.com>
>> 
>> For now, qemu save/load CPU exception info(such as exception_nr and
>> has_error_code), while the exception error_code is ignored. This will
>> cause the dest hypervisor reinject a vCPU exception with error_code(0),
>> potentially causing a guest kernel panic.
>> 
>> For instance, if src VM stopped with an user-mode write #PF (error_code 6),
>> the dest hypervisor will reinject an #PF with error_code(0) when vCPU resume,
>> then guest kernel panic as:
>>   BUG: unable to handle page fault for address: 00007f80319cb010
>>   #PF: supervisor read access in user mode
>>   #PF: error_code(0x0000) - not-present page
>>   RIP: 0033:0x40115d
>> 
>> To fix it, support save/load exception error_code.
>
> this potentially will break migration between new/old QEMU versions
> due to presence new subsection. But then according to commit message
> the guest might panic (on dst) when resumed anyways.
>
> So patch changes how guest will fail
> (panic: old => old, old => new
>  vs migration error: new => old ).
>
> Peter,
> do we care and do we need a compat knob to make existing
> machine type behave old way?

Igor,

So this patch is already in master, it was only posted in this series
because my master is never upto date with origin/master.

Apologies again for the noise.

>
>> 
>> Signed-off-by: Xin Wang <wangxinxin.wang@huawei.com>
>> Link: https://lore.kernel.org/r/20250819145834.3998-1-wangxinxin.wang@huawei.com
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  target/i386/machine.c | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>> 
>> diff --git a/target/i386/machine.c b/target/i386/machine.c
>> index dd2dac1d443..45b7cea80aa 100644
>> --- a/target/i386/machine.c
>> +++ b/target/i386/machine.c
>> @@ -462,6 +462,24 @@ static const VMStateDescription vmstate_exception_info = {
>>      }
>>  };
>>  
>> +static bool cpu_errcode_needed(void *opaque)
>> +{
>> +    X86CPU *cpu = opaque;
>> +
>> +    return cpu->env.has_error_code != 0;
>> +}
>> +
>> +static const VMStateDescription vmstate_error_code = {
>> +    .name = "cpu/error_code",
>> +    .version_id = 1,
>> +    .minimum_version_id = 1,
>> +    .needed = cpu_errcode_needed,
>> +    .fields = (const VMStateField[]) {
>> +        VMSTATE_INT32(env.error_code, X86CPU),
>> +        VMSTATE_END_OF_LIST()
>> +    }
>> +};
>> +
>>  /* Poll control MSR enabled by default */
>>  static bool poll_control_msr_needed(void *opaque)
>>  {
>> @@ -1746,6 +1764,7 @@ const VMStateDescription vmstate_x86_cpu = {
>>      },
>>      .subsections = (const VMStateDescription * const []) {
>>          &vmstate_exception_info,
>> +        &vmstate_error_code,
>>          &vmstate_async_pf_msr,
>>          &vmstate_async_pf_int_msr,
>>          &vmstate_pv_eoi_msr,

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2025-09-05 12:37 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04  8:06 [PATCH v2 000/281] arm_load_dtb cleanups Alex Bennée
2025-09-04  8:06 ` [PATCH v2 001/281] target/i386: Add support for save/load of exception error code Alex Bennée
2025-09-04 12:08   ` Igor Mammedov
2025-09-05 12:36     ` Alex Bennée
2025-09-04  8:06 ` [PATCH v2 002/281] scripts/minikconf.py: fix invalid attribute access Alex Bennée
2025-09-04  8:06 ` [PATCH v2 003/281] scripts/minikconf.py: s/Error/KconfigParserError Alex Bennée
2025-09-04  8:06 ` [PATCH v2 004/281] python: mkvenv: fix messages printed by mkvenv Alex Bennée
2025-09-04  8:06 ` [PATCH v2 005/281] MAINTAINERS: add a few more files to "Top Level Makefile and configure" Alex Bennée
2025-09-04  8:06 ` [PATCH v2 006/281] Update version for the v10.1.0 release Alex Bennée
2025-09-04  8:06 ` [PATCH v2 007/281] Open 10.2 development tree Alex Bennée
2025-09-04  8:06 ` [PATCH v2 008/281] hw: add compat machines for 10.2 Alex Bennée
2025-09-04  8:06 ` [PATCH v2 010/281] tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't initialize Alex Bennée
2025-09-04  8:06 ` [PATCH v2 011/281] tests/functional: Fix reverse_debugging asset precaching Alex Bennée
2025-09-04  8:06 ` [PATCH v2 015/281] tests/functional/meson.build: Split timeout settings by target Alex Bennée
2025-09-04  8:06 ` [PATCH v2 016/281] tests/functional/meson.build: Allow tests to reside in subfolders Alex Bennée
2025-09-04  8:06 ` [PATCH v2 018/281] tests/functional: Move alpha tests into architecture specific folder Alex Bennée
2025-09-04  8:06 ` [PATCH v2 021/281] tests/functional: Move hppa " Alex Bennée
2025-09-04  8:06 ` [PATCH v2 024/281] tests/functional: Move m68k " Alex Bennée
2025-09-04  8:07 ` [PATCH v2 031/281] tests/functional: Move s390x tests into target-specific folders Alex Bennée
2025-09-04  8:07 ` [PATCH v2 032/281] tests/functional: Move sh4/sh4eb " Alex Bennée
2025-09-04  8:07 ` [PATCH v2 034/281] tests/functional: Move x86_64 tests into target-specific folder Alex Bennée
2025-09-04  8:07 ` [PATCH v2 045/281] rust/qemu-api-macros: make derive(Object) friendly when missing parent Alex Bennée
2025-09-04  8:07 ` [PATCH v2 048/281] semihosting: Retrieve stack top from image_info Alex Bennée
2025-09-04  8:07 ` [PATCH v2 049/281] semihosting: Initialize heap once per process Alex Bennée
2025-09-04  8:07 ` [PATCH v2 051/281] linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h Alex Bennée
2025-09-04  8:07 ` [PATCH v2 055/281] linux-user: Move get_elf_hwcap to sparc/elfload.c Alex Bennée
2025-09-04  8:07 ` [PATCH v2 057/281] linux-user: Move get_elf_hwcap to loongarch64/elfload.c Alex Bennée
2025-09-04  8:07 ` [PATCH v2 058/281] linux-user: Move get_elf_hwcap to mips/elfload.c Alex Bennée
2025-09-04  8:07 ` [PATCH v2 059/281] linux-user: Move get_elf_hwcap to sh4/elfload.c Alex Bennée
2025-09-04  8:07 ` [PATCH v2 069/281] linux-user: Remove ELF_PLATFORM Alex Bennée
2025-09-04  8:07 ` [PATCH v2 071/281] linux-user: Move target_cpu_copy_regs decl to qemu.h Alex Bennée
2025-09-04  8:07 ` [PATCH v2 076/281] linux-user/aarch64: Create init_main_thread Alex Bennée
2025-09-04  8:07 ` [PATCH v2 080/281] linux-user/mips: " Alex Bennée
2025-09-04  8:07 ` [PATCH v2 082/281] linux-user/openrisc: " Alex Bennée
2025-09-04  8:07 ` [PATCH v2 083/281] linux-user/sh4: " Alex Bennée
2025-09-04  8:07 ` [PATCH v2 084/281] linux-user/m68k: " Alex Bennée
2025-09-04  8:08 ` [PATCH v2 087/281] linux-user/riscv: " Alex Bennée

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).