Skip to contentSkip to conversation

arm_load_dtb cleanups

PATCH Superseded Alex Bennée 2 participants 52 messages Sep 4, 2025 – Sep 5, 2025

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover arm_load_dtb cleanups

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

Signature · 1 line
2.47.2
#1 lore raw

PATCH v2 1/281 target/i386: Add support for save/load of exception error code

From: Xin Wang <[email protected]>

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.

---
 target/i386/machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
target/i386/machine.c +19 -0
index dd2dac1d443..45b7cea80aa 100644
@@ -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,
Signature · 1 line
2.47.2
#2 lore raw

Re: [PATCH v2 001/281] target/i386: Add support for save/load of exception error code

Quoted 10 lines · On Thu, 4 Sep 2025 09:06:35 +0100 Alex Bennée <[email protected]> wrote:

From: Xin Wang <[email protected]>

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:

Quoted 6 lines
  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?

Quoted 45 lines
---
 target/i386/machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
target/i386/machine.c +19 -0
index dd2dac1d443..45b7cea80aa 100644
@@ -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,
#3 lore raw

Re: [PATCH v2 001/281] target/i386: Add support for save/load of exception error code

Igor Mammedov <[email protected]> writes:

(trim the CC list somewhat)

Quoted 24 lines
Quoted 10 lines · On Thu, 4 Sep 2025 09:06:35 +0100 Alex Bennée <[email protected]> wrote:

From: Xin Wang <[email protected]>

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:

Quoted 6 lines
  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.

Quoted 7 lines

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.

Quoted 46 lines
Quoted 46 lines
---
 target/i386/machine.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
target/i386/machine.c +19 -0
index dd2dac1d443..45b7cea80aa 100644
@@ -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,
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#4 lore raw

PATCH v2 2/281 scripts/minikconf.py: fix invalid attribute access

In reply to Alex Bennée

From: Manos Pitsidianakis <[email protected]>

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

Fixes f349474920d80838ecea3d421531fdb0660b8740 ("minikconfig: implement allnoconfig and defconfig modes")
---
 scripts/minikconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/minikconf.py +1 -1
index 6f7f43b2918..2a4694fb6a3 100644
@@ -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
Signature · 1 line
2.47.2
#5 lore raw

PATCH v2 3/281 scripts/minikconf.py: s/Error/KconfigParserError

In reply to Alex Bennée

From: Manos Pitsidianakis <[email protected]>

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

Fixes 82f5181777ebe04b550fd94a1d04c49dd3f012dc ("kconfig: introduce kconfig files")
---
 scripts/minikconf.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/minikconf.py +3 -1
index 2a4694fb6a3..4de5aeed11a 100644
@@ -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)
 
Signature · 1 line
2.47.2
#6 lore raw

PATCH v2 4/281 python: mkvenv: fix messages printed by mkvenv

In reply to Alex Bennée

From: Paolo Bonzini <[email protected]>

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

---
 python/scripts/mkvenv.py | 4 ++++
 1 file changed, 4 insertions(+)
python/scripts/mkvenv.py +4 -0
index f102527c4de..9aed266df1b 100644
@@ -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)
Signature · 1 line
2.47.2
#7 lore raw

PATCH v2 5/281 MAINTAINERS: add a few more files to "Top Level Makefile and configure"

In reply to Alex Bennée

From: Paolo Bonzini <[email protected]>

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.

---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
MAINTAINERS +3 -1
index a07086ed762..0f3e55b51e8 100644
@@ -4392,7 +4392,6 @@ R: Philippe Mathieu-Daudé <[email protected]>
 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 <[email protected]>
 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
 
Signature · 1 line
2.47.2
#10 lore raw

PATCH v2 8/281 hw: add compat machines for 10.2

In reply to Alex Bennée

From: Cornelia Huck <[email protected]>

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

Message-ID: <[email protected]>

---
 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(-)
include/hw/boards.h +3 -0
index f94713e6e29..665b6201214 100644
@@ -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;
 
include/hw/i386/pc.h +3 -0
index 79b72c54dd3..e83157ab358 100644
@@ -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;
 
hw/arm/virt.c +8 -1
index ef6be3660f5..9326cfc895f 100644
@@ -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)
 {
hw/core/machine.c +3 -0
index bd47527479a..38c949c4f2c 100644
@@ -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" },
hw/i386/pc.c +3 -0
index 2f58e73d334..bc048a6d137 100644
@@ -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" },
hw/i386/pc_piix.c +11 -2
index c03324281bd..d165ac72ed7 100644
@@ -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)
 {
hw/i386/pc_q35.c +11 -2
index b309b2b378d..e89951285e5 100644
@@ -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)
 {
hw/m68k/virt.c +8 -1
index 875fd00ef8d..98cfe43c73a 100644
@@ -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)
 {
hw/ppc/spapr.c +13 -2
index 1855a3cd8d0..eb22333404d 100644
@@ -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
hw/s390x/s390-virtio-ccw.c +13 -1
index a79bd13275b..d0c6e80cb05 100644
@@ -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)
 {
Signature · 1 line
2.47.2
#11 lore raw

PATCH v2 10/281 tests/functional/test_aarch64_virt_gpu: Skip test if EGL won't initialize

In reply to Alex Bennée

From: Peter Maydell <[email protected]>

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.

Message-ID: <[email protected]>

---
 tests/functional/test_aarch64_virt_gpu.py | 2 ++
 1 file changed, 2 insertions(+)
tests/functional/test_aarch64_virt_gpu.py +2 -0
index 38447278579..4e50887c3e9 100755
@@ -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
Signature · 1 line
2.47.2
#12 lore raw

PATCH v2 11/281 tests/functional: Fix reverse_debugging asset precaching

In reply to Alex Bennée

From: Gustavo Romero <[email protected]>

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.

Message-ID: <[email protected]>

---
 tests/functional/test_aarch64_reverse_debug.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/functional/test_aarch64_reverse_debug.py +2 -2
index 58d45328350..8bc91ccfde7 100755
@@ -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))
 
 
Signature · 1 line
2.47.2
#13 lore raw

PATCH v2 12/281 tests/functional: Use more fine-grained locking when looking for free ports

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

Currently, we have one lock that is held while a test is looking for free ports. However, we are also using different ranges for looking for free ports nowadays (PORTS_START is based on the PID of the process), so instead of using only one lock, we should rather use a lock per range instead. This should help to allow running more tests in parallel.

While we're at it, also create the lock files without executable bit (mode is 0o777 by default).

Message-ID: <[email protected]>

---
 tests/functional/qemu_test/ports.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tests/functional/qemu_test/ports.py +3 -2
index 631b77abf6b..81174a61532 100644
@@ -23,8 +23,9 @@ class Ports():
     PORTS_END = PORTS_START + PORTS_RANGE_SIZE
 
     def __enter__(self):
-        lock_file = os.path.join(BUILD_DIR, "tests", "functional", "port_lock")
-        self.lock_fh = os.open(lock_file, os.O_CREAT)
+        lock_file = os.path.join(BUILD_DIR, "tests", "functional",
+                                 f".port_lock.{self.PORTS_START}")
+        self.lock_fh = os.open(lock_file, os.O_CREAT, mode=0o666)
         fcntl.flock(self.lock_fh, fcntl.LOCK_EX)
         return self
 
Signature · 1 line
2.47.2
#14 lore raw

PATCH v2 15/281 tests/functional/meson.build: Split timeout settings by target

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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.

Message-ID: <[email protected]>

---
 tests/functional/meson.build | 50 +++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 6 deletions(-)
tests/functional/meson.build +44 -6
index 38ae0d6cd3b..356aad12dee 100644
@@ -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
Signature · 1 line
2.47.2
#15 lore raw

PATCH v2 16/281 tests/functional/meson.build: Allow tests to reside in subfolders

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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.

Message-ID: <[email protected]>

---
 tests/functional/meson.build | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
tests/functional/meson.build +7 -1
index 356aad12dee..8c24ac1cc2d 100644
@@ -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()
Signature · 1 line
2.47.2
#16 lore raw

PATCH v2 17/281 tests/functional: Move aarch64 tests into architecture specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 MAINTAINERS                                   | 24 +++++-----
 tests/functional/aarch64/meson.build          | 48 +++++++++++++++++++
 .../test_aspeed_ast2700.py}                   |  0
 .../test_aspeed_ast2700fc.py}                 |  0
 .../test_device_passthrough.py}               |  0
 .../test_hotplug_pci.py}                      |  0
 .../test_imx8mp_evk.py}                       |  0
 .../test_kvm.py}                              |  0
 .../test_migration.py}                        |  0
 .../test_multiprocess.py}                     |  0
 .../test_raspi3.py}                           |  0
 .../test_raspi4.py}                           |  0
 .../test_replay.py}                           |  0
 .../test_reverse_debug.py}                    |  0
 .../test_rme_sbsaref.py}                      |  2 +-
 .../test_rme_virt.py}                         |  0
 .../test_sbsaref.py}                          |  0
 .../test_sbsaref_alpine.py}                   |  2 +-
 .../test_sbsaref_freebsd.py}                  |  2 +-
 .../test_smmu.py}                             |  0
 .../test_tcg_plugins.py}                      |  0
 .../test_tuxrun.py}                           |  0
 .../test_virt.py}                             |  0
 .../test_virt_gpu.py}                         |  0
 .../test_xen.py}                              |  0
 .../test_xlnx_versal.py}                      |  0
 tests/functional/meson.build                  | 48 +------------------
 27 files changed, 64 insertions(+), 62 deletions(-)
 create mode 100644 tests/functional/aarch64/meson.build
 rename tests/functional/{test_aarch64_aspeed_ast2700.py => aarch64/test_aspeed_ast2700.py} (100%)
 rename tests/functional/{test_aarch64_aspeed_ast2700fc.py => aarch64/test_aspeed_ast2700fc.py} (100%)
 rename tests/functional/{test_aarch64_device_passthrough.py => aarch64/test_device_passthrough.py} (100%)
 rename tests/functional/{test_aarch64_hotplug_pci.py => aarch64/test_hotplug_pci.py} (100%)
 rename tests/functional/{test_aarch64_imx8mp_evk.py => aarch64/test_imx8mp_evk.py} (100%)
 rename tests/functional/{test_aarch64_kvm.py => aarch64/test_kvm.py} (100%)
 rename tests/functional/{test_aarch64_migration.py => aarch64/test_migration.py} (100%)
 rename tests/functional/{test_aarch64_multiprocess.py => aarch64/test_multiprocess.py} (100%)
 rename tests/functional/{test_aarch64_raspi3.py => aarch64/test_raspi3.py} (100%)
 rename tests/functional/{test_aarch64_raspi4.py => aarch64/test_raspi4.py} (100%)
 rename tests/functional/{test_aarch64_replay.py => aarch64/test_replay.py} (100%)
 rename tests/functional/{test_aarch64_reverse_debug.py => aarch64/test_reverse_debug.py} (100%)
 rename tests/functional/{test_aarch64_rme_sbsaref.py => aarch64/test_rme_sbsaref.py} (98%)
 rename tests/functional/{test_aarch64_rme_virt.py => aarch64/test_rme_virt.py} (100%)
 rename tests/functional/{test_aarch64_sbsaref.py => aarch64/test_sbsaref.py} (100%)
 rename tests/functional/{test_aarch64_sbsaref_alpine.py => aarch64/test_sbsaref_alpine.py} (97%)
 rename tests/functional/{test_aarch64_sbsaref_freebsd.py => aarch64/test_sbsaref_freebsd.py} (97%)
 rename tests/functional/{test_aarch64_smmu.py => aarch64/test_smmu.py} (100%)
 rename tests/functional/{test_aarch64_tcg_plugins.py => aarch64/test_tcg_plugins.py} (100%)
 rename tests/functional/{test_aarch64_tuxrun.py => aarch64/test_tuxrun.py} (100%)
 rename tests/functional/{test_aarch64_virt.py => aarch64/test_virt.py} (100%)
 rename tests/functional/{test_aarch64_virt_gpu.py => aarch64/test_virt_gpu.py} (100%)
 rename tests/functional/{test_aarch64_xen.py => aarch64/test_xen.py} (100%)
 rename tests/functional/{test_aarch64_xlnx_versal.py => aarch64/test_xlnx_versal.py} (100%)
MAINTAINERS +12 -12
index adbed9df2fc..a2a5ccea7b6 100644
@@ -212,7 +212,7 @@ L: [email protected]
 S: Maintained
 F: hw/arm/smmu*
 F: include/hw/arm/smmu*
-F: tests/functional/test_aarch64_smmu.py
+F: tests/functional/aarch64/test_smmu.py
 
 AVR TCG CPUs
 M: Michael Rolnik <[email protected]>
@@ -874,7 +874,7 @@ F: include/hw/arm/fsl-imx8mp.h
 F: include/hw/misc/imx8mp_*.h
 F: include/hw/pci-host/fsl_imx8m_phy.h
 F: docs/system/arm/imx8mp-evk.rst
-F: tests/functional/test_aarch64_imx8mp_evk.py
+F: tests/functional/aarch64/test_imx8mp_evk.py
 F: tests/qtest/rs5c372-test.c
 
 MPS2 / MPS3
@@ -952,8 +952,7 @@ F: include/hw/arm/rasp*
 F: include/hw/*/bcm283*
 F: docs/system/arm/raspi.rst
 F: tests/functional/test_arm_raspi2.py
-F: tests/functional/test_aarch64_raspi3.py
-F: tests/functional/test_aarch64_raspi4.py
+F: tests/functional/aarch64/test_raspi*.py
 
 Real View
 M: Peter Maydell <[email protected]>
@@ -993,7 +992,7 @@ F: hw/misc/sbsa_ec.c
 F: hw/watchdog/sbsa_gwdt.c
 F: include/hw/watchdog/sbsa_gwdt.h
 F: docs/system/arm/sbsa.rst
-F: tests/functional/test_aarch64_*sbsaref*.py
+F: tests/functional/aarch64/test_*sbsaref*.py
 
 Sharp SL-5500 (Collie) PDA
 M: Peter Maydell <[email protected]>
@@ -1063,8 +1062,8 @@ S: Maintained
 F: hw/arm/virt*
 F: include/hw/arm/virt.h
 F: docs/system/arm/virt.rst
-F: tests/functional/test_aarch64_*virt*.py
-F: tests/functional/test_aarch64_tuxrun.py
+F: tests/functional/aarch64/test_*virt*.py
+F: tests/functional/aarch64/test_tuxrun.py
 F: tests/functional/test_arm_tuxrun.py
 F: tests/functional/test_arm_virt.py
 
@@ -1096,7 +1095,7 @@ F: hw/display/dpcd.c
 F: include/hw/display/dpcd.h
 F: docs/system/arm/xlnx-versal-virt.rst
 F: docs/system/arm/xlnx-zcu102.rst
-F: tests/functional/test_aarch64_xlnx_versal.py
+F: tests/functional/aarch64/test_xlnx_versal.py
 
 Xilinx Versal OSPI
 M: Francisco Iglesias <[email protected]>
@@ -2109,7 +2108,7 @@ ARM PCI Hotplug
 M: Gustavo Romero <[email protected]>
 L: [email protected]
 S: Supported
-F: tests/functional/test_aarch64_hotplug_pci.py
+F: tests/functional/aarch64/test_hotplug_pci.py
 
 ACPI/SMBIOS
 M: Michael S. Tsirkin <[email protected]>
@@ -2263,6 +2262,7 @@ F: util/vfio-helpers.c
 F: include/hw/vfio/
 F: docs/devel/migration/vfio.rst
 F: qapi/vfio.json
+F: tests/functional/aarch64/test_device_passthrough.py
 
 vfio-igd
 M: Alex Williamson <[email protected]>
@@ -2638,7 +2638,7 @@ M: Alex Bennée <[email protected]>
 S: Maintained
 F: hw/core/guest-loader.c
 F: docs/system/guest-loader.rst
-F: tests/functional/test_aarch64_xen.py
+F: tests/functional/aarch64/test_xen.py
 
 Intel Hexadecimal Object File Loader
 M: Su Hang <[email protected]>
@@ -2707,7 +2707,7 @@ F: hw/display/virtio-gpu*
 F: hw/display/virtio-vga.*
 F: include/hw/virtio/virtio-gpu.h
 F: docs/system/devices/virtio-gpu.rst
-F: tests/functional/test_aarch64_virt_gpu.py
+F: tests/functional/aarch64/test_virt_gpu.py
 
 vhost-user-blk
 M: Raphael Norwitz <[email protected]>
@@ -3933,7 +3933,7 @@ S: Maintained
 F: docs/devel/tcg-plugins.rst
 F: plugins/
 F: tests/tcg/plugins/
-F: tests/functional/test_aarch64_tcg_plugins.py
+F: tests/functional/aarch64/test_tcg_plugins.py
 F: contrib/plugins/
 F: scripts/qemu-plugin-symbols.py
 
tests/functional/aarch64/meson.build new file +48 -0

48 lines not on this page · raw message

tests/functional/aarch64/test_aspeed_ast2700.py renamed from tests/functional/test_aarch64_aspeed_ast2700.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_aspeed_ast2700.py
rename to tests/functional/aarch64/test_aspeed_ast2700.py
tests/functional/aarch64/test_aspeed_ast2700fc.py renamed from tests/functional/test_aarch64_aspeed_ast2700fc.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_aspeed_ast2700fc.py
rename to tests/functional/aarch64/test_aspeed_ast2700fc.py
tests/functional/aarch64/test_device_passthrough.py renamed from tests/functional/test_aarch64_device_passthrough.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_device_passthrough.py
rename to tests/functional/aarch64/test_device_passthrough.py
tests/functional/aarch64/test_hotplug_pci.py renamed from tests/functional/test_aarch64_hotplug_pci.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_hotplug_pci.py
rename to tests/functional/aarch64/test_hotplug_pci.py
tests/functional/aarch64/test_imx8mp_evk.py renamed from tests/functional/test_aarch64_imx8mp_evk.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_imx8mp_evk.py
rename to tests/functional/aarch64/test_imx8mp_evk.py
tests/functional/aarch64/test_kvm.py renamed from tests/functional/test_aarch64_kvm.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_kvm.py
rename to tests/functional/aarch64/test_kvm.py
tests/functional/aarch64/test_migration.py renamed from tests/functional/test_aarch64_migration.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_migration.py
rename to tests/functional/aarch64/test_migration.py
tests/functional/aarch64/test_multiprocess.py renamed from tests/functional/test_aarch64_multiprocess.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_multiprocess.py
rename to tests/functional/aarch64/test_multiprocess.py
tests/functional/aarch64/test_raspi3.py renamed from tests/functional/test_aarch64_raspi3.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_raspi3.py
rename to tests/functional/aarch64/test_raspi3.py
tests/functional/aarch64/test_raspi4.py renamed from tests/functional/test_aarch64_raspi4.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_raspi4.py
rename to tests/functional/aarch64/test_raspi4.py
tests/functional/aarch64/test_replay.py renamed from tests/functional/test_aarch64_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_replay.py
rename to tests/functional/aarch64/test_replay.py
tests/functional/aarch64/test_reverse_debug.py renamed from tests/functional/test_aarch64_reverse_debug.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_reverse_debug.py
rename to tests/functional/aarch64/test_reverse_debug.py
tests/functional/aarch64/test_rme_sbsaref.py renamed from tests/functional/test_aarch64_rme_sbsaref.py +1 -1
similarity index 98%
rename from tests/functional/test_aarch64_rme_sbsaref.py
rename to tests/functional/aarch64/test_rme_sbsaref.py
index 746770e776d..100f1c7738b 100755
@@ -13,7 +13,7 @@
 
 from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern
 from qemu_test import exec_command_and_wait_for_pattern
-from test_aarch64_rme_virt import test_realms_guest
+from test_rme_virt import test_realms_guest
 
 
 class Aarch64RMESbsaRefMachine(QemuSystemTest):
tests/functional/aarch64/test_rme_virt.py renamed from tests/functional/test_aarch64_rme_virt.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_rme_virt.py
rename to tests/functional/aarch64/test_rme_virt.py
tests/functional/aarch64/test_sbsaref.py renamed from tests/functional/test_aarch64_sbsaref.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_sbsaref.py
rename to tests/functional/aarch64/test_sbsaref.py
tests/functional/aarch64/test_sbsaref_alpine.py renamed from tests/functional/test_aarch64_sbsaref_alpine.py +1 -1
similarity index 97%
rename from tests/functional/test_aarch64_sbsaref_alpine.py
rename to tests/functional/aarch64/test_sbsaref_alpine.py
index 87769993831..abb8f5114bd 100755
@@ -12,7 +12,7 @@
 
 from qemu_test import QemuSystemTest, Asset, skipSlowTest
 from qemu_test import wait_for_console_pattern
-from test_aarch64_sbsaref import fetch_firmware
+from test_sbsaref import fetch_firmware
 
 
 class Aarch64SbsarefAlpine(QemuSystemTest):
tests/functional/aarch64/test_sbsaref_freebsd.py renamed from tests/functional/test_aarch64_sbsaref_freebsd.py +1 -1
similarity index 97%
rename from tests/functional/test_aarch64_sbsaref_freebsd.py
rename to tests/functional/aarch64/test_sbsaref_freebsd.py
index 7ef016fba62..3b942f7795c 100755
@@ -12,7 +12,7 @@
 
 from qemu_test import QemuSystemTest, Asset, skipSlowTest
 from qemu_test import wait_for_console_pattern
-from test_aarch64_sbsaref import fetch_firmware
+from test_sbsaref import fetch_firmware
 
 
 class Aarch64SbsarefFreeBSD(QemuSystemTest):
tests/functional/aarch64/test_smmu.py renamed from tests/functional/test_aarch64_smmu.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_smmu.py
rename to tests/functional/aarch64/test_smmu.py
tests/functional/aarch64/test_tcg_plugins.py renamed from tests/functional/test_aarch64_tcg_plugins.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_tcg_plugins.py
rename to tests/functional/aarch64/test_tcg_plugins.py
tests/functional/aarch64/test_tuxrun.py renamed from tests/functional/test_aarch64_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_tuxrun.py
rename to tests/functional/aarch64/test_tuxrun.py
tests/functional/aarch64/test_virt.py renamed from tests/functional/test_aarch64_virt.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_virt.py
rename to tests/functional/aarch64/test_virt.py
tests/functional/aarch64/test_virt_gpu.py renamed from tests/functional/test_aarch64_virt_gpu.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_virt_gpu.py
rename to tests/functional/aarch64/test_virt_gpu.py
tests/functional/aarch64/test_xen.py renamed from tests/functional/test_aarch64_xen.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_xen.py
rename to tests/functional/aarch64/test_xen.py
tests/functional/aarch64/test_xlnx_versal.py renamed from tests/functional/test_aarch64_xlnx_versal.py +0 -0
similarity index 100%
rename from tests/functional/test_aarch64_xlnx_versal.py
rename to tests/functional/aarch64/test_xlnx_versal.py
tests/functional/meson.build +1 -47

60 lines not on this page · raw message

Signature · 1 line
2.47.2
#17 lore raw

PATCH v2 18/281 tests/functional: Move alpha tests into architecture specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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.

Message-ID: <[email protected]>

---
 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%)
MAINTAINERS +2 -1
index a2a5ccea7b6..8115aae6183 100644
@@ -189,6 +189,7 @@ M: Richard Henderson <[email protected]>
 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
 ------------
tests/functional/alpha/meson.build new file +10 -0
new file mode 100644
index 00000000000..26a5b3f2e4b
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_alpha_system_quick = [
+  'migration',
+]
+
+tests_alpha_system_thorough = [
+  'clipper',
+  'replay',
+]
tests/functional/alpha/test_clipper.py renamed from tests/functional/test_alpha_clipper.py +0 -0
similarity index 100%
rename from tests/functional/test_alpha_clipper.py
rename to tests/functional/alpha/test_clipper.py
tests/functional/alpha/test_migration.py renamed from tests/functional/test_alpha_migration.py +0 -0
similarity index 100%
rename from tests/functional/test_alpha_migration.py
rename to tests/functional/alpha/test_migration.py
tests/functional/alpha/test_replay.py renamed from tests/functional/test_alpha_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_alpha_replay.py
rename to tests/functional/alpha/test_replay.py
tests/functional/meson.build +1 -9
index 9cb6325360f..a7f8c88a078 100644
@@ -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',
 ]
Signature · 1 line
2.47.2
#18 lore raw

PATCH v2 21/281 tests/functional: Move hppa tests into architecture specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 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%)
MAINTAINERS +1 -1
index d01afcbea6d..2e1754912f6 100644
@@ -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
 ------------------
tests/functional/hppa/meson.build new file +5 -0
new file mode 100644
index 00000000000..a3348370884
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_hppa_system_quick = [
+  'seabios',
+]
tests/functional/hppa/test_seabios.py renamed from tests/functional/test_hppa_seabios.py +0 -0
similarity index 100%
rename from tests/functional/test_hppa_seabios.py
rename to tests/functional/hppa/test_seabios.py
tests/functional/meson.build +1 -4
index 81eaa9c218c..8f85c13d3d1 100644
@@ -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',
 ]
Signature · 1 line
2.47.2
#19 lore raw

PATCH v2 22/281 tests/functional: Move i386 tests into architecture specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 MAINTAINERS                                            |  3 ++-
 tests/functional/i386/meson.build                      | 10 ++++++++++
 .../{test_i386_migration.py => i386/test_migration.py} |  0
 .../{test_i386_replay.py => i386/test_replay.py}       |  0
 .../{test_i386_tuxrun.py => i386/test_tuxrun.py}       |  0
 tests/functional/meson.build                           | 10 +---------
 6 files changed, 13 insertions(+), 10 deletions(-)
 create mode 100644 tests/functional/i386/meson.build
 rename tests/functional/{test_i386_migration.py => i386/test_migration.py} (100%)
 rename tests/functional/{test_i386_replay.py => i386/test_replay.py} (100%)
 rename tests/functional/{test_i386_tuxrun.py => i386/test_tuxrun.py} (100%)
MAINTAINERS +2 -1
index 2e1754912f6..2b109ecc18c 100644
@@ -146,6 +146,7 @@ F: target/i386/*.[ch]
 F: target/i386/Kconfig
 F: target/i386/meson.build
 F: tools/i386/
+F: tests/functional/i386/
 
 Guest CPU cores (TCG)
 ---------------------
@@ -1891,7 +1892,7 @@ F: hw/isa/apm.c
 F: include/hw/isa/apm.h
 F: tests/unit/test-x86-topo.c
 F: tests/qtest/test-x86-cpuid-compat.c
-F: tests/functional/test_i386_tuxrun.py
+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
tests/functional/i386/meson.build new file +10 -0
new file mode 100644
index 00000000000..23d8c216be7
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_i386_system_quick = [
+  'migration',
+]
+
+tests_i386_system_thorough = [
+  'replay',
+  'tuxrun',
+]
tests/functional/i386/test_migration.py renamed from tests/functional/test_i386_migration.py +0 -0
similarity index 100%
rename from tests/functional/test_i386_migration.py
rename to tests/functional/i386/test_migration.py
tests/functional/i386/test_replay.py renamed from tests/functional/test_i386_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_i386_replay.py
rename to tests/functional/i386/test_replay.py
tests/functional/i386/test_tuxrun.py renamed from tests/functional/test_i386_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_i386_tuxrun.py
rename to tests/functional/i386/test_tuxrun.py
tests/functional/meson.build +1 -9
index 8f85c13d3d1..f1fc01717c3 100644
@@ -14,6 +14,7 @@ subdir('alpha')
 subdir('arm')
 subdir('avr')
 subdir('hppa')
+subdir('i386')
 
 test_mips_timeouts = {
   'mips_malta' : 480,
@@ -79,15 +80,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_i386_system_quick = [
-  'i386_migration',
-]
-
-tests_i386_system_thorough = [
-  'i386_replay',
-  'i386_tuxrun',
-]
-
 tests_loongarch64_system_thorough = [
   'loongarch64_virt',
 ]
Signature · 1 line
2.47.2
#20 lore raw

PATCH v2 24/281 tests/functional: Move m68k tests into architecture specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 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%)
MAINTAINERS +4 -4
index 716127e831d..e188de813fb 100644
@@ -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 <[email protected]>
@@ -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 <[email protected]>
@@ -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 <[email protected]>
@@ -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
 -------------------
tests/functional/m68k/meson.build new file +9 -0
new file mode 100644
index 00000000000..e29044a6d73
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_m68k_system_thorough = [
+  'mcf5208evb',
+  'nextcube',
+  'replay',
+  'q800',
+  'tuxrun',
+]
tests/functional/m68k/test_mcf5208evb.py renamed from tests/functional/test_m68k_mcf5208evb.py +0 -0
similarity index 100%
rename from tests/functional/test_m68k_mcf5208evb.py
rename to tests/functional/m68k/test_mcf5208evb.py
tests/functional/m68k/test_nextcube.py renamed from tests/functional/test_m68k_nextcube.py +0 -0
similarity index 100%
rename from tests/functional/test_m68k_nextcube.py
rename to tests/functional/m68k/test_nextcube.py
tests/functional/m68k/test_q800.py renamed from tests/functional/test_m68k_q800.py +0 -0
similarity index 100%
rename from tests/functional/test_m68k_q800.py
rename to tests/functional/m68k/test_q800.py
tests/functional/m68k/test_replay.py renamed from tests/functional/test_m68k_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_m68k_replay.py
rename to tests/functional/m68k/test_replay.py
tests/functional/m68k/test_tuxrun.py renamed from tests/functional/test_m68k_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_m68k_tuxrun.py
rename to tests/functional/m68k/test_tuxrun.py
tests/functional/meson.build +1 -8
index e2e66dcf523..d32dd4a371f 100644
@@ -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'
Signature · 1 line
2.47.2
#21 lore raw

PATCH v2 25/281 tests/functional: Move microblaze tests into architecture specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 MAINTAINERS                                           |  2 +-
 tests/functional/meson.build                          | 11 ++---------
 tests/functional/microblaze/meson.build               |  6 ++++++
 .../test_replay.py}                                   |  0
 .../test_s3adsp1800.py}                               |  0
 tests/functional/microblazeel/meson.build             |  5 +++++
 .../test_s3adsp1800.py}                               |  2 +-
 7 files changed, 15 insertions(+), 11 deletions(-)
 create mode 100644 tests/functional/microblaze/meson.build
 rename tests/functional/{test_microblaze_replay.py => microblaze/test_replay.py} (100%)
 rename tests/functional/{test_microblaze_s3adsp1800.py => microblaze/test_s3adsp1800.py} (100%)
 create mode 100644 tests/functional/microblazeel/meson.build
 rename tests/functional/{test_microblazeel_s3adsp1800.py => microblazeel/test_s3adsp1800.py} (92%)
MAINTAINERS +1 -1
index e188de813fb..b6a835777bb 100644
@@ -1370,7 +1370,7 @@ M: Edgar E. Iglesias <[email protected]>
 S: Maintained
 F: hw/microblaze/petalogix_s3adsp1800_mmu.c
 F: include/hw/char/xilinx_uartlite.h
-F: tests/functional/test_microblaze*.py
+F: tests/functional/microblaze*/test_s3adsp1800.py
 
 petalogix_ml605
 M: Edgar E. Iglesias <[email protected]>
tests/functional/meson.build +2 -9
index d32dd4a371f..fee68056145 100644
@@ -17,6 +17,8 @@ subdir('hppa')
 subdir('i386')
 subdir('loongarch64')
 subdir('m68k')
+subdir('microblaze')
+subdir('microblazeel')
 
 test_mips_timeouts = {
   'mips_malta' : 480,
@@ -82,15 +84,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_microblaze_system_thorough = [
-  'microblaze_replay',
-  'microblaze_s3adsp1800'
-]
-
-tests_microblazeel_system_thorough = [
-  'microblazeel_s3adsp1800'
-]
-
 tests_mips_system_thorough = [
   'mips_malta',
   'mips_replay',
tests/functional/microblaze/meson.build new file +6 -0
new file mode 100644
index 00000000000..8069ca9be60
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_microblaze_system_thorough = [
+  'replay',
+  's3adsp1800'
+]
tests/functional/microblaze/test_replay.py renamed from tests/functional/test_microblaze_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_microblaze_replay.py
rename to tests/functional/microblaze/test_replay.py
tests/functional/microblaze/test_s3adsp1800.py renamed from tests/functional/test_microblaze_s3adsp1800.py +0 -0
similarity index 100%
rename from tests/functional/test_microblaze_s3adsp1800.py
rename to tests/functional/microblaze/test_s3adsp1800.py
tests/functional/microblazeel/meson.build new file +5 -0
new file mode 100644
index 00000000000..27619dc5a9a
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_microblazeel_system_thorough = [
+  's3adsp1800'
+]
tests/functional/microblazeel/test_s3adsp1800.py renamed from tests/functional/test_microblazeel_s3adsp1800.py +1 -1
similarity index 92%
rename from tests/functional/test_microblazeel_s3adsp1800.py
rename to tests/functional/microblazeel/test_s3adsp1800.py
index 915902d48bd..75ce8856ed1 100755
@@ -7,7 +7,7 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later. See the COPYING file in the top-level directory.
 
-from test_microblaze_s3adsp1800 import MicroblazeMachine
+from microblaze.test_s3adsp1800 import MicroblazeMachine
 
 
 class MicroblazeLittleEndianMachine(MicroblazeMachine):
Signature · 1 line
2.47.2
#22 lore raw

PATCH v2 31/281 tests/functional: Move s390x tests into target-specific folders

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 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%)
MAINTAINERS +3 -3
index c6410a5f5fd..4a55a20f6a5 100644
@@ -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: [email protected]
 
@@ -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: [email protected]
 
@@ -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
 ------------
tests/functional/meson.build +1 -12
index 7e7a6aa0c93..abaa4e00fca 100644
@@ -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',
tests/functional/s390x/meson.build new file +13 -0
new file mode 100644
index 00000000000..030b116039c
@@ -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',
+]
tests/functional/s390x/test_ccw_virtio.py renamed from tests/functional/test_s390x_ccw_virtio.py +0 -0
similarity index 100%
rename from tests/functional/test_s390x_ccw_virtio.py
rename to tests/functional/s390x/test_ccw_virtio.py
tests/functional/s390x/test_pxelinux.py renamed from tests/functional/test_s390x_pxelinux.py +0 -0
similarity index 100%
rename from tests/functional/test_s390x_pxelinux.py
rename to tests/functional/s390x/test_pxelinux.py
tests/functional/s390x/test_replay.py renamed from tests/functional/test_s390x_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_s390x_replay.py
rename to tests/functional/s390x/test_replay.py
tests/functional/s390x/test_topology.py renamed from tests/functional/test_s390x_topology.py +0 -0
similarity index 100%
rename from tests/functional/test_s390x_topology.py
rename to tests/functional/s390x/test_topology.py
tests/functional/s390x/test_tuxrun.py renamed from tests/functional/test_s390x_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_s390x_tuxrun.py
rename to tests/functional/s390x/test_tuxrun.py
Signature · 1 line
2.47.2
#23 lore raw

PATCH v2 32/281 tests/functional: Move sh4/sh4eb tests into target-specific folders

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 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%)
MAINTAINERS +2 -2
index 4a55a20f6a5..eddec0058e0 100644
@@ -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
 --------------
tests/functional/meson.build +2 -13
index abaa4e00fca..ce713509e32 100644
@@ -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',
 ]
tests/functional/sh4/meson.build new file +10 -0
new file mode 100644
index 00000000000..56f824e1e71
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+test_sh4_timeouts = {
+  'tuxrun' : 240,
+}
+
+tests_sh4_system_thorough = [
+  'r2d',
+  'tuxrun',
+]
tests/functional/sh4/test_r2d.py renamed from tests/functional/test_sh4_r2d.py +0 -0
similarity index 100%
rename from tests/functional/test_sh4_r2d.py
rename to tests/functional/sh4/test_r2d.py
tests/functional/sh4/test_tuxrun.py renamed from tests/functional/test_sh4_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_sh4_tuxrun.py
rename to tests/functional/sh4/test_tuxrun.py
tests/functional/sh4eb/meson.build new file +5 -0
new file mode 100644
index 00000000000..25e9a6e4041
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_sh4eb_system_thorough = [
+  'r2d',
+]
tests/functional/sh4eb/test_r2d.py renamed from tests/functional/test_sh4eb_r2d.py +0 -0
similarity index 100%
rename from tests/functional/test_sh4eb_r2d.py
rename to tests/functional/sh4eb/test_r2d.py
Signature · 1 line
2.47.2
#24 lore raw

PATCH v2 33/281 tests/functional: Move sparc/sparc64 tests into target-specific folders

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 MAINTAINERS                                   |  6 +++---
 tests/functional/meson.build                  | 20 ++-----------------
 tests/functional/sparc/meson.build            | 10 ++++++++++
 .../test_migration.py}                        |  0
 .../test_replay.py}                           |  0
 .../test_sun4m.py}                            |  0
 tests/functional/sparc64/meson.build          | 10 ++++++++++
 .../test_migration.py}                        |  0
 .../test_sun4u.py}                            |  0
 .../test_tuxrun.py}                           |  0
 10 files changed, 25 insertions(+), 21 deletions(-)
 create mode 100644 tests/functional/sparc/meson.build
 rename tests/functional/{test_sparc_migration.py => sparc/test_migration.py} (100%)
 rename tests/functional/{test_sparc_replay.py => sparc/test_replay.py} (100%)
 rename tests/functional/{test_sparc_sun4m.py => sparc/test_sun4m.py} (100%)
 create mode 100644 tests/functional/sparc64/meson.build
 rename tests/functional/{test_sparc64_migration.py => sparc64/test_migration.py} (100%)
 rename tests/functional/{test_sparc64_sun4u.py => sparc64/test_sun4u.py} (100%)
 rename tests/functional/{test_sparc64_tuxrun.py => sparc64/test_tuxrun.py} (100%)
MAINTAINERS +3 -3
index eddec0058e0..b46445ff5c0 100644
@@ -1755,7 +1755,7 @@ F: include/hw/nvram/sun_nvram.h
 F: include/hw/sparc/sparc32_dma.h
 F: include/hw/sparc/sun4m_iommu.h
 F: pc-bios/openbios-sparc32
-F: tests/functional/test_sparc_sun4m.py
+F: tests/functional/sparc/test_sun4m.py
 
 Sun4u
 M: Mark Cave-Ayland <[email protected]>
@@ -1768,8 +1768,8 @@ F: include/hw/pci-host/sabre.h
 F: hw/pci-bridge/simba.c
 F: include/hw/pci-bridge/simba.h
 F: pc-bios/openbios-sparc64
-F: tests/functional/test_sparc64_sun4u.py
-F: tests/functional/test_sparc64_tuxrun.py
+F: tests/functional/sparc64/test_sun4u.py
+F: tests/functional/sparc64/test_tuxrun.py
 
 Sun4v
 M: Artyom Tarasenko <[email protected]>
tests/functional/meson.build +2 -18
index ce713509e32..00d18dba3ce 100644
@@ -32,6 +32,8 @@ subdir('rx')
 subdir('s390x')
 subdir('sh4')
 subdir('sh4eb')
+subdir('sparc')
+subdir('sparc64')
 
 test_x86_64_timeouts = {
   'acpi_bits' : 420,
@@ -54,24 +56,6 @@ tests_generic_linuxuser = [
 tests_generic_bsduser = [
 ]
 
-tests_sparc_system_quick = [
-  'sparc_migration',
-]
-
-tests_sparc_system_thorough = [
-  'sparc_replay',
-  'sparc_sun4m',
-]
-
-tests_sparc64_system_quick = [
-  'sparc64_migration',
-]
-
-tests_sparc64_system_thorough = [
-  'sparc64_sun4u',
-  'sparc64_tuxrun',
-]
-
 tests_x86_64_system_quick = [
   'cpu_queries',
   'mem_addr_space',
tests/functional/sparc/meson.build new file +10 -0
new file mode 100644
index 00000000000..88732becd81
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_sparc_system_quick = [
+  'migration',
+]
+
+tests_sparc_system_thorough = [
+  'replay',
+  'sun4m',
+]
tests/functional/sparc/test_migration.py renamed from tests/functional/test_sparc_migration.py +0 -0
similarity index 100%
rename from tests/functional/test_sparc_migration.py
rename to tests/functional/sparc/test_migration.py
tests/functional/sparc/test_replay.py renamed from tests/functional/test_sparc_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_sparc_replay.py
rename to tests/functional/sparc/test_replay.py
tests/functional/sparc/test_sun4m.py renamed from tests/functional/test_sparc_sun4m.py +0 -0
similarity index 100%
rename from tests/functional/test_sparc_sun4m.py
rename to tests/functional/sparc/test_sun4m.py
tests/functional/sparc64/meson.build new file +10 -0
new file mode 100644
index 00000000000..2e04e7d4f3d
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_sparc64_system_quick = [
+  'migration',
+]
+
+tests_sparc64_system_thorough = [
+  'sun4u',
+  'tuxrun',
+]
tests/functional/sparc64/test_migration.py renamed from tests/functional/test_sparc64_migration.py +0 -0
similarity index 100%
rename from tests/functional/test_sparc64_migration.py
rename to tests/functional/sparc64/test_migration.py
tests/functional/sparc64/test_sun4u.py renamed from tests/functional/test_sparc64_sun4u.py +0 -0
similarity index 100%
rename from tests/functional/test_sparc64_sun4u.py
rename to tests/functional/sparc64/test_sun4u.py
tests/functional/sparc64/test_tuxrun.py renamed from tests/functional/test_sparc64_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_sparc64_tuxrun.py
rename to tests/functional/sparc64/test_tuxrun.py
Signature · 1 line
2.47.2
#25 lore raw

PATCH v2 34/281 tests/functional: Move x86_64 tests into target-specific folder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

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

Message-ID: <[email protected]>

---
 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%)
MAINTAINERS +17 -15
index b46445ff5c0..7b1a94f696c 100644
@@ -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 <[email protected]>
@@ -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 <[email protected]>
@@ -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 <[email protected]>
 M: Michael S. Tsirkin <[email protected]>
 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 <[email protected]>
@@ -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 <[email protected]>
@@ -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 <[email protected]>
 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 <[email protected]>
@@ -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
tests/functional/meson.build +1 -36
index 00d18dba3ce..34e30239a6b 100644
@@ -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',
tests/functional/x86_64/meson.build new file +37 -0
new file mode 100644
index 00000000000..696a9ecab42
@@ -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',
+]
tests/functional/x86_64/test_acpi_bits.py renamed from tests/functional/test_acpi_bits.py +0 -0
similarity index 100%
rename from tests/functional/test_acpi_bits.py
rename to tests/functional/x86_64/test_acpi_bits.py
tests/functional/x86_64/test_cpu_model_versions.py renamed from tests/functional/test_x86_cpu_model_versions.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_cpu_model_versions.py
rename to tests/functional/x86_64/test_cpu_model_versions.py
tests/functional/x86_64/test_cpu_queries.py renamed from tests/functional/test_cpu_queries.py +0 -0
similarity index 100%
rename from tests/functional/test_cpu_queries.py
rename to tests/functional/x86_64/test_cpu_queries.py
tests/functional/x86_64/test_hotplug_blk.py renamed from tests/functional/test_x86_64_hotplug_blk.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_hotplug_blk.py
rename to tests/functional/x86_64/test_hotplug_blk.py
tests/functional/x86_64/test_hotplug_cpu.py renamed from tests/functional/test_x86_64_hotplug_cpu.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_hotplug_cpu.py
rename to tests/functional/x86_64/test_hotplug_cpu.py
tests/functional/x86_64/test_intel_iommu.py renamed from tests/functional/test_intel_iommu.py +0 -0
similarity index 100%
rename from tests/functional/test_intel_iommu.py
rename to tests/functional/x86_64/test_intel_iommu.py
tests/functional/x86_64/test_kvm_xen.py renamed from tests/functional/test_x86_64_kvm_xen.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_kvm_xen.py
rename to tests/functional/x86_64/test_kvm_xen.py
tests/functional/x86_64/test_linux_initrd.py renamed from tests/functional/test_linux_initrd.py +0 -0
similarity index 100%
rename from tests/functional/test_linux_initrd.py
rename to tests/functional/x86_64/test_linux_initrd.py
tests/functional/x86_64/test_mem_addr_space.py renamed from tests/functional/test_mem_addr_space.py +0 -0
similarity index 100%
rename from tests/functional/test_mem_addr_space.py
rename to tests/functional/x86_64/test_mem_addr_space.py
tests/functional/x86_64/test_memlock.py renamed from tests/functional/test_memlock.py +0 -0
similarity index 100%
rename from tests/functional/test_memlock.py
rename to tests/functional/x86_64/test_memlock.py
tests/functional/x86_64/test_migration.py renamed from tests/functional/test_x86_64_migration.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_migration.py
rename to tests/functional/x86_64/test_migration.py
tests/functional/x86_64/test_multiprocess.py renamed from tests/functional/test_x86_64_multiprocess.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_multiprocess.py
rename to tests/functional/x86_64/test_multiprocess.py
tests/functional/x86_64/test_netdev_ethtool.py renamed from tests/functional/test_netdev_ethtool.py +0 -0
similarity index 100%
rename from tests/functional/test_netdev_ethtool.py
rename to tests/functional/x86_64/test_netdev_ethtool.py
tests/functional/x86_64/test_pc_cpu_hotplug_props.py renamed from tests/functional/test_pc_cpu_hotplug_props.py +0 -0
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
tests/functional/x86_64/test_replay.py renamed from tests/functional/test_x86_64_replay.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_replay.py
rename to tests/functional/x86_64/test_replay.py
tests/functional/x86_64/test_reverse_debug.py renamed from tests/functional/test_x86_64_reverse_debug.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_reverse_debug.py
rename to tests/functional/x86_64/test_reverse_debug.py
tests/functional/x86_64/test_tuxrun.py renamed from tests/functional/test_x86_64_tuxrun.py +0 -0
similarity index 100%
rename from tests/functional/test_x86_64_tuxrun.py
rename to tests/functional/x86_64/test_tuxrun.py
tests/functional/x86_64/test_virtio_balloon.py renamed from tests/functional/test_virtio_balloon.py +0 -0
similarity index 100%
rename from tests/functional/test_virtio_balloon.py
rename to tests/functional/x86_64/test_virtio_balloon.py
tests/functional/x86_64/test_virtio_gpu.py renamed from tests/functional/test_virtio_gpu.py +0 -0
similarity index 100%
rename from tests/functional/test_virtio_gpu.py
rename to tests/functional/x86_64/test_virtio_gpu.py
tests/functional/x86_64/test_virtio_version.py renamed from tests/functional/test_virtio_version.py +0 -0
similarity index 100%
rename from tests/functional/test_virtio_version.py
rename to tests/functional/x86_64/test_virtio_version.py
Signature · 1 line
2.47.2
#26 lore raw

PATCH v2 36/281 tests/functional: Move the generic tests to a subfolder

In reply to Alex Bennée

From: Thomas Huth <[email protected]>

This also removes the line for using tests from the main folder since we do not have any tests left here. And while we're at it, also mark the vnc test as generic now since it is not specific to x86.

Message-ID: <[email protected]>

---
 MAINTAINERS                                     |  8 ++++----
 tests/functional/generic/meson.build            | 14 ++++++++++++++
 .../{ => generic}/test_empty_cpu_model.py       |  0
 .../{ => generic}/test_info_usernet.py          |  0
 tests/functional/{ => generic}/test_version.py  |  0
 tests/functional/{ => generic}/test_vnc.py      |  0
 tests/functional/meson.build                    | 17 ++---------------
 tests/functional/x86_64/meson.build             |  1 -
 8 files changed, 20 insertions(+), 20 deletions(-)
 create mode 100644 tests/functional/generic/meson.build
 rename tests/functional/{ => generic}/test_empty_cpu_model.py (100%)
 rename tests/functional/{ => generic}/test_info_usernet.py (100%)
 rename tests/functional/{ => generic}/test_version.py (100%)
 rename tests/functional/{ => generic}/test_vnc.py (100%)
MAINTAINERS +4 -4
index 792d2d6f2de..625fe67b41d 100644
@@ -1976,7 +1976,7 @@ F: include/hw/core/cpu.h
 F: include/hw/cpu/cluster.h
 F: include/system/numa.h
 F: tests/functional/x86_64/test_cpu_queries.py
-F: tests/functional/test_empty_cpu_model.py
+F: tests/functional/generic/test_empty_cpu_model.py
 F: tests/unit/test-smp-parse.c
 T: git https://gitlab.com/ehabkost/qemu.git machine-next
 
@@ -2197,7 +2197,7 @@ S: Odd Fixes
 F: hw/net/
 F: include/hw/net/
 F: tests/qtest/virtio-net-test.c
-F: tests/functional/test_info_usernet.py
+F: tests/functional/generic/test_info_usernet.py
 F: docs/system/virtio-net-failover.rst
 T: git https://github.com/jasowang/qemu.git net
 
@@ -3134,7 +3134,7 @@ S: Supported
 F: include/qemu/option.h
 F: tests/unit/test-keyval.c
 F: tests/unit/test-qemu-opts.c
-F: tests/functional/test_version.py
+F: tests/functional/generic/test_version.py
 F: util/keyval.c
 F: util/qemu-option.c
 
@@ -3252,7 +3252,7 @@ F: include/ui/
 F: qapi/ui.json
 F: util/drm.c
 F: docs/devel/ui.rst
-F: tests/functional/test_vnc.py
+F: tests/functional/generic/test_vnc.py
 
 Cocoa graphics
 M: Peter Maydell <[email protected]>
tests/functional/generic/meson.build new file +14 -0
new file mode 100644
index 00000000000..013cc96fbf8
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+tests_generic_system = [
+  'empty_cpu_model',
+  'info_usernet',
+  'version',
+  'vnc',
+]
+
+tests_generic_linuxuser = [
+]
+
+tests_generic_bsduser = [
+]
tests/functional/generic/test_empty_cpu_model.py renamed from tests/functional/test_empty_cpu_model.py +0 -0
similarity index 100%
rename from tests/functional/test_empty_cpu_model.py
rename to tests/functional/generic/test_empty_cpu_model.py
tests/functional/generic/test_info_usernet.py renamed from tests/functional/test_info_usernet.py +0 -0
similarity index 100%
rename from tests/functional/test_info_usernet.py
rename to tests/functional/generic/test_info_usernet.py
tests/functional/generic/test_version.py renamed from tests/functional/test_version.py +0 -0
similarity index 100%
rename from tests/functional/test_version.py
rename to tests/functional/generic/test_version.py
tests/functional/generic/test_vnc.py renamed from tests/functional/test_vnc.py +0 -0
similarity index 100%
rename from tests/functional/test_vnc.py
rename to tests/functional/generic/test_vnc.py
tests/functional/meson.build +2 -15
index b1eec16add8..2a0c5aa1418 100644
@@ -36,18 +36,7 @@ subdir('sparc')
 subdir('sparc64')
 subdir('x86_64')
 subdir('xtensa')
-
-tests_generic_system = [
-  'empty_cpu_model',
-  'info_usernet',
-  'version',
-]
-
-tests_generic_linuxuser = [
-]
-
-tests_generic_bsduser = [
-]
+subdir('generic')
 
 precache_all = []
 foreach speed : ['quick', 'thorough']
@@ -90,9 +79,7 @@ foreach speed : ['quick', 'thorough']
 
     foreach test : target_tests
       testname = '@0@-@1@'.format(target_base, test)
-      if fs.exists('test_' + test + '.py')
-        testfile = 'test_' + test + '.py'
-      elif fs.exists('generic' / 'test_' + test + '.py')
+      if fs.exists('generic' / 'test_' + test + '.py')
         testfile = 'generic' / 'test_' + test + '.py'
       else
         testfile = target_base / 'test_' + test + '.py'
tests/functional/x86_64/meson.build +0 -1
index 696a9ecab42..d0b4667bb8a 100644
@@ -16,7 +16,6 @@ tests_x86_64_system_quick = [
   'migration',
   'pc_cpu_hotplug_props',
   'virtio_version',
-  'vnc',
   'memlock',
 ]
 
Signature · 1 line
2.47.2
#27 lore raw

PATCH v2 41/281 kvm/kvm-all: make kvm_park/unpark_vcpu local to kvm-all.c

In reply to Alex Bennée

From: Ani Sinha <[email protected]>

kvm_park_vcpu() and kvm_unpark_vcpu() is only used in kvm-all.c. Declare it static, remove it from common header file and make it local to kvm-all.c

---
 include/system/kvm.h | 17 -----------------
 accel/kvm/kvm-all.c  |  4 ++--
 2 files changed, 2 insertions(+), 19 deletions(-)
include/system/kvm.h +0 -17
index 3c7d3147366..4fc09e38910 100644
@@ -317,23 +317,6 @@ int kvm_create_device(KVMState *s, uint64_t type, bool test);
  */
 bool kvm_device_supported(int vmfd, uint64_t type);
 
-/**
- * kvm_park_vcpu - Park QEMU KVM vCPU context
- * @cpu: QOM CPUState object for which QEMU KVM vCPU context has to be parked.
- *
- * @returns: none
- */
-void kvm_park_vcpu(CPUState *cpu);
-
-/**
- * kvm_unpark_vcpu - unpark QEMU KVM vCPU context
- * @s: KVM State
- * @vcpu_id: Architecture vCPU ID of the parked vCPU
- *
- * @returns: KVM fd
- */
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id);
-
 /**
  * kvm_create_and_park_vcpu - Create and park a KVM vCPU
  * @cpu: QOM CPUState object for which KVM vCPU has to be created and parked.
accel/kvm/kvm-all.c +2 -2
index 890d5ea9f86..f36dfe33492 100644
@@ -414,7 +414,7 @@ err:
     return ret;
 }
 
-void kvm_park_vcpu(CPUState *cpu)
+static void kvm_park_vcpu(CPUState *cpu)
 {
     struct KVMParkedVcpu *vcpu;
 
@@ -426,7 +426,7 @@ void kvm_park_vcpu(CPUState *cpu)
     QLIST_INSERT_HEAD(&kvm_state->kvm_parked_vcpus, vcpu, node);
 }
 
-int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
+static int kvm_unpark_vcpu(KVMState *s, unsigned long vcpu_id)
 {
     struct KVMParkedVcpu *cpu;
     int kvm_fd = -ENOENT;
Signature · 1 line
2.47.2
#28 lore raw

PATCH v2 45/281 rust/qemu-api-macros: make derive(Object) friendly when missing parent

In reply to Alex Bennée

From: Marc-André Lureau <[email protected]>

---
 rust/qemu-api-macros/src/lib.rs | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
rust/qemu-api-macros/src/lib.rs +9 -1
index b525d89c09e..a6147418891 100644
@@ -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,
Signature · 1 line
2.47.2
#29 lore raw

PATCH v2 47/281 rust: move dependencies to rust/Cargo.toml

In reply to Alex Bennée

From: Paolo Bonzini <[email protected]>

As more crates start using the same dependencies, it's better to not repeat the versions and move the dependency declarations to the workspace.

---
 rust/Cargo.toml          | 5 +++++
 rust/qemu-api/Cargo.toml | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)
rust/Cargo.toml +5 -0
index 0a83db15356..6f8884eb30b 100644
@@ -15,6 +15,11 @@ license = "GPL-2.0-or-later"
 repository = "https://gitlab.com/qemu-project/qemu/"
 rust-version = "1.77.0"
 
+[workspace.dependencies]
+anyhow = "~1.0"
+foreign = "~0.3.1"
+libc = "0.2.162"
+
 [workspace.lints.rust]
 unexpected_cfgs = { level = "deny", check-cfg = [
     'cfg(MESON)', 'cfg(HAVE_GLIB_WITH_ALIGNED_ALLOC)',
rust/qemu-api/Cargo.toml +3 -3
index db7000dee44..c07a17a28b0 100644
@@ -15,9 +15,9 @@ rust-version.workspace = true
 
 [dependencies]
 qemu_api_macros = { path = "../qemu-api-macros" }
-anyhow = "~1.0"
-libc = "0.2.162"
-foreign = "~0.3.1"
+anyhow = { workspace = true }
+foreign = { workspace = true }
+libc = { workspace = true }
 
 [features]
 default = ["debug_cell"]
Signature · 1 line
2.47.2
#30 lore raw

PATCH v2 48/281 semihosting: Retrieve stack top from image_info

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 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(-)
linux-user/qemu.h +0 -1
index 0b19fa43e65..b6621536b36 100644
@@ -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;
linux-user/aarch64/cpu_loop.c +0 -1
index fea43cefa6b..b65999a75bf 100644
@@ -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;
linux-user/arm/cpu_loop.c +0 -1
index 33f63951a95..e40d6beafa2 100644
@@ -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;
linux-user/m68k/cpu_loop.c +0 -1
index 5da91b997ae..3aaaf02ca4e 100644
@@ -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;
linux-user/riscv/cpu_loop.c +0 -1
index 3ac8bbfec1f..541de765ffa 100644
@@ -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;
semihosting/arm-compat-semi.c +5 -1
index 86e5260e504..bc04b02eba8 100644
@@ -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 */
Signature · 1 line
2.47.2
#31 lore raw

PATCH v2 49/281 semihosting: Initialize heap once per process

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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.

---
 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(-)
linux-user/qemu.h +0 -5
index b6621536b36..4d6fad28c63 100644
@@ -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;
linux-user/aarch64/cpu_loop.c +0 -7
index b65999a75bf..030a630c936 100644
@@ -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;
 }
linux-user/arm/cpu_loop.c +11 -14
index e40d6beafa2..9d54422736c 100644
@@ -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);
+    }
 }
linux-user/m68k/cpu_loop.c +0 -8
index 3aaaf02ca4e..23693f33582 100644
@@ -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;
 }
linux-user/riscv/cpu_loop.c +0 -4
index 541de765ffa..2dd30c7b288 100644
@@ -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;
 }
semihosting/arm-compat-semi.c +9 -13
index bc04b02eba8..bcd13cd6dfd 100644
@@ -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.
Signature · 1 line
2.47.2
#32 lore raw

PATCH v2 50/281 linux-user: Create target/elfload.c files

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

Prepare to split the main linux-user/elfload.c.
Create empty files for each target, and add the common build rule.

---
 meson.build                      | 6 +++++-
 linux-user/aarch64/elfload.c     | 1 +
 linux-user/alpha/elfload.c       | 1 +
 linux-user/arm/elfload.c         | 1 +
 linux-user/hexagon/elfload.c     | 1 +
 linux-user/hppa/elfload.c        | 1 +
 linux-user/i386/elfload.c        | 1 +
 linux-user/loongarch64/elfload.c | 1 +
 linux-user/m68k/elfload.c        | 1 +
 linux-user/microblaze/elfload.c  | 1 +
 linux-user/mips/elfload.c        | 1 +
 linux-user/mips64/elfload.c      | 1 +
 linux-user/openrisc/elfload.c    | 1 +
 linux-user/ppc/elfload.c         | 1 +
 linux-user/riscv/elfload.c       | 1 +
 linux-user/s390x/elfload.c       | 1 +
 linux-user/sh4/elfload.c         | 1 +
 linux-user/sparc/elfload.c       | 1 +
 linux-user/x86_64/elfload.c      | 1 +
 linux-user/xtensa/elfload.c      | 1 +
 20 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 linux-user/aarch64/elfload.c
 create mode 100644 linux-user/alpha/elfload.c
 create mode 100644 linux-user/arm/elfload.c
 create mode 100644 linux-user/hexagon/elfload.c
 create mode 100644 linux-user/hppa/elfload.c
 create mode 100644 linux-user/i386/elfload.c
 create mode 100644 linux-user/loongarch64/elfload.c
 create mode 100644 linux-user/m68k/elfload.c
 create mode 100644 linux-user/microblaze/elfload.c
 create mode 100644 linux-user/mips/elfload.c
 create mode 100644 linux-user/mips64/elfload.c
 create mode 100644 linux-user/openrisc/elfload.c
 create mode 100644 linux-user/ppc/elfload.c
 create mode 100644 linux-user/riscv/elfload.c
 create mode 100644 linux-user/s390x/elfload.c
 create mode 100644 linux-user/sh4/elfload.c
 create mode 100644 linux-user/sparc/elfload.c
 create mode 100644 linux-user/x86_64/elfload.c
 create mode 100644 linux-user/xtensa/elfload.c
meson.build +5 -1
index 50c774a1955..0d42de61ae6 100644
@@ -4327,7 +4327,11 @@ foreach target : target_dirs
     )
     if 'CONFIG_LINUX_USER' in config_target
       dir = base_dir / abi
-      arch_srcs += files(dir / 'signal.c', dir / 'cpu_loop.c')
+      arch_srcs += files(
+        dir / 'cpu_loop.c',
+        dir / 'elfload.c',
+        dir / 'signal.c',
+      )
       if config_target.has_key('TARGET_SYSTBL_ABI')
         arch_srcs += \
           syscall_nr_generators[abi].process(base_dir / abi / config_target['TARGET_SYSTBL'],
linux-user/aarch64/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/alpha/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/arm/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/hexagon/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/hppa/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/i386/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/loongarch64/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/m68k/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/microblaze/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/mips/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/mips64/elfload.c new file +1 -0
new file mode 100644
index 00000000000..b719555e659
@@ -0,0 +1 @@
+#include "../mips/elfload.c"
linux-user/openrisc/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/ppc/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/riscv/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/s390x/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/sh4/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/sparc/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/x86_64/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
linux-user/xtensa/elfload.c new file +1 -0
new file mode 100644
index 00000000000..73fa78ef14e
@@ -0,0 +1 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
Signature · 1 line
2.47.2
#33 lore raw

PATCH v2 51/281 linux-user: Move ppc uabi/asm/elf.h workaround to osdep.h

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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.

---
 include/qemu/osdep.h |  8 ++++++++
 hw/core/loader.c     |  4 ----
 linux-user/elfload.c | 10 ----------
 3 files changed, 8 insertions(+), 14 deletions(-)
include/qemu/osdep.h +8 -0
index 96fe51bc390..be3460b32f2 100644
@@ -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
hw/core/loader.c +0 -4
index e7056ba4bd3..524af6f14a0 100644
@@ -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"
 
linux-user/elfload.c +0 -10
index ea214105ff8..4ca8c39dc26 100644
@@ -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
Signature · 1 line
2.47.2
#34 lore raw

PATCH v2 54/281 linux-user: Move hwcap functions to {arm, aarch64}/elfload.c

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

For get_elf_hwcap and get_elf_hwcap2, change the return type to abi_ulong, and pass in the cpu. We must do these targets at the same time because of the ifdef dependency between TARGET_AARCH64 and TARGET_ARM.

---
 linux-user/aarch64/target_elf.h |   3 +
 linux-user/arm/target_elf.h     |   3 +
 linux-user/arm/target_proc.h    |   4 +-
 linux-user/loader.h             |  10 +-
 linux-user/aarch64/elfload.c    | 333 +++++++++++++++++++++
 linux-user/arm/elfload.c        | 161 ++++++++++
 linux-user/elfload.c            | 505 +-------------------------------
 7 files changed, 510 insertions(+), 509 deletions(-)
linux-user/aarch64/target_elf.h +3 -0
index d955b3d07f9..77108f3cb0c 100644
@@ -8,4 +8,7 @@
 #ifndef AARCH64_TARGET_ELF_H
 #define AARCH64_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+#define HAVE_ELF_HWCAP2         1
+
 #endif
linux-user/arm/target_elf.h +3 -0
index 2abb27a7337..90470bd87b6 100644
@@ -8,4 +8,7 @@
 #ifndef ARM_TARGET_ELF_H
 #define ARM_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+#define HAVE_ELF_HWCAP2         1
+
 #endif
linux-user/arm/target_proc.h +2 -2
index ac75af9ca64..a4cd6948c60 100644
@@ -10,8 +10,8 @@ static int open_cpuinfo(CPUArchState *cpu_env, int fd)
 {
     ARMCPU *cpu = env_archcpu(cpu_env);
     int arch, midr_rev, midr_part, midr_var, midr_impl;
-    target_ulong elf_hwcap = get_elf_hwcap();
-    target_ulong elf_hwcap2 = get_elf_hwcap2();
+    target_ulong elf_hwcap = get_elf_hwcap(env_cpu(cpu_env));
+    target_ulong elf_hwcap2 = get_elf_hwcap2(env_cpu(cpu_env));
     const char *elf_name;
     int num_cpus, len_part, len_var;
 
linux-user/loader.h +4 -6
index 457bb36daa4..151a06f5db5 100644
@@ -101,16 +101,14 @@ 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)
+#if defined(TARGET_I386) || defined(TARGET_X86_64) || defined(TARGET_ARM)
 abi_ulong get_elf_hwcap(CPUState *cs);
+abi_ulong get_elf_hwcap2(CPUState *cs);
 #endif
-#if defined(TARGET_S390X) || defined(TARGET_AARCH64) || defined(TARGET_ARM)
+#if defined(TARGET_S390X)
 uint32_t get_elf_hwcap(void);
-const char *elf_hwcap_str(uint32_t bit);
 #endif
-#if defined(TARGET_AARCH64) || defined(TARGET_ARM)
-uint64_t get_elf_hwcap2(void);
+const char *elf_hwcap_str(uint32_t bit);
 const char *elf_hwcap2_str(uint32_t bit);
-#endif
 
 #endif /* LINUX_USER_LOADER_H */
linux-user/aarch64/elfload.c +333 -0

342 lines not on this page · raw message

linux-user/arm/elfload.c +161 -0

170 lines not on this page · raw message

linux-user/elfload.c +4 -501

523 lines not on this page · raw message

Signature · 1 line
2.47.2
#35 lore raw

PATCH v2 55/281 linux-user: Move get_elf_hwcap to sparc/elfload.c

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 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(-)
linux-user/loader.h +2 -1
index 151a06f5db5..2c8414e0e53 100644
@@ -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
linux-user/sparc/target_elf.h +2 -0
index 7e46748d261..b7544db0a1c 100644
@@ -8,4 +8,6 @@
 #ifndef SPARC_TARGET_ELF_H
 #define SPARC_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
linux-user/elfload.c +1 -29
index 149d1313c0a..16709865f78 100644
@@ -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)
linux-user/sparc/elfload.c +27 -0
index 243e6f9b66a..32ca1b05b1a 100644
@@ -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;
+}
Signature · 1 line
2.47.2
#36 lore raw

PATCH v2 56/281 linux-user: Move hwcap functions to ppc/elfload.c

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/loader.h         |   2 +-
 linux-user/ppc/target_elf.h |   3 +
 linux-user/elfload.c        | 116 +-----------------------------------
 linux-user/ppc/elfload.c    | 116 ++++++++++++++++++++++++++++++++++++
 4 files changed, 122 insertions(+), 115 deletions(-)
linux-user/loader.h +1 -1
index 2c8414e0e53..818c5e6d7d7 100644
@@ -102,7 +102,7 @@ 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_SPARC) || defined(TARGET_PPC)
 abi_ulong get_elf_hwcap(CPUState *cs);
 abi_ulong get_elf_hwcap2(CPUState *cs);
 #endif
linux-user/ppc/target_elf.h +3 -0
index 8c0a8ea4312..4203a89d665 100644
@@ -8,4 +8,7 @@
 #ifndef PPC_TARGET_ELF_H
 #define PPC_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+#define HAVE_ELF_HWCAP2         1
+
 #endif
linux-user/elfload.c +2 -114

122 lines not on this page · raw message

linux-user/ppc/elfload.c +116 -0

119 lines not on this page · raw message

Signature · 1 line
2.47.2
#37 lore raw

PATCH v2 57/281 linux-user: Move get_elf_hwcap to loongarch64/elfload.c

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 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(-)
linux-user/loader.h +2 -1
index 818c5e6d7d7..92b6d41145e 100644
@@ -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
linux-user/loongarch64/target_elf.h +2 -0
index 39a08d35d9b..037740d36f2 100644
@@ -6,4 +6,6 @@
 #ifndef LOONGARCH_TARGET_ELF_H
 #define LOONGARCH_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
linux-user/elfload.c +1 -48

55 lines not on this page · raw message

linux-user/loongarch64/elfload.c +47 -0

50 lines not on this page · raw message

Signature · 1 line
2.47.2
#38 lore raw

PATCH v2 58/281 linux-user: Move get_elf_hwcap to mips/elfload.c

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 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(-)
linux-user/loader.h +1 -1
index 92b6d41145e..04457737dd4 100644
@@ -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
linux-user/mips/target_elf.h +2 -0
index febf710c7ae..877f8347d70 100644
@@ -8,4 +8,6 @@
 #ifndef MIPS_TARGET_ELF_H
 #define MIPS_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
linux-user/mips64/target_elf.h +2 -0
index 02e6d14840a..c0347e5cb6e 100644
@@ -8,4 +8,6 @@
 #ifndef MIPS64_TARGET_ELF_H
 #define MIPS64_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
linux-user/elfload.c +1 -51

58 lines not on this page · raw message

linux-user/mips/elfload.c +50 -0

53 lines not on this page · raw message

Signature · 1 line
2.47.2
#39 lore raw

PATCH v2 59/281 linux-user: Move get_elf_hwcap to sh4/elfload.c

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 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(-)
linux-user/loader.h +2 -1
index 04457737dd4..d8a93998076 100644
@@ -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
linux-user/sh4/target_elf.h +2 -0
index d17011bd752..badd0f5371f 100644
@@ -8,4 +8,6 @@
 #ifndef SH4_TARGET_ELF_H
 #define SH4_TARGET_ELF_H
 
+#define HAVE_ELF_HWCAP          1
+
 #endif
linux-user/elfload.c +1 -28
index dc3f502277a..7e1c11c39f2 100644
@@ -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
 
linux-user/sh4/elfload.c +27 -0
index 546034ec07e..99ad4f6334c 100644
@@ -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;
+}
Signature · 1 line
2.47.2
#40 lore raw

PATCH v2 63/281 linux-user: Remove ELF_HWCAP2

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

All definitions of ELF_HWCAP2 are now identical. Provide a not-reached stub as a fallback definition of get_elf_hwcap2.

---
 linux-user/elfload.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
linux-user/elfload.c +10 -13
index 88d439f3486..7a41917b49d 100644
@@ -448,8 +448,6 @@ static bool init_guest_commpage(void)
     return true;
 }
 
-#define ELF_HWCAP2 get_elf_hwcap2(thread_cpu)
-
 #define ELF_PLATFORM get_elf_platform()
 
 static const char *get_elf_platform(void)
@@ -537,8 +535,6 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE       4096
 
-#define ELF_HWCAP2  get_elf_hwcap2(thread_cpu)
-
 #if TARGET_BIG_ENDIAN
 # define VDSO_HEADER  "vdso-be.c.inc"
 #else
@@ -593,8 +589,6 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #define ELF_ARCH        EM_PPC
 
-#define ELF_HWCAP2 get_elf_hwcap2(thread_cpu)
-
 /*
  * The requirements here are:
  * - keep the final alignment of sp (sp & 0xf)
@@ -1279,6 +1273,10 @@ static inline void init_thread(struct target_pt_regs *regs,
 #ifndef HAVE_ELF_HWCAP
 abi_ulong get_elf_hwcap(CPUState *cs) { return 0; }
 #endif
+#ifndef HAVE_ELF_HWCAP2
+abi_ulong get_elf_hwcap2(CPUState *cs) { g_assert_not_reached(); }
+#define HAVE_ELF_HWCAP2 0
+#endif
 
 #include "elf.h"
 
@@ -1801,9 +1799,9 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
 #ifdef DLINFO_ARCH_ITEMS
     size += DLINFO_ARCH_ITEMS * 2;
 #endif
-#ifdef ELF_HWCAP2
-    size += 2;
-#endif
+    if (HAVE_ELF_HWCAP2) {
+        size += 2;
+    }
     info->auxv_len = size * n;
 
     size += envc + argc + 2;
@@ -1863,10 +1861,9 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
     NEW_AUX_ENT(AT_SECURE, (abi_ulong) qemu_getauxval(AT_SECURE));
     NEW_AUX_ENT(AT_EXECFN, info->file_string);
 
-#ifdef ELF_HWCAP2
-    NEW_AUX_ENT(AT_HWCAP2, (abi_ulong) ELF_HWCAP2);
-#endif
-
+    if (HAVE_ELF_HWCAP2) {
+        NEW_AUX_ENT(AT_HWCAP2, get_elf_hwcap(thread_cpu));
+    }
     if (u_base_platform) {
         NEW_AUX_ENT(AT_BASE_PLATFORM, u_base_platform);
     }
Signature · 1 line
2.47.2
#41 lore raw

PATCH v2 68/281 linux-user/hppa: Create get_elf_platform

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

Move the string literal to a new function.

---
 linux-user/hppa/target_elf.h | 2 ++
 linux-user/elfload.c         | 2 +-
 linux-user/hppa/elfload.c    | 5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)
linux-user/hppa/target_elf.h +2 -0
index 5826ca2cd22..85be00584d8 100644
@@ -8,4 +8,6 @@
 #ifndef HPPA_TARGET_ELF_H
 #define HPPA_TARGET_ELF_H
 
+#define HAVE_ELF_PLATFORM       1
+
 #endif
linux-user/elfload.c +1 -1
index 9d61feae301..83cb6731ec8 100644
@@ -1046,7 +1046,7 @@ static inline void init_thread(struct target_pt_regs *regs,
 
 #define ELF_CLASS       ELFCLASS32
 #define ELF_ARCH        EM_PARISC
-#define ELF_PLATFORM    "PARISC"
+#define ELF_PLATFORM    get_elf_platform(thread_cpu)
 #define STACK_GROWS_DOWN 0
 #define STACK_ALIGNMENT  64
 
linux-user/hppa/elfload.c +5 -0
index 2274fcbde43..9dd3fe092a8 100644
@@ -9,3 +9,8 @@ const char *get_elf_cpu_model(uint32_t eflags)
 {
     return "hppa";
 }
+
+const char *get_elf_platform(CPUState *cs)
+{
+    return "PARISC";
+}
Signature · 1 line
2.47.2
#42 lore raw

PATCH v2 69/281 linux-user: Remove ELF_PLATFORM

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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.

---
 linux-user/elfload.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
linux-user/elfload.c +4 -14
index 83cb6731ec8..d2d73b06fc0 100644
@@ -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) {
Signature · 1 line
2.47.2
#43 lore raw

PATCH v2 71/281 linux-user: Move target_cpu_copy_regs decl to qemu.h

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 include/user/cpu_loop.h | 4 ----
 linux-user/qemu.h       | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
include/user/cpu_loop.h +0 -4
index ad8a1d711f0..346e37ede8b 100644
@@ -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
linux-user/qemu.h +3 -0
index 4d6fad28c63..0c3cfe93a14 100644
@@ -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 */
Signature · 1 line
2.47.2
#44 lore raw

PATCH v2 76/281 linux-user/aarch64: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/aarch64/cpu_loop.c | 14 ++++++--------
 linux-user/elfload.c          | 10 +---------
 2 files changed, 7 insertions(+), 17 deletions(-)
linux-user/aarch64/cpu_loop.c +6 -8
index 030a630c936..4c4921152e8 100644
@@ -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);
linux-user/elfload.c +1 -9
index 95868739546..f93afbdcea3 100644
@@ -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];
Signature · 1 line
2.47.2
#45 lore raw

PATCH v2 80/281 linux-user/mips: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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.

---
 linux-user/elfload.c       |  8 +-------
 linux-user/mips/cpu_loop.c | 16 ++++++----------
 2 files changed, 7 insertions(+), 17 deletions(-)
linux-user/elfload.c +1 -7
index 0feccfbe916..ac96755b06c 100644
@@ -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
linux-user/mips/cpu_loop.c +6 -10
index 6405806eb02..e67b8a2e463 100644
@@ -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;
     }
 
Signature · 1 line
2.47.2
#46 lore raw

PATCH v2 82/281 linux-user/openrisc: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/elfload.c           |  7 +------
 linux-user/openrisc/cpu_loop.c | 11 ++++-------
 2 files changed, 5 insertions(+), 13 deletions(-)
linux-user/elfload.c +1 -6
index 3f9ec493595..03c95397744 100644
@@ -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
linux-user/openrisc/cpu_loop.c +4 -7
index 306b4f8eb43..8c72347a99a 100644
@@ -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);
 }
Signature · 1 line
2.47.2
#47 lore raw

PATCH v2 83/281 linux-user/sh4: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/elfload.c      |  8 +-------
 linux-user/sh4/cpu_loop.c | 10 ++++------
 2 files changed, 5 insertions(+), 13 deletions(-)
linux-user/elfload.c +1 -7
index 03c95397744..8604308a310 100644
@@ -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
linux-user/sh4/cpu_loop.c +4 -6
index ee9eff3428a..259ea1cc8bb 100644
@@ -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;
 }
Signature · 1 line
2.47.2
#48 lore raw

PATCH v2 84/281 linux-user/m68k: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/elfload.c       | 11 +----------
 linux-user/m68k/cpu_loop.c | 25 ++++++-------------------
 2 files changed, 7 insertions(+), 29 deletions(-)
linux-user/elfload.c +1 -10
index 8604308a310..46150586aff 100644
@@ -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
linux-user/m68k/cpu_loop.c +6 -19
index 23693f33582..aca0bf23dc6 100644
@@ -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;
 }
Signature · 1 line
2.47.2
#49 lore raw

PATCH v2 87/281 linux-user/riscv: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/elfload.c        |  7 +------
 linux-user/riscv/cpu_loop.c | 10 ++++------
 2 files changed, 5 insertions(+), 12 deletions(-)
linux-user/elfload.c +1 -6
index 16aa09214e8..556f11d720d 100644
@@ -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
 
linux-user/riscv/cpu_loop.c +4 -6
index 2dd30c7b288..b3162815320 100644
@@ -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)) {
Signature · 1 line
2.47.2
#50 lore raw

PATCH v2 88/281 linux-user/hppa: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/elfload.c       | 13 +------------
 linux-user/hppa/cpu_loop.c | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 19 deletions(-)
linux-user/elfload.c +1 -12
index 556f11d720d..4876e4b0a80 100644
@@ -864,18 +864,7 @@ static void elf_core_copy_regs(target_elf_gregset_t *regs,
 
 #define VDSO_HEADER "vdso.c.inc"
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    regs->iaoq[0] = infop->entry | PRIV_USER;
-    regs->iaoq[1] = regs->iaoq[0] + 4;
-    regs->gr[23] = 0;
-    regs->gr[24] = infop->argv;
-    regs->gr[25] = infop->argc;
-    /* The top-of-stack contains a linkage buffer.  */
-    regs->gr[30] = infop->start_stack + 64;
-    regs->gr[31] = infop->entry;
-}
+#define HAVE_INIT_MAIN_THREAD
 
 #define LO_COMMPAGE  0
 
linux-user/hppa/cpu_loop.c +11 -7
index 9abaad5ef81..3af50653bb7 100644
@@ -196,12 +196,16 @@ void cpu_loop(CPUHPPAState *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    int i;
-    for (i = 1; i < 32; i++) {
-        env->gr[i] = regs->gr[i];
-    }
-    env->iaoq_f = regs->iaoq[0];
-    env->iaoq_b = regs->iaoq[1];
+    CPUArchState *env = cpu_env(cs);
+
+    env->iaoq_f = info->entry | PRIV_USER;
+    env->iaoq_b = env->iaoq_f + 4;
+    env->gr[23] = 0;
+    env->gr[24] = info->argv;
+    env->gr[25] = info->argc;
+    /* The top-of-stack contains a linkage buffer.  */
+    env->gr[30] = info->start_stack + 64;
+    env->gr[31] = info->entry;
 }
Signature · 1 line
2.47.2
#51 lore raw

PATCH v2 89/281 linux-user/xtensa: Create init_main_thread

In reply to Alex Bennée

From: Richard Henderson <[email protected]>

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

---
 linux-user/elfload.c         | 18 +-----------------
 linux-user/xtensa/cpu_loop.c | 22 ++++++++++++++++------
 2 files changed, 17 insertions(+), 23 deletions(-)
linux-user/elfload.c +1 -17
index 4876e4b0a80..447a9be11d7 100644
@@ -905,23 +905,7 @@ static bool init_guest_commpage(void)
 #define ELF_CLASS       ELFCLASS32
 #define ELF_ARCH        EM_XTENSA
 
-static inline void init_thread(struct target_pt_regs *regs,
-                               struct image_info *infop)
-{
-    regs->windowbase = 0;
-    regs->windowstart = 1;
-    regs->areg[1] = infop->start_stack;
-    regs->pc = infop->entry;
-    if (info_is_fdpic(infop)) {
-        regs->areg[4] = infop->loadmap_addr;
-        regs->areg[5] = infop->interpreter_loadmap_addr;
-        if (infop->interpreter_loadmap_addr) {
-            regs->areg[6] = infop->interpreter_pt_dynamic_addr;
-        } else {
-            regs->areg[6] = infop->pt_dynamic_addr;
-        }
-    }
-}
+#define HAVE_INIT_MAIN_THREAD
 
 /* See linux kernel: arch/xtensa/include/asm/elf.h.  */
 #define ELF_NREG 128
linux-user/xtensa/cpu_loop.c +16 -6
index c0fcf743e70..43a194fc4a4 100644
@@ -238,12 +238,22 @@ void cpu_loop(CPUXtensaState *env)
     }
 }
 
-void target_cpu_copy_regs(CPUArchState *env, target_pt_regs *regs)
+void init_main_thread(CPUState *cs, struct image_info *info)
 {
-    int i;
-    for (i = 0; i < 16; ++i) {
-        env->regs[i] = regs->areg[i];
+    CPUArchState *env = cpu_env(cs);
+
+    env->sregs[WINDOW_BASE] = 0;
+    env->sregs[WINDOW_START] = 1;
+    env->regs[1] = info->start_stack;
+    env->pc = info->entry;
+
+    if (info_is_fdpic(info)) {
+        env->regs[4] = info->loadmap_addr;
+        env->regs[5] = info->interpreter_loadmap_addr;
+        if (info->interpreter_loadmap_addr) {
+            env->regs[6] = info->interpreter_pt_dynamic_addr;
+        } else {
+            env->regs[6] = info->pt_dynamic_addr;
+        }
     }
-    env->sregs[WINDOW_START] = regs->windowstart;
-    env->pc = regs->pc;
 }
Signature · 1 line
2.47.2