Commit Graph

131312 Commits

Author SHA1 Message Date
Markus Armbruster
8b61adae4e qapi: Fix misspelled section tags in doc comments
Section tags are case sensitive and end with a colon.  Screwing up
either gets them interpreted as ordinary paragraph.  Fix a few.

Fixes: 4e88e7e340 (qapi/qom: Define cache enumeration and properties for machine, 2024-11-01)
Fixes: 8eb6d39e22 (qom: qom-list-get, 2025-07-11)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260701061136.798815-1-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-07-14 10:53:03 +02:00
Stefan Hajnoczi
499039798c Merge tag 'pull-request-2026-07-12' of https://gitlab.com/huth/qemu into staging
* Fix functional tests to take aliased machine names into account again

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmpTcFISHHRoLmh1dGhA
# cG9zdGVvLmV1AAoJEC7Z13T+cC21I3cQAIVeNFL6k3GT9vAu9CoOhkmIdRcWYtc9
# vPTOg3RScP8CiuvUVAGkalzKYPdbjj5hYcViO1wHNaECNJRiYGGdiNYkRMdukLev
# P7jionoC7SEPV7UIRgSRwWiIPRYM39DPS7jTfUnhBTQ7tW8pHnzfAUdyd//E6Ml6
# EQInvcseggzTqOfcLya15JWwNC+/HNjaMNuUYOmtwW7PzZYVeSNEp96jPSqBnPvO
# n0u9QGu1BOJBKXc4NgRyUuM0iRszDQoMAj1HXHgNYtrSms7YM9lNjK3OKLHJ0p3R
# UHOi/jrUHf992g7Vb9uY5NTcqBFim+RBqvN3wvVqZ+cAdxLqToYFPQTsdzVXddVi
# Ie3fGTAtBNm/u4Bo8VYd3rPWElhlqelaJ+sm0QFQpCEJuWzYoKiVs1NB59xY8Vxu
# z/I3iytiMXMfvC5A+RJuPPGUVknAThQmnusvgWWeaeiOCjDmTdXucLxm9T8+liQV
# tCVdYQOD5UhbWMS9BEo3r3xJicP8lzRwbdJd4UbWFfpEpw/HqFNvlI8iqgK9MkV6
# d33irRvRPrTdQcJ2/IeVRDywusDp6VxOci8eaG7gyX+KJLzEYRdxbir4O3inK9+y
# VMScyzZjqKiqHytYUCp2uo3rkx8qCaqolQxkrHfvZIfjghaS7XA7v1HvYMiVs/8p
# +IWU1Xvl02ij
# =palu
# -----END PGP SIGNATURE-----
# gpg: Signature made Sun 12 Jul 2026 12:45:38 CEST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "th.huth@posteo.eu"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.eu>" [full]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2026-07-12' of https://gitlab.com/huth/qemu:
  tests/functional: fix querying available machines

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-12 21:49:04 +02:00
Vladimir Sementsov-Ogievskiy
1531b9ec8c tests/functional: fix querying available machines
Aliases are not handled, and that's why tests used them
are skipped, like this:

    PYTHONPATH=python:tests/functional \
    QEMU_TEST_QEMU_BINARY=$PWD/build/qemu-system-x86_64 \
    MESON_BUILD_ROOT=$PWD/build \
    ./build/pyvenv/bin/python3 tests/functional/x86_64/test_hotplug_blk.py

TAP version 13
ok 1 test_hotplug_blk.HotPlugBlk.test # SKIP no support for machine q35
1..1

Fixes: 0e7aa78b0b ("tests/functional: use QMP to query available machines")
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260710090317.498350-1-vsementsov@yandex-team.ru>
Signed-off-by: Thomas Huth <th.huth@posteo.eu>
2026-07-12 10:12:17 +02:00
Stefan Hajnoczi
a759542a2c Merge tag 'pull-lu-20260710' of https://gitlab.com/rth7680/qemu into staging
Handle loading of ET_EXEC binaries at address 0.
Share probe_guest_base code between linux-user and bsd-user.

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmpReQUdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV8BPQf/UmwW68Nxc8MqtEwx
# 5DRI97pqT6ZDlJGXXjPUYjpeDdJyDS4KIAoI+FRvJlNcaKkrI7nsBO54SCsRGImW
# 0iabkCh4HZMjRCSrYvllxJGE6K4IRQOGPpVAwNKl/0zQsQZuDnMIhi+sI4GfYUTh
# SNXsPLCCidF4LAaC1B/xzzA+GMGoTgNeWXPE01v/Q+EMcnCdztUpmJsB5SAHUqna
# zUl0cTom8QOx71qlFBSzwHht4rapws//ey1rLH4U2EQB8X3hxHtN4xXNwKwyaK2z
# 3AZDTgrM9CxviXmcW3uXAd2AC2X+whXQap6n3/vQOqz2awESRCt97GLMWyqHsvxg
# iExrPQ==
# =W4uK
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 11 Jul 2026 00:58:13 CEST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-lu-20260710' of https://gitlab.com/rth7680/qemu:
  common-user: Move guest_base, have_guest_base to probe-guest-base.c
  bsd-user: Use probe_guest_base
  common-user: Move probe_guest_base from linux-user
  common-user: Implement read_self_maps for FreeBSD
  common-user: Move selfmap from util
  include/user/guest-host: Include missing cpu.h
  common-user: Initialize mmap_min_addr for FreeBSD
  common-user: Move mmap_min_addr from linux-user
  linux-user: Use PGBRange for commpage
  linux-user: Pass image_range to probe_guest_base
  linux-user: Drop hiaddr out-of-range check in probe_guest_base
  linux-user: Use PGBRange in load_elf_image
  linux-user: Introduce PGBRange

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-11 07:15:53 +02:00
Stefan Hajnoczi
49e82e1aac Merge tag 'pull-tpm-2026-07-10-1' of https://github.com/stefanberger/qemu-tpm into staging
Merge tpm 2026/07/10 v1

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEuBi5yt+QicLVzsZrda1lgCoLQhEFAmpRAe4ACgkQda1lgCoL
# QhGL0gf9HIR8FclQjPEi4qEYylE0hD7CXEpOkxmiX3dIP8fVn/FX8fYjSetgcJdb
# DINIiph2ypTRv+ZUtAC+s8UaYMCYUV9CM5Fs3TnwEayAvVNuuIRfz5gi00eZyprE
# RxL4b6LMoucTm9HnBre8SYlGzlb25MgstHy86s0vl4O9LuLZ9PgJq8aONp99YvCK
# IdAIbyOoL3wAyzpK55igRa1Ld6uxLGALByWWXZOKyLnutog/V8yOhV2uo70h8u6j
# DhFeAVNTZHDRwFvONO1n0M97mY21tWaU4QQ3gmznEknfpnbB66y503LhuKwmlOgg
# FdOSO+cB93wECvXi7uK7nR9VYHMDsg==
# =WrOS
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Jul 2026 16:30:06 CEST
# gpg:                using RSA key B818B9CADF9089C2D5CEC66B75AD65802A0B4211
# gpg: Good signature from "Stefan Berger <stefanb@linux.vnet.ibm.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B818 B9CA DF90 89C2 D5CE  C66B 75AD 6580 2A0B 4211

* tag 'pull-tpm-2026-07-10-1' of https://github.com/stefanberger/qemu-tpm:
  hw/core/machine: disable tpm-tis-device PPI for machine type <= 11.0
  hw/tpm: gate PPI support on tpm-tis-device behind a device property
  hw/core/platform-bus: guard platform_bus_get_mmio_addr() against NULL

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-11 07:15:22 +02:00
Richard Henderson
de1a225711 common-user: Move guest_base, have_guest_base to probe-guest-base.c
Unify the definitions of guest_base and have_guest_base.

Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:40:42 -07:00
Richard Henderson
58d6d6f035 bsd-user: Use probe_guest_base
Merge the PT_LOAD loop with the PT_INTERP loop, as the XXX
comment suggests.  Pass the probed range to probe_guest_base.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:40:42 -07:00
Richard Henderson
9affb4decd common-user: Move probe_guest_base from linux-user
Prepare to share probe_guest_base with bsd-user.

Create a linux_probe_guest_base wrapper with the portions
of probe_guest_base that are linux specific: managing the
commpage for various targets.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:40:42 -07:00
Richard Henderson
c418250409 common-user: Implement read_self_maps for FreeBSD
Use sysctl to fetch the vm map of the current process.

Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:40:02 -07:00
Richard Henderson
544f4c5b68 common-user: Move selfmap from util
This interface is only used for user-only.  It's more usefully
placed within common-user than util.  Temporarily add stub
implementation for bsd-user.

Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:39:58 -07:00
Richard Henderson
259de598b3 include/user/guest-host: Include missing cpu.h
This file dereferences CPUState without including the required header.

Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:39:54 -07:00
Richard Henderson
7c1a3ad10e common-user: Initialize mmap_min_addr for FreeBSD
Use sysctl to fetch the vm layout of the current process.

Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:39:50 -07:00
Richard Henderson
c56da35d5d common-user: Move mmap_min_addr from linux-user
Introduce user/mmap-min-addr.h.  Initialize the variable
from a constructor instead of main.

Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:39:43 -07:00
Richard Henderson
6fe7a5bba7 linux-user: Use PGBRange for commpage
This simplifies check for no commpage to a NULL pointer
check, rather than reserved values for LO_COMMPAGE and
HI_COMMPAGE.

Unify {LO,HI}_COMMPAGE into a single COMMPAGE define.

Acked-by: Warner Losh <imp@bsdimp.com>
Tested-by: Helge Deller <deller@gmx.de>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:38:10 -07:00
Richard Henderson
3452cbd09f linux-user: Pass image_range to probe_guest_base
Pass a PGBRange structure instead of separate guest_loaddr
and guest_hiaddr parameters.  This allows NULL to indicate
that the image is relocatable, so that image_range->lo == 0
is a valid fixed setting.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/1890
Tested-by: Helge Deller <deller@gmx.de>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:38:10 -07:00
Richard Henderson
66259fc5a2 linux-user: Drop hiaddr out-of-range check in probe_guest_base
Since dropping 32-bit host support, a guest address cannot
overflow a host pointer.  This means guest_hiaddr is unused
for relocatable images, so don't pass guest_hiaddr as size.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:38:10 -07:00
Richard Henderson
1e2ccb69b1 linux-user: Use PGBRange in load_elf_image
Collect into range instead of loaddr+hiaddr.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:38:10 -07:00
Richard Henderson
fb13afb1c6 linux-user: Introduce PGBRange
Create a structure to hold a beginning/end range for guest virtual
addresses, for use by probe_guest_base.  Use vaddr for clarity.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-07-10 14:38:10 -07:00
Mohammadfaiz Bawa
5e33de4f00 hw/core/machine: disable tpm-tis-device PPI for machine type <= 11.0
Set ppi=off in hw_compat_11_0[] so that older machine types do not
register the "tpm-ppi" RAMBlock, restoring backward migration.

Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260619093140.832136-4-mbawa@redhat.com
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-07-10 10:29:27 -04:00
Mohammadfaiz Bawa
5f0348bf6c hw/tpm: gate PPI support on tpm-tis-device behind a device property
Add a "ppi" boolean property (default: true) to tpm-tis-device.
When ppi=off the RAMBlock is never registered and the migration
stream omits "tpm-ppi", restoring backward compatibility.

Move sysbus_init_mmio() calls from instance_init to realizefn so
the memory regions are initialized before being registered.  When
ppi=off, the PPI MMIO region is simply not exposed.

Fixes: 46cd2c1050 ("hw/tpm: add PPI support to tpm-tis-device for ARM64 virt")
Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260619093140.832136-3-mbawa@redhat.com
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-07-10 10:29:27 -04:00
Mohammadfaiz Bawa
fb7609c4bf hw/core/platform-bus: guard platform_bus_get_mmio_addr() against NULL
sysbus_mmio_get_region() returns NULL when a device has fewer MMIO
regions than the requested slot index.  platform_bus_get_mmio_addr()
passes the result directly to memory_region_is_mapped() without a
NULL check, causing a SIGSEGV.

Return -1 early when the region pointer is NULL, consistent with the
existing "not mapped" path.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Mohammadfaiz Bawa <mbawa@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260619093140.832136-2-mbawa@redhat.com
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-07-10 10:29:27 -04:00
Stefan Hajnoczi
56c0c25d5a Merge tag 'pull-riscv-to-apply-20260710' of https://github.com/alistair23/qemu into staging
RISC-V PR for 11.1

* Fix IOMMU fault type for spa_fetch() faults
* Check IOMMU for reserved PTE bits
* Fault when IOMMU !PTE_U and no priv access
* Fault IOMMU for non-user PTE in G_STAGE
* Check IOMMU reserved MSI PTE basic bits
* Record fault on IOMMU-generated MSI write
* Move RISC-V TCG files and fix --disable-tcg
* Check for misaligned IOMMU IOHGATP_PPN
* Update IOMMU ioval2 when faulting in spa_fetch()
* Forbid IOMMU GATE/SADE if caps.AMO_HWADD is zero
* Set IOMMU ftype and iova in riscv_iommu_ctx()
* Check PCIe DOE mailbox length for overflows
* Add extensions after v7.1-rc4 update
* Remove job building OpenSBI firmware binaries
* Correct ACPI field sequence in SPCR table

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEaukCtqfKh31tZZKWr3yVEwxTgBMFAmpQXvUACgkQr3yVEwxT
# gBPkyQ/+J3Lhx3W1Go5+m4oRBbCPxq5w4ZyV3VUPNBcwLXtcZJQNiW2YghCGegNn
# 1HJzHihA1W9YromNlmIJzcOOWM81yScf0tV29NXCQW0Si1N9cA2jr4z8Nunwcndu
# L+T5s5nLKaijwM0xnL4CtnhZ3fu+gcowS1V2ohaQvRyMVkHCHUsz9nqoHa/j6GsX
# ipItcOQt6tXcAD1n+MqD5lm1UlQ1eV1d3pMLIwTU3+WpvDJzgOGriF+t56kbVIlT
# NcyT2ShmSSVpl6nu8VqqmE8nMLkKzw7c6uAJI8QR99yCqCWeFhkCeE6boE0CWFZl
# qAsmWL3tY1FcKU1bKiSZBaeDDFJUq1lKTMzJFyTDOR6O0kuVtUi9vJvSK1BXyGza
# zBjmRvnZYVM1CPu6IE/HvVWc3L1EECv1v6LF+yIOKfSpWe5k+AM8NN82awHPBQLO
# wnsUWFziecLae9ipdOnhmf7MB2oHiYzmjyRahgr4/ZbCOvcBdUF8l43nH067iNub
# 9DXuQt61dcayEkfz281ziiHBwSqkwK6aEpuEDcG8MFXyYth98Rl6e0iz5AHp5+rv
# YVp1sKcel9ZJSIdHb2zo/yXJNh/0tG6MChpoQnaJ2xHw+KHlRs1xZjt04itJl0lK
# utEe24epJCzE2HPeRVBTPSMRRvh5KudaAMdOgj5dsPCM6cq3qEM=
# =cZmZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Jul 2026 04:54:45 CEST
# gpg:                using RSA key 6AE902B6A7CA877D6D659296AF7C95130C538013
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6AE9 02B6 A7CA 877D 6D65  9296 AF7C 9513 0C53 8013

* tag 'pull-riscv-to-apply-20260710' of https://github.com/alistair23/qemu: (40 commits)
  tests: update SPCR loongarch64 and riscv64 test data
  hw/acpi: correct field sequence in SPCR table
  tests: allow differences in SPCR
  gitlab-ci: Remove job building OpenSBI firmware binaries
  target/riscv/kvm: add extensions after v7.1-rc4 update
  hw/pci/pcie_doe: Check mailbox length for overflows
  hw/riscv/riscv-iommu.c: set ftype and iova in riscv_iommu_ctx()
  hw/riscv/riscv-iommu: forbid GATE/SADE if caps.AMO_HWADD is zero
  hw/riscv/riscv-iommu.c: update ioval2 when faulting in spa_fetch()
  hw/riscv/riscv-iommu.c: check for misaligned IOHGATP_PPN
  gitlab-ci.d/crossbuilds: add riscv64 KVM-only build job
  target/riscv: move riscv_cpu_set_aia_ireg_rmw_cb() to riscv_imsic
  target/riscv: move riscv_cpu_set_geilen() to riscv-imsic
  target/riscv/tcg: remove unused riscv_cpu_get_geilen()
  target/riscv: move riscv_cpu_set_rdtime_fn to riscv_aclint
  target/riscv/gdbstub.c: isolate TCG only checks
  hw/riscv/riscv_hart.c isolate tcg only bits
  target/riscv/cpu.c: filter TCG only bits in riscv_cpu_reset_hold()
  target/riscv: gate riscv_cpu_update_mip with tcg_enabled()
  target/riscv/cpu.c: handle TCG bits of riscv_cpu_dump_state
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-10 07:11:03 +02:00
Stefan Hajnoczi
ab2056a0b7 Merge tag 'pull-ufs-20260709' of https://gitlab.com/jeuk20.kim/qemu into staging
hw/ufs: fix double unref of wrapped scsi-hd

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEUBfYMVl8eKPZB+73EuIgTA5dtgIFAmpO2osACgkQEuIgTA5d
# tgJmPw//dnLJD2NEQN6M5kMJRE921idE8cwBaUYsuIjltONnoH0i3J1t/8HA8RVp
# N27mzF2MP7cTJQfzWwncyb7+e7X6N/bv8+MeioTzRXZc7LeusZkHH8tSsXG+NvxI
# cI2NwSbdj4T5g8E8QqGXdKnEpgJpu2BkSHeu7traoSholFGRC4vXj/bi8Gl9ZAQw
# T736WijPkTg45OtVZ4jm/PXn3FIq5jlloXFmB0usdor+Srhimg/NrTFfxk4tUXF/
# ufpAqhUTlaX7ZEfOOhTZz3nmfUVOzjfNwtd1CtXbSgPxHpR3vgFNeJOiToz+RnyZ
# JkIiGo7RAC6JvlNtYXNAtRXwsYp2uW4ktxu1jxaY2BGCNBeVHQ7g/1sd2APBQR9U
# uyLpArFiuR2Ar83l5hshQw/pBhlC4C8XkzEpZHEN4m0XcsFKK3RPyn6tdGWpJ7/M
# +BSLMNj0fj3vy0f6V9uMfhi+3qjpEQgqaTPE9plgIeivU4zvlcq29D74z9ZdlQWs
# ii31j/eac5X/YksgpWNxWQDtYRQk1vGbYFIlKeE4xmmRhRg5OO7m3KQUi6NMCySi
# p09gmENnZt+fOagGPK66AcPgFhO1IyuIffTGgSzVqoPT6AgB3wMt6aQhJXMHaOLF
# Lh/sRWEI/1DFziizTA/yZPcBlxrQrRT1wkn9nMOsxY+Vud290A8=
# =2JE2
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 09 Jul 2026 01:17:31 CEST
# gpg:                using RSA key 5017D831597C78A3D907EEF712E2204C0E5DB602
# gpg: Good signature from "Jeuk Kim <jeuk20.kim@samsung.com>" [unknown]
# gpg:                 aka "Jeuk Kim <jeuk20.kim@gmail.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 5017 D831 597C 78A3 D907  EEF7 12E2 204C 0E5D B602

* tag 'pull-ufs-20260709' of https://gitlab.com/jeuk20.kim/qemu:
  hw/ufs: avoid double unref of wrapped scsi-hd

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-09 12:04:14 +02:00
Stefan Hajnoczi
4faab9a11f Merge tag 'pbouvier/pr/dockerfiles-20260708' of https://gitlab.com/p-b-o/qemu into staging
Changes:
- [PATCH 0/4] tests/docker/dockerfiles: add missing apt update (Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>)
  Link: https://lore.kernel.org/qemu-devel/20260707214655.1138626-1-pierrick.bouvier@oss.qualcomm.com

# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmpOfzkACgkQtEQ30Zwo
# Yt96VAv/U8oAJN9b2zGCENHTA35eTvURp/ael4Pf2SsH9DDusFxPm74581BWzmCu
# 1Id7buN/05EruvNcw2HTrk4STr7Vv7hkkXlzY5lI1AEPGFsO7dI8NqTxzETwSNcx
# W+lF5i8ZiYMf2ZIazkFRXJrjf3IYJl0P40qk+xC711H/GHum6/aqPWNLvcH1yPaW
# bjGMjc5nVcv6bT+mDbcAjqzET07dlAndJzWUP4QDohwL7zWXOpp0xvPTdMiUXchx
# B5G9NxGpLAn+iQpHYFaBHsDQxG3WW710XJHsttfU31/nuffApavL0Pf7jwXQg3/0
# oAEZiVGoEg7WHh2wkbNd8JDtTLfgLQiEmB8AXNXbQ2NGmpBb+XPaPaKEctjVFc4N
# OEz1vOuiZ/U3K0JXVLIMCuq2LRLF9MzhKT/b/DDP+zpU3Cu930S1V2MAOnalTz4G
# pIddFJwIDrwvnVdqaQ53PONgWqd3ZFv1pcWFZGSlNBqvqdqXotT78jxDEHgP/hO8
# rTwp/kgO
# =OJcx
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 08 Jul 2026 18:47:53 CEST
# gpg:                using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 37C1 5694 D8BA 9764 B197  3FDB B444 37D1 9C28 62DF

* tag 'pbouvier/pr/dockerfiles-20260708' of https://gitlab.com/p-b-o/qemu:
  tests/docker/dockerfiles/debian-all-test-cross.docker: add missing apt update
  tests/docker/dockerfiles/debian.docker: add missing apt update
  tests/docker/dockerfiles/ubuntu2404.docker: add missing apt update
  tests/lcitool/refresh: use raw string literal for trailers

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-09 12:03:39 +02:00
Stefan Hajnoczi
88b410c527 Merge tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu into staging
* Outline security classification guidelines
* Use QEMU lock guards in inotify code
* Fix certificate error checking

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEOSEivHoFu8YQee2OpU5XPKwd8GwFAmpNPEEACgkQpU5XPKwd
# 8Gy+Og//YYRoqF40fhgRFTjdU7z6ph2Gy0uAnqMf3up35KFa8Pp7bXU72bR4Pcbs
# GJMLv5/432V4vE4Sbx3u6+WssMPy4jycKysNTO4YFhd6wp9Sbpr9rWbbhxTJxBB1
# SvK3HjPocRe0PRQ063Jgz854IQ/aZ+skipNGAS1y2g3yfWb1/USi7J/L9EPwq3ty
# VOMS8muHYaea+T+66DFfYJve+5zmneTHCUkHQMui9EFB25yqjPYUZ4GWymurRoAS
# UeS7sGIKzCDcAeiFzwFoB13O+GOH3/nJ2xblNfj+3ywRmVXshwt73EoZX5xLuYE8
# o1M26J4tfF6rR6V3aPoD4w3OGstU+/bNgarTvgJmPdFlldKlbE6gXGY+kv8ejJqO
# YDe8/3HMEgdXBuUqaV60hY1NbW6+ZXkH3i4JuhwE4OnoOChbxooRmxDk5LIPfZFn
# KvF9AjrbhTsBVNjs5xOvcIZcCrstMqN00Zmta2KhoHqs3ffJYyXiIdk9kZbt1cDE
# tF0ttwDqUwAyHAGkFc2AjiwgH1jXXlUeojITJLzNWZeumSFPyOfEK9yxZw9gYRFp
# mBS2HLRCiSmcPJsyGKykm2Kg0thZou5zbnZ5EsAmfWsd+jRw0ynJ6jmCeUvmsmg3
# 4BzDsDnB771FY0QbB7N+T4pYNtUIztlc8myrhCEQqNTKgBKv/5o=
# =PwLK
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 07 Jul 2026 19:49:53 CEST
# gpg:                using RSA key 392122BC7A05BBC61079ED8EA54E573CAC1DF06C
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF
#      Subkey fingerprint: 3921 22BC 7A05 BBC6 1079  ED8E A54E 573C AC1D F06C

* tag 'misc-next-pull-request' of https://gitlab.com/berrange/qemu:
  docs: outline some guidelines for security classification
  io/channel-socket: Document why we can ignore socket_set_cork() errors
  util/filemonitor-inotify: Use QEMU_LOCK_GUARD()
  crypto/x509-utils: fix gnutls error code in crt_init failure path

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-09 11:03:05 +02:00
Heinrich Schuchardt
ec7d324287 tests: update SPCR loongarch64 and riscv64 test data
On LoongArch and RISC-V the SPCR test data contained:

    Terminal Type : 00
    Language : 03

The corrected values are:

    Terminal Type : 03
    Language : 00

See the specification of the table in
https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table

The ACPI table data was rebuilt with
tests/data/acpi/rebuild-expected-aml.sh.

Remove SPCR expections from tests/qtest/bios-tables-test-allowed-diff.h.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260705063147.199732-4-heinrich.schuchardt@canonical.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 16:21:52 +10:00
Heinrich Schuchardt
15c73b0f17 hw/acpi: correct field sequence in SPCR table
On LoongArch and RISC-V invalid SPCR tables are created:

    Terminal Type : 00
    Language : 03

The correct values are:

    Terminal Type : 03
    Language : 00

This is due to commit 7dd0b070fa ("hw/arm/virt-acpi-build.c: Migrate
SPCR creation to common location") that swapped the fields.

See the specification of the table in
https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table

This page shows version 1.10. But the sequence of the fields was not changed
since version 1.0.

Our LoongArch and ARM code uses version 1.07 of the specification.
Our RISC-V code uses version 1.10 of the specification.

Fixes: 7dd0b070fa ("hw/arm/virt-acpi-build.c: Migrate SPCR creation to common location")
Origin: https://lore.kernel.org/qemu-devel/20260326121947.51200-1-heinrich.schuchardt@canonical.com/T/#u
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2146419
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260705063147.199732-3-heinrich.schuchardt@canonical.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:44:21 +10:00
Heinrich Schuchardt
18a5220990 tests: allow differences in SPCR
For easier bisection add the SPCR table to bios-tables-test-allowed-diff.h.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260705063147.199732-2-heinrich.schuchardt@canonical.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:42:34 +10:00
Bin Meng
46a593eb8a gitlab-ci: Remove job building OpenSBI firmware binaries
The OpenSBI firmware build job follows the same pattern as the EDK2 job
[1] that was removed earlier [2]: it exists to produce firmware binaries
from CI artifacts, but those outputs are not consumed by the tree.

Remove the job definition and its project include to avoid maintaining
bitrotting container and firmware build logic.

[1] 71920809ce ("gitlab-ci.yml: Add jobs to build EDK2 firmware binaries")
[2] 690ceb7193 ("gitlab-ci: Remove job building EDK2 firmware binaries")

Signed-off-by: Bin Meng <bin.meng@processmission.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260706161716.29488-1-bin.meng@processmission.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:40:46 +10:00
Wang Yechao
83a87a38b6 target/riscv/kvm: add extensions after v7.1-rc4 update
Expose zilsd, zclsd and zalasr.

Signed-off-by: Wang Yechao <wang.yechao255@zte.com.cn>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260707072610.403595-1-wang.yechao255@zte.com.cn>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:38:59 +10:00
Alistair Francis
c7e6185454 hw/pci/pcie_doe: Check mailbox length for overflows
It was possible that a guest could overflow the `doe_cap->write_mbox`
buffer by writing more then PCI_DOE_DW_SIZE_MAX dwords.
`doe_cap->write_mbox_len` would continue to increment and there were no
bounds checks on the length when offsetting into doe_cap->write_mbox.

This patch adds a check and reports a guest error if we would overflow.

On an overflow we also silenty discard the entire object as instructed
to do in the PCIe spec when the length specified in the header
(up to PCI_DOE_DW_SIZE_MAX dwords) doesn't match the length of the
object.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3679
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Tao Tang <tangtao1634@phytium.com.cn>
Message-ID: <20260707020750.788960-1-alistair.francis@wdc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:37:12 +10:00
Daniel Henrique Barboza
ce7fb32827 hw/riscv/riscv-iommu.c: set ftype and iova in riscv_iommu_ctx()
We're hardcoding faulting type as READ, where it could very well be a
write access, and we're not recording the faulting addr/iova.

A note was added in the fault_type logic because I wasn't able to
trivially handle a probable code repeitition it in this same patch.
Something to do in a later date.

Fixes: 0c54acb824 ("hw/riscv: add RISC-V IOMMU base emulation")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3564
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260701092241.307801-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:35:24 +10:00
Daniel Henrique Barboza
6d2b9d542f hw/riscv/riscv-iommu: forbid GATE/SADE if caps.AMO_HWADD is zero
When capabilities.AMO_HWADD isn't set, DC.tc.GADE and DC.tc.SADE are
reserved bits and setting them throws a DDT_MISCONFIGURED error.

Fixes: 0c54acb824 ("hw/riscv: add RISC-V IOMMU base emulation")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3549
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Message-ID: <20260630172110.1866951-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:33:37 +10:00
Daniel Henrique Barboza
79616dd6e4 hw/riscv/riscv-iommu.c: update ioval2 when faulting in spa_fetch()
riscv_iommu_translate(), the only caller of riscv_iommu_spa_fetch(),
will use riscv_iommu_report_fault() for all faults it detects.  And it
will use iotlb->translated_addr as 'iotval2' every time.

At this moment we're updating iotlb->translated_addr only after a
translation step is completed, meaning any fault that occur before that
will have a zeroed iotlb->translated_addr, and as a result iotval2 will
also be zero later on.

Keep iotlb->translated_addr updated with the latest translated addr we
have.

Fixes: 0c54acb824 ("hw/riscv: add RISC-V IOMMU base emulation")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3559
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260702171202.1322493-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:31:50 +10:00
Daniel Henrique Barboza
bf274c5429 hw/riscv/riscv-iommu.c: check for misaligned IOHGATP_PPN
We must check if IOHGATP_PPN is 16kb aligned for non-bare GATP modes.

Fixes: 69a9ae4836 ("hw/riscv/riscv-iommu: add ATS support")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3550
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Message-ID: <20260702203616.1795588-2-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 15:30:03 +10:00
Zephyr Li
e2512b2291 gitlab-ci.d/crossbuilds: add riscv64 KVM-only build job
Add CI coverage for a riscv64 --disable-tcg cross build. This ensures that
RISC-V no-TCG/KVM-only builds keep working and prevents TCG-only code from
being accidentally pulled into common RISC-V sources again.

The cross_accel_build_job template enables KVM by default via
--enable-${ACCEL:-kvm}, so the extra options only need to disable TCG.

Signed-off-by: Zephyr Li <fritchleybohrer@gmail.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-25-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
6dd762b415 target/riscv: move riscv_cpu_set_aia_ireg_rmw_cb() to riscv_imsic
riscv_imsic.c is the only caller.  Having it sitting in the TCG only
cpu_helper.c gets in the way of --disable-tcg for no good reason.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-24-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
beecb30958 target/riscv: move riscv_cpu_set_geilen() to riscv-imsic
riscv_imsic.c is the only caller.  Having it sitting in the TCG only
cpu_helper.c gets in the way of --disable-tcg for no good reason.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-23-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
466c59145f target/riscv/tcg: remove unused riscv_cpu_get_geilen()
No one uses it.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260703180538.3346781-22-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
cb1b461838 target/riscv: move riscv_cpu_set_rdtime_fn to riscv_aclint
There's no need for it to be in cpu_helper since riscv_aclint is the
only caller.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-21-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
002749d230 target/riscv/gdbstub.c: isolate TCG only checks
The following functions are TCG only and are broken, if they were ever
usable in the first place, with KVM:

- riscv_gdb_(get|se)t_csr
- riscv_gdb_(get|set)_virtual
- riscv_gen_dynamic_csr_feature

Gate everything with TCG enabled to at least get them out of the way to
enable --disable-tcg.

As a note for the future: other archs have distincts gdbstub files for
each accelerator.  There's a strong case for RISC-V to do the same.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260703180538.3346781-20-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
a0b0643890 hw/riscv/riscv_hart.c isolate tcg only bits
riscv_cpu_register_csr_qtest_callback(), vcsr_call() and
csr_qtest_callback() are all TCG only and are not available in
--disable-tcg builds.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260703180538.3346781-19-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
209638d448 target/riscv/cpu.c: filter TCG only bits in riscv_cpu_reset_hold()
We have a lot of TCG only initialization in the common cpu_reset_hold
callback that prevents --disable-tcg to work.

Put a CONFIG_TCG ifdef around those bits to make the build work.
Eventually we'll create a TCG specific reset function in tcg-cpu.c but
for now this suffices.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-18-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
6c91b423a9 target/riscv: gate riscv_cpu_update_mip with tcg_enabled()
riscv_cpu_update_mip() is a TCG only call.  Its KVM equivalent is
kvm_riscv_set_irq().  cpu.c gates the KVM only function with a
kvm_enabled() check, making it unavailable for TCG only builds.  We need
to do the same for riscv_cpu_update_mip() otherwise a KVM only build
will fail because it doesn't know what this function is.

Use tcg_enabled() for the couple of riscv_cpu_update_mip() calls we have
unguarded in cpu.c.

We have way more calls to deal with in time_helper.c which isn't using
kvm_riscv_set_irq() at all, so create a riscv_accel_set_irq() local
helper that will choose whether to use the KVM or TCG API.

The reason we're going through all this hassle in time_helper.c is
because hw/int/riscv_aclint.c uses it, and if we don't do something
about we won't have riscv_aclint working for KVM.  Whether this is a
real problem or not and we should remove aclint support for KVM is
question for another day.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-17-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
5fa9e8597b target/riscv/cpu.c: handle TCG bits of riscv_cpu_dump_state
riscv_dump_csr() is a TCG only function but we'll have to implement it
at some capacity for KVM eventually, therefore put it under a CONFIG_TCG
ifdef while making a note that this function is unimplemented in KVM.

The csr_ops array is also TCG specific, thus the for loop inside
dump_state that iterates it is also TCG only business.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260703180538.3346781-16-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
705fe3819b target/riscv: move riscv_cpu_claim_interrupts to cpu.c
The function is used by hw/intc/ files that KVM cares about like
riscv_aplic.c.  Move it to cpu.c to be accessible for --disable-tcg
builds.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-15-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
e49b1e25fa target/riscv: move some irq helpers to cpu.c
riscv_cpu_has_work() uses a handful of irq pending functions from
cpu_helper.c.  There is a very high possibility that KVM doesn't need
the current implermentation of has_work(), but the common accel code
needs an implementation of this callback (see cpu_exec_class_post_init)
otherwise the KVM driver won't initialize.

Move the relevant irq helpers to cpu.c to allow KVM to keep using the
current has_work implementation, allowing --disable-tcg to work.  We'll
circle it back to evaluate a proper KVM implementation for it in a later
date.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-14-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
e26e53b4ab target/riscv: move riscv_cpu_set_nmi() to tcg-cpu.c
This function is related to Smrnmi and non-masked interrupts, firing up
interrupts via env->rnmip from riscv_cpu_local_irq_pending().

This is all TCG only code.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-13-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
5b9e32dd5c target/riscv: move custom_csrs logic to tcg-cpu.c
We have a couple of CPUs that has a set of custom CSRs that uses TCG
specific APIs.  Move the related code to tcg-cpu.c and do not set
.custom_csrs if we're not in a TCG build.

What we'll end up doing, sooner or later, is punting all these CPUs to
tcg-cpu.c since they're all TCG specific and KVM has nothing to do with
them.  Another time.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-12-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00
Daniel Henrique Barboza
458630c430 target/riscv: move csr.h to tcg subdir
After KVM is no longer reliant on csr.h move it to the TGC only land.

Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260703180538.3346781-11-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2026-07-09 14:58:03 +10:00