Commit Graph

130941 Commits

Author SHA1 Message Date
Philippe Mathieu-Daudé
d682cd181c cpu: Better name cpu_single_step() trace event
cpu_single_step() is not related to breakpoints. Rename the
trace event.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260705215729.62196-30-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
93e7ca71d7 accel/tcg: Improve docstrings around TCGCPUOps::*watchpoint* handlers
Commit d5ee641cfc ("target/ppc: Implement watchpoint debug facility
for v2.07S") also implemented TCGCPUOps::debug_check_watchpoint for
PPC: make the comment generic.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-29-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
cbdbbfaf76 target/ppc: Ensure TCG is used in ppc_update_daw()
Per commit d5ee641cfc ("target/ppc: Implement watchpoint debug
facility for v2.07S"), only TCG is implemented:

    ISA v2.07S introduced the watchpoint facility based on the DAWR0
    and DAWRX0 SPRs. Implement this in TCG.
                     ^^^^^^^^^^^^^^^^^^^^^

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260705215729.62196-28-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
0b55b519c6 target/arm: Inline check_watchpoints() in arm_debug_check_watchpoint()
check_watchpoints() is called once, by arm_debug_check_watchpoint(),
which doesn't do more than this call. Merge both. No logical change
intended.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-27-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
0c4f68b2e3 accel: Use GdbBreakpointType enum
Include '_gdbstub_' in the AccelOpsClass handlers to emphasize
we are handling gdbstub-related requests.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-26-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
af97fe2eaf gdbstub: Introduce GdbBreakpointType enumerator
Introduce the GdbBreakpointType enumerator to better follow
code related to GDB protocol handling.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-25-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
85b6e24fa2 gdbstub: Reduce @type variable scope
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-24-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
9285f1a215 gdbstub/user: Directly call gdb_breakpoint_remove_all() in user mode
No need to deref external methods with unused argument to
end up calling a method defined in the same unit file, call
it directly.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-23-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
9dfa834009 accel: Remove unnecessary 'inline' qualifier in remove_all_breakpoints
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-22-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
fe90b5f15b cpu: Move BREAKPOINT definitions to 'exec/breakpoint.h'
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-20-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Richard Henderson
032731dbaf cpu: Move cpu_breakpoint_test out of line
Move the function to cpu-common.c, with the other
breakpoint functions.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260705215729.62196-19-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
0533f08413 accel: Remove AccelOpsClass::supports_guest_debug
Now accelerators hold the 'guest debug supported' information
in their state, accessible by the common code. No need to call
a per-accelerator handler, simply check for the SSTEP_ENABLE
in AccelGdbConfig::sstep_flags.

Remove all AccelOpsClass::supports_guest_debug implementations,
inline gdb_supports_guest_debug() and remove the now unnecessary
KVMState::have_guest_debug field.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-18-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
2aaa8ee7de accel: Hold @can_reverse information in AccelGdbConfig
Hold @can_reverse in AccelGdbConfig, set it when initializing
AccelState in AccelClass::init_machine handlers (only TCG sets
it). Remove gdb_can_reverse() as now unused.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-ID: <20260705215729.62196-17-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
d1286e2933 gdbstub: Make default replay_mode value explicit in stubs
Make explicit @replay_mode is stubbed as REPLAY_MODE_NONE.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-16-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
8c60f7f38e accel: Have each implementation return their AccelGdbConfig
Hold the per-accelerator AccelGdbConfig in AccelState, set its
single @sstep_flags field in AccelClass::init_machine handlers.

Remove the AccelClass::gdbstub_supported_sstep_flags() getter
and inline the single accel_supported_gdbstub_sstep_flags() call
in gdb_init_gdbserver_state().

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-15-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
e9c5654035 gdbstub: Move supported_sstep_flags in AccelGdbConfig structure
supported_sstep_flags are per-accelerators. Move them
to a new AccelGdbConfig structure, still in GDBState.

Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-14-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
5ba4a7d02b gdbstub: Reduce gdb_supports_guest_debug() scope
gdb_supports_guest_debug() is only required for system emulation,
reduce its scope by making it private; remove the user emulation
variant.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260705215729.62196-13-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
f2468e2f49 accel/kvm: Hold have_guest_debug in KVMState
Prefer to store per-accelerator variables in the per-accelerator
state, rather than as static variables. This is a good practice
to allow concurrent accelerators in the future.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-12-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
e32e858cf8 accel/kvm: Simplify kvm_init() w.r.t. TARGET_KVM_HAVE_GUEST_DEBUG
Simplify #ifdef'ry using TARGET_KVM_HAVE_GUEST_DEBUG in kvm_init().
No need to zero-initialize kvm_sstep_flags again.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-11-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
0f66a69172 accel/kvm: Always define AccelOpsClass::supports_guest_debug
Whether TARGET_KVM_HAVE_GUEST_DEBUG is defined or not,
kvm_supports_guest_debug() still exists and can be called.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-10-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
67ae20cc4a accel/whpx: Implement missing AccelClass::gdbstub_supported_sstep_flags
Correct gdbstub support requires some gdbstub_supported_sstep_flags.
Apparently missed in commit d7482ffe97 ("whpx: Added support for
breakpoints and stepping"), even with the recent 19b48084f7 ("whpx:
i386: re-enable guest debug support") fixes.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-9-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
82d97eeda8 gdbstub: Only return E22 when reverse GDB is not supported
No need to keep processing the arguments when we know
reverse debugging is not available.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20260705215729.62196-8-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
32822e3898 gdbstub: Add trace event for STEP packet handler
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20260705215729.62196-7-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Magnus Kulke
ce0b7a15bc accel/mshv: Fix pointer to proc feature bitfield
Processor features are stored in a union containing two "banks":

union hv_partition_processor_features {
    uint64_t as_uint[2];
    struct {
        uint64_t sse3_support:1;
        ...
    }
}

get_proc_features() to retrieve the 2nd bank was passing a pointer that
steps over the whole union (+16B) instead of picking the 2nd bank _in_
the union. This manifests in mismatching feature bits for the 2nd bank
and possibly other side-effects caused by writing beyond the union.

We need to step over the first bank (+8B) by using as_uint64[0/1] to
correct this behaviour.

Resolves: Coverity CID 1660876
Fixes: 2f6da91e8a ("accel/mshv: store partition proc features")
Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20260701130335.418156-1-magnuskulke@linux.microsoft.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
abdd572a43 accel/mshv: Replace @dirty field by generic CPUState::vcpu_dirty field
No need for accel-specific @dirty field when we have
a generic one in CPUState. (Other accelerators already
did that in commits 6f13a0ada01..36ab216b81d).

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Tested-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-6-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
586a25c492 accel/hvf: Remove left-over comment
Missed in commit 6bf331164c ("accel/hvf: Drop hvf_slot and
hvf_find_overlap_slot").

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260705215729.62196-5-philmd@oss.qualcomm.com>
2026-07-06 15:42:18 +02:00
Philippe Mathieu-Daudé
cadee08114 accel/tcg: Restrict tlb_protect/unprotect_code() to TCG
Both tlb_protect() and tlb_unprotect_code() are only used
within accel/tcg/. Avoid exposing them to the whole code base,
declare them in a new "system-page-protection.h" local header
(maintaining the previous LGPL-2.1-or-later license).

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260705215729.62196-4-philmd@oss.qualcomm.com>
2026-07-06 15:41:34 +02:00
Philippe Mathieu-Daudé
c1b47f48eb target/i386: Remove duplicate tlb_flush() call in cpu_post_load()
Common vCPU cpu_common_post_load() handler calls tlb_flush() since
commit 9656f324d2 ("Move interrupt_request and user_mode_only to
common cpu state..."), no need to call it twice.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260705215729.62196-3-philmd@oss.qualcomm.com>
2026-07-06 14:57:07 +02:00
Philippe Mathieu-Daudé
65339110b7 cpu: Constify CPUState::cc (cached CPUClass pointer)
Various CPUState can share the same CPUClass parent,
and must not update its fields. Protect the CPUClass
by marking the CPUState pointer const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260705215729.62196-2-philmd@oss.qualcomm.com>
2026-07-06 14:57:00 +02:00
Stefan Hajnoczi
4ee536fac7 Merge tag 'firmware-20260704-pull-request' of https://gitlab.com/kraxel/qemu into staging
igvm: add device tree support

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmpIkaMACgkQTLbY7tPo
# cTg4NA/8CB9HEZG6kKV1fh/7N5ev0iL5S1K3HCxKYcHoyMfkkhDvORSa5oF8gYoP
# HiJC4D+8X+523YFOzvxsaRgTC0J6iRucktIz2PNHBpy7npcQpiRjI1l9Z4FPEH0b
# iPSuKgpliOYIUi/ckeTKK4q2GwYsxIaLhu/uGsEr10cCf62JkXigkc5t1ZXa/ggv
# HYBVNE9HM6CG6SWQKEqrfuSYex8Xa4+x/euzsAgDkuEBfYykHt4duDD1iObEJ6Cy
# 3UXodgkcLrnz5baWbtTNjmVRsQfyjtD7/kfo4yPNvzC80UIjdvxg4COXF6YxId5P
# gDBWl8bY9rqYah8zQ4QzxbVZ7HWJDCILLWc0O2Mlw70KdUQ7g5JA1Gjf6Ms5YgB6
# PEH+rJ9ir09MJ9Z7AWRo3Ry91opDGrKUos2maQHdf8AADV9afmJVQ1frnDgUjF/3
# PXZVVCSpVoLBP5GLT+2l60qFYzJPqd/HsK5cWGaZEJyfvejrZjEVI6l9FliQFJ9l
# HiLEo2yhWVtRzruy7Uv16tU42xODmDMBKU12HZfQLvYbKUaBf24YpLiBprEzUM72
# snXGhZX7wQl6ghQ7mxdLncECRRvFwuknZPeLBPWyp6rm5IuTvxkhRtgCHS4RFYbr
# 7NDjzJ3/gg9YXy3z0cJjRkaBfJvwdYTUTpuq0yDVOfNL53L0jbA=
# =7c95
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 04 Jul 2026 06:52:51 CEST
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* tag 'firmware-20260704-pull-request' of https://gitlab.com/kraxel/qemu:
  igvm: add device tree parameter support
  igvm: use idiomatic meson conditional for IGVM build files
  igvm: Report error on missing parameter area in directive handlers

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-05 08:42:47 +02:00
Stefan Hajnoczi
24a55d1f55 Merge tag 'pull-ppc-for-11.1-misc-20260703' of https://gitlab.com/harshpb/qemu into staging
PPC queue for 2026-07-03

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEa4EM1tK+EPOIPSFCRUTplPnWj7sFAmpHPNAACgkQRUTplPnW
# j7tkjQ/9FP3/sTw0MxhGdLItxurrEzu3f4jiDKpnjEIqiJInzYl/2fJKZU611PSp
# gydfdNhkr71TxuJggibAosEblcWRq9KqQXysDpNrJ8rqEIeLj0lv9/JigLTZqU3e
# vsfDmfdCAB7YTtpm6HkTYW81EPD0X8AwQqz4FCNDQ0zeNUBIU8IU/ARP2j80CTnm
# 5xRK42aZb9CMYYIk3p8l4FuZmv6Y0Jf0daXM4WsEdHu9KjGvYr1glTY/lgblNPug
# kWIcjPqQ6x/hloYqxTTcsfJBnKfdaVppuh6LbJbgISsQIBzTqrD2HvEIpNFJRKnS
# 1XGwLj6cMmm4u2tv3BF0yVDJCEff312n2VFskmOrCUJOR+g2UqDzMb4+7JOpufEn
# Fla38+a9H9ThdnUNaak8+KquHDOJzDAOugOdMvsID8KlJ/q3wrTTEUUImj5Bwyqz
# Gc7naNx+3D+BSiahDe4LP71ZFLrQJ/eYCj71for5xZNcZVOQ6IDhymEMUAcRzkt6
# 2qICF6XmkYfuH+1113KMxG65NpKGEvktONQ6UpLWTubQ++BNK1Bt2v8PAWSis/d8
# EYg5M/R7RqhbxufIUDLXJIuxB3xuiVg+e+x/M8X0LffmYhPI1cuZPmth4/75IKL+
# 9Vddgc1hSHX1EUjRyZpoK6WArOTNvUOZMEcAhGr/0NgK5O/1Z10=
# =1TRv
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 03 Jul 2026 06:38:40 CEST
# gpg:                using RSA key 6B810CD6D2BE10F3883D21424544E994F9D68FBB
# gpg: Good signature from "Harsh Prateek Bora <harsh.prateek.bora@gmail.com>" [full]
# gpg:                 aka "Harsh Prateek Bora <harshpb@linux.ibm.com>" [full]
# Primary key fingerprint: 6B81 0CD6 D2BE 10F3 883D  2142 4544 E994 F9D6 8FBB

* tag 'pull-ppc-for-11.1-misc-20260703' of https://gitlab.com/harshpb/qemu:
  ppc/pnv: add test to verify external DTB is honored
  ppc/pnv: avoid regenerating DTB if external DTB is present
  docs/system/ppc/pseries: Update the link to the SLOF repository
  target/ppc: Expose the TB offset of the guest in QEMU monitor
  hw/pci-host: Split PowerNV PHB5 code from PHB4 files
  Revert "hw/ppc: Deprecate 405 CPUs"
  pseries: Update SLOF firmware image to release 20260627

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-05 08:42:07 +02:00
Stefan Hajnoczi
7f2007d192 Merge tag 'pull-qobject-2026-07-02' of https://repo.or.cz/qemu/armbru into staging
QObject patches for 2026-07-02

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCgAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmpGUpgSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTA3wP/jXwy30ND7OQE5HErDKp4priCm9cMPcR
# 30FxOS+E9bAT6KCDmnUqRVELebGn0x3gz9MXWO8qQcU4MHneN4M/42Dh/oa1t+xd
# Zva2rIfVW1FHPvzEfsKsUFPq1LaY+uM9XW2DdEjyv11RoMZwVHiWseURXwB2HNLH
# HNfxBOlGa8VTvI5kpRafN+DNRjeMEWcIXqZRHr51GeFfc6av0CTUYM2xdwRQTw3m
# GQGDvLIllxb9STwnSKieBdkCpBGSwffcjJipt7VmvORYNsi3pcJgAhWFzM9UWqPp
# ZENwziphyd/4XLAC4EaMlXnXlAzLJh+H7+th6Ylirkjo1sULO9cCFbYcANqljLdT
# GIIafRoe4zuZp1gFPgT51nA53Adzd1TWCT462R1uzbVJxoEdthsYVB7WMamBJySA
# MuuMjq4JVeROBgDbO/X7+EnzmI0torT24XpFxFjfBGb9zSnG7YRzSSf8sDQIwir+
# tlh0e6LzsVJckJ0IUAjglLKb49QUnmzrSx8+6LCH0iFMkHWwXdtd5Vyk5SofIXIy
# Dc6t2qH8USkOjwgs5vKdr9m8LEv2iELegpanmZDTd+zIEFR1WP1SRiirmkoD7QJY
# 0zK3gabC5uUpcfKx6EE2UXWpFW/tVDjMUN43QoL48/pVDuYUcqXJ8y2DEqjHV4Sd
# O5wd3ZOFdvVc
# =jshD
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 02 Jul 2026 13:59:20 CEST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-qobject-2026-07-02' of https://repo.or.cz/qemu/armbru:
  json-parser: add location to JSON parsing errors
  json-streamer: do not heap-allocate JSONToken
  json-streamer: remove token queue
  json-streamer: make brace/bracket count unsigned
  json-streamer: reuse parser
  json-parser: replace with a push parser
  qobject/json-writer: preallocate output buffer

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-03 07:42:51 +02:00
Shivang Upadhyay
f9d05801eb ppc/pnv: add test to verify external DTB is honored
Test boots a powernv11 machine, using a custom dtb.
Custom dtb has the following bootargs.

    chosen {
        bootargs = "hello world";
    };

Test Checks whether above bootargs make it to kernel's command line.

Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260630103508.254000-3-shivangu@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:21 +05:30
Shivang Upadhyay
55db0113c3 ppc/pnv: avoid regenerating DTB if external DTB is present
Currently externally provided dtb is overwritten in `pnv_reset`.
Fix this by only creating dtb if not provided from `-dtb`.

Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>
Reviewed-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260630103508.254000-2-shivangu@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:21 +05:30
Thomas Huth
75f3c97476 docs/system/ppc/pseries: Update the link to the SLOF repository
SLOF has been moved to gitlab.com already a while ago. We updated
the link in pc-bios/README in commit 7f98b4f25e ("pseries: Update
SLOF firmware image"), but forgot to update it in the manual, too.

Signed-off-by: Thomas Huth <th.huth@posteo.eu>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260702074842.4806-1-th.huth@posteo.eu
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:21 +05:30
Gautam Menghani
feeef57ca0 target/ppc: Expose the TB offset of the guest in QEMU monitor
When debugging issues in KVM guests, it is sometimes helpful to have a
unified trace log of both guest and host to see where things are going
wrong. Expose the TB (timebase) offset through QEMU monitor to enable
capturing of unified log.

The below steps can be then used for KVM guests to get a unified log:
1. In host
trace-cmd record -e kvm_hv:kvm_guest_enter -e kvm_hv:kvm_guest_exit \
    -C ppc-tb -o trace_host.dat

2. In guest
trace-cmd record -e powerpc:hcall_entry -e powerpc:hcall_exit -C ppc-tb \
    --ts-offset <TB offset from QEMU monitor> -o trace_guest.dat

  NOTE: The TB offset would be reported as a negative number in QEMU
  monitor. For this step, the minus sign must be ignored.

3. Transfer the guest logs to the host with scp/rsync

4. Unify the logs
trace-cmd report -i trace_host.dat -i trace_guest.dat > combined_log

In case of TCG guests, the TB offset would be
reported as 0 since the offset logic is not applicable in this case.

Tested-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Reviewed-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Tested-by: Sneh Shikha Yadav <syadav@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260629052602.78276-1-gautam@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:21 +05:30
Jishnu Warrier
ea87cc5e3c hw/pci-host: Split PowerNV PHB5 code from PHB4 files
Separate Power10/11 PHB5 implementation from Power9 PHB4 code for
better maintainability and clarity. This is a pure code movement
with no functional changes.

Signed-off-by: Jishnu Warrier <jishnuvw@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260608093430.2729688-1-jishnuvw@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:21 +05:30
Glenn Miles
544f05ad64 Revert "hw/ppc: Deprecate 405 CPUs"
This reverts commit 52f0b59ec6.

The PowerPC 405 CPU is used by the PPE42 CPU which was added to
QEMU v10.2.  The PPE42 CPU is basically a stripped down version
of the PowerPC 405 CPU and is used by the Power9, Power10, and
Power11 CPUs as an embedded processor to handle various tasks.
Also, IBM has plans to use the PowerPC 405 CPU model within a
year to model the On Chip Controller (OCC), which has an embedded
PPC405 CPU.  Therefore, this patch removes the PowerPC 405 CPU
from the deprecated list.

Signed-off-by: Glenn Miles <milesg@linux.ibm.com>
Acked-by: Cédric Le Goater <clg@redhat.com>
Acked-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260505144621.1308457-1-milesg@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:21 +05:30
Thomas Huth
07a20852f4 pseries: Update SLOF firmware image to release 20260627
Contains a fix for the parsing of ELF program headers.

Signed-off-by: Thomas Huth <th.huth@posteo.eu>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-07-03 10:07:12 +05:30
Stefan Hajnoczi
b4bdad7dce Merge tag 'dump-pr-v1' of https://gitlab.com/marcandre.lureau/qemu into staging
Dump patches for 2026-06-30

To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmpD3PsACgkQ2ujhCXWW
# nOUW8g//W75y5yaaujNXQ/tqRmIGpVKuB1rC5QXJgRYQlpEIh21tPeHHUUFpOSgU
# llgo2NZM4fqX450vBDU2L6J+qtGc7Q6tm3EKlAe+dZeIlqCcrvHDTGHLq83pCGZQ
# LbABgwnxRcK+BOmSH/LdsP33dFYWBMMwSNZ0P/C986pAs5m/Ji6oz7OI1hRvv5E/
# /HjwJLaXbCyOesWicKpFmN2wiwi3GRiiwI5mBBrue3mmkTvHzb52Pas/B+jT/q/G
# WzIKMYUAwlvYIg2NiWcr1r5UAaXohq4Z4O8jWSpXFoZbg24B5GfmPzg2/mWKtFs1
# UN5J5soqHA/7DV+hDK6v3dPWFnjAMe5PtxjtFdxlt7z5B0LS2hnwHW3tbZtWIhbV
# cFUheXb+ySVw6h0ieK/Ym5k76tExvWHMDfacBHD6oo+ikiOxifCdSSvADYYvnpIU
# ySfjfnEwXg2F/TrsL1o4uotcHeyONJEjy/V6l+pgOATyTGfUvUk0PCRwGNNBhshx
# fZVbP8TSFw3NmS5j86dPUa8hyX1AZPRwSnxPzN/iOnCGigyPjJ3clcGQZ1YGwnip
# KvDXQjmoirJutwEWVd1HZmGnWUqAfrJuselSvER5dWFEKnukbn7wmkIQx3aixZT4
# 1/AUNqPsMNREDTMHN6KCAK7mj7024Gq2Gmupu7aYpdZZtPHUXPA=
# =NMTJ
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 30 Jun 2026 17:12:59 CEST
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'dump-pr-v1' of https://gitlab.com/marcandre.lureau/qemu:
  dump: fix misleading VMCOREINFO phys_base parse error
  tests/qtest/dump: cover win-dmp availability via vmcoreinfo
  tests/qtest/dump: reject win-dmp without vmcoreinfo
  tests/qtest: add dump-guest-memory test
  dump: make win_dump_available() check vmcoreinfo for a Windows dump header
  system/cpus: refuse memsave/pmemsave while guest RAM is being migrated
  dump: refuse dump-guest-memory while guest RAM is being migrated
  migration: add migration_guest_ram_loading() helper

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-02 16:04:08 +02:00
Paolo Bonzini
b6368e7c77 json-parser: add location to JSON parsing errors
Now that all calls to parse_error have a token, add the line and column
to the message.  As far as I can see the two important TODOs (better
errors and better EOI handling) are done, and the others (token range
information and "parsed size"?) do not really matter or are handled
better by json-streamer.c.  So remove the list, which had sat unchanged
since 2009.

This needs some adjustments to provide a good x and y for error messages.
First of all, they switch from zero-based to one-based, which is safe
because they were both sitting unused.  Second, right now the x and y
are those of the *last* character in the token.  Modify json-lexer.c to
freeze tok->x and tok->y at the first character added to the GString.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260626101727.1727389-7-pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:56:35 +02:00
Paolo Bonzini
55320a2983 json-streamer: do not heap-allocate JSONToken
This is not needed with a push parser.  Since it processes tokens
immediately, the JSONToken can be created directly on the stack
and does not need to copy the lexer's string data.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260626101727.1727389-6-pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:55:41 +02:00
Paolo Bonzini
ddd1f36f81 json-streamer: remove token queue
Now fully exploit the push parser, feeding it one token at a time
without having to wait until braces and brackets are balanced.

While the nesting counts are retained for error recovery purposes,
the system can now report the first parsing error without waiting
for parentheses to be balanced.  This also means that JSON_ERROR
can be handled in json-parser.c, not json-streamer.c.

After reporting the error, json-streamer.c then enters an error recovery
mode where subsequent errors are suppressed.  This mimics the previous
error reporting behavior, but it provides prompt feedback on parsing
errors.  As an example, here is an example interaction with qemu-ga.

BEFORE (error reported only once braces are balanced):

   >> {"execute":foo
   >> }
   << {"error": {"class": "GenericError", "desc": "JSON parse error, invalid keyword 'foo'"}}
   >> {"execute":"somecommand"}
   << {"error": {"class": "CommandNotFound", "desc": "The command somecommand has not been found"}}

AFTER (error reported immediately, but similar error recovery as before):

   >> {"execute":foo
   << {"error": {"class": "GenericError", "desc": "JSON parse error, invalid keyword 'foo'"}}
   >> }
   >> {"execute":"somecommand"}
   << {"error": {"class": "CommandNotFound", "desc": "The command somecommand has not been found"}}

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260626101727.1727389-5-pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Token size limit check off-by-one fixed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:55:41 +02:00
Paolo Bonzini
19c04b99ca json-streamer: make brace/bracket count unsigned
It makes no sense to let brace_count and bracket_count go negative,
also because it immediately ends error recovery and sets them both
back to zero.  Instead set them to zero *before* choosing
whether to process the token queue; this makes it possible to
have the fields as unsigned.

Note that JSON_END_OF_INPUT now forces the parentheses to appear
balanced, so that the queue is emptied and an error is reported;
hence, the "type != JSON_END_OF_INPUT" condition can be removed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260626101727.1727389-4-pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Comment tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:55:01 +02:00
Paolo Bonzini
e8f8abcba1 json-streamer: reuse parser
The push parser can be reset, so reuse it when the json-streamer
detects a completed toplevel object.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260626101727.1727389-3-pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:50:13 +02:00
Paolo Bonzini
3b2f714e4a json-parser: replace with a push parser
In order to avoid stashing all the tokens corresponding to a JSON value,
embed the parsing stack and state machine in JSONParser.  This is more
efficient and allows for more prompt error recovery; it also does not
make the code substantially larger than the current recursive descent
parser, though the state machine is probably a bit harder to follow.

The stack consists of QLists and QDicts corresponding to open
brackets and braces, plus optionally a QString with the current
key on top of each QDict.

After each value is parsed, it is added to the top array or dictionary
or, if the stack is empty, json_parser_feed returns the complete
QObject.

For now, json-streamer.c keeps tracking the tokens up until braces
and brackets are balanced, and then shoves the whole queue of tokens
into the push parser.  The only logic change is that JSON_END_OF_INPUT
always triggers the emptying of the queue; the parser takes notice and
checks that there is nothing on the stack.  Not using brace_count
and bracket_count for this is the first step towards improved separation
of concerns between json-parser.c and json-streamer.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20260626101727.1727389-2-pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Minor comment improvements]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:48:56 +02:00
Bin Guo
a21232a255 qobject/json-writer: preallocate output buffer
json_writer_new() creates the output GString with g_string_new(NULL),
which starts at the GLib default of 64 bytes.  Serializing typical
QMP responses then requires multiple reallocations as the buffer
grows -- for query-qmp-schema the GString is reallocated 12+ times.

Preallocate JSON_WRITER_INITIAL_SIZE (4096) bytes.  This covers
most QMP responses without any reallocation.  The JSONWriter is a
short-lived object so the preallocation does not accumulate.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
Message-ID: <20260603022538.92780-1-guobin@linux.alibaba.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-02 13:45:45 +02:00
Luigi Leonardi
1c4bd8f13c igvm: add device tree parameter support
Coconut SVSM, with the upcoming device tree support [1], will use
the IGVM device tree parameter to discover virtio-mmio and ISA serial
devices instead of relying on the fw_cfg interface, which is
QEMU-specific.

The device tree is packed before copying into the IGVM parameter area
to reduce its size, since IGVM files can define tighter memory
constraints for parameter areas. Packing is done in the generic IGVM
backend rather than in per-architecture device tree setup code, so
that each architecture does not need to handle it individually.

[1] https://github.com/coconut-svsm/svsm/pull/1006

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-ID: <20260626-microvm_device_tree-v6-3-9cd13cf057e2@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-07-02 11:14:19 +02:00
Luigi Leonardi
85db68ba49 igvm: use idiomatic meson conditional for IGVM build files
Replace the explicit igvm.found() check with system_ss.add(when:,
if_true:), matching the pattern used by all other optional backends.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-ID: <20260626-microvm_device_tree-v6-2-9cd13cf057e2@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-07-02 11:14:19 +02:00
Luigi Leonardi
4d3b9dc4d1 igvm: Report error on missing parameter area in directive handlers
Parameter areas are how an IGVM file tells QEMU to allocate buffers
for runtime information the guest needs — VP count, memory map,
MADT and so on. Usage directives reference a parameter area by index
to tell QEMU where to write each piece of data. If the index doesn't
match any declared parameter area, the data has nowhere to go and
should be treated as an error.

The directive handlers that look up a parameter area all return 0
(success) when `qigvm_find_param_entry()` can't find it. Therefore,
the load succeeds but the guest never gets the expected parameters.

Note that the IGVM library already validates parameter area indices
when the file is loaded, so this path should only be reachable with
a malformed file that bypassed library validation. This is defensive
programming against that case.

Report the error with error_setg() and return -1 instead.

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-ID: <20260626-microvm_device_tree-v6-1-9cd13cf057e2@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-07-02 11:14:19 +02:00