]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
4 months agotarget/i386: mshv, emulate: move the generic x86 helpers to target/i386/emulate
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:39 +0000 (00:39 +0100)] 
target/i386: mshv, emulate: move the generic x86 helpers to target/i386/emulate

HVF doesn't use them at this point, but move them to common code as that's what they are.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-18-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: saving/restoring less state for WHPX_LEVEL_FAST_RUNTIME_STATE
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:38 +0000 (00:39 +0100)] 
whpx: i386: saving/restoring less state for WHPX_LEVEL_FAST_RUNTIME_STATE

Optimise vmexits by save/restoring less state in those cases instead of the full state.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20260223233950.96076-17-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: common, i386, arm: rework state levels
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:37 +0000 (00:39 +0100)] 
whpx: common, i386, arm: rework state levels

Change state levels from a set of ifdefs to an enum.
Make register state loads use state levels too.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-16-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: remove CPUID trapping
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:36 +0000 (00:39 +0100)] 
whpx: i386: remove CPUID trapping

Very partial in its current state and results in significantly inconsistent
CPUID data. Remove it until it's reimplemented later.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-15-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: remove messages
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:35 +0000 (00:39 +0100)] 
whpx: i386: remove messages

Remove some messages printed by the WHPX backend that don't
have an equivalent elsewhere and don't convey an error.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-14-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: remove remaining winhvemulation support code
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:34 +0000 (00:39 +0100)] 
whpx: i386: remove remaining winhvemulation support code

After moving away to target/i386/emulate, this is no longer necessary.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-13-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: flags conversion for target/i386/emulate internal state
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:33 +0000 (00:39 +0100)] 
whpx: i386: flags conversion for target/i386/emulate internal state

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-12-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: switch over from winhvemulation to target/i386/emulate
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:32 +0000 (00:39 +0100)] 
whpx: i386: switch over from winhvemulation to target/i386/emulate

Using the mshv backend as a base, move away from winhvemulation
to using common QEMU code used by the HVF and mshv backends.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-11-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: move whpx_get_reg/whpx_set_reg to generic code
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:31 +0000 (00:39 +0100)] 
whpx: move whpx_get_reg/whpx_set_reg to generic code

These will be used in the next commit on the x86_64 backend too.
Also move flush_cpu_state as it's used by get_reg/set_reg and the arm64 code.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20260223233950.96076-10-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: refactor whpx_destroy_vcpu to arch-specific function
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:30 +0000 (00:39 +0100)] 
whpx: refactor whpx_destroy_vcpu to arch-specific function

Avoid a TARGET_X86_64 define by moving platform-specific code
away from generic WHPX support.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-9-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: preparatory changes before switching over from winhvemulation
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:29 +0000 (00:39 +0100)] 
whpx: preparatory changes before switching over from winhvemulation

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-8-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agowhpx: i386: re-enable guest debug support
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:28 +0000 (00:39 +0100)] 
whpx: i386: re-enable guest debug support

Fix what got broken several years ago by adding ops->supports_guest_debug
support as an architecture-specific function.

arm64 WHP doesn't currently provide support needed for this.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-7-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agotarget/i386: emulate, hvf: move x86_mmu to common code
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:27 +0000 (00:39 +0100)] 
target/i386: emulate, hvf: move x86_mmu to common code

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-6-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agotarget/i386/emulate: rework string_rep emulation
Mohamed Mediouni [Mon, 23 Feb 2026 23:39:26 +0000 (00:39 +0100)] 
target/i386/emulate: rework string_rep emulation

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-5-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agotarget/i386/emulate/x86_decode: Actually use stream in decode_instruction_stream()
Bernhard Beschow [Mon, 23 Feb 2026 23:39:25 +0000 (00:39 +0100)] 
target/i386/emulate/x86_decode: Actually use stream in decode_instruction_stream()

Compared to decode_instruction(), decode_instruction_stream() has an additional
stream parameter which avoids some guest memory accesses during instruction
decoding. Both functions defer the actual work to decode_opcode() which would
set the stream pointer to zero such that decode_instruction_stream() essentially
behaved like decode_instruction(). Given that all callers of
decode_instruction_stream() properly zero-initialize the decode parameter, the
memset() call can be moved into decode_instruction() which is the only other
user of decode_opcode(). This preserves the non-zero stream pointer which
avoids extra guest memory accesses.

Fixes: 1e25327b244a ("target/i386/emulate: Allow instruction decoding from stream")
cc: qemu-stable
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Wei Liu (Microsoft) <wei.liu@kernel.org>
Tested-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260223233950.96076-4-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agotarget/i386/hvf/x86_mmu: Fix compiler warning
Bernhard Beschow [Mon, 23 Feb 2026 23:39:24 +0000 (00:39 +0100)] 
target/i386/hvf/x86_mmu: Fix compiler warning

When reusing the code in WHPX, GCC emits the following warning when compiling
for i386-softmmu under MSYS2:

  In file included from ../src/target/i386/emulate/x86_mmu.c:20:
  ../src/target/i386/emulate/x86_mmu.c: In function 'vmx_write_mem':
  ../src/target/i386/emulate/x86_mmu.c:251:25: error: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'target_ulong' {aka 'unsigned int'} [-Werror=format=]
    251 |             VM_PANIC_EX("%s: mmu_gva_to_gpa %llx failed\n", __func__, gva);
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~            ~~~
        |                                                                       |
        |                                                                       target_ulong {aka unsigned int}
  ../src/target/i386/emulate/panic.h:34:12: note: in definition of macro 'VM_PANIC_EX'
     34 |     printf(__VA_ARGS__); \
        |            ^~~~~~~~~~~
  ../src/target/i386/emulate/x86_mmu.c:251:48: note: format string is defined here
    251 |             VM_PANIC_EX("%s: mmu_gva_to_gpa %llx failed\n", __func__, gva);
        |                                             ~~~^
        |                                                |
        |                                                long long unsigned int
        |                                             %x

Fix the warning by reusing the target-specific macro TARGET_FMT_lx which exists
for this exact purpose.

Fixes: c97d6d2cdf97 ("i386: hvf: add code base from Google's QEMU repository")
cc: qemu-stable
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Wei Liu (Microsoft) <wei.liu@kernel.org>
Link: https://lore.kernel.org/r/20260223233950.96076-3-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agotarget/i386/emulate/x86_decode: Fix compiler warning
Bernhard Beschow [Mon, 23 Feb 2026 23:39:23 +0000 (00:39 +0100)] 
target/i386/emulate/x86_decode: Fix compiler warning

When compiling for i386-softmmu under MSYS2, GCC emits the following warning:

  In function 'get_reg_val',
      inlined from 'calc_modrm_operand64' at ../src/target/i386/emulate/x86_decode.c:1796:15:
  ../src/target/i386/emulate/x86_decode.c:1703:5: error: 'memcpy' forming offset [4, 7] is out of the bounds [0, 4] of object 'val' with type 'target_ulong' {aka 'unsigned int'} [-Werror=array-bounds=]
   1703 |     memcpy(&val,
        |     ^~~~~~~~~~~~
   1704 |            get_reg_ref(env, reg, rex_present, is_extended, size),
        |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1705 |            size);
        |            ~~~~~
  ../src/target/i386/emulate/x86_decode.c: In function 'calc_modrm_operand64':
  ../src/target/i386/emulate/x86_decode.c:1702:18: note: 'val' declared here
   1702 |     target_ulong val = 0;
        |                  ^~~

In the calc_modrm_operand64() case the compiler sees size == 8 to be mem-copied
to a target_ulong variable which is only 4 bytes wide in case of i386-softmmu.
Note that when size != 1, get_reg_ref() always returns a pointer to an 8 byte
register, regardless of the target_ulong size. Fix the compiler warning by
always providing 8 bytes of storage by means of uint64_t.

Fixes: 77a2dba45cc9 ("target/i386/emulate: stop overloading decode->op[N].ptr")
cc: qemu-stable
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Wei Liu (Microsoft) <wei.liu@kernel.org>
Link: https://lore.kernel.org/r/20260223233950.96076-2-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agohw/i386/vmmouse: Fix hypercall clobbers
Josh Poimboeuf [Thu, 5 Feb 2026 16:47:35 +0000 (08:47 -0800)] 
hw/i386/vmmouse: Fix hypercall clobbers

Fedora QA reported the following kernel panic:

  BUG: unable to handle page fault for address: 0000000040003e54
  #PF: supervisor write access in kernel mode
  #PF: error_code(0x0002) - not-present page
  PGD 1082ec067 P4D 0
  Oops: Oops: 0002 [#1] SMP NOPTI
  CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.19.0-0.rc4.260108gf0b9d8eb98df.34.fc43.x86_64 #1 PREEMPT(lazy)
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20251119-3.fc43 11/19/2025
  RIP: 0010:vmware_hypercall4.constprop.0+0x52/0x90
  Code: 48 83 c4 20 5b e9 69 f0 fc fe 8b 05 a0 c1 b2 01 85 c0 74 23 b8 68 58 4d 56 b9 27 00 00 00 31 d2 bb 04 00 00 00 66 ba 58 56 ed <89> 1f 89 0e 41 89 10 5b e9 3c f0 fc fe 6a 00 49 89 f9 45 31 c0 31
  RSP: 0018:ff5eeb3240003e40 EFLAGS: 00010046
  RAX: 0000000000000000 RBX: 000000000000ffca RCX: 000000000000ffac
  RDX: 0000000000000000 RSI: 0000000040003e58 RDI: 0000000040003e54
  RBP: ff1e05f3c1204800 R08: ff5eeb3240003e5c R09: 000000009d899c41
  R10: 000000000000003d R11: ff5eeb3240003ff8 R12: 0000000000000000
  R13: 00000000000000ff R14: ff1e05f3c02f9e00 R15: 000000000000000c
  FS:  0000000000000000(0000) GS:ff1e05f489e40000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000040003e54 CR3: 000000010841d002 CR4: 0000000000771ef0
  PKRU: 55555554
  Call Trace:
   <IRQ>
   vmmouse_report_events+0x13e/0x1b0
   psmouse_handle_byte+0x15/0x60
   ps2_interrupt+0x8a/0xd0
   ...

It was triggered by dereferencing a bad pointer (RDI) immediately after
a VMware hypercall for VMWARE_CMD_ABSPOINTER_DATA in the vmmouse driver:

  ffffffff82135070 <vmware_hypercall4.constprop.0>:
  ...
  ffffffff821350ac:       b8 68 58 4d 56          mov    $0x564d5868,%eax
  ffffffff821350b1:       b9 27 00 00 00          mov    $0x27,%ecx
  ffffffff821350b6:       31 d2                   xor    %edx,%edx
  ffffffff821350b8:       bb 04 00 00 00          mov    $0x4,%ebx
  ffffffff821350bd:       66 ba 58 56             mov    $0x5658,%dx
  ffffffff821350c1:       ed                      in     (%dx),%eax <-- hypercall
  ffffffff821350c2:       89 1f                   mov    %ebx,(%rdi) <-- crash

Reading the kernel disassembly shows that RDI should contain the value
of a valid kernel stack address here (0xff5eeb3240003e54).  Instead it
contains 0x40003e54, suggesting the hypervisor cleared the upper 32
bits.

And indeed, Alexey discovered that QEMU's vmmouse_get_data() and
vmmouse_set_data() are only saving/restoring the lower 32 bits, while
clearing the upper 32.  Fix that by changing the type of the saved data
array from uint32_t to uint64_t.

Fixes: 548df2acc6fc ("VMMouse Emulation, by Anthony Liguori.")
Reported-by: Justin Forbes <jforbes@fedoraproject.org>
Debugged-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/c508fc1d4a4ccd8c9fb1e51b71df089e31115a53.1770309998.git.jpoimboe@kernel.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3293
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agoMerge tag 'pull-target-arm-20260226' of https://gitlab.com/pm215/qemu into staging
Peter Maydell [Thu, 26 Feb 2026 16:00:07 +0000 (16:00 +0000)] 
Merge tag 'pull-target-arm-20260226' of https://gitlab.com/pm215/qemu into staging

target-arm queue:
 * target/arm: set the correct TI bits for WFIT traps
 * target/arm: Refactorings preparatory to KVM SME support
 * target/arm/kvm: Don't free migration-blocker reason on failure
 * target/arm/kvm: add kvm-psci-version vcpu property
 * Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"
 * hw/arm/virt: Add virtio-mmio-transports property
 * hw/arm/virt: Update error message for bad gic-version option
 * hw/cpu: Build a15mpcore.c once as common object
 * hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro
 * hw/ssi/xilinx_spips: Reset TX FIFO in reset
 * hw/char/pl011: Only log "data written to disabled UART" once
 * tests/functional: Make sure test case .py files are executable

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmmgbNoZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3hzREACaWhS6mbqwKA0ao5GJFIex
# NFF3PqUf5MFx5J2wt6wNYBRvE2/laqJM84v5c2fVqQmxUPC0K7kiBu8JRliFMDvK
# zeykVX30e0a59M3dxeqs5A3D398g9v4STIosj8HydKcVYavVyJaFoi5Uw01h6GAp
# BRlRAcXMX1RnICyltuueKXYkuIqCZ4lOlpDZbSU/c97b01B2Um4m3MOuKXM0RBGo
# RroTPkNInuIX+SSNbKiSb53CNzvZFn6cP/NQnCtarx9UONxxESPvXSRufG1YjqMw
# YJnvJsR8ZkEZfQMhN3305N5yaQdM8T2ZIcd8JT/mCiwTP/31xquCS+M2SjriD54p
# TU8lZm4r4r3K6DKWxpfa/A6BGUjStAkXVytfHKWZHBAKN59GhKIl6uX4I8W402H3
# OEzNs10K0arrCYkW4hUGnayW0DSzqYJKk8Ejc0vOJkDm3RP6NjiZmYom/iR1Tpbk
# 1AKDJ+DuewuCSp9iFcXLbhzfZJl2in4lbJaFy8xRJn+M1CLbAsdKU5o7FJYjbKdS
# cBL/9STS+Puko+A9+WyLHh00drkFndjKruCPFTmXHnOyujIkegaBDrKN1OKebtgL
# XisfuivE6ipZqAMYZwEcnSZluKsLFDUo3rQXeQK4CQFuKvsSM9ilmBWQ9V5avxO3
# /goJymB/HYlVJhlEh33Bcg==
# =8ERD
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Feb 26 15:55:06 2026 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20260226' of https://gitlab.com/pm215/qemu:
  hw/char/pl011: Only log "data written to disabled UART" once
  target/arm/kvm: Don't free migration-blocker reason on failure
  target/arm: Add have_ffr argument to kvm_arch_{get, put}_sve
  target/arm: Add vq argument to kvm_arch_{get, put}_sve
  target/arm: Drop kvm_arm_pmu_supported
  target/arm: Remove kvm test in arm_set_pmu
  target/arm: Drop kvm_arm_sve_supported
  target/arm: Move kvm test out of cpu_arm_set_sve
  target/arm: Init sve_vq in kvm_arm_set_cpu_features_from_host
  target/arm: Move kvm_arm_sve_get_vls within kvm.c
  target/arm: Remove aarch64 test for kvm
  hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro
  hw/cpu: Build a15mpcore.c once as common object
  Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"
  target/arm/kvm: add kvm-psci-version vcpu property
  tests/functional: Make sure test case .py files are executable
  hw/arm/virt: Update error message for bad gic-version option
  hw/arm/virt: Add virtio-mmio-transports property
  target/arm: set the correct TI bits for WFIT traps
  hw/ssi/xilinx_spips: Reset TX FIFO in reset

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agoscripts/coverity: Drop --enable-libnfs from configure
Peter Maydell [Thu, 26 Feb 2026 11:10:01 +0000 (11:10 +0000)] 
scripts/coverity: Drop --enable-libnfs from configure

The environment we do our coverity build in (amd64-fedora-container)
has just upgraded to Fedora 43.  This ships with libnfs version
16.2.0.  We can't currently build against that: in commit
e2d98f257138 we added a requirement to meson.build that libnfs be <
6.0.0, because of an upstream API change that we haven't yet updated
block/nfs.c to handle.

The result is that the coverity CI job currently fails in
configure:

Dependency libnfs found: NO. Found 16.2.0 but need: '<6.0.0' ;
matched: '>=1.9.3'
Run-time dependency libnfs found: NO
../meson.build:1150:11: ERROR: Dependency lookup for libnfs with
method 'pkgconfig' failed: Invalid version, need 'libnfs' ['<6.0.0']
found '16.2.0'.

Fix the coverity builds by dropping --enable-libnfs. This means we
will no longer have coverage of block/nfs.c until/unless we do
that update to handle the new libnfs API.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20260226111001.1021810-1-peter.maydell@linaro.org

4 months agoconfigure: allow PyPI access for python 'tooling' dependencies
John Snow [Wed, 25 Feb 2026 19:12:55 +0000 (14:12 -0500)] 
configure: allow PyPI access for python 'tooling' dependencies

We actually do not allow our meson requirements to be fetched online
because we strictly prefer the vendored version. Move the tooling group
installation to a different invocation that does allow PyPI to be
accessed when configure is run without explicitly disabling PyPI access.

This will allow QEMU to download and install python3-wheel for you if
you don't have it in your host environment.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-id: 20260225191255.955585-1-jsnow@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agohw/char/pl011: Only log "data written to disabled UART" once
Peter Maydell [Thu, 26 Feb 2026 11:27:19 +0000 (11:27 +0000)] 
hw/char/pl011: Only log "data written to disabled UART" once

We log a GUEST_ERROR message "PL011 data written to disabled UART" if
the guest writes data to the TX FIFO when it has not set the enable
bit in the UART.  The idea is to note that the guest has done
something dubious but let it work anyway.  However, since we print
this message for every output character, it floods the logs when
running a guest that does this.

Keep a note of whether we've printed the log message or not, so we
only output it once.  If the guest actively disables the UART, we
re-arm the log message.

Notably, the Linux kernel does not bother to enable the UART if it is
used for earlycon, relying on the firmware having already done that.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Message-id: 20260210101702.3980804-1-peter.maydell@linaro.org

4 months agotarget/arm/kvm: Don't free migration-blocker reason on failure
Peter Maydell [Thu, 26 Feb 2026 11:27:19 +0000 (11:27 +0000)] 
target/arm/kvm: Don't free migration-blocker reason on failure

The migrate_add_blocker() function documents that if it fails it will
free the Error it is passed via its reasonp argument and set reasonp
to NULL.  That means that in kvm_arm_enable_mte() we don't need to
call error_free(mte_migration_blocker) in the failure codepath.
Doing so is harmless because error_free(NULL) is permitted and does
nothing, but we can remove the unnecessary code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-id: 20260223173232.453165-1-peter.maydell@linaro.org

4 months agotarget/arm: Add have_ffr argument to kvm_arch_{get, put}_sve
Richard Henderson [Thu, 26 Feb 2026 11:27:19 +0000 (11:27 +0000)] 
target/arm: Add have_ffr argument to kvm_arch_{get, put}_sve

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Add vq argument to kvm_arch_{get, put}_sve
Richard Henderson [Thu, 26 Feb 2026 11:27:19 +0000 (11:27 +0000)] 
target/arm: Add vq argument to kvm_arch_{get, put}_sve

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Drop kvm_arm_pmu_supported
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Drop kvm_arm_pmu_supported

This function has only one use, so inline it and drop the stubs.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Remove kvm test in arm_set_pmu
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Remove kvm test in arm_set_pmu

In kvm_arm_get_host_cpu_features, we only set ARM_FEATURE_PMU if
kvm_arm_pmu_supported.  In arm_cpu_post_init we only register the
"pmu" property if ARM_FEATURE_PMU.  Therefore, if kvm is enabled,
we can only arrive in arm_set_pmu if kvm_arm_pmu_supported.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Drop kvm_arm_sve_supported
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Drop kvm_arm_sve_supported

This function has only one real use, so inline it and
drop the stubs.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Move kvm test out of cpu_arm_set_sve
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Move kvm test out of cpu_arm_set_sve

Introduce a set of stub property callbacks for when we really
don't want to be able to enable SVE.  Register the real or stub
funtions in aarch64_add_sve_properties depending on whether or
not SVE is available.

Adjust aarch64_a64fx_initfn to initialize the set of supported
vector sizes before calling aarch64_add_sve_properties.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Init sve_vq in kvm_arm_set_cpu_features_from_host
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Init sve_vq in kvm_arm_set_cpu_features_from_host

Probe for SVE vector sizes with the same scratch vm that
we use for probing other features.  Remove a separate
initialization path in arm_cpu_sve_finalize.
Unexport kvm_arm_sve_get_vls.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Move kvm_arm_sve_get_vls within kvm.c
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Move kvm_arm_sve_get_vls within kvm.c

Prepare to adjust the invocation point and visibility.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: Remove aarch64 test for kvm
Richard Henderson [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: Remove aarch64 test for kvm

We no longer support kvm for aarch32, therefore the aarch64
test is trivially true.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260216034432.23912-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agohw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro
Philippe Mathieu-Daudé [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
hw/misc/allwinner-cpucfg: Remove use of ARM_CPU() cast macro

allwinner_cpucfg_cpu_reset() doesn't access ARM CPU internal
fields: no need to cast, pass a generic CPU pointer along.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260225034720.41495-1-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agohw/cpu: Build a15mpcore.c once as common object
Philippe Mathieu-Daudé [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
hw/cpu: Build a15mpcore.c once as common object

a15mpcore.c doesn't need to include the target-specific 'kvm_arm.h'
header, it only lacks the qemu_get_cpu() declaration which comes
from 'hw/core/cpu.h'. Include the latter and build as common object.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260225034451.41338-1-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agoRevert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"
Mohamed Mediouni [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
Revert "target/arm/hvf: Sync CNTV_CTL_EL0 & CNTV_CVAL_EL0"

This reverts commit bfbea371ef2cabc47effac5a286e2644d727a8d6.

This commit breaks VM save/restore:

Assertion failed: (b), function hvf_arch_get_registers, file hvf.c, line 667.
zsh: abort      ./qemu-system-aarch64 -m 8192 -M virt,accel=hvf -cdrom  -device virtio-gpu

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Tested-by: Zenghui Yu <zenghui.yu@linux.dev>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm/kvm: add kvm-psci-version vcpu property
Sebastian Ott [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm/kvm: add kvm-psci-version vcpu property

Provide a kvm specific vcpu property to override the default
(as of kernel v6.13 that would be PSCI v1.3) PSCI version emulated
by kvm. Current valid values are: 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3

Note: in order to support PSCI v0.1 we need to drop vcpu
initialization with KVM_CAP_ARM_PSCI_0_2 in that case.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Sebastian Ott <sebott@redhat.com>
Message-id: 20260220115656.4831-2-sebott@redhat.com
[PMM: adjust sscanf to not permit negative numbers]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotests/functional: Make sure test case .py files are executable
Peter Maydell [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
tests/functional: Make sure test case .py files are executable

The top-level test python scripts in tests/functional are supposed to
be marked executable; "make check-functional" doesn't care about
this, but it allows them to be run as standalone executables to
exercise a single test, as docs/devel/testing/functional.rst
describes.

A couple of files have got into the tree without the executable
bit set: fix them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20260212151258.1750268-1-peter.maydell@linaro.org

4 months agohw/arm/virt: Update error message for bad gic-version option
Peter Maydell [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
hw/arm/virt: Update error message for bad gic-version option

As we added different valid gic-version option settings,
we forgot to update the hint in the error message produced
when the user specifies an invalid value:

$ qemu-system-aarch64 -M virt,help | grep gic-version
  gic-version=<string>   - Set GIC version. Valid values are 2, 3, 4, host and max
$ qemu-system-aarch64 -M virt,gic-version=bang
qemu-system-aarch64: Invalid gic-version value
Valid values are 3, 2, host, max.

Update the error string to match the one we use in the help text
for the option.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20260219110228.3804482-1-peter.maydell@linaro.org

4 months agohw/arm/virt: Add virtio-mmio-transports property
Mohammadfaiz Bawa [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
hw/arm/virt: Add virtio-mmio-transports property

Windows ARM64 guests detect virtio-mmio devices declared in ACPI
tables even when no backend is attached. This causes "Unknown
devices" (ACPI\LNRO0005) to appear in Device Manager.

Until Windows fixes that by supporting, add a new machine
property 'virtio-mmio-transports' to control the number of
virtio-mmio transports instantiated. The default remains
NUM_VIRTIO_TRANSPORTS (32) for backward compatibility.
Setting it to 0 allows users to disable virtio-mmio entirely.

Usage: -machine virt,virtio-mmio-transports=0

Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
Message-id: 20260219173256.152743-1-mbawa@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agotarget/arm: set the correct TI bits for WFIT traps
Alex Bennée [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
target/arm: set the correct TI bits for WFIT traps

The WFIT trap should be reported as 0b10.

Cc: qemu-stable@nongnu.org
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Gustavo Romero <gustavo.romero@linaro.org>
Message-id: 20260220171945.1065102-1-alex.bennee@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agohw/ssi/xilinx_spips: Reset TX FIFO in reset
Weixie Cui [Thu, 26 Feb 2026 11:27:18 +0000 (11:27 +0000)] 
hw/ssi/xilinx_spips: Reset TX FIFO in reset

In xilinx_spips_reset() and xlnx_zynqmp_qspips_reset() a cut and
paste error meant we reset the RX FIFO twice and the TX FIFO not at
all.  Correct this to reset both FIFOs.

Cc: qemu-stable@nongnu.org
Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260223095905.67709-1-cuiweixie@gmail.com
[Rewrote commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agoMerge tag 'single-binary-20260226' of https://github.com/philmd/qemu into staging
Peter Maydell [Thu, 26 Feb 2026 09:33:12 +0000 (09:33 +0000)] 
Merge tag 'single-binary-20260226' of https://github.com/philmd/qemu into staging

Various patches related to single binary effort:

- Remove TARGET_PHYS_ADDR_SPACE_BITS definition
- Remove MonitorDef register entries already provided by gdbstub XML
- Remove gdbstub ldtul*() macros
- Build various gdbstub.c files once
- Make qemu_arch_available() and page-vary common code

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmmfgeYACgkQ4+MsLN6t
# wN6AUA/9E5LY2fWlQWHGXu4vDmzL4dqiIsitjd/2uo09Z7VQqJNOV+E1aj1cvk+y
# 0+CNafpwd3QkcdGFeAJla2qbTsSyQkEv5/ijZadprl1weAHSOM+0NNINL2fu1sZA
# VXLaUNXTEnrD82WPntF4ovbahcHzqPiimupZ0/RB1i6CAlcUv2fhN8hkmFwq1XaB
# DBNW0AG3+dL/qhYoJyloZCEn394QSTyVzexfqeQgbk1Zrwyx6b+EtobRIq9lEMTp
# 7OFQocPjOuXid+LR93MlRy/LSuw8ZAABIizFm924eMjuIe+JHRdOyRVl0N84kbcU
# TsaI7cB+qHM4uVrMrmaEpBBFATAWhMNxJMPTAYevrLOAN3whZj1a3ogKrZGroTPL
# aJG3M6to7TxKr1qDp+V75NkldUq/N4AG43aWLXODNuCewCZ9hV2QWMzAKuu9Ez4Q
# 6sEX2G8PlbiqnKqLkdFUg3Ny58v57IRXzyXJOrj9JG9v7NPCmHLT+xyyzVy3NVnF
# ZXbG0x/3/7jDGlYwPN5PKH7+NlEb44OwQ0qSyL7392mnhz+5DZ4IQr3LQriIFt31
# HT7fnlR1Kz01+vy7cezCHJOFdikK9cpJeKwljYkWhSOQvThRv5cELABiIrlXo423
# YVNZEirZWjiF8fS+nDJA91S3wj7pWGm0j3iSBGGPZ+9tG6OwHKU=
# =fOn0
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Feb 25 23:12:38 2026 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'single-binary-20260226' of https://github.com/philmd/qemu: (70 commits)
  page-vary: Build migration_legacy_page_bits as common code
  page-vary: Build finalize_target_page_bits as common code
  page-vary: Build set_preferred_target_page_bits as common code
  target-info: Move TARGET_PAGE_BITS sanity check
  target-info: Add page_bits_{init,vary}
  page-vary: Expose TARGET_PAGE_BITS_MIN definition
  meson: don't access 'cxx' object without checking cpp lang
  system: Reduce 'arch_init.h' scope
  system: Make qemu_arch_available() common code
  hw/scsi/disk: Prefer target_s390x() over qemu_arch_available()
  qemu/target_info: Add target_s390x() helper
  qemu: Document qemu_arch_available() method
  target/m68k: clean-up includes in cpu.c
  target/tricore: Build 'gdbstub.c' once for system single binary
  target/s390x: Build 'gdbstub.c' once for system single binary
  target/rx: Build 'gdbstub.c' once for system single binary
  target/m68k: Build 'gdbstub.c' once for system single binary
  target/loongarch: Build 'gdbstub.c' once for system single binary
  target/avr: Build 'gdbstub.c' once for system single binary
  target/alpha: Build 'gdbstub.c' once for system single binary
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agopage-vary: Build migration_legacy_page_bits as common code
Richard Henderson [Tue, 17 Feb 2026 09:51:05 +0000 (19:51 +1000)] 
page-vary: Build migration_legacy_page_bits as common code

Use target_info->page_bits_init to implement
migration_legacy_page_bits.  Because this is the last
function within the file, rename page-vary-target.c
to page-vary-system.c and build once for system mode.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260217095106.598486-7-richard.henderson@linaro.org>
[PMD: Update MAINTAINERS]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agopage-vary: Build finalize_target_page_bits as common code
Richard Henderson [Tue, 17 Feb 2026 09:51:04 +0000 (19:51 +1000)] 
page-vary: Build finalize_target_page_bits as common code

Use target_info->page_bits_init to merge
finalize_target_page_bits_common into
finalize_target_page_bits in page-vary-common.c.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20260217095106.598486-6-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agopage-vary: Build set_preferred_target_page_bits as common code
Richard Henderson [Tue, 17 Feb 2026 09:51:03 +0000 (19:51 +1000)] 
page-vary: Build set_preferred_target_page_bits as common code

Use target_info->page_bits_vary to merge
set_preferred_target_page_bits_common into
set_preferred_target_page_bits in page-vary-common.c.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260217095106.598486-5-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agotarget-info: Move TARGET_PAGE_BITS sanity check
Richard Henderson [Tue, 17 Feb 2026 09:51:02 +0000 (19:51 +1000)] 
target-info: Move TARGET_PAGE_BITS sanity check

Move the check from page-vary-target.c to target-info-stub.c,
in the process of removing page-vary-target.c entirely.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260217095106.598486-4-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agotarget-info: Add page_bits_{init,vary}
Richard Henderson [Tue, 17 Feb 2026 09:51:01 +0000 (19:51 +1000)] 
target-info: Add page_bits_{init,vary}

Add two fields that will hold TARGET_PAGE_BITS,
TARGET_PAGE_BITS_VARY, TARGET_PAGE_BITS_LEGACY.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260217095106.598486-3-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agopage-vary: Expose TARGET_PAGE_BITS_MIN definition
Philippe Mathieu-Daudé [Thu, 12 Feb 2026 22:42:33 +0000 (23:42 +0100)] 
page-vary: Expose TARGET_PAGE_BITS_MIN definition

We'll use TARGET_PAGE_BITS_MIN in page-vary-common.c,
so expose it via "exec/page-vary.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260213182713.44924-3-philmd@linaro.org>

4 months agomeson: don't access 'cxx' object without checking cpp lang
Daniel P. Berrangé [Tue, 10 Feb 2026 17:33:55 +0000 (17:33 +0000)] 
meson: don't access 'cxx' object without checking cpp lang

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260210173355.776365-1-berrange@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agosystem: Reduce 'arch_init.h' scope
Philippe Mathieu-Daudé [Fri, 13 Feb 2026 14:24:01 +0000 (15:24 +0100)] 
system: Reduce 'arch_init.h' scope

Better to restrict qemu_arch_available() scope so it is only
used by generic system/ code to parse command line options.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-6-philmd@linaro.org>

4 months agosystem: Make qemu_arch_available() common code
Philippe Mathieu-Daudé [Fri, 13 Feb 2026 14:14:33 +0000 (15:14 +0100)] 
system: Make qemu_arch_available() common code

Remove the need of per-target QEMU_ARCH. Define the
QEMU_ARCH_* constants based on SYS_EMU_TARGET_* ones,
themselves already exposed via target_arch(), allowing
to check the current target is included in @arch_bitmask.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-5-philmd@linaro.org>

4 months agohw/scsi/disk: Prefer target_s390x() over qemu_arch_available()
Philippe Mathieu-Daudé [Fri, 13 Feb 2026 13:50:45 +0000 (14:50 +0100)] 
hw/scsi/disk: Prefer target_s390x() over qemu_arch_available()

qemu_arch_available() is used to check if a broadly available
feature should be exposed to a particular set of target
architectures. Here we only want to check something that is
specific to s390x: the target_s390x() helper is more adapted.
Besides, it will allow to reduce qemu_arch_available() scope.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-4-philmd@linaro.org>

4 months agoqemu/target_info: Add target_s390x() helper
Philippe Mathieu-Daudé [Fri, 13 Feb 2026 13:50:36 +0000 (14:50 +0100)] 
qemu/target_info: Add target_s390x() helper

Add a helper to distinct whether the binary is targetting
S390x or not.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-3-philmd@linaro.org>

4 months agoqemu: Document qemu_arch_available() method
Philippe Mathieu-Daudé [Fri, 13 Feb 2026 14:11:10 +0000 (15:11 +0100)] 
qemu: Document qemu_arch_available() method

qemu_arch_available() is used to check if a broadly available
feature should be exposed to a particular set of target
architectures.

Since its argument is a mask of bits, rename it as @arch_bitmask.

We have less than 32 target architectures so far, so restrict it
to the uint32_t type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-2-philmd@linaro.org>

4 months agotarget/m68k: clean-up includes in cpu.c
Alex Bennée [Thu, 19 Feb 2026 17:17:57 +0000 (17:17 +0000)] 
target/m68k: clean-up includes in cpu.c

We don't need translation-block.h as the TB flags are local and the
only bits needed come from cpu-ops.h. The vmstate is a system only
concerns so we can guard against including it for linux-user.

Finally tidy up the order to keep things together with the local cpu.h
kept at the end.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20260219171810.602667-2-alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4 months agotarget/tricore: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:53:17 +0000 (09:53 +0100)] 
target/tricore: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-tricore binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-50-philmd@linaro.org>

4 months agotarget/s390x: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:39:05 +0000 (09:39 +0100)] 
target/s390x: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-s390x binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-49-philmd@linaro.org>

4 months agotarget/rx: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:38:48 +0000 (09:38 +0100)] 
target/rx: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-rx binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-48-philmd@linaro.org>

4 months agotarget/m68k: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:46:24 +0000 (09:46 +0100)] 
target/m68k: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-m68k binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-47-philmd@linaro.org>

4 months agotarget/loongarch: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:46:07 +0000 (09:46 +0100)] 
target/loongarch: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-loongarch64 binary, but by
moving 'gdbstub.c' in the target_common_system_arch[] source
set the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-46-philmd@linaro.org>

4 months agotarget/avr: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:45:30 +0000 (09:45 +0100)] 
target/avr: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-avr binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-45-philmd@linaro.org>

4 months agotarget/alpha: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:45:05 +0000 (09:45 +0100)] 
target/alpha: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-alpha binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-44-philmd@linaro.org>

4 months agotarget/or1k: Build 'gdbstub.c' once for system single binary
Philippe Mathieu-Daudé [Thu, 19 Feb 2026 08:32:02 +0000 (09:32 +0100)] 
target/or1k: Build 'gdbstub.c' once for system single binary

There is a single qemu-system-or1k binary, but by moving
'gdbstub.c' in the target_common_system_arch[] source set
the resulting object can be linked into a single qemu-sytem
binary.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-43-philmd@linaro.org>

4 months agotarget/or1k: Rename 'openrisc' -> 'or1k' in meson.build
Philippe Mathieu-Daudé [Thu, 19 Feb 2026 08:31:35 +0000 (09:31 +0100)] 
target/or1k: Rename 'openrisc' -> 'or1k' in meson.build

Follow commit 62822fc7e0f ("target/or1k: Rename from openrisc").

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-42-philmd@linaro.org>

4 months agotarget/sh4: Build 'gdbstub.c' once for system binaries
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:39:18 +0000 (09:39 +0100)] 
target/sh4: Build 'gdbstub.c' once for system binaries

'gdbstub.c' can now be built once for all qemu-system-sh4*
binaries.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-41-philmd@linaro.org>

4 months agotarget/sh4: Build 'monitor.c' once for system binaries
Philippe Mathieu-Daudé [Thu, 19 Feb 2026 08:42:36 +0000 (09:42 +0100)] 
target/sh4: Build 'monitor.c' once for system binaries

'monitor.c' can be built once for all qemu-system-sh4* binaries.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-40-philmd@linaro.org>

4 months agotarget/microblaze: Build 'gdbstub.c' once for system binaries
Philippe Mathieu-Daudé [Wed, 18 Feb 2026 08:37:32 +0000 (09:37 +0100)] 
target/microblaze: Build 'gdbstub.c' once for system binaries

'gdbstub.c' can now be built once for all qemu-system-microblaze*
binaries.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-39-philmd@linaro.org>

4 months agogdbstub/helpers: Convert gdb_get_regl() macro to inlined helper
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:28:50 +0000 (17:28 +0100)] 
gdbstub/helpers: Convert gdb_get_regl() macro to inlined helper

Rather than checking TARGET_LONG_BITS at build time,
check target_long_bits() at runtime.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-38-philmd@linaro.org>

4 months agotarget/sparc: Expand gdb_get_regl() in gdb_get_rega()
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:09:53 +0000 (17:09 +0100)] 
target/sparc: Expand gdb_get_regl() in gdb_get_rega()

Convert the gdb_get_rega() macro to an inlined function,
expanding gdb_get_regl() via a TARGET_SPARC64 definition check.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-37-philmd@linaro.org>

4 months agotarget/sh4: Expand gdb_get_regl() -> gdb_get_reg32()
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:02:23 +0000 (17:02 +0100)] 
target/sh4: Expand gdb_get_regl() -> gdb_get_reg32()

The SH4 targets are only built as 32-bit:

  $ git grep TARGET_LONG_BITS configs/targets/sh4*
  configs/targets/sh4-linux-user.mak:5:TARGET_LONG_BITS=32
  configs/targets/sh4-softmmu.mak:2:TARGET_LONG_BITS=32
  configs/targets/sh4eb-linux-user.mak:6:TARGET_LONG_BITS=32
  configs/targets/sh4eb-softmmu.mak:3:TARGET_LONG_BITS=32

Mechanically replace:

  gdb_get_regl() -> gdb_get_reg32()

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-36-philmd@linaro.org>

4 months agotarget/rx: Expand gdb_get_regl() -> gdb_get_reg32()
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:02:38 +0000 (17:02 +0100)] 
target/rx: Expand gdb_get_regl() -> gdb_get_reg32()

The Renesas RX target is only built as 32-bit:

  $ git grep TARGET_LONG_BITS configs/targets/rx*
  configs/targets/rx-softmmu.mak:5:TARGET_LONG_BITS=32

Mechanically replace:

  gdb_get_regl() -> gdb_get_reg32()

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-35-philmd@linaro.org>

4 months agotarget/hexagon: Expand gdb_get_regl() -> gdb_get_reg32()
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:03:40 +0000 (17:03 +0100)] 
target/hexagon: Expand gdb_get_regl() -> gdb_get_reg32()

The Hexagon target is only built as 32-bit:

  $ git grep TARGET_LONG_BITS configs/targets/hexagon*
  configs/targets/hexagon-linux-user.mak:5:TARGET_LONG_BITS=32

Mechanically replace:

  gdb_get_regl() -> gdb_get_reg32()

Reviewed-by: Brian Cain <Brian.Cain@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-34-philmd@linaro.org>

4 months agotarget/alpha: Expand gdb_get_regl() -> gdb_get_reg64()
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:04:12 +0000 (17:04 +0100)] 
target/alpha: Expand gdb_get_regl() -> gdb_get_reg64()

The Alpha targets are only built as 64-bit:

  $ git grep TARGET_LONG_BITS configs/targets/alpha-*
  configs/targets/alpha-linux-user.mak:4:TARGET_LONG_BITS=64
  configs/targets/alpha-softmmu.mak:2:TARGET_LONG_BITS=64

Mechanically replace:

  gdb_get_regl() -> gdb_get_reg64()

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-33-philmd@linaro.org>

4 months agogdbstub: Remove ldtul*() macros
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 15:49:43 +0000 (16:49 +0100)] 
gdbstub: Remove ldtul*() macros

These macros aren't used anymore, remove them to avoid
further uses creeping back in.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-32-philmd@linaro.org>

4 months agotarget/i386: Expand 64-bit definitions when TARGET_LONG_BITS == 64
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 16:00:38 +0000 (17:00 +0100)] 
target/i386: Expand 64-bit definitions when TARGET_LONG_BITS == 64

Where both gdb_read/write_register() functions check for
'TARGET_LONG_BITS == 64' we can expand the following definitions:

  ldtul_p() -> ldq_p()

  gdb_get_regl() -> gdb_get_reg64()

Do the same in i386_cpu_gdb_get_egprs(): check TARGET_LONG_BITS to
effectively inline gdb_get_regl().

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-31-philmd@linaro.org>

4 months agotarget/i386: Replace ldtul_p() -> ldn_p()
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 15:43:53 +0000 (16:43 +0100)] 
target/i386: Replace ldtul_p() -> ldn_p()

Prefer ldn_p(target_long_bits) over target-specific ldtul_p().

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20260219191955.83815-30-philmd@linaro.org>

4 months agotarget/riscv: Remove unnecessary target_ulong type uses
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 15:56:44 +0000 (16:56 +0100)] 
target/riscv: Remove unnecessary target_ulong type uses

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-29-philmd@linaro.org>

4 months agotarget/riscv: Replace ldtul_p() -> ldn_p()
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 15:48:12 +0000 (16:48 +0100)] 
target/riscv: Replace ldtul_p() -> ldn_p()

Prefer ldn_p(riscv_cpu_is_32bit) over target-specific ldtul_p().

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260219191955.83815-28-philmd@linaro.org>

4 months agotarget/mips: Replace ldtul_p() -> ldn_p()
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 10:44:29 +0000 (11:44 +0100)] 
target/mips: Replace ldtul_p() -> ldn_p()

Prefer ldn_p(target_long_bits/8) over target-specific ldtul_p().

Use deposit64() in gdb_write_register(), allowing to remove
'target_ulong' type uses.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-27-philmd@linaro.org>

4 months agotarget/ppc: Replace ldtul_p() -> ldn_p()
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 15:13:19 +0000 (16:13 +0100)] 
target/ppc: Replace ldtul_p() -> ldn_p()

Prefer ldn_p(target_long_bits/8) over target-specific ldtul_p().

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-26-philmd@linaro.org>

4 months agotarget/sparc: Factor sparc_cpu_gdb_write_register() out
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 15:34:04 +0000 (16:34 +0100)] 
target/sparc: Factor sparc_cpu_gdb_write_register() out

Factor sparc_cpu_gdb_write_register() out.

Prefer ldn_p(target_long_bits/8) over target-specific ldtul_p().

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-25-philmd@linaro.org>

4 months agotarget/riscv: Remove empty target_monitor_defs() symbol
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 11:57:48 +0000 (12:57 +0100)] 
target/riscv: Remove empty target_monitor_defs() symbol

Prefer the stub target_monitor_defs() symbol introduced in commit
bf957284006 ("monitor: remove target-specific code from monitor.c").

Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-24-philmd@linaro.org>

4 months agotarget/or1k: Use XML register definitions from GDB
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 07:19:27 +0000 (08:19 +0100)] 
target/or1k: Use XML register definitions from GDB

Import gdb-xml/or1k-fpu.xml from mainstream binutils, tag
'binutils-2_46' [*]. Register as CPUClass::gdb_core_xml_file.

[*] https://sourceware.org/git/?p=binutils-gdb.git;a=blob_plain;f=gdb/features/or1k-core.xml;h=0d13f355f5296ae426794eb3003dcc18fbbd49d5;hb=refs/tags/binutils-2_46

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-23-philmd@linaro.org>

4 months agotarget/ppc: Extract monitor-related code to monitor.c
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 11:34:47 +0000 (12:34 +0100)] 
target/ppc: Extract monitor-related code to monitor.c

Keep ppc-qmp-cmds.c for QMP, use monitor.c for HMP.

Since ppc-qmp-cmds.c was introduced using the MIT license
(see commit bf957284006 "monitor: remove target-specific
code from monitor.c") retain the same license for the new
monitor.c file.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-22-philmd@linaro.org>

4 months agotarget/ppc: Remove MonitorDef register entries available via gdbstub
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 12:34:03 +0000 (13:34 +0100)] 
target/ppc: Remove MonitorDef register entries available via gdbstub

All these registers are already provided by via gdbstub parsed XML
and handler by the gdb_get_register() helper in the monitor/hmp.c
file. Remove as now unreachable code.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-21-philmd@linaro.org>

4 months agotarget/m68k: Remove MonitorDef register entries available via gdbstub
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 12:28:03 +0000 (13:28 +0100)] 
target/m68k: Remove MonitorDef register entries available via gdbstub

All these registers are already provided by via gdbstub parsed XML
and handler by the gdb_get_register() helper in the monitor/hmp.c
file. Remove as now unreachable code.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-20-philmd@linaro.org>

4 months agotarget/i386: Remove MonitorDef register entries available via gdbstub
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 12:11:03 +0000 (13:11 +0100)] 
target/i386: Remove MonitorDef register entries available via gdbstub

All these registers are already provided by via gdbstub parsed XML
and handler by the gdb_get_register() helper in the monitor/hmp.c
file. Remove as now unreachable code.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-19-philmd@linaro.org>

4 months agotarget/sparc: Remove MonitorDef register entries available via gdbstub
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 01:52:27 +0000 (02:52 +0100)] 
target/sparc: Remove MonitorDef register entries available via gdbstub

All these registers are already provided by via gdbstub parsed XML
and handler by the gdb_get_register() helper in the monitor/hmp.c
file. Remove as now unreachable code.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-18-philmd@linaro.org>

4 months agomonitor/hmp: Handle gdb-xml exposed registers via gdb_get_register()
Philippe Mathieu-Daudé [Thu, 19 Feb 2026 19:19:18 +0000 (20:19 +0100)] 
monitor/hmp: Handle gdb-xml exposed registers via gdb_get_register()

Implement the gdb_get_register() helper and call it before the
regular get_monitor_def() one. Registers is exposed via the
GDB XML files will be directly handled, possibily allowing new
registers added to XML files to be automatically accessible in
QEMU monitor. All targets having GDB XML files can now be used
within the monitor.

For example with Loongarch, before:

  $ qemu-system-loongarch64 -M virt -S -monitor stdio
  QEMU 10.2.0 monitor - type 'help' for more information

  (qemu) info registers

  CPU#0
   PC=000000001c000000  FCSR0 0x00000000
   ...

  (qemu) p/x $pc
  unknown register
  Try "help p" for more information
  (qemu)

and after:

  $ ./qemu-system-loongarch64 -M virt -S -monitor stdio
  QEMU 10.2.50 monitor - type 'help' for more information
  (qemu) p/x $pc
  0x1c000000
  (qemu)

Similarly RISC-V:

  QEMU 10.2.0 monitor - type 'help' for more information
  (qemu) p/x $pc
  unknown register
  Try "help p" for more information

VS

  QEMU 10.2.50 monitor - type 'help' for more information
  (qemu) p/x $pc
  0x1000
  (qemu)

Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-17-philmd@linaro.org>

4 months agotarget/sparc: Expose gdbstub registers to sparc32 targets
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 01:51:34 +0000 (02:51 +0100)] 
target/sparc: Expose gdbstub registers to sparc32 targets

Import gdb-xml/sparc32-{cpu,fpu,cp0}.xml from mainstream binutils,
tag 'binutils-2_46', found in the gdb/features/sparc/folder [*].

Register them by setting the CPUClass::gdb_core_xml_file field and
calling gdb_register_coprocessor() in sparc_cpu_register_gdb_regs().

[*] https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/features/sparc;hb=refs/tags/binutils-2_46

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-16-philmd@linaro.org>

4 months agotarget/sparc: Expose gdbstub registers to sparc32plus target
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 01:51:58 +0000 (02:51 +0100)] 
target/sparc: Expose gdbstub registers to sparc32plus target

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-15-philmd@linaro.org>

4 months agotarget/sparc: Restore 'gdb-xml/sparc64-cpu.xml'
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 01:47:29 +0000 (02:47 +0100)] 
target/sparc: Restore 'gdb-xml/sparc64-cpu.xml'

Restore gdb-xml/sparc64-cpu.xml from mainstream binutils, tag
'binutils-2_46', found in the gdb/features/sparc/folder [*].

[*] https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/features/sparc;hb=refs/tags/binutils-2_46

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-14-philmd@linaro.org>

4 months agotarget/sparc: Restore 'gdb-xml/sparc64-fpu.xml'
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 01:45:46 +0000 (02:45 +0100)] 
target/sparc: Restore 'gdb-xml/sparc64-fpu.xml'

Restore gdb-xml/sparc64-fpu.xml from mainstream binutils, tag
'binutils-2_46', found in the gdb/features/sparc/folder [*].

Extract sparc_fpu_gdb_write_register() out of
sparc_cpu_gdb_read_register() and sparc_fpu_gdb_write_register()
out of sparc_cpu_gdb_write_register(), taking care to update the
register indexes in the switch cases.

Register these helpers with a call to gdb_register_coprocessor()
in sparc_cpu_register_gdb_regs().

[*] https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/features/sparc;hb=refs/tags/binutils-2_46

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-13-philmd@linaro.org>

4 months agotarget/sparc: Restore 'gdb-xml/sparc64-cp0.xml'
Philippe Mathieu-Daudé [Sun, 15 Feb 2026 01:38:28 +0000 (02:38 +0100)] 
target/sparc: Restore 'gdb-xml/sparc64-cp0.xml'

Restore gdb-xml/sparc64-cp0.xml from mainstream binutils, tag
'binutils-2_46', found in the gdb/features/sparc/folder [*].

Extract sparc_cp0_gdb_write_register() out of
sparc_cpu_gdb_read_register() and sparc_cp0_gdb_write_register()
out of sparc_cpu_gdb_write_register(), taking care to update the
register indexes in the switch cases.

Register these helpers with a call to gdb_register_coprocessor()
in sparc_cpu_register_gdb_regs().

[*] https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/features/sparc;hb=refs/tags/binutils-2_46

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-12-philmd@linaro.org>

4 months agotarget/sparc: Introduce sparc_cpu_register_gdb_regs() stub
Philippe Mathieu-Daudé [Mon, 16 Feb 2026 22:24:34 +0000 (23:24 +0100)] 
target/sparc: Introduce sparc_cpu_register_gdb_regs() stub

Introduce sparc_cpu_register_gdb_regs() which we are going
to fill in the next commits.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-11-philmd@linaro.org>

4 months agogdbstub: Always infer gdb_num_core_regs when using XML file
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 11:51:25 +0000 (12:51 +0100)] 
gdbstub: Always infer gdb_num_core_regs when using XML file

Rather correct inferred count over invalid manual one.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-10-philmd@linaro.org>

4 months agogdbstub: Make generated compound literal array size explicit
Philippe Mathieu-Daudé [Mon, 16 Feb 2026 13:11:53 +0000 (14:11 +0100)] 
gdbstub: Make generated compound literal array size explicit

GDBFeature::num_regs holds the number of registers, but when using
the compound literal construction, if the last array entry is not
set, the array will be shorter. Prevent array overrun by making the
array length explicit,

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-Id: <20260216214332.47639-1-philmd@linaro.org>

4 months agotarget/ppc: Remove dead code depending on USE_APPLE_GDB
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 14:18:12 +0000 (15:18 +0100)] 
target/ppc: Remove dead code depending on USE_APPLE_GDB

We never defined USE_APPLE_GDB, so the code introduced in commit
b3cad3abf6d ("PPC: Add support for Apple gdb in gdbstub") is dead
since almost 12 years. Remove it.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-9-philmd@linaro.org>

4 months agotarget/ppc: Fix CPUClass::gdb_num_core_regs value
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 07:07:21 +0000 (08:07 +0100)] 
target/ppc: Fix CPUClass::gdb_num_core_regs value

Only 70 registers are exposed from GDB XML file (for either
32 / 64-bit variants).

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-8-philmd@linaro.org>

4 months agotarget/riscv: Extract monitor-related code to monitor.c
Philippe Mathieu-Daudé [Tue, 17 Feb 2026 07:54:47 +0000 (08:54 +0100)] 
target/riscv: Extract monitor-related code to monitor.c

Keep riscv-qmp-cmds.c for QMP, use monitor.c for HMP.

Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260219191955.83815-7-philmd@linaro.org>