Compare commits

..

271 Commits

Author SHA1 Message Date
Andreas Stieger
4d30ee017d qemu-linux-user: drop pcre
qemu-linux-user: drop conditional requirement on pcre, all glib2 versions are recent enough to use pcre2
2025-04-11 20:08:34 +02:00
0c00530cde [openSUSE] Update to version 9.2.3
Update to latest stable release (9.2.3)

Full backport list here:
 https://lore.kernel.org/qemu-devel/44124379-3349-45cf-9238-8a847d8b2770@tls.msk.ru/

Fixes: bsc#1236329

A selection of them is reported here below:
 hw/intc/aspeed: Fix IRQ handler mask check
 hw/misc/aspeed_hace: Fix buffer overflow in has_padding function
 target/riscv: fix handling of nop for vstart >= vl in some vector instruction
 target/riscv: refactor VSTART_CHECK_EARLY_EXIT() to accept vl as a parameter
 Makefile: "make dist" generates a .xz, not .bz2
 target/ppc: Fix e200 duplicate SPRs
 target/ppc: Fix facility interrupt checks for VSX
 ppc/spapr: fix default cpu for pre-9.0 machines.
 host/include/loongarch64: Fix inline assembly compatibility with Clang
 linux-user/riscv: Fix handling of cpu mask in riscv_hwprobe syscall
 target/riscv: fixes a bug against `ssamoswap` behavior in M-mode
 target/riscv: fix access permission checks for CSR_SSP
 docs/about/emulation: Fix broken link
 vdpa: Allow vDPA to work on big-endian machine
 vdpa: Fix endian bugs in shadow virtqueue
 target/loongarch: Fix vldi inst
 target/arm: Simplify pstate_sm check in sve_access_check
 target/arm: Make DisasContext.{fp, sve}_access_checked tristate
 util/cacheflush: Make first DSB unconditional on aarch64
 docs: Rename default-configs to configs
 block: Zero block driver state before reopening
 hw/xen/hvm: Fix Aarch64 typo
 hw/net/smc91c111: Don't allow data register access to overrun buffer
 hw/net/smc91c111: Sanitize packet length on tx
 hw/net/smc91c111: Sanitize packet numbers
 ppc/pnv/occ: Fix common area sensor offsets
 xen: No need to flush the mapcache for grants (bsc#1236329)
 net: move backend cleanup to NIC cleanup
 net: parameterize the removing client from nc list
 util/qemu-timer.c: Don't warp timer from timerlist_rearm()
 target/arm: Correct STRD atomicity
 target/arm: Correct LDRD atomicity and fault behaviour
 hw/arm: enable secure EL2 timers for sbsa machine
 hw/arm: enable secure EL2 timers for virt machine
 target/arm: Implement SEL2 physical and virtual timers
 ...

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-11 20:03:43 +02:00
6038edfebf [openSUSE][RPM] spec: Require ipxe and virtio-gpu packages for more arch-es (bsc#1240157)
qemu-imxe and some *-virtio-gpu-* packages are necessary for ARM, PPC
and s390 to work.

References: bsc#1240157
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:15 +02:00
6647ae3a8a [openSUSE] Update to version 9.2.2
Update to latest stable release (9.2.2)

Full backport list here:
 https://lore.kernel.org/qemu-devel/3e847ae0-8dfc-440e-92f7-6eaa89818837@tls.msk.ru/

A selection of them is reported here below:
 net/slirp: libslirp 4.9.0 compatibility
 target/sparc: Fix gdbstub incorrectly handling registers f32-f62
 target/sparc: Fix register selection for all F*TOx and FxTO* instructions
 elfload: Fix alignment when unmapping excess reservation
 hw/net/smc91c111: Ignore attempt to pop from empty RX fifo
 make-release: don't rely on $CWD when excluding subproject directories
 ui/sdl2: reenable the SDL2 Windows keyboard hook procedure
 vfio/iommufd: Fix SIGSEV in iommufd_cdev_attach()
 gitlab-ci.d/cirrus: Update the FreeBSD job to v14.2
 qmp: update vhost-user protocol feature maps
 linux-user: Do not define struct sched_attr if libc headers do
 block-backend: Fix argument order when calling 'qapi_event_send_block_io_error()'
 block: Fix leak in send_qmp_error_event
 rust: add --rust-target option for bindgen

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Zhenzhong Duan
760c586cbf tests/acpi: q35: Update host address width in DMAR (bsc#1228343)
Differences:

@@ -1,39 +1,39 @@
 /*
  * Intel ACPI Component Architecture
  * AML/ASL+ Disassembler version 20200925 (64-bit version)
  * Copyright (c) 2000 - 2020 Intel Corporation
  *
- * Disassembly of tests/data/acpi/x86/q35/DMAR.dmar, Mon Nov 11 15:31:18 2024
+ * Disassembly of /tmp/aml-SPJ4W2, Mon Nov 11 15:31:18 2024
  *
  * ACPI Data Table [DMAR]
  *
  * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
  */

 [000h 0000   4]                    Signature : "DMAR"    [DMA Remapping table]
 [004h 0004   4]                 Table Length : 00000078
 [008h 0008   1]                     Revision : 01
-[009h 0009   1]                     Checksum : 15
+[009h 0009   1]                     Checksum : 0C
 [00Ah 0010   6]                       Oem ID : "BOCHS "
 [010h 0016   8]                 Oem Table ID : "BXPC    "
 [018h 0024   4]                 Oem Revision : 00000001
 [01Ch 0028   4]              Asl Compiler ID : "BXPC"
 [020h 0032   4]        Asl Compiler Revision : 00000001

-[024h 0036   1]           Host Address Width : 26
+[024h 0036   1]           Host Address Width : 2F
 [025h 0037   1]                        Flags : 01
 [026h 0038  10]                     Reserved : 00 00 00 00 00 00 00 00 00 00

 [030h 0048   2]                Subtable Type : 0000 [Hardware Unit Definition]
 [032h 0050   2]                       Length : 0040

 [034h 0052   1]                        Flags : 00
 [035h 0053   1]                     Reserved : 00
 [036h 0054   2]           PCI Segment Number : 0000
 [038h 0056   8]        Register Base Address : 00000000FED90000

 [040h 0064   1]            Device Scope Type : 03 [IOAPIC Device]
 [041h 0065   1]                 Entry Length : 08
 [042h 0066   2]                     Reserved : 0000
 [044h 0068   1]               Enumeration ID : 00
 [045h 0069   1]               PCI Bus Number : FF

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Acked-by: Clément Mathieu--Drif<clement.mathieu--drif@eviden.com>
Message-Id: <20241212083757.605022-18-zhenzhong.duan@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 81ab964f21)
References: bsc#1228343
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Zhenzhong Duan
95e2fa90e3 intel_iommu: Set default aw_bits to 48 starting from QEMU 9.2 (bsc#1228343)
According to VTD spec, stage-1 page table could support 4-level and
5-level paging.

However, 5-level paging translation emulation is unsupported yet.
That means the only supported value for aw_bits is 48. So default
aw_bits to 48 when stage-1 translation is turned on.

For legacy and scalable modes, 48 is the default choice for modern
OS when both 48 and 39 are supported. So it makes sense to set
default to 48 for these two modes too starting from QEMU 9.2.
Use pc_compat_9_1 to handle the compatibility for machines before
9.2.

Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Clément Mathieu--Drif<clement.mathieu--drif@eviden.com>
Reviewed-by: Yi Liu <yi.l.liu@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20241212083757.605022-17-zhenzhong.duan@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit ddd84fd0c1)
References: bsc#1228343
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Zhenzhong Duan
c8f105cc34 tests/acpi: q35: allow DMAR acpi table changes (bsc#1228343)
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20241212083757.605022-16-zhenzhong.duan@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 9609d71018)
References: bsc#1228343
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Thomas Huth
60e7bfce5c pc-bios: Update the s390 bios images with the recent changes (jsc#PED-958)
Fix the problem with the non-quiesced virtio-net device and
make sure to abort the boot process if the user specified a wrong
loadparm parameter.

Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 9744ceb94b)
References: jsc#PED-958
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Jared Rossi
8158c93e0a pc-bios/s390-ccw: Abort IPL on invalid loadparm (jsc#PED-958)
Because the loadparm specifies an exact kernel the user wants to boot, if the
loadparm is invalid it must represent a misconfiguration of the guest. Thus we
should abort the IPL immediately, without attempting to use other devices, to
avoid booting into an unintended guest image.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
Message-ID: <20250117212235.1324063-2-jrossi@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 64fa0de46e)
References: jsc#PED-958
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Thomas Huth
b2fc15ab86 pc-bios/s390-ccw/netmain: Fix error messages with regards to the TFTP server (jsc#PED-958)
The code in net_init_ip() currently bails out early if "rc" is less
than 0, so the if-statements that check for negative "rc" codes to
print out some specific error messages with regards to the TFTP server
are never reached. Move them earlier to bring that dead code back to
life.

Reviewed-by: Jared Rossi <jrossi@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Tested-by: Jared Rossi <jrossi@linux.ibm.com>
Message-ID: <20250116115826.192047-4-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit bbfa7f8558)
References: jsc#PED-958
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Thomas Huth
41a8400fa1 pc-bios/s390-ccw: Fix boot problem with virtio-net devices (jsc#PED-958)
When we are trying to boot from virtio-net devices, the
s390-ccw bios currently leaves the virtio-net device enabled
after using it. That means that the receiving virt queues will
continue to happily write incoming network packets into memory.
This can corrupt data of the following boot process. For example,
if you set up a second guest on a virtual network and create a
lot of broadcast traffic there, e.g. with:

 ping -i 0.02 -s 1400  -b 192.168.1.255

and then you try to boot a guest with two boot devices, a network
device first (which should not be bootable) and e.g. a bootable SCSI
CD second, then this guest will fail to load the kernel from the CD
image:

 $ qemu-system-s390x -m 2G -nographic -device virtio-scsi-ccw \
    -netdev tap,id=net0 -device virtio-net-ccw,netdev=net0,bootindex=1 \
    -drive if=none,file=test.iso,format=raw,id=cd1 \
    -device scsi-cd,drive=cd1,bootindex=2
 LOADPARM=[        ]

 Network boot device detected
 Network boot starting...
   Using MAC address: 52:54:00:12:34:56
   Requesting information via DHCP: done
   Using IPv4 address: 192.168.1.76
   Using TFTP server: 192.168.1.1
 Trying pxelinux.cfg files...
   TFTP error: ICMP ERROR "port unreachable"
   Receiving data:  0 KBytes
 Repeating TFTP read request...
   TFTP error: ICMP ERROR "port unreachable"
 Failed to load OS from network.
 Failed to IPL from this network!
 LOADPARM=[        ]

 Using virtio-scsi.

 ! virtio-scsi:setup:inquiry: response VS RESP=ff !
 ERROR: No suitable device for IPL. Halting...

We really have to shut up the virtio-net devices after we're not
using it anymore. The easiest way to do this is to simply reset
the device, so let's do that now.

Reviewed-by: Jared Rossi <jrossi@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Tested-by: Jared Rossi <jrossi@linux.ibm.com>
Message-ID: <20250116115826.192047-3-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 68c95ed1db)
References: jsc#PED-958
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Thomas Huth
620400658c pc-bios/s390-ccw/virtio: Add a function to reset a virtio device (jsc#PED-958)
To be able to properly silence a virtio device after using it,
we need a global function to reset the device.

Reviewed-by: Jared Rossi <jrossi@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Tested-by: Jared Rossi <jrossi@linux.ibm.com>
Message-ID: <20250116115826.192047-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 3936d05563)
References: jsc#PED-958
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
Thomas Huth
dbd87f4e3f hw/s390x: Fix crash that occurs when inspecting older versioned machines types (jsc#PED-958)
qemu-system-s390x currently crashes when trying to inspect older
machines types, for example:

 $ echo '{ "execute": "qmp_capabilities" }
         { "execute": "qom-list-properties","arguments":
           { "typename": "s390-ccw-virtio-3.0-machine"}}' \
   | ./qemu-system-s390x -qmp stdio -no-shutdown
 {"QMP": {"version": {"qemu": {"micro": 50, "minor": 2, "major": 9},
  "package": "v9.2.0-1071-g81e97df3e7"}, "capabilities": ["oob"]}}
 {"return": {}}
 **
 Bail out! ERROR:../target/s390x/cpu_models.c:832:s390_set_qemu_cpu_model:
  assertion failed: (QTAILQ_EMPTY_RCU(&cpus_queue))
 Aborted (core dumped)

The problem is that the versioned s390-ccw-virtio machine types
use instance_init() to set global state that should be initialized
before the CPUs get instantiated. But instance_init() is not called
only for the machine that is finally used, it is also called for
temporary instances of objects that are e.g. just created for
introspection. That means that those instance_init() functions can
also be called while a machine (and its CPUs) is already created,
which triggers the assertion in cpu_models.c.

So we must not use instance_init() for setting global state, but
use the machine->init() function instead, which is really only called
once when the machine comes to life.

Fixes: 3b00f702c2 ("s390x/cpumodel: add zpci, aen and ais facilities")
Message-ID: <20250120085059.239345-1-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 807830e809)
References: jsc#PED-9583
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:10 +02:00
de6c5aca88 [openSUSE] Update to version 9.2.1
Update to latest stable release (9.2.1)

Full backport list here:
 https://lore.kernel.org/qemu-devel/qemu-stable-9.2.1-20250207102656@cover.tls.msk.ru/

A selection of them is reported here below:
 9pfs: fix regression regarding CVE-2023-2861
 tcg: Reset free_temps before tcg_optimize
 tcg/riscv: Fix StoreStore barrier generation
 x86/loader: only patch linux kernels
 roms: re-add edk2-basetools target
 pc-bios: add missing riscv64 descriptor
 hw/intc/arm_gicv3_its: Zero initialize local DTEntry etc structs
 meson.build: Disallow libnfs v6 to fix the broken macOS build
 target/i386: Reset TSCs of parked vCPUs too on VM reset
 hw/intc/riscv_aplic: Fix APLIC in_clrip and clripnum write emulation
 s390x/s390-virtio-ccw: don't crash on weird RAM sizes
 target/loongarch: Use actual operand size with vbsrl check
 docs: Correct '-runas' and '-fsdev/-virtfs proxy' indentation
 docs: Correct release of TCG trace-events removal
 target/i386/cpu: Fix notes for CPU models
 migration/multifd: Fix compile error caused by page_size usage
 migration/multifd: Fix compat with QEMU < 9.0
 migration: Add more error handling to analyze-migration.py
 migration: Remove unused argument in vmsd_desc_field_end
 migration: Fix parsing of s390 stream
 s390x: Fix CSS migration
 migration: Rename vmstate_info_nullptr
 ...

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 18:05:05 +02:00
Hendrik Brueckner
92ec18e24a s390x/cpumodel: gen17 model
This commit introduces the definition of the gen17a/gen17b CPU model.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Message-ID: <20241206122751.189721-16-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 21b8db2299)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
c2708950d6 s390x/cpumodel: Add PLO-extension facility
The PLO-extension facility introduces numerous locking related
subfunctions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-15-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 393c835e34)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
e71b97e17a s390x/cpumodel: correct PLO feature wording
The PLO functions 0, 4, 8, 12, 16, and 20 use 32-bit registers
values.  The plo-*gr variants use 64-bit instead and, thus, correct
the wording.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-14-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 5a0a136df7)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
4e2a9f19a0 s390x/cpumodel: Add Sequential-Instruction-Fetching facility
The sequential instruction fetching facility provides few guarantees,
for example, to avoid stop machine calls on enabling/disabling kprobes.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-13-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit a5fa8bee72)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
907a31fec2 s390x/cpumodel: add Ineffective-nonconstrained-transaction facility
This facility indicates reduced support for noncontrained
transactional-execution.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-12-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 12417b713c)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
abbfbae459 s390x/cpumodel: add Vector-Packed-Decimal-Enhancement facility 3
This facility introduces new capabilities for the signed-pack-decimal
format.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-11-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit db4c208abd)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
2cc799fa40 s390x/cpumodel: add Miscellaneous-Instruction-Extensions Facility 4
This facility introduces few new instructions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-10-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit e68e5ea6fe)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
0e84841694 s390x/cpumodel: add Vector Enhancements facility 3
The Vector Enhancements facility 3 introduces new instructions and
extends support for doubleword/quadword elements.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-9-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 0b2c66a3fa)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
60ed1f521e s390x/cpumodel: add Concurrent-functions facility support
The Concurrent-functions facility introduces the new instruction
Perform Functions with Concurrent Results (PFCR) with few subfunctions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-8-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit c9ea365dce)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
2d9f662f05 linux-headers: Update to Linux 6.13-rc1
This linux headers update includes required changes for
the gen17 CPU model.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Suggested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20241206122751.189721-7-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 44fe383c27)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
ad3cf2fdcc s390x/cpumodel: Add ptff Query Time-Stamp Event (QTSE) support
Introduce a new PTFF subfunction to query-stamp events.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-6-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit eba6f49128)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
d7d4dd6545 s390x/cpumodel: add msa13 subfunctions
MSA13 introduces query authentication information (QAI) subfunctions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Message-ID: <20241206122751.189721-5-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit ba4614fdac)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
79c2537596 s390x/cpumodel: add msa12 changes
MSA12 changes the KIMD/KLMD instruction format for SHA3/SHAKE.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Message-ID: <20241206122751.189721-4-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 496fc02e0e)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
87f4adcc57 s390x/cpumodel: add msa11 subfunctions
MSA11 introduces new HMAC subfunctions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Message-ID: <20241206122751.189721-3-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 11dc902082)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
Hendrik Brueckner
554a0363c6 s390x/cpumodel: add msa10 subfunctions
MSA10 introduces new AES XTS subfunctions.

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Message-ID: <20241206122751.189721-2-brueckner@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 1029cd5b98)
References: PED-10266
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
fba56ed2a3 [openSUSE][RPM] Fix the build with the latest Sphinx
Explicitly BuildRequires sphinx_rtd_theme.

Signed-off-by: Steve Kowalik <steven.kowalik@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
45fc0dac8b [openSUSE] Update submodule references for 9.2.0
Point the submodules to the repositories that host our downstream
patches:

* roms/seabios
 - [openSUSE] switch to python3 as needed
 - [openSUSE] build: enable cross compilation on ARM
* roms/SLOF
 - Allow to override build date with SOURCE_DATE_EPOCH
* roms/ipxe
 - [ath5k] Add missing AR5K_EEPROM_READ in ath5k_eeprom_read_turbo_modes
 - [openSUSE] [build] Makefile: fix issues of build reproducibility
 - [openSUSE] [test] help compiler out by initializing array[openSUSE]
 - [openSUSE] [build] Silence GCC 12 spurious warnings
 - [librm] Use explicit operand size when pushing a label address
* roms/skiboot
 - [openSUSE] Makefile: define endianess for cross-building on aarch64
 - [openSUSE] Make Sphinx build reproducible (boo#1102408)
* roms/qboot
 - [openSUSE] add cross.ini file to handle aarch64 based build

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
3b71b0d9e8 [openSUSE][RPM] Update to version 9.2.0
Update to latest upstream release 9.0.0.

Full changelog at:
 https://wiki.qemu.org/ChangeLog/9.2

Highlights include:
 * virtio-gpu: support for 3D acceleration of Vulkan applications via
   Venus Vulkan driver in the guest and virglrenderer host library
 * crypto: GLib crypto backend now supports SHA-384 hashes
 * migration: QATzip-accelerated compression support while using multiple
   migration streams
 * Rust: experimental support for device models written in Rust (for
   development use only)
 * ARM: emulation support for FEAT_EBF16, FEAT_CMOW architecture features
 * ARM: support for two-stage SMMU translation for sbsa-ref and virt boards
 * ARM: support for CPU Security Extensions for xilinx-zynq-a9 board
 * ARM: 64GB+ memory support when using HVF acceleration on newer Macs
 * HPPA: SeaBIOS-hppa v17 firmware with various fixes and enhancements
 * RISC-V: IOMMU support for virt machine
 * RISC-V: support for control flow integrity and Svvptc extensions, and
   support for Bit-Manipulation extension on OpenTitan boards
 * RISC-V: improved performance for vector unit-stride/whole register
   ld/st instructions
 * s390x: support for booting from other devices if the previous ones fail
 * x86: support for new nitro-enclave machine type that can emulate
   AWS Nitro Enclave and can boot from Enclave Image Format files.
 * x86: KVM support for enabling AVX10, as well as enabling specific
   AVX10 versions via command-line
 * and lots more...

Other changes:
- Removed deprecated 'cris' support
- Removed deprecated virtfs-proxy-helper
- `--enable-rust` not addressed yet

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
1fba9edbcd Revert "ui/curses: Do not use console_select()" (bsc#1232712)
This reverts commit e99441a379.

This is an emergency measure taken for dealing with bsc#1232712,
until a proper solution is found upstream.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:59 +02:00
29ac5b7400 Revert "hw/xen: Register framebuffer backend via xen_backend_init()" (bsc#1232712)
This reverts commit 6ece1df966.

This is an emergency measure taken for dealing with bsc#1232712,
until a proper solution is found upstream.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
8cca2c5051 [openSUSE] Update to version 9.1.2
Update to latest stable release (9.1.2).

Full list of backports here:
 https://lore.kernel.org/qemu-devel/21ba2773-11a6-45ad-bf98-9b5c2cdccb9b@tls.msk.ru/

A selection of them is listed here too:
 usb-hub: Fix handling port power control messages
 hw/audio/hda: fix memory leak on audio setup
 Revert "hw/audio/hda: fix memory leak on audio setup" (bsc#1232728)
 hw/misc/mos6522: Fix bad class definition of the MOS6522 device
 vfio/container: Fix container object destruction
 target/i386: fix hang when using slow path for ptw_setl
 tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc()
 linux-user/arm: Select vdso for be8 and be32 modes
 linux-user/arm: Reduce vdso alignment to 4k
 linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR
 accel/tcg: Fix user-only probe_access_internal plugin check
 target/arm: Drop user-only special case in sve_stN_r
 linux-user: Fix setreuid and setregid to use direct syscalls
 hw/i386/pc: Don't try to init PCI NICs if there is no PCI bus
 target/i386: Fix legacy page table walk
 9pfs: fix crash on 'Treaddir' request
 hw/nvme: fix handling of over-committed queues
 migration: Ensure vmstate_save() sets errp
 target/arm: Fix SVE SDOT/UDOT/USDOT (4-way, indexed)
 target/arm: Add new MMU indexes for AArch32 Secure PL1&0
 Revert "target/arm: Fix usage of MMU indexes when EL3 is AArch32"
 acpi/disassemle-aml.sh: fix up after dir reorg
 hw/acpi: Fix ordering of BDF in Generic Initiator PCI Device Handle.
 qemu-ga: Fix a SIGSEGV in ga_run_command() helper
 hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions
 tests/tcg: Replace -mpower8-vector with -mcpu=power8
 hw/ssi/pnv_spi: Fixes Coverity CID 1558831
 hw/ssi/pnv_spi: Return early in transfer()
 hw/ssi/pnv_spi: Match _xfer_buffer_free() with _xfer_buffer_new()
 ppc/pnv: ADU fix possible buffer overrun with invalid size
 target/ppc: Fix HFSCR facility checks
 target/ppc: Fix mtDPDES targeting SMT siblings
 ppc/pnv: Fix LPC POWER8 register sanity check
 ppc/pnv: Fix LPC serirq routing calculation
 target/ppc: Make divd[u] handler method decodetree compatible
 target/ppc: Set ctx->opcode for decode_insn32()
 target/riscv: Fix vcompress with rvv_ta_all_1s
 target/riscv/kvm: clarify how 'riscv-aia' default works
 target/riscv/kvm: set 'aia_mode' to default in error path
 hw/intc/riscv_aplic: Check and update pending when write sourcecfg
 target/riscv: Set vtype.vill on CPU reset
 hw/intc: Don't clear pending bits on IRQ lowering
 target/riscv: Correct SXL return value for RV32 in RV64 QEMU
 target/riscv/csr.c: Fix an access to VXSAT
 stubs: avoid duplicate symbols in libqemuutil.a
 target/arm: Store FPSR cumulative exception bits in env->vfp.fpsr
 target/arm: Fix arithmetic underflow in SETM instruction
 hw/sd/omap_mmc: Don't use sd_cmd_type_t
 target/arm: Don't assert in regime_is_user() for E10 mmuidx values
 net/tap-win32: Fix gcc 14 format truncation errors
 net: fix build when libbpf is disabled, but libxdp is enabled
 Fix calculation of minimum in colo_compare_tcp
 net: Check if nc is NULL in qemu_get_vnet_hdr_len()
 plugins: fix qemu_plugin_reset
 dockerfiles: fix default targets for debian-loongarch-cross
 gitlab: make check-[dco|patch] a little more verbose
 vfio/migration: Report only stop-copy size in
 linux-user/riscv: Fix definition of RISCV_HWPROBE_EXT_ZVFHMIN
 linux-user/ppc: Fix sigmask endianness issue in sigreturn
 linux-user: Emulate /proc/self/maps under mmap_lock
 target/i386: Use probe_access_full_mmu in ptw_translate
 target/i386: Walk NPT in guest real mode
 tcg: Reset data_gen_ptr correctly
 raw-format: Fix error message for invalid offset/size
 tests/qemu-iotests/211.out: Update to expect MapEntry 'compressed' field
 Revert "hw/sh4/r2d: Realize IDE controller before accessing it"
 tests: Wait for migration completion on destination QEMU to avoid failures
 target/i386: Use only 16 and 32-bit operands for IN/OUT
 accel/kvm: check for KVM_CAP_READONLY_MEM on VM
 target/i386/tcg: Use DPL-level accesses for interrupts and call gates
 KVM: Dynamic sized kvm memslots array
 tcg/s390x: fix constraint for 32-bit TSTEQ/TSTNE

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
Fabiano Rosas
27901ae68c [openSUSE] block: Move qcow2 invalidation query-block op_blocker
Putting the query-block operation blocker in the qcow2 invalidation
coroutine is incorrect because the bdrv_op_block() function expects to
run in the main thread. Move the blocker up to bdrv_activate().

References: bsc#1221812
References: bsc#1232283
References: bsc#1230978
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2025-04-01 17:58:58 +02:00
d74a7937e5 [openSUSE] Update to version 9.1.1
Update to latest stable release (9.1.1).

Full list of backports here:
 https://lore.kernel.org/qemu-devel/7f0561ec-3564-4860-bacf-a98071a5ce52@tls.msk.ru/

A selection of them is listed here too:
 ui/dbus: fix filtering all update messages
 ui/win32: fix potential use-after-free with dbus shared memory
 ui/dbus: fix leak on message filtering
 hw/audio/hda: fix memory leak on audio setup
 hw/audio/hda: free timer on exit
 hw/char/pl011: Use correct masks for IBRD and FBRD
 hw/intc/arm_gicv3_cpuif: Add cast to match the documentation
 hw/intc/arm_gicv3: Add cast to match the documentation
 hw/intc/arm_gicv3: Add cast to match the documentation
 meson: ensure -mcx16 is passed when detecting ATOMIC128
 meson: define qemu_isa_flags
 meson: fix machine option for x86_version
 target/m68k: Always return a temporary from gen_lea_mode
 tcg/ppc: Use TCG_REG_TMP2 for scratch index in prepare_host_addr
 tcg/ppc: Use TCG_REG_TMP2 for scratch tcg_out_qemu_st
 linux-user: Fix parse_elf_properties GNU0_MAGIC check
 linux-user/flatload: Take mmap_lock in load_flt_binary()
 vnc: fix crash when no console attached
 testing: bump mips64el cross to bookworm and fix package list
 hw/sd/sdcard: Fix handling of disabled boot partitions
 target/arm: Avoid target_ulong for physical address lookups
 block/reqlist: allow adding overlapping requests
 util/timer: avoid deadlock when shutting down
 hw/mips/jazz: fix typo in in-built NIC alias
 target/ppc: Fix lxvx/stxvx facility check
 tcg: Fix iteration step in 32-bit gvec operation
 hw/loongarch/virt: Add description for virt machine type
 migration/multifd: Fix p->iov leak in multifd-uadk.c
 target/ppc: Fix migration of CPUs with TLB_EMB TLB type
 target/hppa: Fix random 32-bit linux-user crashes
 target/arm: Correct ID_AA64ISAR1_EL1 value for neoverse-v1
 hw/char/stm32l4x5_usart.c: Enable USART ACK bit response
 migration/multifd: Fix rb->receivedmap cleanup race
 mac_dbdma: Remove leftover `dma_memory_unmap` calls

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
Heitor Moreira da Silva
05d8d23ca7 [openSUSE][RPM] The qemu translation is not being installed (boo#1231166)
Use the %lang_package macro for qemu-lang and some rpmlint fixes
2025-04-01 17:58:58 +02:00
c59b521b10 [openSUSE][RPM] explicitly enable qemu-img support for vhdx and vpc
Was disabled by mistake, when updating the QEMU version.
Reinstate it.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
33adb08a6b [openSUSE][RPM] Consolidate disabling all features during 'configure' in a macro
When running configure, first of all we disable everything, and then we
enable only the feature that we know we want (and, of course, system
and user emulation use different sets of such features).

Consolidate the first part in a macro, that can be share between the two
spec files, making everything simpler and prettier.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
7b84bc608f [openSUSE][RPM] Consolidate handling of conditional features
Convert conditional build of features to the %bcond_without, so they
can actually be disabled, e.g., at the project level.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
9c751a8d3e [openSUSE][RPM] (commented out) services for qemu-pr-helper
Upstream provides services for qemu-pr-helper. So far, we've not needed
them, so let's continue not to ship them for now.

However, in case at some point we want to start offering them, stash the
commented out runes for that in the spec file.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
aa1d0f2831 [openSUSE][RPM] package qemu-vmsr-helper
Package qemu-vmsr-helper for letting VMs access the RAPL MSR.

I'll live in its own package and only makes sense on x86_64.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
João Silva
86700a687a [openSUSE] block: Add a thread-pool version of fstat (bsc#1211000)
The fstat call can take a long time to finish when running over
NFS. Add a version of it that runs in the thread pool.

Adapt one of its users, raw_co_get_allocated_file size to use the new
version. That function is called via QMP under the qemu_global_mutex
so it has a large chance of blocking VCPU threads in case it takes too
long to finish.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: João Silva <jsilva@suse.de>
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
2fd74df480 [openSUSE] block: Convert qmp_query_block and qmp_query_named_block_nodes to coroutine (bsc#1211000)
Convert the remaining functions to make the QMP commands query-block
and query-named-block-nodes run in their entirety in a coroutine. With
this, any yield from those commands will return all the way back to
the main loop. This releases the BQL and the main loop and avoids
having the QMP command block another more important task from running.

Both commands need to be converted at once because hmp_info_block
calls both and it needs to be moved to a coroutine as well.

Now the wrapper for bdrv_co_get_allocated_file_size() can be made not
mixed and the wrapper for bdrv_co_block_device_info() can be removed.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
Signed-off-by: Lin Ma <lma@suse.com>
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:58 +02:00
Fabiano Rosas
15c24165a7 [openSUSE] block: Don't query all block devices at hmp_nbd_server_start (bsc#1211000)
We're currently doing a full query-block just to enumerate the devices
for qmp_nbd_server_add and then discarding the BlockInfoList
afterwards. Alter hmp_nbd_server_start to instead iterate explicitly
over the block_backends list.

This allows the removal of the dependency on qmp_query_block from
hmp_nbd_server_start. This is desirable because we're about to move
qmp_query_block into a coroutine and don't need to change the NBD code
at the same time.

Add the GRAPH_RDLOCK_GUARD_MAINLOOP macro because
bdrv_skip_implicit_filters() needs the graph lock.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
7f7862cf7a [openSUSE] block: Convert bdrv_block_device_info into co_wrapper (bsc#1211000)
We're converting callers of bdrv_co_get_allocated_file_size() to run
in coroutines because that function will be made asynchronous when
called (indirectly) from the QMP dispatcher.

This function is a candidate because it calls bdrv_query_image_info()
-> bdrv_co_do_query_node_info() -> bdrv_co_get_allocated_file_size().

It is safe to turn this is a coroutine because the code it calls is
made up of either simple accessors and string manipulation functions
[1] or it has already been determined to be safe [2].

1) bdrv_refresh_filename(), bdrv_is_read_only(),
   blk_enable_write_cache(), bdrv_cow_bs(), blk_get_public(),
   throttle_group_get_name(), bdrv_write_threshold_get(),
   bdrv_query_dirty_bitmaps(), throttle_group_get_config(),
   bdrv_filter_or_cow_bs(), bdrv_skip_implicit_filters()

2) bdrv_co_do_query_node_info() (see previous commits);

This was the only caller of bdrv_query_image_info(), so we can remove
the wrapper for that function now.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
809f42450c [openSUSE] block: Convert bdrv_query_image_info to coroutine (bsc#1211000)
This function is a caller of bdrv_do_query_node_info(), which have
been converted to a coroutine. Convert this function as well so we're
closer from having the whole qmp_query_block as a single coroutine.

Also remove the wrapper for bdrv_co_do_query_node_info() now that all
its callers are converted.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
ea5943a913 [openSUSE] block: Convert bdrv_query_block_graph_info to coroutine (bsc#1211000)
We're converting callers of bdrv_co_get_allocated_file_size() to run
in coroutines because that function will be made asynchronous when
called (indirectly) from the QMP dispatcher.

This function is a candidate because it calls bdrv_do_query_node_info(),
which in turn calls bdrv_co_get_allocated_file_size().

All the functions called from bdrv_do_query_node_info() onwards are
coroutine-safe, either have a coroutine version themselves[1] or are
mostly simple code/string manipulation[2].

1) bdrv_co_getlength(), bdrv_co_get_allocated_file_size(),
   bdrv_co_get_info();

2) bdrv_refresh_filename(), bdrv_get_format_name(),
   bdrv_get_full_backing_filename(), bdrv_query_snapshot_info_list(),
   bdrv_get_specific_info();

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
efd51e6bd1 [openSUSE] block: Run bdrv_do_query_node_info in a coroutine (bsc#1211000)
Move this function into a coroutine so we can convert the whole
qmp_query_block command into a coroutine in the next patches.

Placing the entire command in a coroutine allow us to yield all the
way back to the main loop, releasing the BQL and unblocking the main
loop.

When the whole conversion is completed, we'll be able to avoid a
priority inversion that happens when a QMP command calls a slow
(buggy) system call and blocks the vcpu thread from doing mmio due to
contention on the BQL.

About coroutine safety:

Most callees have coroutine versions themselves and thus are safe to
call in a coroutine. The remaining ones:

- bdrv_refresh_filename, bdrv_get_full_backing_filename: String
  manipulation, nothing that would be unsafe for use in coroutines;

- bdrv_get_format_name: Just accesses a field;

- bdrv_get_specific_info, bdrv_query_snapshot_info_list: No locks or
  anything that would poll or block.

(using a mixed wrapper for now, but after all callers are converted,
this can become a coroutine exclusively)

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
da08f77a1a [openSUSE] block: Reschedule query-block during qcow2 invalidation (bsc#1221812)
There is a small window at the end of block device migration when
devices are being re-activated. This includes a resetting of some
fields of BDRVQcow2State at qcow2_co_invalidate_cache(). A concurrent
QMP query-block command can call qcow2_get_specific_info() during this
window and see the cleared values, which leads to an assert:

  qcow2_get_specific_info: Assertion `false' failed

This is the same issue as Gitlab #1933, which has already been
resolved[1], but there the fix applied only to non-coroutine
commands. Once we move query-block to a coroutine the problem will
manifest again.

Add an operation blocker to the invalidation function to block the
query info path during this window.

Instead of failing query-block, which would be disruptive to users,
use the blocker to know when to reschedule the coroutine back into the
iohandler so it doesn't run while the BDRVQcow2State is inconsistent.

To avoid failing query-block when all block operations are blocked,
unblock the INFO operation at various places. This preserves the prior
situations where query-block used to work.

1 - https://gitlab.com/qemu-project/qemu/-/issues/1933

Link: https://lore.kernel.org/all/87bk6trl9i.fsf@suse.de/
Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
References: bsc#1221812
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
5cb1ad71d8 [openSUSE] block: Take the graph lock in bdrv_snapshot_list (bsc#1211000)
This function has up until now always ran in the main loop, outside of
a coroutine. We're about to make it run inside a coroutine so start
actually taking the graph lock.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:57 +02:00
Fabiano Rosas
fb1d246c6e [openSUSE] block: Temporarily mark bdrv_co_get_allocated_file_size as mixed (bsc#1211000)
Some callers of this function are about to be converted to run in
coroutines, so allow it to be executed both inside and outside a
coroutine while we convert all the callers.

This will be reverted once all callers of bdrv_do_query_node_info run
in a coroutine.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
Fabiano Rosas
ea1a7c94e8 [openSUSE] block: Allow the wrapper script to see functions declared in qapi.h (bsc#1211000)
The following patches will add co_wrapper annotations to functions
declared in qapi.h. Add that header to the set of files used by
block-coroutine-wrapper.py.

Link: https://lore.kernel.org/r/20240409145917.6780-1-farosas@suse.de
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
References: bsc#1211000
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
Fabiano Rosas
505ce4a793 [openSUSE][RPM] configure: Fix with-pkgversion option
There was a typo on the subshell invocation: s/%/$

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
Fabiano Rosas
9b40e3d552 [openSUSE][RPM] Exclude riscv edk2 files
These files are not provided by the QEMU packages.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
Fabiano Rosas
9fa4f23f29 [openSUSE][RPM] Remove nios2
The nios2 emulation target has been removed upstream by commit
6c3014858c (target/nios2: Remove the deprecated Nios II target,
2024-03-27).

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
Fabiano Rosas
3cbf6caca8 [openSUSE][RPM] Update tests acpi path
Upstream commit 7c08eefcaf (tests/data/acpi: Move x86 ACPI tables
under x86/${machine} path, 2024-06-25) has moved some files under
tests/data. Update the spec file to match.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
Fabiano Rosas
e1eec9e1e5 [openSUSE][RPM] configure: remove options for removed features
The avx512f, live-block-migration and pvrdma options no longer exist
in upstream configure because those features were removed. Make the
corresponding changes in the spec files.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:56 +02:00
eaf87a2922 [openSUSE] Update version to 9.1.0
Update to latest upstream major release, 9.1.0:

  https://lore.kernel.org/qemu-devel/172549088090.3334224.10887376086844748499@amd.com/

Full changelog available here:

  https://wiki.qemu.org/ChangeLog/9.1

Some of the most notable features/fixes:
 * migration: compression offload support via Intel In-Memory Analytics
   Accelerator (IAA) or User Space Accelerator Development Kit (UADK),
   along with enhanced support for postcopy failure recovery
 * virtio: support for VIRTIO_F_NOTIFICATION_DATA, allowing guest
   drivers to provide additional data as part of sending device notifications
   for performance/debug purposes
 * guest-agent: support for guest-network-get-route command on linux,
   guest-ssh-* commands on Windows, and enhanced CLI support for
   configuring allowed/blocked commands
 * block: security fixes for QEMU NBD server and NBD TLS encryption
 * ARM: emulation support for FEAT_NMI, FEAT_CSV2_3, FEAT_ETS2,
   FEAT_Spec_FPACC, FEAT_WFxT, FEAT_Debugv8p8 architecture features
 * ARM: nested/two-stage page table support for emulated SMMUv3
 * ARM: xilinx_zynq board support for cache controller and multiple
   CPUs, and B-L475E-IOT01A board support for a DM163 display
 * LoongArch: support for directly booting an ELF kernel and for running
   up to 256 vCPUs via extioi virt extension
 * LoongArch: enhanced debug/GDB support
 * RISC-V: support for version 1.13 of privileged architecture specification
 * RISC-V: support for Zve32x, Zve64x, Zimop, Zcmop, Zama16b, Zabha,
   Zawrs, and Smcntrpmf extensions
 * RISC-V: enhanced debug/GDB support and general fixes
 * SPARC: emulation support for FMAF, IMA, VIS3, and VIS4 architecture
   features
 * x86: KVM support for running AMD SEV-SNP guests
 * x86: CPU emulation support for Icelake-Server-v7, SapphireRapids-v3,
   and SierraForest

The following bugs/CVEs were solved (in 9.0.x) with backports that are
now included in 9.1 upstream:
 - CVE-2024-4467 (bsc#1227322)
 - CVE-2024-7409 (bsc#1229007)

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
Fabiano Rosas
4a80001691 [openSUSE] fixup patch "pc: q35: Allow 1024 cpus for old machine types"
Remove spurious initialization with PC_MACHINE_CLASS().

Signed-off-by: Fabiano Rosas <farosas@suse.de>
[DF: added some context in the changelog]
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
25a71c48ec [openSUSE] Workflows for Virtualization:Staging:TDX
Define the workflows for the TDX staging branch.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
bb01c65b12 [openSUSE] roms: Build ipxe with NO_WERROR=1 (bsc#1227960)
This should allow qemu to be built with GCC14. [1] I believe that the
package actually intends to use -Wno-error already (which makes sense
for package building) because it puts it to EXTRA_CFLAGS, but at least
the ipxe slap -Werror after EXTRA_CFLAGS, unless NO_WERROR is defined
to one.

[1] https://github.com/ipxe/ipxe/issues/1219

References: bsc#1227960
Signed-off-by: Martin Jambor <mjambor@suse.com>
[set NO_WERROR=1 only for ipxe]
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
05d8a25ffa [openSUSE] Update to version 9.0.2
Update to latest stable release (9.0.2).

Full list of backports here:
 https://lore.kernel.org/qemu-devel/1721203819.679622.831479.nullmailer@tls.msk.ru/

A selection of them is listed here too:
 hw/nvme: fix number of PIDs for FDP RUH update
 sphinx/qapidoc: Fix to generate doc for explicit, unboxed arguments
 char-stdio: Restore blocking mode of stdout on exit
 virtio: remove virtio_tswap16s() call in vring_packed_event_read()
 virtio-pci: Fix the failure process in kvm_virtio_pci_vector_use_one()
 tcg/optimize: Fix TCG_COND_TST* simplification of setcond2
 block: Parse filenames only when explicitly requested
 iotests/270: Don't store data-file with json: prefix in image
 iotests/244: Don't store data-file with protocol in image
 qcow2: Don't open data_file with BDRV_O_NO_IO
 tests: add testing of parameter=3D1 for SMP topology (bsc#1228169)
 hw/core: allow parameter=3D1 for SMP topology on any machine
 target/arm: Fix FJCVTZS vs flush-to-zero
 target/arm: Fix VCMLA Dd, Dn, Dm[idx]
 i386/cpu: fixup number of addressable IDs for processor cores in the physical package
 tests: Update our CI to use CentOS Stream 9 instead of 8
 migration: Fix file migration with fdset
 tcg/loongarch64: Fix tcg_out_movi vs some pcrel pointers
 target/sparc: use signed denominator in sdiv helper
 linux-user: Make TARGET_NR_setgroups affect only the current thread
 accel/tcg: Fix typo causing tb->page_addr[1] to not be recorded
 stdvga: fix screen blanking
 hw/audio/virtio-snd: Always use little endian audio format
 Revert "monitor: use aio_co_reschedule_self()"
 ui/gtk: Draw guest frame at refresh cycle
 virtio-net: drop too short packets early
 target/i386: fix size of EBP writeback in gen_enter()

References: bsc#1228169
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
75a822b582 [openSUSE] Update to version 9.0.1
Update to latest stable release (9.0.1).

Full list of backports here:
 https://lore.kernel.org/qemu-devel/1718081053.366429.1238758.nullmailer@tls.msk.ru/

A selection of them is reported here too:
 Update version for 9.0.1 release
 target/loongarch: fix a wrong print in cpu dump
 ui/sdl2: Allow host to power down screen
 virtio-gpu: fix v2 migration
 target/i386: fix SSE and SSE2 feature check
 target/i386: fix xsave.flat from kvm-unit-tests
 disas/riscv: Decode all of the pmpcfg and pmpaddr CSRs
 riscv, gdbstub.c: fix reg_width in ricsv_gen_dynamic_vector_feature()
 target/riscv/kvm.c: Fix the hart bit setting of AIA
 target/riscv: rvzicbo: Fixup CBO extension register calculation
 target/riscv: do not set mtval2 for non guest-page faults
 target/riscv: prioritize pmp errors in raise_mmu_exception()
 target/riscv: rvv: Remove redudant SEW checking for vector fp narrow/widen instructions
 target/riscv: rvv: Check single width operator for vfncvt.rod.f.f.w
 target/riscv: rvv: Check single width operator for vector fp widen instructions
 target/riscv: rvv: Fix Zvfhmin checking for vfwcvt.f.f.v and vfncvt.f.f.w instructions
 target/riscv/cpu.c: fix Zvkb extension config
 target/riscv: Fix the element agnostic function problem
 target/riscv/kvm: tolerate KVM disable ext errors
 target/riscv/kvm: Fix exposure of Zkr
 hw/intc/riscv_aplic: APLICs should add child earlier than realize
 iotests: test NBD+TLS+iothread
 qio: Inherit follow_coroutine_ctx across TLS
 target/arm: Disable SVE extensions when SVE is disabled
 hw/intc/arm_gic: Fix handling of NS view of GICC_APR<n>
 hvf: arm: Fix encodings for ID_AA64PFR1_EL1 and debug System registers
 gitlab: use 'setarch -R' to workaround tsan bug
 gitlab: use $MAKE instead of 'make'
 dockerfiles: add 'MAKE' env variable to remaining containers
 gitlab: Update msys2-64bit runner tags
 target/i386: no single-step exception after MOV or POP SS
 target/i386: disable jmp_opt if EFLAGS.RF is 1
 hw/loongarch/virt: Fix FDT memory node address width
 hw/loongarch: Fix fdt memory node wrong 'reg'
 target/loongarch/kvm: fpu save the vreg registers high 192bit
 hw/core/machine: move compatibility flags for VirtIO-net USO to machine 8.1
 target-i386: hyper-v: Correct kvm_hv_handle_exit return value
 hw/pflash: fix block write start
 tcg/loongarch64: Fill out tcg_out_{ld,st} for vector regs
 ui/gtk: Check if fence_fd is equal to or greater than 0
 ui/gtk: Fix mouse/motion event scaling issue with GTK display backend
 configure: Fix error message when C compiler is not working
 configure: quote -D options that are passed through to meson
 target/i386: fix feature dependency for WAITPKG
 target/i386: rdpkru/wrpkru are no-prefix instructions
 target/i386: fix operand size for DATA16 REX.W POPCNT
 hw/remote/vfio-user: Fix config space access byte order
 hw/loongarch/virt: Fix memory leak
 target/sh4: Update DisasContextBase.insn_start
 target/sparc: Fix FPMERGE
 target/sparc: Fix FMULD8*X16
 target/sparc: Fix FMUL8x16A{U,L}
 target/sparc: Fix FMUL8x16
 target/sparc: Fix FEXPAND
 target/i386: Give IRQs a chance when resetting HF_INHIBIT_IRQ_MASK
 plugins: Update stale comment
 target/sh4: Fix SUBV opcode
 target/sh4: Fix ADDV opcode
 hw/arm/npcm7xx: Store derivative OTP fuse key in little endian
 hw/dmax/xlnx_dpdma: fix handling of address_extension descriptor fields
 hw/ufs: Fix buffer overflow bug
 .gitlab-ci.d/cirrus.yml: Shorten the runtime of the macOS and FreeBSD jobs
 tests/avocado: update sunxi kernel from armbian to 6.6.16
 target/arm: Restrict translation disabled alignment check to VMSA
 target/riscv/kvm: remove sneaky strerrorname_np() instance
 target/loongarch/cpu.c: typo fix: expection
 backends/cryptodev-builtin: Fix local_error leaks
 nbd/server: Mark negotiation functions as coroutine_fn
 nbd/server: do not poll within a coroutine context
 docs: i386: pc: Update maximum CPU numbers for PC Q35
 linux-user: do_setsockopt: fix SOL_ALG.ALG_SET_KEY
 migration/colo: Fix bdrv_graph_rdlock_main_loop: Assertion `!qemu_in_coroutine()' failed.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
6a725f2b84 [openSUSE][RPM] Prioritize PA over PipeWire in SLE (bsc#1222218)
Change the order of audio driver list in SLE to prefer pulseaudio
over pipewire (related to bsc#1222218).

Signed-off-by: Antonio Larrosa <alarrosa@suse.com>
References: bsc#1222218
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
54d77f6214 [openSUSE][RPM] Hostname normalization (for repr. build ) done properly (boo#1084909)
In commit "[openSUSE][RPM] Normalize hostname, for reproducible builds"
(dec5f6c8a7acd23222a14c6600d6967219fda65c) the USER and HOSTNAME
variables were defined in the different RPM section. Fix that.

Fixes: dec5f6c8a7acd23222a14c6600d6967219fda65c
References: boo#1084909
Suggested-by: Bernhard M. Wiedemann <githubbmwprimary@lsmod.de>
Signed-offf-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
6004ed7a6b [openSUSE][RPM] Update to version 9.0.0
Update to latest upstream release 9.0.0.

Full changelog at:
 https://wiki.qemu.org/ChangeLog/9.0

Highlights include:
 * block: virtio-blk now supports multiqueue where different queues of a
   single disk can be processed by different I/O threads
 * gdbstub: various improvements such as catching syscalls in user-mode,
   support for fork-follow modes, and support for siginfo:read
 * memory: preallocation of memory backends can now be handled
   concurrently using multiple threads in some cases
 * migration: support for "mapped-ram" capability allowing for more
   efficient VM snapshots, improved support for zero-page detection, and
   checkpoint-restart support for VFIO
 * ARM: architectural feature support for ECV (Enhanced Counter Virtualization),
   NV (Nested Virtualization), and NV2 (Enhanced Nested
   Virtualization)
 * ARM: board support for B-L475E-IOT01A IoT node, mp3-an536 (MPS3 dev board
   + AN536 firmware), and raspi4b (Raspberry Pi 4 Model B)
 * ARM: additional IO/disk/USB/SPI/ethernet controller and timer support for
   Freescale i.MX6, Allwinner R40, Banana Pi, npcm7xxx, and virt boards
 * HPPA: numerous bug fixes and SeaBIOS-hppa firmware updated to version 16
 * LoongArch: KVM acceleration support, including LSX/LASX vector
   extensions
 * RISC-V: ISA/extension support for Zacas, amocas, RVA22 profiles,
   Zaamo, Zalrsc, Ztso, and more
 * RISC-V: SMBIOS support for RISC-V virt machine, ACPI support for
   SRAT, SLIT, AIA, PLIC and updated RHCT table support, and numerous fixes
 * s390x: Emulation support for CVDG, CVB, CVBY and CVBG instructions,
   and fixes for LAE (Load Address Extended) emulation
 * and lots more...

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
815f2890da [openSUSE] Update to version 8.2.3 (bsc#1224179)
Update to latest stable release (8.2.3).

Full changelog/backports here:
 https://lore.kernel.org/qemu-devel/1713980341.971368.1218343.nullmailer@tls.msk.ru/

Some of the upstream backports are:
 Update version for 8.2.3 release
 ppc/spapr: Initialize max_cpus limit to SPAPR_IRQ_NR_IPIS.
 ppc/spapr: Introduce SPAPR_IRQ_NR_IPIS to refer IRQ range for CPU IPIs.
 hw/pci-host/ppc440_pcix: Do not expose a bridge device on PCI bus
 hw/isa/vt82c686: Keep track of PIRQ/PINT pins separately
 virtio-pci: fix use of a released vector
 linux-user/x86_64: Handle the vsyscall page in open_self_maps_{2,4}
 hw/audio/virtio-snd: Remove unused assignment
 hw/net/net_tx_pkt: Fix overrun in update_sctp_checksum()
 hw/sd/sdhci: Do not update TRNMOD when Command Inhibit (DAT) is set
 hw/net/lan9118: Fix overflow in MIL TX FIFO
 hw/net/lan9118: Replace magic '2048' value by MIL_TXFIFO_SIZE definition
 backends/cryptodev: Do not abort for invalid session ID
 hw/misc/applesmc: Fix memory leak in reset() handler
 hw/block/nand: Fix out-of-bound access in NAND block buffer
 hw/block/nand: Have blk_load() take unsigned offset and return boolean
 hw/block/nand: Factor nand_load_iolen() method out
 qemu-options: Fix CXL Fixed Memory Window interleave-granularity typo
 hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs
 hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs
 hw/display/virtio-gpu: Protect from DMA re-entrancy bugs
 mirror: Don't call job_pause_point() under graph lock (bsc#1224179)
 ...and many more...

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
192fd08cda [openSUSE] Update version to 8.2.2
Update to latest stable release (8.2.2).

Full changelog here:
 https://lore.kernel.org/qemu-devel/1709577077.783602.1474596.nullmailer@tls.msk.ru/

Upstream backports:
 chardev/char-socket: Fix TLS io channels sending too much data to the backend
 tests/unit/test-util-sockets: Remove temporary file after test
 hw/usb/bus.c: PCAP adding 0xA in Windows version
 hw/intc/Kconfig: Fix GIC settings when using "--without-default-devices"
 gitlab: force allow use of pip in Cirrus jobs
 tests/vm: avoid re-building the VM images all the time
 tests/vm: update openbsd image to 7.4
 target/i386: leave the A20 bit set in the final NPT walk
 target/i386: remove unnecessary/wrong application of the A20 mask
 target/i386: Fix physical address truncation
 target/i386: check validity of VMCB addresses
 target/i386: mask high bits of CR3 in 32-bit mode
 pl031: Update last RTCLR value on write in case it's read back
 hw/nvme: fix invalid endian conversion
 update edk2 binaries to edk2-stable202402
 update edk2 submodule to edk2-stable202402
 target/ppc: Fix crash on machine check caused by ifetch
 target/ppc: Fix lxv/stxv MSR facility check
 .gitlab-ci.d/windows.yml: Drop msys2-32bit job
 system/vl: Update description for input grab key
 docs/system: Update description for input grab key
 hw/hppa/Kconfig: Fix building with "configure --without-default-devices"
 tests/qtest: Depend on dbus_display1_dep
 meson: Explicitly specify dbus-display1.h dependency
 audio: Depend on dbus_display1_dep
 ui/console: Fix console resize with placeholder surface
 ui/clipboard: add asserts for update and request
 ui/clipboard: mark type as not available when there is no data
 ui: reject extended clipboard message if not activated
 target/i386: Generate an illegal opcode exception on cmp instructions with lock prefix
 i386/cpuid: Move leaf 7 to correct group
 i386/cpuid: Decrease cpuid_i when skipping CPUID leaf 1F
 i386/cpu: Mask with XCR0/XSS mask for FEAT_XSAVE_XCR0_HI and FEAT_XSAVE_XSS_HI leafs
 i386/cpu: Clear FEAT_XSAVE_XSS_LO/HI leafs when CPUID_EXT_XSAVE is not available
 .gitlab-ci/windows.yml: Don't install libusb or spice packages on 32-bit
 iotests: Make 144 deterministic again
 target/arm: Don't get MDCR_EL2 in pmu_counter_enabled() before checking ARM_FEATURE_PMU
 target/arm: Fix SVE/SME gross MTE suppression checks
 target/arm: Handle mte in do_ldrq, do_ldro
 target/arm: Split out make_svemte_desc
 target/arm: Adjust and validate mtedesc sizem1
 target/arm: Fix nregs computation in do_{ld,st}_zpa
 linux-user/aarch64: Choose SYNC as the preferred MTE mode
 tests/acpi: Update DSDT.cxl to reflect change _STA return value.
 hw/i386: Fix _STA return value for ACPI0017
 tests/acpi: Allow update of DSDT.cxl
 smmu: Clear SMMUPciBus pointer cache when system reset
 virtio_iommu: Clear IOMMUPciBus pointer cache when system reset
 virtio-gpu: Correct virgl_renderer_resource_get_info() error check
 hw/cxl: Pass CXLComponentState to cache_mem_ops
 hw/cxl/device: read from register values in mdev_reg_read()
 cxl/cdat: Fix header sum value in CDAT checksum
 cxl/cdat: Handle cdat table build errors
 vhost-user.rst: Fix vring address description
 tcg/arm: Fix goto_tb for large translation blocks
 tcg: Increase width of temp_subindex
 hw/net/tulip: add chip status register values
 hw/smbios: Fix port connector option validation
 hw/smbios: Fix OEM strings table option validation
 configure: run plugin TCG tests again
 tests/docker: Add sqlite3 module to openSUSE Leap container
 hw/riscv/virt-acpi-build.c: fix leak in build_rhct()
 migration: Fix logic of channels and transport compatibility check
 virtio-blk: avoid using ioeventfd state in irqfd conditional
 virtio: Re-enable notifications after drain
 virtio-scsi: Attach event vq notifier with no_poll
 iotests: give tempdir an identifying name
 iotests: fix leak of tmpdir in dry-run mode
 hw/scsi/lsi53c895a: add missing decrement of reentrancy counter
 linux-user/aarch64: Add padding before __kernel_rt_sigreturn
 tcg/loongarch64: Set vector registers call clobbered
 pci-host: designware: Limit value range of iATU viewport register
 target/arm: Reinstate "vfp" property on AArch32 CPUs
 qemu-options.hx: Improve -serial option documentation
 system/vl.c: Fix handling of '-serial none -serial something'
 target/arm: fix exception syndrome for AArch32 bkpt insn
 block/blkio: Make s->mem_region_alignment be 64 bits
 qemu-docs: Update options for graphical frontends
 Make 'uri' optional for migrate QAPI
 vfio/pci: Clear MSI-X IRQ index always
 migration: Fix use-after-free of migration state object
 migration: Plug memory leak on HMP migrate error path

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
95e4d1df31 [openSUSE] Increase default phys bits to 42, if host supports that
We wanted QEMU to support larger VMs (in therm of RAM size) by default
and we therefore introduced patch "[openSUSE] increase x86_64 physical
bits to 42". This, however, means that we create VMs with 42 bits of
physical address space even on hosts that only has, say, 40. And that
can't work.

In fact, it has been a problem since a long time (e.g., bsc#1205978) and
it's also the actual root cause of bsc#1219977.

Get rid of that old patch, in favor of a new one that still raise the
default number of address bits to 42, but only on hosts that supports
that.

This means that we can also use the proper SeaBIOS version, without
reverting commits that were only a problem due to our broken downstream
patch.

We probably aslo don't need to ship some of the custom ACPI tables (for
passing tests), but we'll actually remove them later, after double
checking properly that all the tests do work.

References: bsc#1205978
References: bsc#1219977
References: bsc#1220799
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
8de09dbd70 [openSUSE][RPM] Cosmetic fixes to spec files (copyright, sorting, etc)
Update the copyright year to 2024, sort dependencies etc.

This way, 'osc' does not have to do these changes all the times (they're
automatic, so no big deal, but it's annoying to see them in the diffs of
all the requests).

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
4f153cd7ad [openSUSE] roms/seabios: Drop an old (and no longer necessary) downstream patch
Drop the patch "[openSUSE] build: be explicit about -mx86-used-note=no"
from SeaBIOS.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
21fec370a8 [openSUSE][RPM] Update to latest stable versio (8.2.1)
Backported commits:
 * Update version for 8.2.1 release
 * target/arm: Fix incorrect aa64_tidcp1 feature check
 * target/arm: Fix A64 scalar SQSHRN and SQRSHRN
 * target/xtensa: fix OOB TLB entry access
 * qtest: bump aspeed_smc-test timeout to 6 minutes
 * monitor: only run coroutine commands in qemu_aio_context
 * iotests: port 141 to Python for reliable QMP testing
 * iotests: add filter_qmp_generated_node_ids()
 * block/blklogwrites: Fix a bug when logging "write zeroes" operations.
 * virtio-net: correctly copy vnet header when flushing TX (bsc#1218484, CVE-2023-6693)
 * tcg/arm: Fix SIGILL in tcg_out_qemu_st_direct
 * linux-user/riscv: Adjust vdso signal frame cfa offsets
 * linux-user: Fixed cpu restore with pc 0 on SIGBUS
 * block/io: clear BDRV_BLOCK_RECURSE flag after recursing in bdrv_co_block_status
 * coroutine-ucontext: Save fake stack for pooled coroutine
 * tcg/s390x: Fix encoding of VRIc, VRSa, VRSc insns
 * accel/tcg: Revert mapping of PCREL translation block to multiple virtual addresses
 * acpi/tests/avocado/bits: wait for 200 seconds for SHUTDOWN event from bits VM
 * s390x/pci: drive ISM reset from subsystem reset
 * s390x/pci: refresh fh before disabling aif
 * s390x/pci: avoid double enable/disable of aif
 * hw/scsi/esp-pci: set DMA_STAT_BCMBLT when BLAST command issued
 * hw/scsi/esp-pci: synchronise setting of DMA_STAT_DONE with ESP completion interrupt
 * hw/scsi/esp-pci: generate PCI interrupt from separate ESP and PCI sources
 * hw/scsi/esp-pci: use correct address register for PCI DMA transfers
 * migration/rdma: define htonll/ntohll only if not predefined
 * hw/pflash: implement update buffer for block writes
 * hw/pflash: use ldn_{be,le}_p and stn_{be,le}_p
 * hw/pflash: refactor pflash_data_write()
 * backends/cryptodev: Do not ignore throttle/backends Errors
 * target/i386: pcrel: store low bits of physical address in data[0]
 * target/i386: fix incorrect EIP in PC-relative translation blocks
 * target/i386: Do not re-compute new pc with CF_PCREL
 * load_elf: fix iterator's type for elf file processing
 * target/hppa: Update SeaBIOS-hppa to version 15
 * target/hppa: Fix IOR and ISR on error in probe
 * target/hppa: Fix IOR and ISR on unaligned access trap
 * target/hppa: Export function hppa_set_ior_and_isr()
 * target/hppa: Avoid accessing %gr0 when raising exception
 * hw/hppa: Move software power button address back into PDC
 * target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
 * hw/pci-host/astro: Add missing astro & elroy registers for NetBSD
 * hw/hppa/machine: Disable default devices with --nodefaults option
 * hw/hppa/machine: Allow up to 3840 MB total memory
 * readthodocs: fully specify a build environment
 * .gitlab-ci.d/buildtest.yml: Work around htags bug when environment is large
 * target/s390x: Fix LAE setting a wrong access register
 * tests/qtest/virtio-ccw: Fix device presence checking
 * tests/acpi: disallow tests/data/acpi/virt/SSDT.memhp changes
 * tests/acpi: update expected data files
 * edk2: update binaries to git snapshot
 * edk2: update build config, set PcdUninstallMemAttrProtocol = TRUE.
 * edk2: update to git snapshot
 * tests/acpi: allow tests/data/acpi/virt/SSDT.memhp changes
 * util: fix build with musl libc on ppc64le
 * tcg/ppc: Use new registers for LQ destination
 * hw/intc/arm_gicv3_cpuif: handle LPIs in in the list registers
 * hw/vfio: fix iteration over global VFIODevice list
 * vfio/container: Replace basename with g_path_get_basename
 * edu: fix DMA range upper bound check
 * hw/net: cadence_gem: Fix MDIO_OP_xxx values
 * audio/audio.c: remove trailing newline in error_setg
 * chardev/char.c: fix "abstract device type" error message
 * target/riscv: Fix mcycle/minstret increment behavior
 * hw/net/can/sja1000: fix bug for single acceptance filter and standard frame
 * target/i386: the sgx_epc_get_section stub is reachable
 * configure: use a native non-cross compiler for linux-user
 * include/ui/rect.h: fix qemu_rect_init() mis-assignment
 * target/riscv/kvm: do not use non-portable strerrorname_np()
 * iotests: Basic tests for internal snapshots
 * vl: Improve error message for conflicting -incoming and -loadvm
 * block: Fix crash when loading snapshot on inactive node

References: bsc#1218484 (CVE-2023-6693)
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
d1147a03ac [openSUSE][RPM] factor common definitions between qemu and qemu-linux-user spec files
Simplify both the spec files, by factoring common definitions.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
846edc405e [openSUSE][RPM] Install the VGA module "more often" (bsc#1219164)
Depending on the VM configuration (both at the VM definition level and
on the guest itself) a VGA console might be necessary, or weird lockup
will occur. Since the VGA module package is smalle enough, add a
dependency for it, from other display modules, to act as a workaround.

While there, make more explicit and precise the dependencies between all
the various modules, by specifying that they should all have the same
version and release.

References: bsc#1219164
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
55fba8c1ed [openSUSE][RPM] Create the legacy qemu-kvm symlink for all arches
Historically, KVM was available only for x86 and s390, and was invoked
via a binary called 'kvm' or 'qemu-kvm'. For a while, we've shipped a
package that was making it possible to invoke QEMU like that, but only
for these two arches. This, however, created a lot of confusion and
dependencies issues.

Fix them by creating a symlink from 'qemu-kvm' to the proper binary on
all arches and by making the main QEMU package Providing and Obsoleting
(also on all arches) the old qemu-kvm one.

Note that, for RISCV, the qemu-system-riscv64 binary, to which the symlink
should point, is in the qemu-extra package. However, if we are on RISCV,
qemu-extra is an hard dependency of qemu. Therefore, it's fine to ship
the link and also set the Provides: and Obsoletes: tag in the qemu
package itself. It'd be more correct to do that in the qemu-extra
package, of course, but this would complicate the spec file and it's not
worth it, considering this is all legacy and should very well go away
soon.

References: bsc#1218684
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
8785330847 [openSUSE][RPM] spec: allow building without spice
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
0d2a7887e4 [openSUSE] Update ipxe submodule reference (bsc#1219733, bsc#1219722)
Add to the ipxe submodule the commit (and all its dependencies) for
fixing building with binutils 2.42

References: bsc#1219733
References: bsc#1219722
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
574f04480a [openSUSE][RPM] Disable test-crypto-secret in linux-user build 2025-04-01 17:58:55 +02:00
Fabian Vogt
409d709201 [openSUSE][RPM] Fix enabling features on non-x86_64
The %endif was in the wrong place, so on non-x86_64, most features were
disabled.
2025-04-01 17:58:55 +02:00
8db551e41a [openSUSE] Update submodule references for 8.2.0
Point the submodules to the repositories that host our downstream
patches:

* roms/seabios
 - [openSUSE] switch to python3 as needed
 - [openSUSE] build: enable cross compilation on ARM
 - [openSUSE] build: be explicit about -mx86-used-note=no
* roms/SLOF
 - Allow to override build date with SOURCE_DATE_EPOCH
* roms/ipxe
 - [ath5k] Add missing AR5K_EEPROM_READ in ath5k_eeprom_read_turbo_modes
 - [openSUSE] [build] Makefile: fix issues of build reproducibility
 - [openSUSE] [test] help compiler out by initializing array[openSUSE]
 - [openSUSE] [build] Silence GCC 12 spurious warnings
 - [librm] Use explicit operand size when pushing a label address
* roms/skiboot
 - [openSUSE] Makefile: define endianess for cross-building on aarch64
 - [openSUSE] Make Sphinx build reproducible (boo#1102408)
* roms/qboot
 - [openSUSE] add cross.ini file to handle aarch64 based build

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
8feac51cf0 [openSUSE][RPM] Update version to 8.2
Update to latest upstream release.

The full list of changes are available at:

  https://wiki.qemu.org/ChangeLog/8.2

Highlights include:
 * New virtio-sound device emulation
 * New virtio-gpu rutabaga device emulation used by Android emulator
 * New hv-balloon for dynamic memory protocol device for Hyper-V guests
 * New Universal Flash Storage device emulation
 * Network Block Device (NBD) 64-bit offsets for improved performance
 * dump-guest-memory now supports the standard kdump format
 * ARM: Xilinx Versal board now models the CFU/CFI, and the TRNG device
 * ARM: CPU emulation support for cortex-a710 and neoverse-n2
 * ARM: architectural feature support for PACQARMA3, EPAC, Pauth2, FPAC,
   FPACCOMBINE, TIDCP1, MOPS, HBC, and HPMN0
 * HPPA: CPU emulation support for 64-bit PA-RISC 2.0
 * HPPA: machine emulation support for C3700, including Astro memory
   controller and four Elroy PCI bridges
 * LoongArch: ISA support for LASX extension and PRELDX instruction
 * LoongArch: CPU emulation support for la132
 * RISC-V: ISA/extension support for AIA virtualization support via KVM,
   and vector cryptographic instructions
 * RISC-V: Numerous extension/instruction cleanups, fixes, and reworks
 * s390x: support for vfio-ap passthrough of crypto adapter for
   protected
   virtualization guests
 * Tricore: support for TC37x CPU which implements ISA v1.6.2
 * Tricore: support for CRCN, FTOU, FTOHP, and HPTOF instructions
 * x86: Zen support for PV console and network devices

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
a78c0b0623 [openSUSE][RPM] Restrict canokey to openSUSE only
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
f326dfde1c [openSUSE][RPM] Fix virtiofsd dependency on 32 bit systems
And make the switch more general, as we now have multiple
instances of it.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
Ludwig Nussel
6af37e050b [openSUSE][RPM] Add support for canokeys (boo#1217520) 2025-04-01 17:58:55 +02:00
e3528bad4b [openSUSE][RPM] Disable Xen support in ALP-based distros
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
0cdbe99877 [openSUSE][RPM] Some more refinements of inter-subpackage dependencies
Add some block drivers and virtiofsd as hard dependencies of the
qemu-headless package, to make sure it's really useful for headless
server environments (even when recommended packages are not installed).

Singed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
0e5d1771a9 [openSUSE][RPM] Normalize hostname, for reproducible builds
Use a fixed USER value (in case someone builds outside of OBS/osc).

References: boo#1084909
Signed-off-by: Bernhard M. Wiedemann <githubbmwprimary@lsmod.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
af66732f1a [openSUSE][RPM] New subpackage, for SPICE
Define a new sub-(meta-)package that can be installed for having
all the other modules and packages necessary for SPICE to work.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
c12acf867c [openSUSE] Update version to 8.1.3
Align to upstream stable release. It includes many of the patches we had
backported ourself, to fix bugs and issues, plus more.

See here for details:
- https://lore.kernel.org/qemu-devel/1700589639.257680.3420728.nullmailer@tls.msk.ru/
- https://gitlab.com/qemu-project/qemu/-/commits/stable-8.1?ref_type=heads

An (incomplete!) list of such backports is:
 * Update version for 8.1.3 release
 * hw/mips: LOONGSON3V depends on UNIMP device
 * target/arm: HVC at EL3 should go to EL3, not EL2
 * s390x/pci: only limit DMA aperture if vfio DMA limit reported
 * target/riscv/kvm: support KVM_GET_REG_LIST
 * target/riscv/kvm: improve 'init_multiext_cfg' error msg
 * tracetool: avoid invalid escape in Python string
 * tests/tcg/s390x: Test LAALG with negative cc_src
 * target/s390x: Fix LAALG not updating cc_src
 * tests/tcg/s390x: Test CLC with inaccessible second operand
 * target/s390x: Fix CLC corrupting cc_src
 * tests/qtest: ahci-test: add test exposing reset issue with pending callback
 * hw/ide: reset: cancel async DMA operation before resetting state
 * target/mips: Fix TX79 LQ/SQ opcodes
 * target/mips: Fix MSA BZ/BNZ opcodes displacement
 * ui/gtk-egl: apply scale factor when calculating window's dimension
 * ui/gtk: force realization of drawing area
 * ati-vga: Implement fallback for pixman routines
 * ...

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
6a7a2a0f4e [openSUSE] Make Sphinx build reproducible (boo#1102408)
Avoid parallel processing in sphinx because that causes variations in
generated files

This is addressed here, with a downstream patch, until a proper solution
is found upstream.

Signed-off-by: Bernhard Wiedemann <bwiedemann@suse.com>
References: boo#1102408
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
073249aca9 [openSUSE] supportconfig: Adapt plugin to modern supportconfig
The supportconfig 'scplugin.rc' file is deprecated in favor of
supportconfig.rc'. Adapt the qemu plugin to the new scheme.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
f1f2300010 [openSUSE] Add -p1 to autosetup in spec files
Our workflow does not include patches in the spec files. Still, it could
be useful to add some there, during development and/or debugging issues.

Make sure that they are applied properly, by adding -p1 to the
%autosetup directive (it's a nop if there are no patches, so both cases
are ok).

Suggested-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
546ee0678a [openSUSE] Update version to 8.1.2
This fixes the following upstream issues:
 * https://gitlab.com/qemu-project/qemu/-/issues/1826
 * https://gitlab.com/qemu-project/qemu/-/issues/1834
 * https://gitlab.com/qemu-project/qemu/-/issues/1846

It also contains a fix for:
 * CVE-2023-42467 (bsc#1215192)

As well as several upstream backports:
 * target/riscv: Fix vfwmaccbf16.vf
 * disas/riscv: Fix the typo of inverted order of pmpaddr13 and pmpaddr14
 * roms: use PYTHON to invoke python
 * hw/audio/es1370: reset current sample counter
 * migration/qmp: Fix crash on setting tls-authz with null
 * util/log: re-allow switching away from stderr log file
 * vfio/display: Fix missing update to set backing fields
 * amd_iommu: Fix APIC address check
 * vdpa net: follow VirtIO initialization properly at cvq isolation probing
 * vdpa net: stop probing if cannot set features
 * vdpa net: fix error message setting virtio status
 * vdpa net: zero vhost_vdpa iova_tree pointer at cleanup
 * linux-user/hppa: Fix struct target_sigcontext layout
 * chardev/char-pty: Avoid losing bytes when the other side just (re-)connected
 * hw/display/ramfb: plug slight guest-triggerable leak on mode setting
 * win32: avoid discarding the exception handler
 * target/i386: fix memory operand size for CVTPS2PD
 * target/i386: generalize operand size "ph" for use in CVTPS2PD
 * subprojects/berkeley-testfloat-3: Update to fix a problem with compiler warnings
 * scsi-disk: ensure that FORMAT UNIT commands are terminated
 * esp: restrict non-DMA transfer length to that of available data
 * esp: use correct type for esp_dma_enable() in sysbus_esp_gpio_demux()
 * optionrom: Remove build-id section
 * target/tricore: Fix RCPW/RRPW_INSERT insns for width = 0
 * accel/tcg: Always require can_do_io
 * accel/tcg: Always set CF_LAST_IO with CF_NOIRQ
 * accel/tcg: Improve setting of can_do_io at start of TB
 * accel/tcg: Track current value of can_do_io in the TB
 * accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop
 * accel/tcg: Avoid load of icount_decr if unused
 * softmmu: Use async_run_on_cpu in tcg_commit
 * migration: Move return path cleanup to main migration thread
 * migration: Replace the return path retry logic
 * migration: Consolidate return path closing code
 * migration: Remove redundant cleanup of postcopy_qemufile_src
 * migration: Fix possible race when shutting down to_dst_file
 * migration: Fix possible races when shutting down the return path
 * migration: Fix possible race when setting rp_state.error
 * migration: Fix race that dest preempt thread close too early
 * ui/vnc: fix handling of VNC_FEATURE_XVP
 * ui/vnc: fix debug output for invalid audio message
 * hw/scsi/scsi-disk: Disallow block sizes smaller than 512 [CVE-2023-42467]
 * accel/tcg: mttcg remove false-negative halted assertion
 * meson.build: Make keyutils independent from keyring
 * target/arm: Don't skip MTE checks for LDRT/STRT at EL0
 * hw/arm/boot: Set SCR_EL3.FGTEn when booting kernel
 * include/exec: Widen tlb_hit/tlb_hit_page()
 * tests/file-io-error: New test
 * file-posix: Simplify raw_co_prw's 'out' zone code
 * file-posix: Fix zone update in I/O error path
 * file-posix: Check bs->bl.zoned for zone info
 * file-posix: Clear bs->bl.zoned on error
 * hw/cxl: Fix out of bound array access
 * hw/cxl: Fix CFMW config memory leak
 * linux-user/hppa: lock both words of function descriptor
 * linux-user/hppa: clear the PSW 'N' bit when delivering signals
 * hw/ppc: Read time only once to perform decrementer write
 * hw/ppc: Reset timebase facilities on machine reset
 * hw/ppc: Always store the decrementer value
 * target/ppc: Sign-extend large decrementer to 64-bits
 * hw/ppc: Avoid decrementer rounding errors
 * hw/ppc: Round up the decrementer interval when converting to ns
 * host-utils: Add muldiv64_round_up

Signed-of-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
336b01c893 [openSUSE] Update to version 8.1.1
This includes the following commits:

 * tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR (Marc-André Lureau)
 * meson: Fix targetos match for illumos and Solaris. (Jonathan Perkin)
 * s390x/ap: fix missing subsystem reset registration (Janosch Frank)
 * ui: fix crash when there are no active_console (Marc-André Lureau)
 * virtio-gpu/win32: set the destroy function on load (Marc-André Lureau)
 * target/riscv: Allocate itrigger timers only once (Akihiko Odaki)
 * target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes (Leon Schuermann)
 * target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0 (Daniel Henrique Barboza)
 * hw/riscv: virt: Fix riscv,pmu DT node path (Conor Dooley)
 * linux-user/riscv: Use abi type for target_ucontext (LIU Zhiwei)
 * hw/intc: Make rtc variable names consistent (Jason Chien)
 * hw/intc: Fix upper/lower mtime write calculation (Jason Chien)
 * target/riscv: Fix zfa fleq.d and fltq.d (LIU Zhiwei)
 * target/riscv: Fix page_check_range use in fault-only-first (LIU Zhiwei)
 * target/riscv/cpu.c: add zmmul isa string (Daniel Henrique Barboza)
 * hw/char/riscv_htif: Fix the console syscall on big endian hosts (Thomas Huth)
 * hw/char/riscv_htif: Fix printing of console characters on big endian hosts (Thomas Huth)
 * arm64: Restore trapless ptimer access (Colton Lewis)
 * virtio: Drop out of coroutine context in virtio_load() (Kevin Wolf)
 * qxl: don't assert() if device isn't yet initialized (Marc-André Lureau)
 * hw/net/vmxnet3: Fix guest-triggerable assert() (Thomas Huth)
 * docs tests: Fix use of migrate_set_parameter (Markus Armbruster)
 * qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options (Thomas Huth)
 * hw/i2c/aspeed: Fix TXBUF transmission start position error (Hang Yu)
 * hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode (Hang Yu)
 * hw/ide/ahci: fix broken SError handling (Niklas Cassel)
 * hw/ide/ahci: fix ahci_write_fis_sdb() (Niklas Cassel)
 * hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set (Niklas Cassel)
 * hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared (Niklas Cassel)
 * hw/ide/ahci: simplify and document PxCI handling (Niklas Cassel)
 * hw/ide/ahci: write D2H FIS when processing NCQ command (Niklas Cassel)
 * hw/ide/core: set ERR_STAT in unsupported command completion (Niklas Cassel)
 * target/ppc: Fix LQ, STQ register-pair order for big-endian (Nicholas Piggin)
 * target/ppc: Flush inputs to zero with NJ in ppc_store_vscr (Richard Henderson)
 * hw/ppc/e500: fix broken snapshot replay (Maksim Kostin)
 * ppc/vof: Fix missed fields in VOF cleanup (Nicholas Piggin)
 * ui/dbus: Properly dispose touch/mouse dbus objects (Bilal Elmoussaoui)
 * target/i386: raise FERR interrupt with iothread locked (Paolo Bonzini)
 * linux-user: Adjust brk for load_bias (Richard Henderson)
 * target/arm: properly document FEAT_CRC32 (Alex Bennée)
 * block-migration: Ensure we don't crash during migration cleanup (Fabiano Rosas)
 * softmmu: Assert data in bounds in iotlb_to_section (Richard Henderson)
 * docs/about/license: Update LICENSE URL (Philippe Mathieu-Daudé)
 * target/arm: Fix 64-bit SSRA (Richard Henderson)
 * target/arm: Fix SME ST1Q (Richard Henderson)
 * accel/kvm: Specify default IPA size for arm64 (Akihiko Odaki)
 * kvm: Introduce kvm_arch_get_default_type hook (Akihiko Odaki)
 * include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts (Thomas Huth)
 * target/s390x: Check reserved bits of VFMIN/VFMAX's M5 (Ilya Leoshkevich)
 * target/s390x: Fix VSTL with a large length (Ilya Leoshkevich)
 * target/s390x: Use a 16-bit immediate in VREP (Ilya Leoshkevich)
 * target/s390x: Fix the "ignored match" case in VSTRS (Ilya Leoshkevich)

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
29ee41aafa [openSUSE][RPM] spec: enable the Pipewire audio backend (bsc#1215486)
Enable the Pipewire audio backend (available since 8.1), in the
appropriate subpackage.

References: bsc#1215486
Signed-off-by: Dario Faggioli
2025-04-01 17:58:55 +02:00
d9eed861a9 [openSUSE][RPM] Use discount instead of perl-Text-Markdown
perl-Text-Markdown is not always available (e.g., in SLE/Leap).
Use discount instead, as the provider of the 'markdown' binary.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
564c05e9fb [openSUSE][RPM] Transform meson subproject in git submodules
OBS SCM bridge can handle git submodule, while it can't handle (yet?)
meson subprojects. The (ugly, I know!) solution, for now, is to turn
the latter into the former, with commands like the followings:

git submodule add -f https://gitlab.com/qemu-project/berkeley-testfloat-3 subprojects/berkeley-testfloat-3
git -C subprojects/berkeley-testfloat-3 reset --hard 40619cbb3bf32872df8c53cc457039229428a263

(the hash used comes from the subprojects/berkeley-testfloat-3.wrap file)

It's also necessary to manually apply the layering of the packagefiles,
and that is done in the specfile.

Longer term and better solutions could be:
- Make SCM support meson subprojects
- Create standalone packages for the subprojects (and instruct
  QEMU to pick stuff from there)

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:55 +02:00
bb5da0b274 [openSUSE][RPM] Update to version 8.1.0
Full list of changes are available at:

  https://wiki.qemu.org/ChangeLog/8.1

Highlights:
 * VFIO: improved live migration support, no longer an experimental feature
 * GTK GUI now supports multi-touch events
 * ARM, PowerPC, and RISC-V can now use AES acceleration on host processor
 * PCIe: new QMP commands to inject CXL General Media events, DRAM
   events and Memory Module events
 * ARM: KVM VMs on a host which supports MTE (the Memory Tagging Extension)
   can now use MTE in the guest
 * ARM: emulation support for bpim2u (Banana Pi BPI-M2 Ultra) board and
   neoverse-v1 (Cortex Neoverse-V1) CPU
 * ARM: new architectural feature support for: FEAT_PAN3 (SCTLR_ELx.EPAN),
   FEAT_LSE2 (Large System Extensions v2), and experimental support for
   FEAT_RME (Realm Management Extensions)
 * Hexagon: new instruction support for v68/v73 scalar, and v68/v69 HVX
 * Hexagon: gdbstub support for HVX
 * MIPS: emulation support for Ingenic XBurstR1/XBurstR2 CPUs, and MXU
   instructions
 * PowerPC: TCG SMT support, allowing pseries and powernv to run with up
   to 8 threads per core
 * PowerPC: emulation support for Power9 DD2.2 CPU model, and perf
   sampling support for POWER CPUs
 * RISC-V: ISA extension support for BF16/Zfa, and disassembly support
   for Zcm*/Z*inx/XVentanaCondOps/Xthead
 * RISC-V: CPU emulation support for Veyron V1
 * RISC-V: numerous KVM/emulation fixes and enhancements
 * s390: instruction emulation fixes for LDER, LCBB, LOCFHR, MXDB, MXDBR,
   EPSW, MDEB, MDEBR, MVCRL, LRA, CKSM, CLM, ICM, MC, STIDP, EXECUTE, and
   CLGEBR(A)
 * SPARC: updated target/sparc to use tcg_gen_lookup_and_goto_ptr() for
   improved performance
 * Tricore: emulation support for TC37x CPU that supports ISA v1.6.2
   instructions
 * Tricore: instruction emulation of POPCNT.W, LHA, CRC32L.W, CRC32.B,
   SHUFFLE, SYSCALL, and DISABLE
 * x86: CPU model support for GraniteRapids
 * and lots more...

This also (automatically) fixes:
 - bsc#1212850 (CVE-2023-3354)
 - bsc#1213001 (CVE-2023-3255)
 - bsc#1213925 (CVE-2023-3180)
 - bsc#1213414 (CVE-2023-3301)
 - bsc#1207205 (CVE-2023-0330)
 - bsc#1212968 (CVE-2023-2861)
 - bsc#1179993, bsc#1181740, bsc#1211697

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
b2599f48c1 [openSUSE][RPM] Use --preserve-argv0 in qemu-linux-user (boo#1197298, bsc#1212768)
By default try to preserve argv[0].

Original report is boo#1197298, which also became relevant recently again in bsc#1212768.

Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
References: boo#1197298
References: bsc#1212768
Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
2025-04-01 17:58:54 +02:00
0db0355f0f [openSUSE][RPM] Split qemu-tools package (#31)
Create separate packages for qemu-img and qemu-pr-helper.

Signed-off-by: Vasiliy Ulyanov <vulyanov@suse.de>
Co-authored-by: Vasiliy Ulyanov <vulyanov@suse.de>
2025-04-01 17:58:54 +02:00
916785a462 [openSUSE][RPM] Fix deps for virtiofsd and improve spec files
Address the comments from Factory Submission
https://build.opensuse.org/request/show/1088674?notification_id=40890530:
- remove the various '%defattr()'
- make sure that we depend on virtiofsd only on arch-es
  where it can actually be built

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
5ae8e4a328 [openSUSE][RPM] spec: require virtiofsd, now that it is a sep package (#27)
Since version 8.0.0, virtiofsd is not part of QEMU sources any longer.
We therefore have also moved it to a separate package. To retain
compatibility and consistency of behavior, require such a package as an
hard dependency.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
5495887d7a [openSUSE][RPM] Try to avoid recommending too many packages (bsc#1205680)
For example, let's try to avoid recommending GUI UI stuff, unless GTK is
already installed. This way we avoid things like bringing in an entire
graphic stack on servers.

References: bsc#1205680
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
484514de58 [openSUSE][RPM] Move documentation to a subpackage and fix qemu-headless (bsc#1209629)
- The qemu-headless subpackage was defined but never build, because it
  had no files. Fix that by putting there just a simple README.

- Move the docs in a dedicated subpackage

Resolves: bsc#1209629
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Gerd Hoffmann
5e2e7c53dd [openSUSE] roms: add back edk2-basetools target
The efi nic boot rom builds depend on this, they need the
EfiRom utility from edk2 BaseTools.

Fixes: 22e11539e1 ("edk2: replace build scripts")
Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
References: https://lore.kernel.org/qemu-devel/20230411101709.445259-1-kraxel@redhat.com/
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
357f4ee3c2 [openSUSE][OBS] Limit the workflow runs to the factory branch (#25)
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
14f15b3453 [openSUSE] pc: q35: Allow 1024 cpus for old machine types (bsc#1202282, jsc#PED-2592)
In SUSE/openSUSE, we bumped up the number of maximum vcpus since
machine type q35-7.1. Make sure that this continue to be true, for
backward compatibility.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
References: https://lore.kernel.org/qemu-devel/166876173513.24238.8968021290016401421.stgit@tumbleweed.Wayrath/
References: bsc#1202282, jsc#PED-2592
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
a82667a411 [openSUSE] meson: remove $pkgversion from CONFIG_STAMP input to broaden compatibility
As part of the effort to close the gap with Leap I think we are fine
removing the $pkgversion component to creating a unique CONFIG_STAMP.
This stamp is only used in creating a unique symbol used in ensuring the
dynamically loaded modules correspond correctly to the loading qemu.
The default inputs to producing this unique symbol are somewhat reasonable
as a generic mechanism, but specific packaging and maintenance practices
might require the default to be modified for best use. This is an example
of that.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
b42fd32824 [openSUSE] meson: install ivshmem-client and ivshmem-server
Turn on the meson install flag for these executables

Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
b7d2019932 [openSUSE] Make installed scripts explicitly python3 (bsc#1077564)
We want to explicitly reference python3 in the scripts we install.

References: bsc#1077564
Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
68508c0f5d [openSUSE] Disable some tests that have problems in OBS
We are disabling the following tests:

qemu-system-ppc64 / display-vga-test

They are failing due to some memory corruption errors. We believe that
this might be due to the combination of the compiler version and of LTO,
and will take up the investigation within the upstream community.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
bb40ad7dca [openSUSE] tests/qemu-iotests: Triple timeout of i/o tests due to obs environment
Executing tests in obs is very fickle, since you aren't guaranteed
reliable cpu time. Triple the timeout for each test to help ensure
we don't fail a test because the stars align against us.

Signed-off-by: Bruce Rogers <brogers@suse.com>
[DF: Small tweaks necessary for rebasing on top of 6.2.0]
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
3d656b365e [openSUSE] tests: change error message in test 162
Since we have a quite restricted execution environment, as far as
networking is concerned, we need to change the error message we expect
in test 162. There is actually no routing set up so the error we get is
"Network is unreachable". Change the expected output accordingly.

Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
33d5ef422e [openSUSE] Revert "tests/qtest: enable more vhost-user tests by default"
Revert commit "tests/qtest: enable more vhost-user tests by default"
(8dcb404bff), as it causes prooblem when building with GCC 12 and LTO
enabled.

This should be considered temporary, until the actual reason why the
code of the tests that are added in that commit breaks.

It has been reported upstream, and will be (hopefully) solved there:
https://lore.kernel.org/qemu-devel/1d3bbff9e92e7c8a24db9e140dcf3f428c2df103.camel@suse.com/

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Hannes Reinecke
1c99f41038 [openSUSE] scsi-generic: check for additional SG_IO status on completion (bsc#1178049)
SG_IO may return additional status in the 'status', 'driver_status',
and 'host_status' fields. When either of these fields are set the
command has not been executed normally, so we should not continue
processing this command but rather return an error.
scsi_read_complete() already checks for these errors,
scsi_write_complete() does not.

References: bsc#1178049
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Mauro Matteo Cascella
ec814199b9 [openSUSE] hw/scsi/megasas: check for NULL frame in megasas_command_cancelled() (bsc#1180432, CVE-2020-35503)
Ensure that 'cmd->frame' is not NULL before accessing the 'header' field.
This check prevents a potential NULL pointer dereference issue.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1910346
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
Reported-by: Cheolwoo Myung <cwmyung@snu.ac.kr>
References: bsc#1180432, CVE-2020-35503
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
0c19f451ce [openSUSE] scsi-generic: replace logical block count of response of READ CAPACITY (SLE-20965)
While using SCSI passthrough, Following scenario makes qemu doesn't
realized the capacity change of remote scsi target:
1. online resize the scsi target.
2. issue 'rescan-scsi-bus.sh -s ...' in host.
3. issue 'rescan-scsi-bus.sh -s ...' in vm.

In above scenario I used to experienced errors while accessing the
additional disk space in vm. I think the reasonable operations should
be:
1. online resize the scsi target.
2. issue 'rescan-scsi-bus.sh -s ...' in host.
3. issue 'block_resize' via qmp to notify qemu.
4. issue 'rescan-scsi-bus.sh -s ...' in vm.

The errors disappear once I notify qemu by block_resize via qmp.

So this patch replaces the number of logical blocks of READ CAPACITY
response from scsi target by qemu's bs->total_sectors. If the user in
vm wants to access the additional disk space, The administrator of
host must notify qemu once resizeing the scsi target.

Bonus is that domblkinfo of libvirt can reflect the consistent capacity
information between host and vm in case of missing block_resize in qemu.
E.g:
...
    <disk type='block' device='lun'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sdc' index='1'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
...

Before:
1. online resize the scsi target.
2. host:~  # rescan-scsi-bus.sh -s /dev/sdc
3. guest:~ # rescan-scsi-bus.sh -s /dev/sda
4  host:~  # virsh domblkinfo --domain $DOMAIN --human --device sda
Capacity:       4.000 GiB
Allocation:     0.000 B
Physical:       8.000 GiB

5. guest:~ # lsblk /dev/sda
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0   8G  0 disk
└─sda1   8:1    0   2G  0 part

After:
1. online resize the scsi target.
2. host:~  # rescan-scsi-bus.sh -s /dev/sdc
3. guest:~ # rescan-scsi-bus.sh -s /dev/sda
4  host:~  # virsh domblkinfo --domain $DOMAIN --human --device sda
Capacity:       4.000 GiB
Allocation:     0.000 B
Physical:       8.000 GiB

5. guest:~ # lsblk /dev/sda
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda      8:0    0   4G  0 disk
└─sda1   8:1    0   2G  0 part

References: [SUSE-JIRA] (SLE-20965)
Signed-off-by: Lin Ma <lma@suse.com>
2025-04-01 17:58:54 +02:00
Olaf Hering
290f9e12a0 [openSUSE] xen: ignore live parameter from xen-save-devices-state (bsc#1079730, bsc#1101982, bsc#106399)
The final step of xl migrate|save for an HVM domU is saving the state of
qemu. This also involves releasing all block devices. While releasing
backends ought to be a separate step, such functionality is not
implemented.

Unfortunately, releasing the block devices depends on the optional
'live' option. This breaks offline migration with 'virsh migrate domU
dom0' because the sending side does not release the disks, as a result
the receiving side can not properly claim write access to the disks.

As a minimal fix, remove the dependency on the 'live' option. Upstream
may fix this in a different way, like removing the newly added 'live'
parameter entirely.

Fixes: 5d6c599fe1 ("migration, xen: Fix block image lock issue on live migration")

Signed-off-by: Olaf Hering <olaf@aepfle.de>
References: bsc#1079730, bsc#1101982, bsc#1063993
Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
5229e92512 [openSUSE] xen: add block resize support for xen disks
Provide monitor naming of xen disks, and plumb guest driver
notification through xenstore of resizing instigated via the
monitor.

[BR: minor edits to pass qemu's checkpatch script]
[BR: significant rework needed due to upstream xen disk qdevification]
[BR: At this point, monitor_add_blk call is all we need to add!]
Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
fa6d9d996d [openSUSE] xen_disk: Add suse specific flush disable handling and map to QEMU equiv (bsc#879425)
Add code to read the suse specific suse-diskcache-disable-flush flag out
of xenstore, and set the equivalent flag within QEMU.

Patch taken from Xen's patch queue, Olaf Hering being the original author.
[bsc#879425]

[BR: minor edits to pass qemu's checkpatch script]
[BR: With qdevification of xen-block, code has changed significantly]
Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Olaf Hering <olaf@aepfle.de>
2025-04-01 17:58:54 +02:00
Andreas Färber
528288d7b3 [openSUSE] Raise soft address space limit to hard limit
For SLES we want users to be able to use large memory configurations
with KVM without fiddling with ulimit -Sv.

Signed-off-by: Andreas Färber <afaerber@suse.de>
[BR: add include for sys/resource.h]
Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
c6dfaa0dc3 [openSUSE] qemu-bridge-helper: reduce security profile (boo#988279)
Change from using glib alloc and free routines to those
from libc. Also perform safety measure of dropping privs
to user if configured no-caps.

References: boo#988279
Signed-off-by: Bruce Rogers <brogers@suse.com>
[AF: Rebased for v2.7.0-rc2]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2025-04-01 17:58:54 +02:00
Alexander Graf
9002c50e91 [openSUSE] Make char muxer more robust wrt small FIFOs
Virtio-Console can only process one character at a time. Using it on S390
gave me strange "lags" where I got the character I pressed before when
pressing one. So I typed in "abc" and only received "a", then pressed "d"
but the guest received "b" and so on.

While the stdio driver calls a poll function that just processes on its
queue in case virtio-console can't take multiple characters at once, the
muxer does not have such callbacks, so it can't empty its queue.

To work around that limitation, I introduced a new timer that only gets
active when the guest can not receive any more characters. In that case
it polls again after a while to check if the guest is now receiving input.

This patch fixes input when using -nographic on s390 for me.

[AF: Rebased for v2.7.0-rc2]
[BR: minor edits to pass qemu's checkpatch script]
Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
Alexander Graf
2f1b116ae0 [openSUSE] PPC: KVM: Disable mmu notifier check
When using hugetlbfs (which is required for HV mode KVM on 970), we
check for MMU notifiers that on 970 can not be implemented properly.

So disable the check for mmu notifiers on PowerPC guests, making
KVM guests work there, even if possibly racy in some odd circumstances.

Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
Alexander Graf
bee69b11dd [openSUSE] linux-user: lseek: explicitly cast non-set offsets to signed
When doing lseek, SEEK_SET indicates that the offset is an unsigned variable.
Other seek types have parameters that can be negative.

When converting from 32bit to 64bit parameters, we need to take this into
account and enable SEEK_END and SEEK_CUR to be negative, while SEEK_SET stays
absolute positioned which we need to maintain as unsigned.

Signed-off-by: Alexander Graf <agraf@suse.de>
2025-04-01 17:58:54 +02:00
Alexander Graf
ec58ef0a2d [openSUSE] linux-user: use target_ulong
Linux syscalls pass pointers or data length or other information of that sort
to the kernel. This is all stuff you don't want to have sign extended.
Otherwise a host 64bit variable parameter with a size parameter will extend
it to a negative number, breaking lseek for example.

Pass syscall arguments as ulong always.

Signed-off-by: Alexander Graf <agraf@suse.de>
[JRZ: changes from linux-user/qemu.h wass moved to linux-user/user-internals.h]
Signed-off-by: Jose R Ziviani <jziviani@suse.de>
[DF: Forward port, i.e., use ulong for do_prctl too]
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Andreas Färber
f937345924 [openSUSE] qemu-binfmt-conf: Modify default path
Change QEMU_PATH from /usr/local/bin to /usr/bin prefix.

Signed-off-by: Andreas Färber <afaerber@suse.de>
2025-04-01 17:58:54 +02:00
Bruce Rogers
0f300c119c [openSUSE] roms/Makefile: add --cross-file to qboot meson setup for aarch64
We add a --cross-file reference so that we can do cross compilation
of qboot from an aarch64 build.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Bruce Rogers
d804d5b8b1 [openSUSE] roms/Makefile: pass a packaging timestamp to subpackages with date info (bsc#1011213)
Certain rom subpackages build from qemu git-submodules call the date
program to include date information in the packaged binaries. This
causes repeated builds of the package to be different, wkere the only
real difference is due to the fact that time build timestamp has
changed. To promote reproducible builds and avoid customers being
prompted to update packages needlessly, we'll use the timestamp of the
VERSION file as the packaging timestamp for all packages that build in a
timestamp for whatever reason.

References: bsc#1011213
Signed-off-by: Bruce Rogers <brogers@suse.com>
2025-04-01 17:58:54 +02:00
4446caf068 [openSUSE][RPM] Spec file adjustments for 8.0.0 (and later)
The sgabios submodule is no longer there, so let's get rid of any
reference to it from our spec files.

Remove no longer supported './configure' options.

We're also not set yet for using the set_version service, so we need to
update the following manually:
- the Version: tags in the spec files
- the rpm/seabios_version and rpm/skiboot_version files (see qemu.spec
  for instructions on how to do that)
- the %{sbver} variable in rpm/common.inc

A better solution for handling this aspect is being worked on.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
1c61b9f7a8 [openSUSE][OBS] Add OBS workflow
Create a rebuild (for pushes) and a pull request workflow.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
c86a3841d4 [openSUSE][RPM] Split qemu and qemu-linux-user spec files
Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
c027265412 [openSUSE][RPM] Provide seabios and skiboot version files
In an upstream tarball there are some special files, generated by a
script that is run when the archive is prepared. Let's make our
repository look a little more like that, so we can build it properly.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
9d3ea9d3d1 [openSUSE][RPM] Add downstream packaging files
Stash the "packaging files" in the QEMU repository, in the rpm/
directory. During package build, they will be pulled out from there
and used as appropriate.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
2025-04-01 17:58:54 +02:00
Michael Tokarev
9027aa6395 Update version for 9.2.3 release
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-26 12:13:22 +03:00
Steven Lee
b1efa5c236 hw/intc/aspeed: Fix IRQ handler mask check
Updated the IRQ handler mask check to AND with select variable.
This ensures that the interrupt service routine is correctly triggered
for the interrupts within the same irq group.

For example, both `eth0` and the debug UART are handled in `GICINT132`.
Without this fix, the debug console may hang if the `eth0` ISR is not
handled.

Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
Change-Id: Ic3609eb72218dfd68be6057d78b8953b18828709
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Fixes: d831c5fd86 ("aspeed/intc: Add AST2700 support")
Link: https://lore.kernel.org/qemu-devel/20250320092543.4040672-2-steven_lee@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
(cherry picked from commit 7b8cbe5162)
(Mjt: update for before v9.2.0-2466-g5824e8bf6beb
 "hw/intc/aspeed: Introduce IRQ handler function to reduce code duplication")
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 23:59:53 +03:00
Jamin Lin
df9168b019 hw/misc/aspeed_hace: Fix buffer overflow in has_padding function
The maximum padding size is either 64 or 128 bytes and should always be smaller
than "req_len". If "padding_size" exceeds "req_len", then
"req_len - padding_size" underflows due to "uint32_t" data type, leading to a
large incorrect value (e.g., `0xFFXXXXXX`). This causes an out-of-bounds memory
access, potentially leading to a buffer overflow.

Added a check to ensure "padding_size" does not exceed "req_len" before
computing "pad_offset". This prevents "req_len - padding_size" from underflowing
and avoids accessing invalid memory.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Fixes: 5cd7d8564a ("aspeed/hace: Support AST2600 HACE ")
Link: https://lore.kernel.org/qemu-devel/20250321092623.2097234-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
(cherry picked from commit 78877b2e06)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 23:49:55 +03:00
Chao Liu
3cdd1f45aa target/riscv: fix handling of nop for vstart >= vl in some vector instruction
Recently, when I was writing a RISCV test, I found that when VL is set to 0, the
instruction should be nop, but when I tested it, I found that QEMU will treat
all elements as tail elements, and in the case of VTA=1, write all elements
to 1.

After troubleshooting, it was found that the vext_vx_rm_1 function was called in
the vext_vx_rm_2, and then the vext_set_elems_1s function was called to process
the tail element, but only VSTART >= vl was checked in the vext_vx_rm_1
function, which caused the tail element to still be processed even if it was
returned in advance.

So I've made the following change:

Put VSTART_CHECK_EARLY_EXIT(env) at the beginning of the vext_vx_rm_2 function,
so that the VSTART register is checked correctly.

Fixes: df4252b2ec ("target/riscv/vector_helpers: do early exit when
vstart >= vl")
Signed-off-by: Chao Liu <lc00631@tecorigin.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <b2649f14915150be4c602d63cd3ea4adf47e9d75.1741573286.git.lc00631@tecorigin.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 4e9e2478df)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 14:21:24 +03:00
Chao Liu
7f5f3e5acd target/riscv: refactor VSTART_CHECK_EARLY_EXIT() to accept vl as a parameter
Some vector instructions are special, such as the vlm.v instruction,
where setting its vl actually sets evl = (vl + 7) >> 3. To improve
maintainability, we will uniformly use VSTART_CHECK_EARLY_EXIT() to
check for the condition vstart >= vl. This function will also handle
cases involving evl.

Fixes: df4252b2ec ("target/riscv/vector_helpers: do early exit when
vstart >= vl")
Signed-off-by: Chao Liu <lc00631@tecorigin.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <f575979874e323a9e0da7796aa391c7d87e56f88.1741573286.git.lc00631@tecorigin.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit e83845316a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 14:21:24 +03:00
Michael Tokarev
154ed561b3 Makefile: "make dist" generates a .xz, not .bz2
Fixes: 9bc9e95119 (make-release: switch to .xz format by default)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 14fb6dbbc5)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 08:03:28 +03:00
Nicholas Piggin
3e7d8d2233 target/ppc: Fix e200 duplicate SPRs
DSRR0/1 registers are in the BookE ISA not e200 specific, so
remove the duplicate e200 register definitions.

Cc: Roman Kapl <rka@sysgo.com>
Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2768
Fixes: 0e3bf48909 ("ppc: add DBCR based debugging")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
(cherry picked from commit 73c0c904fc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:57:58 +03:00
Nicholas Piggin
6726d4874b target/ppc: Fix facility interrupt checks for VSX
Facility interrupt checks in general should come after the ISA version
check, because the facility interrupt and facility type themselves are
ISA dependent and should not appear on CPUs where the instruction does
not exist at all.

This resolves a QEMU crash booting NetBSD/macppc due to

  qemu: fatal: Raised an exception without defined vector 94

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2741
Cc: Chinmay Rath <rathc@linux.ibm.com>
Cc: qemu-stable@nongnu.org
Debugged-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Fixes: aa0f34ec3f ("target/ppc: implement vrlq")
Fixes: 7419dc5b2b ("target/ppc: Move VSX vector storage access insns to decodetree.")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
(cherry picked from commit 8defe9da08)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:57:27 +03:00
Harsh Prateek Bora
64e16e3886 ppc/spapr: fix default cpu for pre-9.0 machines.
When POWER10 CPU was made as default, we missed keeping POWER9 as
default for older pseries releases (pre-9.0) at that time.
This caused breakge in default cpu evaluation for older pseries
machines and hence this fix.

Fixes: 51113013f3 ("ppc/spapr: change pseries machine default to POWER10 CPU")
Cc: qemu-stable@nongnu.org
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250313094705.2361997-1-harshpb@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
(cherry picked from commit 1490d0bcdf)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:56:48 +03:00
Yao Zi
73768dae4a host/include/loongarch64: Fix inline assembly compatibility with Clang
Clang on LoongArch only accepts fp register names in the dollar-prefixed
form, while GCC allows omitting the dollar. Change registers in ASM
clobbers to the dollar-prefixed form to make user emulators buildable
with Clang on loongarch64. No functional change invovled.

Cc: qemu-stable@nongnu.org
Fixes: adc8467e69 ("host/include/loongarch64: Add atomic16 load and store")
Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
(cherry picked from commit ca2737d6ec)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:53:41 +03:00
Richard Henderson
d83b61f59c linux-user/riscv: Fix handling of cpu mask in riscv_hwprobe syscall
The third argument of the syscall contains the size of the
cpu mask in bytes, not bits.  Nor is the size rounded up to
a multiple of sizeof(abi_ulong).

Cc: qemu-stable@nongnu.org
Reported-by: Andreas Schwab <schwab@suse.de>
Fixes: 9e1c7d982d ("linux-user/riscv: Add syscall riscv_hwprobe")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250308225902.1208237-3-richard.henderson@linaro.org>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 1a010d22b7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:49:26 +03:00
Deepak Gupta
803a6864ef target/riscv: fixes a bug against ssamoswap behavior in M-mode
Commit f06bfe3dc3 ("target/riscv: implement zicfiss instructions") adds
`ssamoswap` instruction. `ssamoswap` takes the code-point from existing
reserved encoding (and not a zimop like other shadow stack instructions).
If shadow stack is not enabled (via xenvcfg.SSE) and effective priv is
less than M then `ssamoswap` must result in an illegal instruction
exception. However if effective priv is M, then `ssamoswap` results in
store/AMO access fault. See Section "22.2.3. Shadow Stack Memory
Protection" of priv spec.

Fixes: f06bfe3dc3 ("target/riscv: implement zicfiss instructions")

Reported-by: Ved Shanbhogue <ved@rivosinc.com>
Signed-off-by: Deepak Gupta <debug@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250306064636.452396-2-debug@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit d2c5759c8d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:46:14 +03:00
Deepak Gupta
68a90134c0 target/riscv: fix access permission checks for CSR_SSP
Commit:8205bc1 ("target/riscv: introduce ssp and enabling controls for
zicfiss") introduced CSR_SSP but it mis-interpreted the spec on access
to CSR_SSP in M-mode. Gated to CSR_SSP is not gated via `xSSE`. But
rather rules clearly specified in section "22.2.1. Shadow Stack Pointer
(ssp) CSR access contr" in the priv spec.

Fixes: 8205bc127a ("target/riscv: introduce ssp and enabling controls
for zicfiss". Thanks to Adam Zabrocki for bringing this to attention.

Reported-by: Adam Zabrocki <azabrocki@nvidia.com>
Signed-off-by: Deepak Gupta <debug@rivosinc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250306064636.452396-1-debug@rivosinc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 86c78b2806)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:46:14 +03:00
Santiago Monserrat Campanello
9c3273c16e docs/about/emulation: Fix broken link
semihosting link to risc-v changed

Signed-off-by: Santiago Monserrat Campanello <santimonserr@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2717
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250305102632.91376-1-santimonserr@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 672cb29d1e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-24 07:44:59 +03:00
Konstantin Shkolnyy
bcf9282f53 vdpa: Allow vDPA to work on big-endian machine
Add .set_vnet_le() function that always returns success, assuming that
vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and
outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit b027f55a99)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Konstantin Shkolnyy
cda37a6bd7 vdpa: Fix endian bugs in shadow virtqueue
VDPA didn't work on a big-endian machine due to missing/incorrect
CPU<->LE data format conversions.

Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
Message-Id: <20250212164923.1971538-1-kshk@linux.ibm.com>
Fixes: 10857ec0ad ("vhost: Add VhostShadowVirtqueue")
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 50e9754149)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Guo Hongyu
bb50cc9e75 target/loongarch: Fix vldi inst
Refer to the link below for a description of the vldi instructions:
https://jia.je/unofficial-loongarch-intrinsics-guide/lsx/misc/#synopsis_88
Fixed errors in vldi instruction implementation.

Signed-off-by: Guo Hongyu <guohongyu24@mails.ucas.ac.cn>
Tested-by: Xianglai Li <lixianglai@loongson.cn>
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
(cherry picked from commit 02ce6cea71)
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2865
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Richard Henderson
d08e538de8 target/arm: Simplify pstate_sm check in sve_access_check
In StreamingMode, fp_access_checked is handled already.
We cannot fall through to fp_access_check lest we fall
foul of the double-check assertion.

Cc: qemu-stable@nongnu.org
Fixes: 285b1d5fce ("target/arm: Handle SME in sve_access_check")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250307190415.982049-3-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: move declaration of 'ret' to top of block]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit cc7abc35df)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Richard Henderson
a75e415ca5 target/arm: Make DisasContext.{fp, sve}_access_checked tristate
The check for fp_excp_el in assert_fp_access_checked is
incorrect.  For SME, with StreamingMode enabled, the access
is really against the streaming mode vectors, and access
to the normal fp registers is allowed to be disabled.
C.f. sme_enabled_check.

Convert sve_access_checked to match, even though we don't
currently check the exception state.

Cc: qemu-stable@nongnu.org
Fixes: 3d74825f4d ("target/arm: Add SME enablement checks")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250307190415.982049-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 298a04998f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Joe Komlodi
cf8bd64d4f util/cacheflush: Make first DSB unconditional on aarch64
On ARM hosts with CTR_EL0.DIC and CTR_EL0.IDC set, this would only cause
an ISB to be executed during cache maintenance, which could lead to QEMU
executing TBs containing garbage instructions.

This seems to be because the ISB finishes executing instructions and
flushes the pipeline, but the ISB doesn't guarantee that writes from the
executed instructions are committed. If a small enough TB is created, it's
possible that the writes setting up the TB aren't committed by the time the
TB is executed.

This function is intended to be a port of the gcc implementation
(85b46d0795/libgcc/config/aarch64/sync-cache.c (L67))
which makes the first DSB unconditional, so we can fix the synchronization
issue by doing that as well.

Cc: qemu-stable@nongnu.org
Fixes: 664a79735e ("util: Specialize flush_idcache_range for aarch64")
Signed-off-by: Joe Komlodi <komlodi@google.com>
Message-id: 20250310203622.1827940-2-komlodi@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit e6c38d2ab5)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Greg Kurz
0c85c9746f docs: Rename default-configs to configs
This was missed at the time.

Fixes: 812b31d3f9 ("configs: rename default-configs to configs and reorganise")
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250306174113.427116-1-groug@kaod.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 48170c2d86)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Kevin Wolf
490c737bc7 block: Zero block driver state before reopening
Block drivers assume in their .bdrv_open() implementation that their
state in bs->opaque has been zeroed; it is initially allocated with
g_malloc0() in bdrv_open_driver().

bdrv_snapshot_goto() needs to make sure that it is zeroed again before
calling drv->bdrv_open() to avoid that block drivers use stale values.

One symptom of this bug is VMDK running into a double free when the user
tries to apply an internal snapshot like 'qemu-img snapshot -a test
test.vmdk'. This should be a graceful error because VMDK doesn't support
internal snapshots.

==25507== Invalid free() / delete / delete[] / realloc()
==25507==    at 0x484B347: realloc (vg_replace_malloc.c:1801)
==25507==    by 0x54B592A: g_realloc (gmem.c:171)
==25507==    by 0x1B221D: vmdk_add_extent (../block/vmdk.c:570)
==25507==    by 0x1B1084: vmdk_open_sparse (../block/vmdk.c:1059)
==25507==    by 0x1AF3D8: vmdk_open (../block/vmdk.c:1371)
==25507==    by 0x1A2AE0: bdrv_snapshot_goto (../block/snapshot.c:299)
==25507==    by 0x205C77: img_snapshot (../qemu-img.c:3500)
==25507==    by 0x58FA087: (below main) (libc_start_call_main.h:58)
==25507==  Address 0x832f3e0 is 0 bytes inside a block of size 272 free'd
==25507==    at 0x4846B83: free (vg_replace_malloc.c:989)
==25507==    by 0x54AEAC4: g_free (gmem.c:208)
==25507==    by 0x1AF629: vmdk_close (../block/vmdk.c:2889)
==25507==    by 0x1A2A9C: bdrv_snapshot_goto (../block/snapshot.c:290)
==25507==    by 0x205C77: img_snapshot (../qemu-img.c:3500)
==25507==    by 0x58FA087: (below main) (libc_start_call_main.h:58)

This error was discovered by fuzzing qemu-img.

Cc: qemu-stable@nongnu.org
Closes: https://gitlab.com/qemu-project/qemu/-/issues/2853
Closes: https://gitlab.com/qemu-project/qemu/-/issues/2851
Reported-by: Denis Rastyogin <gerben@altlinux.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250310104858.28221-1-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit b75c5f9879)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Philippe Mathieu-Daudé
704eaf8219 hw/xen/hvm: Fix Aarch64 typo
There is no TARGET_ARM_64 definition. Luckily enough,
when TARGET_AARCH64 is defined, TARGET_ARM also is.

Fixes: 733766cd37 ("hw/arm: introduce xenpvh machine")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250305153929.43687-2-philmd@linaro.org>
(cherry picked from commit 3a11b653a6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
6620335418 hw/net/smc91c111: Don't allow data register access to overrun buffer
For accesses to the 91c111 data register, the address within the
packet's data frame is determined by a combination of the pointer
register and the offset used to access the data register, so that you
can access data at effectively wider than byte width.  The pointer
register's pointer field is 11 bits wide, which is exactly the size
to index a 2048-byte data frame.

We weren't quite getting the logic right for ensuring that we end up
with a pointer value to use in the s->data[][] array that isn't out
of bounds:

 * we correctly mask when getting the initial pointer value
 * for the "autoincrement the pointer register" case, we
   correctly mask after adding 1 so that the pointer register
   wraps back around at the 2048 byte mark
 * but for the non-autoincrement case where we have to add the
   low 2 bits of the data register offset, we don't account
   for the possibility that the pointer register is 0x7ff
   and the addition should wrap

Fix this bug by factoring out the "get the p value to use as an array
index" into a function, making it use FIELD macro names rather than
hard-coded constants, and having a utility function that does "add a
value and wrap it" that we can use both for the "autoincrement" and
"add the offset bits" codepaths.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2758
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250228191652.1957208-1-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 700d3d6dd4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
e8fd97fc1e hw/net/smc91c111: Sanitize packet length on tx
When the smc91c111 transmits a packet, it must read a control byte
which is at the end of the data area and CRC.  However, we don't
sanitize the length field in the packet buffer, so if the guest sets
the length field to something large we will try to read past the end
of the packet data buffer when we access the control byte.

As usual, the datasheet says nothing about the behaviour of the
hardware if the guest misprograms it in this way.  It says only that
the maximum valid length is 2048 bytes.  We choose to log the guest
error and silently drop the packet.

This requires us to factor out the "mark the tx packet as complete"
logic, so we can call it for this "drop packet" case as well as at
the end of the loop when we send a valid packet.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2742
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250228174802.1945417-3-peter.maydell@linaro.org>
[PMD: Update smc91c111_do_tx() as len > MAX_PACKET_SIZE]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit aad6f264ad)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
e9f6c32339 hw/net/smc91c111: Sanitize packet numbers
The smc91c111 uses packet numbers as an index into its internal
s->data[][] array. Valid packet numbers are between 0 and 3, but
the code does not generally check this, and there are various
places where the guest can hand us an arbitrary packet number
and cause an out-of-bounds access to the data array.

Add validation of packet numbers. The datasheet is not very
helpful about how guest errors like this should be handled:
it says nothing on the subject, and none of the documented
error conditions are relevant. We choose to log the situation
with LOG_GUEST_ERROR and silently ignore the attempted operation.

In the places where we are about to access the data[][] array
using a packet number and we know the number is valid because
we got it from somewhere that has already validated, we add
an assert() to document that belief.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250228174802.1945417-2-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 2fa3a5b946)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Nicholas Piggin
f3da6934cd ppc/pnv/occ: Fix common area sensor offsets
The commit to fix the OCC common area sensor mappings didn't update the
register offsets to match.

Before this change, skiboot reports:

[    0.347100086,3] OCC: Chip 0 sensor data invalid

Afterward, there is no error and the sensor_groups directory appears
under /sys/firmware/opal/.

The SLW_IMAGE_BASE address looks like a workaround to intercept firmware
memory accesses, but that does not seem to be required now (and would
have been broken by the OCC common area region mapping change anyway).
So it can be removed.

Fixes: 3a1b70b66b ("ppc/pnv: Fix OCC common area region mapping")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
(cherry picked from commit 29c041ca7f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Stefano Stabellini
c96b8c0e39 xen: No need to flush the mapcache for grants
On IOREQ_TYPE_INVALIDATE we need to invalidate the mapcache for regular
mappings. Since recently we started reusing the mapcache also to keep
track of grants mappings. However, there is no need to remove grant
mappings on IOREQ_TYPE_INVALIDATE requests, we shouldn't do that. So
remove the function call.

Fixes: 9ecdd4bf08 (xen: mapcache: Add support for grant mappings)
Cc: qemu-stable@nongnu.org
Reported-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
Message-Id: <20250206194915.3357743-2-edgar.iglesias@gmail.com>
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
(cherry picked from commit 68adcc784b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Eugenio Pérez
aeade0a251 net: move backend cleanup to NIC cleanup
Commit a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net
structures if peer nic is present") effectively delayed the backend
cleanup, allowing the frontend or the guest to access it resources as
long as the frontend is still visible to the guest.

However it does not clean up the resources until the qemu process is
over.  This causes an effective leak if the device is deleted with
device_del, as there is no way to close the vdpa device.  This makes
impossible to re-add that device to this or other QEMU instances until
the first instance of QEMU is finished.

Move the cleanup from qemu_cleanup to the NIC deletion and to
net_cleanup.

Fixes: a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present")
Reported-by: Lei Yang <leiyang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit e7891c575f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Eugenio Pérez
9e00d74a9a net: parameterize the removing client from nc list
This change is used in later commits so we can avoid the removal of the
netclient if it is delayed.

No functional change intended.

Reviewed-by: Si-Wei Liu <si-wei.liu@oracle.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit db0d4017f9)
(Mjt: pick this one up for the following change,
 "net: move backend cleanup to NIC cleanup")
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
5cf3b48094 util/qemu-timer.c: Don't warp timer from timerlist_rearm()
Currently we call icount_start_warp_timer() from timerlist_rearm().
This produces incorrect behaviour, because timerlist_rearm() is
called, for instance, when a timer callback modifies its timer.  We
cannot decide here to warp the timer forwards to the next timer
deadline merely because all_cpu_threads_idle() is true, because the
timer callback we were called from (or some other callback later in
the list of callbacks being invoked) may be about to raise a CPU
interrupt and move a CPU from idle to ready.

The only valid place to choose to warp the timer forward is from the
main loop, when we know we have no outstanding IO or timer callbacks
that might be about to wake up a CPU.

For Arm guests, this bug was mostly latent until the refactoring
commit f6fc36deef ("target/arm/helper: Implement
CNTHCTL_EL2.CNT[VP]MASK"), which exposed it because it refactored a
timer callback so that it happened to call timer_mod() first and
raise the interrupt second, when it had previously raised the
interrupt first and called timer_mod() afterwards.

This call seems to have originally derived from the
pre-record-and-replay icount code, which (as of e.g.  commit
db1a49726c in 2010) in this location did a call to
qemu_notify_event(), necessary to get the icount code in the vCPU
round-robin thread to stop and recalculate the icount deadline when a
timer was reprogrammed from the IO thread.  In current QEMU,
everything is done on the vCPU thread when we are in icount mode, so
there's no need to try to notify another thread here.

I suspect that the other reason why this call was doing icount timer
warping is that it pre-dates commit efab87cf79 from 2015, which
added a call to icount_start_warp_timer() to main_loop_wait().  Once
the call in timerlist_rearm() has been removed, if the timer
callbacks don't cause any CPU to be woken up then we will end up
calling icount_start_warp_timer() from main_loop_wait() when the rr
main loop code calls rr_wait_io_event().

Remove the incorrect call from timerlist_rearm().

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2703
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250210135804.3526943-1-peter.maydell@linaro.org
(cherry picked from commit 02ae315467)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
ec36d522ce target/arm: Correct STRD atomicity
Our STRD implementation doesn't correctly implement the requirement:
 * if the address is 8-aligned the access must be a 64-bit
   single-copy atomic access, not two 32-bit accesses

Rewrite the handling of STRD to use a single tcg_gen_qemu_st_i64()
of a value produced by concatenating the two 32 bit source registers.
This allows us to get the atomicity right.

As with the LDRD change, now that we don't update 'addr' in the
course of performing the store we need to adjust the offset
we pass to op_addr_ri_post() and op_addr_rr_post().

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250227142746.1698904-3-peter.maydell@linaro.org
(cherry picked from commit ee786ca115)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
f72e697f24 target/arm: Correct LDRD atomicity and fault behaviour
Our LDRD implementation is wrong in two respects:

 * if the address is 4-aligned and the load crosses a page boundary
   and the second load faults and the first load was to the
   base register (as in cases like "ldrd r2, r3, [r2]", then we
   must not update the base register before taking the fault
 * if the address is 8-aligned the access must be a 64-bit
   single-copy atomic access, not two 32-bit accesses

Rewrite the handling of the loads in LDRD to use a single
tcg_gen_qemu_ld_i64() and split the result into the destination
registers. This allows us to get the atomicity requirements
right, and also implicitly means that we won't update the
base register too early for the page-crossing case.

Note that because we no longer increment 'addr' by 4 in the course of
performing the LDRD we must change the adjustment value we pass to
op_addr_ri_post() and op_addr_rr_post(): it no longer needs to
subtract 4 to get the correct value to use if doing base register
writeback.

STRD has the same problem with not getting the atomicity right;
we will deal with that in the following commit.

Cc: qemu-stable@nongnu.org
Reported-by: Stu Grossman <stu.grossman@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250227142746.1698904-2-peter.maydell@linaro.org
(cherry picked from commit cde3247651)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Alex Bennée
3c84a63e2c hw/arm: enable secure EL2 timers for sbsa machine
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20250204125009.2281315-10-peter.maydell@linaro.org
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 9a9d9e8209)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Alex Bennée
472a420761 hw/arm: enable secure EL2 timers for virt machine
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20250204125009.2281315-9-peter.maydell@linaro.org
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 5dcaea8bcd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Alex Bennée
ab37d6bd89 target/arm: Implement SEL2 physical and virtual timers
When FEAT_SEL2 was implemented the SEL2 timers were missed. This
shows up when building the latest Hafnium with SPMC_AT_EL=2. The
actual implementation utilises the same logic as the rest of the
timers so all we need to do is:

  - define the timers and their access functions
  - conditionally add the correct system registers
  - create a new accessfn as the rules are subtly different to the
    existing secure timer

Fixes: e9152ee91c (target/arm: add ARMv8.4-SEL2 system registers)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20250204125009.2281315-7-peter.maydell@linaro.org
Cc: qemu-stable@nongnu.org
Cc: Andrei Homescu <ahomescu@google.com>
Cc: Arve Hjønnevåg <arve@google.com>
Cc: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
[PMM: CP_ACCESS_TRAP_UNCATEGORIZED -> CP_ACCESS_UNDEFINED;
 offset logic now in gt_{indirect,direct}_access_timer_offset() ]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit f9f99d7ca5)
(Mjt: CP_ACCESS_UNDEFINED -> CP_ACCESS_TRAP_UNCATEGORIZED)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
739dabb1ad target/arm: Refactor handling of timer offset for direct register accesses
When reading or writing the timer registers, sometimes we need to
apply one of the timer offsets.  Specifically, this happens for
direct reads of the counter registers CNTPCT_EL0 and CNTVCT_EL0 (and
their self-synchronized variants CNTVCTSS_EL0 and CNTPCTSS_EL0).  It
also applies for direct reads and writes of the CNT*_TVAL_EL*
registers that provide the 32-bit downcounting view of each timer.

We currently do this with duplicated code in gt_tval_read() and
gt_tval_write() and a special-case in gt_virt_cnt_read() and
gt_cnt_read().  Refactor this so that we handle it all in a single
function gt_direct_access_timer_offset(), to parallel how we handle
the offset for indirect accesses.

The call in the WFIT helper previously to gt_virt_cnt_offset() is
now to gt_direct_access_timer_offset(); this is the correct
behaviour, but it's not immediately obvious that it shouldn't be
considered an indirect access, so we add an explanatory comment.

This commit should make no behavioural changes.

(Cc to stable because the following bugfix commit will
depend on this one.)

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250204125009.2281315-6-peter.maydell@linaro.org
(cherry picked from commit 02c648a0a1)
(Mjt: context fix in target/arm/internals.h)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
69b4ed0259 target/arm: Always apply CNTVOFF_EL2 for CNTV_TVAL_EL02 accesses
Currently we handle CNTV_TVAL_EL02 by calling gt_tval_read() for the
EL1 virt timer.  This is almost correct, but the underlying
CNTV_TVAL_EL0 register behaves slightly differently.  CNTV_TVAL_EL02
always applies the CNTVOFF_EL2 offset; CNTV_TVAL_EL0 doesn't do so if
we're at EL2 and HCR_EL2.E2H is 1.

We were getting this wrong, because we ended up in
gt_virt_cnt_offset() and did the E2H check.

Factor out the tval read/write calculation from the selection of the
offset, so that we can special case gt_virt_tval_read() and
gt_virt_tval_write() to unconditionally pass CNTVOFF_EL2.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250204125009.2281315-5-peter.maydell@linaro.org
(cherry picked from commit 4aecd4b442)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
b692aea803 target/arm: Make CNTPS_* UNDEF from Secure EL1 when Secure EL2 is enabled
When we added Secure EL2 support, we missed that this needs an update
to the access code for the EL3 physical timer registers.  These are
supposed to UNDEF from Secure EL1 when Secure EL2 is enabled.

(Note for stable backporting: for backports to branches where
CP_ACCESS_UNDEFINED is not defined, the old name to use instead
is CP_ACCESS_TRAP_UNCATEGORIZED.)

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250204125009.2281315-4-peter.maydell@linaro.org
(cherry picked from commit bdd641541f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:48 +03:00
Peter Maydell
033367d0af target/arm: Don't apply CNTVOFF_EL2 for EL2_VIRT timer
The CNTVOFF_EL2 offset register should only be applied for accessses
to CNTVCT_EL0 and for the EL1 virtual timer (CNTV_*).  We were
incorrectly applying it for the EL2 virtual timer (CNTHV_*).

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250204125009.2281315-3-peter.maydell@linaro.org
(cherry picked from commit 5709038aa8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Peter Maydell
cefb009762 target/arm: Apply correct timer offset when calculating deadlines
When we are calculating timer deadlines, the correct definition of
whether or not to apply an offset to the physical count is described
in the Arm ARM DDI4087 rev L.a section D12.2.4.1.  This is different
from when the offset should be applied for a direct read of the
counter sysreg.

We got this right for the EL1 physical timer and for the EL1 virtual
timer, but got all the rest wrong: they should be using a zero offset
always.

Factor the offset calculation out into a function that has a comment
documenting exactly which offset it is calculating and which gets the
HYP, SEC, and HYPVIRT cases right.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20250204125009.2281315-2-peter.maydell@linaro.org
(cherry picked from commit db6c219283)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Patrick Venture
413f7ba6a8 hw/gpio: npcm7xx: fixup out-of-bounds access
The reg isn't validated to be a possible register before
it's dereferenced for one case.  The mmio space registered
for the gpio device is 4KiB but there aren't that many
registers in the struct.

Cc: qemu-stable@nongnu.org
Fixes: 526dbbe087 ("hw/gpio: Add GPIO model for Nuvoton NPCM7xx")
Signed-off-by: Patrick Venture <venture@google.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20250226024603.493148-1-venture@google.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 3b2e22c0bb)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Markus Armbruster
80f66f3d22 docs/about/build-platforms: Correct minimum supported Python version
Fixes: ca056f4499 (Python: Drop support for Python 3.7)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250227080757.3978333-2-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit 87c8b4fc3c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Denis Rastyogin
007ea6d6ed block/qed: fix use-after-free by nullifying timer pointer after free
This error was discovered by fuzzing qemu-img.

In the QED block driver, the need_check_timer timer is freed in
bdrv_qed_detach_aio_context, but the pointer to the timer is not
set to NULL. This can lead to a use-after-free scenario
in bdrv_qed_drain_begin().

The need_check_timer pointer is set to NULL after freeing the timer.
Which helps catch this condition when checking in bdrv_qed_drain_begin().

Closes: https://gitlab.com/qemu-project/qemu/-/issues/2852
Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
Message-ID: <20250304083927.37681-1-gerben@altlinux.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 2ad638a3d1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Rodrigo Dias Correa
56e190d73e goldfish_rtc: Fix tick_offset migration
Instead of migrating the raw tick_offset, goldfish_rtc migrates a
recalculated value based on QEMU_CLOCK_VIRTUAL. As QEMU_CLOCK_VIRTUAL
stands still across a save-and-restore cycle, the guest RTC becomes out
of sync with the host RTC when the VM is restored.

As described in the bug description, it looks like this calculation was
copied from pl031 RTC, which had its tick_offset migration fixed by
Commit 032cfe6a79 ("pl031: Correctly migrate state when using -rtc
clock=host").

Migrate the tick_offset directly, adding it as a version-dependent field
to VMState. Keep the old behavior when migrating from previous versions.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2033
Signed-off-by: Rodrigo Dias Correa <r@drigo.nl>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250114212150.228241-1-r@drigo.nl>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 3521f9cadc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Daniel Henrique Barboza
426beec96a target/riscv: throw debug exception before page fault
In the RISC-V privileged ISA section 3.1.15 table 15, it is determined
that a debug exception that is triggered from a load/store has a higher
priority than a possible fault that this access might trigger.

This is not the case ATM as shown in [1]. Adding a breakpoint in an
address that deliberately will fault is causing a load page fault
instead of a debug exception. The reason is that we're throwing in the
page fault as soon as the fault occurs (end of riscv_cpu_tlb_fill(),
raise_mmu_exception()), not allowing the installed watchpoints to
trigger.

Call cpu_check_watchpoint() in the page fault path to search and execute
any watchpoints that might exist for the address, never returning back
to the fault path. If no watchpoints are found cpu_check_watchpoint()
will return and we'll fall-through the regular path to
raise_mmu_exception().

[1] https://gitlab.com/qemu-project/qemu/-/issues/2627

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2627
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250121170626.1992570-3-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit c86edc5476)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Daniel Henrique Barboza
1408266d1c target/riscv/debug.c: use wp size = 4 for 32-bit CPUs
The mcontrol select bit (19) is always zero, meaning our triggers will
always match virtual addresses. In this condition, if the user does not
specify a size for the trigger, the access size defaults to XLEN.

At this moment we're using def_size = 8 regardless of CPU XLEN. Use
def_size = 4 in case we're running 32 bits.

Fixes: 95799e36c1 ("target/riscv: Add initial support for the Sdtrig extension")
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250121170626.1992570-2-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 3fba76e61c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Max Chou
1fc0a58a98 target/riscv: rvv: Fix incorrect vlen comparison in prop_vlen_set
In prop_vlen_set function, there is an incorrect comparison between
vlen(bit) and vlenb(byte).
This will cause unexpected error when user applies the `vlen=1024` cpu
option with a vendor predefined cpu type that the default vlen is
1024(vlenb=128).

Fixes: 4f6d036ccc ("target/riscv/cpu.c: remove cpu->cfg.vlen")
Signed-off-by: Max Chou <max.chou@sifive.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <20250124090539.2506448-1-max.chou@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit bf3adf93f1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Max Chou
39408f6f14 target/riscv: rvv: Fix unexpected behavior of vector reduction instructions when vl is 0
According to the Vector Reduction Operations section in the RISC-V "V"
Vector Extension spec,
"If vl=0, no operation is performed and the destination register is not
updated."

The vd should be updated when vl is larger than 0.

Fixes: fe5c9ab1fc ("target/riscv: vector single-width integer reduction instructions")
Fixes: f714361ed7 ("target/riscv: rvv-1.0: implement vstart CSR")
Signed-off-by: Max Chou <max.chou@sifive.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-ID: <20250124101452.2519171-1-max.chou@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit ffd455963f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Joelle van Dyne
16549930bb target/arm/hvf: sign extend the data for a load operation when SSE=1
In the syndrome value for a data abort, bit 21 is SSE, which is
set to indicate that the abort was on a sign-extending load. When
we handle the data abort from the guest via address_space_read(),
we forgot to handle this and so would return the wrong value if
the guest did a sign-extending load to an MMIO region. Add the
sign-extension of the returned data.

Cc: qemu-stable@nongnu.org
Signed-off-by: Joelle van Dyne <j@getutm.app>
Message-id: 20250224184123.50780-1-j@getutm.app
[PMM: Drop an unnecessary check on 'len'; expand commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 12c365315a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Joelle van Dyne
576338eea1 target/arm/hvf: Disable SME feature
macOS 15.2's Hypervisor.framework exposes SME feature on M4 Macs.
However, QEMU's hvf accelerator code does not properly support it
yet, causing QEMU to fail to start when hvf accelerator is used on
these systems, with the error message:

  qemu-aarch64-softmmu: cannot disable sme4224
  All SME vector lengths are disabled.
  With SME enabled, at least one vector length must be enabled.

Ideally we would have SME support on these hosts; however, until that
point, we must suppress the SME feature in the ID registers, so that
users can at least run non-SME guests.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2665
Signed-off-by: Joelle van Dyne <j@getutm.app>
Message-id: 20250224165735.36792-1-j@getutm.app
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: expanded commit message, comment]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit fd207677a8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Paolo Bonzini
44a7e0aaf7 physmem: replace assertion with error
It is possible to start QEMU with a confidential-guest-support object
even in TCG mode.  While there is already a check in qemu_machine_creation_done:

    if (machine->cgs && !machine->cgs->ready) {
        error_setg(errp, "accelerator does not support confidential guest %s",
                   object_get_typename(OBJECT(machine->cgs)));
        exit(1);
    }

the creation of RAMBlocks happens earlier, in qemu_init_board(), if
the command line does not override the default memory backend with
-M memdev.  Then the RAMBlock will try to use guest_memfd (because
machine_require_guest_memfd correctly returns true; at least correctly
according to the current implementation) and trigger the assertion
failure for kvm_enabled().  This happend with a command line as
simple as the following:

    qemu-system-x86_64 -m 512 -nographic -object sev-snp-guest,reduced-phys-bits=48,id=sev0 \
       -M q35,kernel-irqchip=split,confidential-guest-support=sev0
    qemu-system-x86_64: ../system/physmem.c:1871: ram_block_add: Assertion `kvm_enabled()' failed.

Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20250217120812.396522-1-pbonzini@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 6debfb2cb1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Bibo Mao
7f667fc7fe target/loongarch/gdbstub: Fix gdbstub incorrectly handling some registers
Write operation with R32 (orig_a0) and R34 (CSR_BADV) is discarded on
gdbstub implementation for LoongArch system. And return value should
be register size rather than 0, since it is used to calculate offset of
next register such as R33 (PC) in function handle_write_all_regs().

Cc: qemu-stable@nongnu.org
Fixes: ca61e75071 ("target/loongarch: Add gdb support.")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
(cherry picked from commit 7bd4eaa847)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Matias Ezequiel Vara Larsen
dc203a5987 vhost-user-snd: correct the calculation of config_size
Use virtio_get_config_size() rather than sizeof(struct
virtio_snd_config) for the config_size in the vhost-user-snd frontend.
The frontend shall rely on device features for the size of the device
configuration space. The presence of `controls` in the config space
depends on VIRTIO_SND_F_CTLS according to the specification (v1.3):
`
5.14.4 Device Configuration Layout
...

controls
(driver-read-only) indicates a total number of all available control
elements if VIRTIO_SND_F_CTLS has been negotiated.
`
This fixes an issue introduced by commit ab0c7fb2 ("linux-headers:
update to current kvm/next") in which the optional field `controls` is
added to the virtio_snd_config structure. This breaks vhost-user-device
backends that do not implement the `controls` field.

Fixes: ab0c7fb22b ("linux-headers: update to current kvm/next")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2805
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
Message-Id: <20250217131255.829892-1-mvaralar@redhat.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Dorinda Bassey <dbassey@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit e87b6efb11)
(Mjt: context fix for 9.2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Alexander Graf
298340c152 hw/virtio/virtio-nsm: Respond with correct length
When we return a response packet from NSM, we need to indicate its
length according to the content of the response. Prior to this patch, we
returned the length of the source buffer, which may confuse guest code
that relies on the response size.

Fix it by returning the response payload size instead.

Fixes: bb154e3e0c ("device/virtio-nsm: Support for Nitro Secure Module device")
Reported-by: Vikrant Garg <vikrant1garg@gmail.com>
Signed-off-by: Alexander Graf <graf@amazon.com>
Message-Id: <20250213114541.67515-1-graf@amazon.com>
Reviewed-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
Fixes: bb154e3e0c (&quot;device/virtio-nsm: Support for Nitro Secure Module device&quot;)<br>
Reported-by: Vikrant Garg <vikrant1garg@gmail.com>
Signed-off-by: Alexander Graf <graf@amazon.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Vikrant Garg <vikrant1garg@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 131fe64e63)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-03-18 09:02:47 +03:00
Stefano Garzarella
9b878bd927 cryptodev/vhost: allocate CryptoDevBackendVhost using g_mem0()
The function `vhost_dev_init()` expects the `struct vhost_dev`
(passed as a parameter) to be fully initialized. This is important
because some parts of the code check whether `vhost_dev->config_ops`
is NULL to determine if it has been set (e.g. later via
`vhost_dev_set_config_notifier`).

To ensure this initialization, it’s better to allocate the entire
`CryptoDevBackendVhost` structure (which includes `vhost_dev`) using
`g_mem0()`, following the same approach used for other vhost devices,
such as in `vhost_net_init()`.

Fixes: 042cea274c ("cryptodev: add vhost-user as a new cryptodev backend")
Cc: qemu-stable@nongnu.org
Reported-by: myluo24@m.fudan.edu.cn
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20250211135523.101203-1-sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 83cb18ac45)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 12:29:14 +03:00
Sairaj Kodilkar
d1b8423fb8 amd_iommu: Use correct bitmask to set capability BAR
AMD IOMMU provides the base address of control registers through
IVRS table and PCI capability. Since this base address is of 64 bit,
use 32 bits mask (instead of 16 bits) to set BAR low and high.

Fixes: d29a09ca68 ("hw/i386: Introduce AMD IOMMU")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Message-Id: <20250207045354.27329-3-sarunkod@amd.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 3684717b74)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:51:32 +03:00
Sairaj Kodilkar
84858471e6 amd_iommu: Use correct DTE field for interrupt passthrough
Interrupt passthrough is determine by the bits 191,190,187-184.
These bits are part of the 3rd quad word (i.e. index 2) in DTE. Hence
replace dte[3] by dte[2].

Fixes: b44159fe0 ("x86_iommu/amd: Add interrupt remap support when VAPIC is not enabled")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Message-Id: <20250207045354.27329-2-sarunkod@amd.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 63dc0b8647)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:51:32 +03:00
Thomas Huth
ecaf555439 hw/i386/microvm: Fix crash that occurs when introspecting the microvm machine
QEMU currently crashes when you try to inspect the properties of the
microvm machine:

 $ echo '{ "execute": "qmp_capabilities" }
         { "execute": "qom-list-properties","arguments":
           { "typename": "microvm-machine"}}' | \
   ./qemu-system-x86_64 -qmp stdio
 {"QMP": {"version": {"qemu": {"micro": 50, "minor": 2, "major": 9},
  "package": "v9.2.0-1072-g60af367187-dirty"}, "capabilities": ["oob"]}}
 {"return": {}}
 qemu-system-x86_64: ../qemu/hw/i386/acpi-microvm.c:250:
  void acpi_setup_microvm(MicrovmMachineState *):
   Assertion `x86ms->fw_cfg' failed.
 Aborted (core dumped)

This happens because the microvm machine adds a machine_done (and a
powerdown_req) notifier in their instance_init function - however, the
instance_init of machines are not only called for machines that are
realized, but also for machines that are introspected, so in this case
the listener is added for a microvm machine that is never realized. And
since there is already a running machine, the listener function is
triggered immediately, causing a crash since it was not for the right
machine it was meant for.

Such listener functions must never be installed from an instance_init
function. Let's do it from microvm_machine_state_init() instead - this
function is the MachineClass->init() function instead, i.e. guaranteed
to be only called once in the lifetime of a QEMU process.

Since the microvm_machine_done() and microvm_powerdown_req() were
defined quite late in the microvm.c file, we have to move them now
also earlier, so that we can get their function pointers from
microvm_machine_state_init() without having to introduce a separate
prototype for those functions earlier.

Reviewed-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250123204708.1560305-1-thuth@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 38ef383073)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:50:03 +03:00
Thomas Huth
1e4ce3dd87 hw/i386/pc: Fix crash that occurs when introspecting TYPE_PC_MACHINE machines
QEMU currently crashes when you try to inspect the machines based on
TYPE_PC_MACHINE for their properties:

 $ echo '{ "execute": "qmp_capabilities" }
         { "execute": "qom-list-properties","arguments":
                      { "typename": "pc-q35-10.0-machine"}}' \
   | ./qemu-system-x86_64 -M pc -qmp stdio
 {"QMP": {"version": {"qemu": {"micro": 50, "minor": 2, "major": 9},
  "package": "v9.2.0-1070-g87e115c122-dirty"}, "capabilities": ["oob"]}}
 {"return": {}}
 Segmentation fault (core dumped)

This happens because TYPE_PC_MACHINE machines add a machine_init-
done_notifier in their instance_init function - but instance_init
of machines are not only called for machines that are realized,
but also for machines that are introspected, so in this case the
listener is added for a q35 machine that is never realized. But
since there is already a running pc machine, the listener function
is triggered immediately, causing a crash since it was not for the
right machine it was meant for.

Such listener functions must never be installed from an instance_init
function. Let's do it from pc_basic_device_init() instead - this
function is called from the MachineClass->init() function instead,
i.e. guaranteed to be only called once in the lifetime of a QEMU
process.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2779
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250117192106.471029-1-thuth@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit de538288e4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:49:04 +03:00
Akihiko Odaki
4f5adbe697 hw/net: Fix NULL dereference with software RSS
When an eBPF program cannot be attached, virtio_net_load_ebpf() returns
false, and virtio_net_device_realize() enters the code path to handle
errors because of this, but it causes NULL dereference because no error
is generated.

Change virtio_net_load_ebpf() to return false only when a fatal error
occurred.

Fixes: b5900dff14 ("hw/net: report errors from failing to use eBPF RSS FDs")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20250116-software-v1-1-9e5161b534d8@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit bc82af6b0d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:45:46 +03:00
Bernhard Beschow
437999ae81 Kconfig: Extract CONFIG_USB_CHIPIDEA from CONFIG_IMX
TYPE_CHIPIDEA models an IP block which is also used in TYPE_ZYNQ_MACHINE which
itself is not an IMX device. CONFIG_ZYNQ selects CONFIG_USB_EHCI_SYSBUS while
TYPE_CHIPIDEA is a separate compilation unit, so only works by accident if
CONFIG_IMX is given. Fix that by extracting CONFIG_USB_CHIPIDEA from CONFIG_IMX.

cc: qemu-stable@nongnu.org
Fixes: 616ec12d0f "hw/arm/xilinx_zynq: Fix USB port instantiation"
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-id: 20250209103604.29545-1-shentey@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 464ce71a96)
(Mjt: context fixup due to missing
 v9.2.0-1303-g1b326f278d05 "hw/pci-host/designware: Expose MSI IRQ")
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:38:01 +03:00
Peter Maydell
3ffbdc3e12 target/arm: Correct errors in WFI/WFE trapping
The code for WFI/WFE trapping has several errors:
 * it wasn't using arm_sctlr(), so it would look at SCTLR_EL1
   even if the CPU was in the EL2&0 translation regime
 * it was raising UNDEF, not Monitor Trap, for traps to
   AArch32 EL3 because of SCR.{TWE,TWI}
 * it was not honouring SCR.{TWE,TWI} when running in
   AArch32 at EL3 not in Monitor mode
 * it checked SCR.{TWE,TWI} even on v7 CPUs which don't have
   those bits

Fix these bugs.

Cc: qemu-stable@nongnu.org
Fixes: b1eced713d ("target-arm: Add WFx instruction trap support")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-15-peter.maydell@linaro.org
(cherry picked from commit 2b95a2d01b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:24:18 +03:00
Peter Maydell
37600704dd target/arm: Honour SDCR.TDCC and SCR.TERR in AArch32 EL3 non-Monitor modes
There are not many traps in AArch32 which should trap to Monitor
mode, but these trap bits should trap not just lower ELs to Monitor
mode but also the non-Monitor modes running at EL3 (i.e.  Secure
System, Secure Undef, etc).

We get this wrong because the relevant access functions implement the
AArch64-style logic of
   if (el < 3 && trap_bit_set) {
       return CP_ACCESS_TRAP_EL3;
   }
which won't trap the non-Monitor modes at EL3.

Correct this error by using arm_is_el3_or_mon() instead, which
returns true when the CPU is at AArch64 EL3 or AArch32 Monitor mode.
(Since the new callsites are compiled also for the linux-user mode,
we need to provide a dummy implementation for CONFIG_USER_ONLY.)

This affects only:
 * trapping of ERRIDR via SCR.TERR
 * trapping of the debug channel registers via SDCR.TDCC
 * trapping of GICv3 registers via SCR.IRQ and SCR.FIQ
   (which we already used arm_is_el3_or_mon() for)

This patch changes the handling of SCR.TERR and SDCR.TDCC. This
patch only changes guest-visible behaviour for "-cpu max" on
the qemu-system-arm binary, because SCR.TERR
and SDCR.TDCC (and indeed the entire SDCR register) only arrived
in Armv8, and the only guest CPU we support which has any v8
features and also starts in AArch32 EL3 is the 32-bit 'max'.

Other uses of CP_ACCESS_TRAP_EL3 don't need changing:

 * uses in code paths that can't happen when EL3 is AArch32:
   access_trap_aa32s_el1, cpacr_access, cptr_access, nsacr_access
 * uses which are in accessfns for AArch64-only registers:
   gt_stimer_access, gt_cntpoff_access, access_hxen, access_tpidr2,
   access_smpri, access_smprimap, access_lor_ns, access_pauth,
   access_mte, access_tfsr_el2, access_scxtnum, access_fgt
 * trap bits which exist only in the AArch64 version of the
   trap register, not the AArch32 one:
   access_tpm, pmreg_access, access_dbgvcr32, access_tdra,
   access_tda, access_tdosa (TPM, TDA and TDOSA exist only in
   MDCR_EL3, not in SDCR, and we enforce this in sdcr_write())

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-8-peter.maydell@linaro.org
(cherry picked from commit 4d436fb05c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:12:51 +03:00
Peter Maydell
7a9fa39856 hw/intc/arm_gicv3_cpuif: Don't downgrade monitor traps for AArch32 EL3
In the gicv3_{irq,fiq,irqfiq}_access() functions, there is a check
which downgrades a CP_ACCESS_TRAP_EL3 to CP_ACCESS_TRAP if EL3 is not
AArch64.  This has been there since the GIC was first implemented,
but it isn't right: if we are trapping because of SCR.IRQ or SCR.FIQ
then we definitely want to be going to EL3 (doing
AArch32.TakeMonitorTrapException() in pseudocode terms).  We might
want to not take a trap at all, but we don't ever want to go to the
default target EL, because that would mean, for instance, taking a
trap to Hyp mode if the trapped access was made from Hyp mode.

(This might have been an attempt to work around our failure to
properly implement Monitor Traps.)

Remove the bogus check.

Cc: qemu-stable@nongnu.org
Fixes: 359fbe65e0 ("hw/intc/arm_gicv3: Implement GICv3 CPU interface registers")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-7-peter.maydell@linaro.org
(cherry picked from commit d04c6c3c00)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 09:12:24 +03:00
Peter Maydell
68b115ddae target/arm: Make CP_ACCESS_TRAPs to AArch32 EL3 be Monitor traps
In system register access pseudocode the common pattern for
AArch32 registers with access traps to EL3 is:

at EL1 and EL2:
  if HaveEL(EL3) && !ELUsingAArch32(EL3) && (SCR_EL3.TERR == 1) then
     AArch64.AArch32SystemAccessTrap(EL3, 0x03);
  elsif HaveEL(EL3) && ELUsingAArch32(EL3) && (SCR.TERR == 1) then
     AArch32.TakeMonitorTrapException();
at EL3:
  if (PSTATE.M != M32_Monitor) && (SCR.TERR == 1) then
     AArch32.TakeMonitorTrapException();

(taking as an example the ERRIDR access pseudocode).

This implements the behaviour of (in this case) SCR.TERR that
"Accesses to the specified registers from modes other than Monitor
mode generate a Monitor Trap exception" and of SCR_EL3.TERR that
"Accesses of the specified Error Record registers at EL2 and EL1
are trapped to EL3, unless the instruction generates a higher
priority exception".

In QEMU we don't implement this pattern correctly in two ways:
 * in access_check_cp_reg() we turn the CP_ACCESS_TRAP_EL3 into
   an UNDEF, not a trap to Monitor mode
 * in the access functions, we check trap bits like SCR.TERR
   only when arm_current_el(env) < 3 -- this is correct for
   AArch64 EL3, but misses the "trap non-Monitor-mode execution
   at EL3 into Monitor mode" case for AArch32 EL3

In this commit we fix the first of these two issues, by
making access_check_cp_reg() handle CP_ACCESS_TRAP_EL3
as a Monitor trap. This is a kind of exception that we haven't
yet implemented(!), so we need a new EXCP_MON_TRAP for it.

This diverges from the pseudocode approach, where every access check
function explicitly checks for "if EL3 is AArch32" and takes a
monitor trap; if we wanted to be closer to the pseudocode we could
add a new CP_ACCESS_TRAP_MONITOR and make all the accessfns use it
when appropriate.  But because there are no non-standard cases in the
pseudocode (i.e.  where either it raises a Monitor trap that doesn't
correspond to an AArch64 SystemAccessTrap or where it raises a
SystemAccessTrap that doesn't correspond to a Monitor trap), handling
this all in one place seems less likely to result in future bugs
where we forgot again about this special case when writing an
accessor.

(The cc of stable here is because "hw/intc/arm_gicv3_cpuif: Don't
downgrade monitor traps for AArch32 EL3" which is also cc:stable
will implicitly use the new EXCP_MON_TRAP code path.)

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-6-peter.maydell@linaro.org
(cherry picked from commit 4cf4948651)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 00:13:02 +03:00
Peter Maydell
a98c7cee17 target/arm: Report correct syndrome for UNDEFINED LOR sysregs when NS=0
The pseudocode for the accessors for the LOR sysregs says they
are UNDEFINED if SCR_EL3.NS is 0. We were reporting the wrong
syndrome value here; use CP_ACCESS_TRAP_UNCATEGORIZED.

Cc: qemu-stable@nongnu.org
Fixes: 2d7137c10f ("target/arm: Implement the ARMv8.1-LOR extension")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-5-peter.maydell@linaro.org
(cherry picked from commit 707d478ed8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 00:12:31 +03:00
Peter Maydell
41945c6bbb target/arm: Report correct syndrome for UNDEFINED S1E2 AT ops at EL3
The pseudocode for AT S1E2R and AT S1E2W says that they should be
UNDEFINED if executed at EL3 when EL2 is not enabled. We were
incorrectly using CP_ACCESS_TRAP and reporting the wrong exception
syndrome as a result. Use CP_ACCESS_TRAP_UNCATEGORIZED.

Cc: qemu-stable@nongnu.org
Fixes: 2a47df9532 ("target-arm: Wire up AArch64 EL2 and EL3 address translation ops")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-4-peter.maydell@linaro.org
(cherry picked from commit ccda792945)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 00:12:17 +03:00
Peter Maydell
7988e7c6ba target/arm: Report correct syndrome for UNDEFINED AT ops with wrong NSE, NS
R_NYXTL says that these AT insns should be UNDEFINED if they
would operate on an EL lower than EL3 and SCR_EL3.{NSE,NS} is
set to the Reserved {1, 0}. We were incorrectly reporting
them with the wrong syndrome; use CP_ACCESS_TRAP_UNCATEGORIZED
so they are reported as UNDEFINED.

Cc: qemu-stable@nongnu.org
Fixes: 1acd00ef14 ("target/arm/helper: Check SCR_EL3.{NSE, NS} encoding for AT instructions")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-3-peter.maydell@linaro.org
(cherry picked from commit 1960d9701e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 00:11:58 +03:00
Peter Maydell
4a4426275b target/arm: Report correct syndrome for UNDEFINED CNTPS_*_EL1 from EL2 and NS EL1
The access pseudocode for the CNTPS_TVAL_EL1, CNTPS_CTL_EL1 and
CNTPS_CVAL_EL1 secure timer registers says that they are UNDEFINED
from EL2 or NS EL1.  We incorrectly return CP_ACCESS_TRAP from the
access function in these cases, which means that we report the wrong
syndrome value to the target EL.

Use CP_ACCESS_TRAP_UNCATEGORIZED, which reports the correct syndrome
value for an UNDEFINED instruction.

Cc: qemu-stable@nongnu.org
Fixes: b4d3978c2f ("target-arm: Add the AArch64 view of the Secure physical timer")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250130182309.717346-2-peter.maydell@linaro.org
(cherry picked from commit b819fd6994)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-25 00:11:31 +03:00
Michael Tokarev
ea35a5082a Update version for 9.2.2 release
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-24 08:46:48 +03:00
Michael Tokarev
d62f4b6d0d net/slirp: libslirp 4.9.0 compatibility
Update the code in net/slirp.c to be compatible with
libslirp 4.9.0, which deprecated slirp_pollfds_fill()
and started using slirp_os_socket type for sockets
(which is a 64-bit integer on win64) for all callbacks
starting with version 6 of the interface.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Message-ID: <20250130123253.864681-1-mjt@tls.msk.ru>
[thuth: Added some spaces to make checkpatch.pl happy]
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit f141caa270)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-19 23:02:09 +03:00
Mikael Szreder
9a51650419 target/sparc: Fix gdbstub incorrectly handling registers f32-f62
The gdbstub implementation for the Sparc architecture would
incorrectly calculate the the floating point register offset.
This resulted in, for example, registers f32 and f34 to point to
the same value.

The issue was caused by the confusion between even register numbers
and even register indexes. For example, the register index of f32 is 64
and f34 is 65.

Cc: qemu-stable@nongnu.org
Fixes: 30038fd818 ("target-sparc: Change fpr representation to doubles.")
Signed-off-by: Mikael Szreder <git@miszr.win>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250214070343.11501-1-git@miszr.win>
(cherry picked from commit 7a74e46808)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-19 14:01:02 +03:00
Mikael Szreder
5afb837e3c target/sparc: Fix register selection for all F*TOx and FxTO* instructions
A bug was introduced in commit 0bba7572d4 which causes the fdtox
and fqtox instructions to incorrectly select the destination registers.
More information and a test program can be found in issue #2802.

Cc: qemu-stable@nongnu.org
Fixes: 0bba7572d4 ("target/sparc: Perform DFPREG/QFPREG in decodetree")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2802
Signed-off-by: Mikael Szreder <git@miszr.win>
Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
[rth: Squash patches together, since the second fixes a typo in the first.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250205090333.19626-3-git@miszr.win>
(cherry picked from commit 807c3ebd1e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-19 14:01:02 +03:00
Fabiano Rosas
dffec2ddd0 elfload: Fix alignment when unmapping excess reservation
When complying with the alignment requested in the ELF and unmapping
the excess reservation, having align_end not aligned to the guest page
causes the unmap to be rejected by the alignment check at
target_munmap and later brk adjustments hit an EEXIST.

Fix by aligning the start of region to be unmapped.

Fixes: c81d1fafa6 ("linux-user: Honor elf alignment when placing images")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1913
Signed-off-by: Fabiano Rosas <farosas@suse.de>
[rth: Align load_end as well.]
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250213143558.10504-1-farosas@suse.de>
(cherry picked from commit 4b7b20a3b7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-19 14:01:02 +03:00
Peter Maydell
aead95c7fa hw/net/smc91c111: Ignore attempt to pop from empty RX fifo
The SMC91C111 includes an MMU Command register which permits
the guest to remove entries from the RX FIFO. The datasheet
does not specify what happens if the guest tries to do this
when the FIFO is already empty; there are no status registers
containing error bits which might be applicable.

Currently we don't guard at all against pop of an empty
RX FIFO, with the result that we allow the guest to drive
the rx_fifo_len index to negative values, which will cause
smc91c111_receive() to write to the rx_fifo[] array out of
bounds when we receive the next packet.

Instead ignore attempts to pop an empty RX FIFO.

Cc: qemu-stable@nongnu.org
Fixes: 80337b66a8 ("NIC emulation for qemu arm-softmmu")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2780
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250207151157.3151776-1-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 937df81af6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-17 15:50:29 +03:00
Michael Roth
4b1b34c1e7 make-release: don't rely on $CWD when excluding subproject directories
The current logic scans qemu.git/subprojects/ from *.wrap files to
determine whether or not to include the associated directories in the
release tarballs. However, the script assumes that it is being run from
the top-level of the source directory, which may not always be the case.
In particular, when generating releases via, e.g.:

  make qemu-9.2.1.tar.xz

the $CWD will either be an arbitrary external build directory, or
qemu.git/build, and the exclusions will not be processed as expected.
Fix this by using the $src parameter passed to the script as the root
directory for the various subproject/ paths referenced by this logic.

Also, the error case at the beginning of the subproject_dir() will not
result in the error message being printed, and will instead produce an
error message about "error" not being a valid command. Fix this by using
basic shell commands.

Fixes: be27b5149c ("make-release: only leave tarball of wrap-file subprojects")
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit b79b05d1a0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-16 09:47:29 +03:00
Volker Rümelin
616814cd00 ui/sdl2: reenable the SDL2 Windows keyboard hook procedure
Windows only:

The libSDL2 Windows message loop needs the libSDL2 Windows low
level keyboard hook procedure to grab the left and right Windows
keys correctly. Reenable the SDL2 Windows keyboard hook procedure.

Since SDL2 2.30.4 the SDL2 keyboard hook procedure also filters
out the special left Control key event for every Alt Gr key event
on keyboards with an international layout. This means the QEMU low
level keyboard hook procedure is no longer needed. Remove the QEMU
Windows keyboard hook procedure.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2139
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2323
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Link: https://lore.kernel.org/r/20241231115950.6732-1-vr_qemu@t-online.de
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 4dafba778a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: context fix in ui/sdl2.c (includes))
2025-02-15 20:40:55 +03:00
Zhenzhong Duan
d47f418ea1 vfio/iommufd: Fix SIGSEV in iommufd_cdev_attach()
When iommufd_cdev_ram_block_discard_disable() fails for whatever reason,
errp should be set or else SIGSEV is triggered in vfio_realize() when
error_prepend() is called.

By this chance, use the same error message for both legacy and iommufd
backend.

Fixes: 5ee3dc7af7 ("vfio/iommufd: Implement the iommufd backend")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20250116102307.260849-1-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
(cherry picked from commit 7b3d5b84cb)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-12 22:12:02 +03:00
Thomas Huth
fe21d932f2 gitlab-ci.d/cirrus: Update the FreeBSD job to v14.2
The FreeBSD job started to fail since the 14-1 image disappeared
from the cloud. Update the job to v14.2 to fix it.

Message-ID: <20250211120817.35050-1-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 66a1b4991c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-12 22:09:39 +03:00
Laurent Vivier
18b0d72fdd qmp: update vhost-user protocol feature maps
Add VHOST_USER_PROTOCOL_F_SHARED_OBJECT and
VHOST_USER_PROTOCOL_F_DEVICE_STATE protocol feature maps to
the virtio introspection.

Cc: jonah.palmer@oracle.com
Fixes: 1609476662 ("vhost-user: add shared_object msg")
Cc: aesteve@redhat.com
Fixes: cda83adc62 ("vhost-user: Interface for migration state transfer")
Cc: hreitz@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 1e3d4d9a1a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-11 09:35:19 +03:00
Khem Raj
34febb2831 linux-user: Do not define struct sched_attr if libc headers do
glibc 2.41+ has added [1] definitions for sched_setattr and
sched_getattr functions and struct sched_attr.  Therefore, it needs
to be checked for here as well before defining sched_attr, to avoid
a compilation failure.

Define sched_attr conditionally only when SCHED_ATTR_SIZE_VER0 is
not defined.

[1] https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=21571ca0d70302909cf72707b2a7736cf12190a0;hp=298bc488fdc047da37482f4003023cb9adef78f8

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2799
Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 27a8d899c7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-11 09:21:03 +03:00
Peter Krempa
37ff07ea12 block-backend: Fix argument order when calling 'qapi_event_send_block_io_error()'
Commit 7452162ade introduced 'qom-path' argument to BLOCK_IO_ERROR
event but when the event is instantiated in 'send_qmp_error_event()' the
arguments for 'device' and 'qom_path' in
qapi_event_send_block_io_error() were reversed :

Generated code for sending event:

  void qapi_event_send_block_io_error(const char *qom_path,
                                      const char *device,
                                      const char *node_name,
                                      IoOperationType operation,
                                      [...]

Call inside send_qmp_error_event():

     qapi_event_send_block_io_error(blk_name(blk),
                                    blk_get_attached_dev_path(blk),
                                    bs ? bdrv_get_node_name(bs) : NULL, optype,
                                    [...]

This results into reporting the QOM path as the device alias and vice
versa which in turn breaks libvirt, which expects the device alias being
either a valid alias or empty (which would make libvirt do the lookup by
node-name instead).

Cc: qemu-stable@nongnu.org
Fixes: 7452162ade ("qapi: add qom-path to BLOCK_IO_ERROR event")
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Message-ID: <09728d784888b38d7a8f09ee5e9e9c542c875e1e.1737973614.git.pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 107c551de0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-11 09:18:58 +03:00
Fabiano Rosas
d7b8b07197 block: Fix leak in send_qmp_error_event
ASAN detected a leak when running the ahci-test
/ahci/io/dma/lba28/retry:

Direct leak of 35 byte(s) in 1 object(s) allocated from:
    #0 in malloc
    #1 in __vasprintf_internal
    #2 in vasprintf
    #3 in g_vasprintf
    #4 in g_strdup_vprintf
    #5 in g_strdup_printf
    #6 in object_get_canonical_path ../qom/object.c:2096:19
    #7 in blk_get_attached_dev_id_or_path ../block/block-backend.c:1033:12
    #8 in blk_get_attached_dev_path ../block/block-backend.c:1047:12
    #9 in send_qmp_error_event ../block/block-backend.c:2140:36
    #10 in blk_error_action ../block/block-backend.c:2172:9
    #11 in ide_handle_rw_error ../hw/ide/core.c:875:5
    #12 in ide_dma_cb ../hw/ide/core.c:894:13
    #13 in dma_complete ../system/dma-helpers.c:107:9
    #14 in dma_blk_cb ../system/dma-helpers.c:129:9
    #15 in blk_aio_complete ../block/block-backend.c:1552:9
    #16 in blk_aio_write_entry ../block/block-backend.c:1619:5
    #17 in coroutine_trampoline ../util/coroutine-ucontext.c:175:9

Plug the leak by freeing the device path string.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241111145214.8261-1-farosas@suse.de>
[PMD: Use g_autofree]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241111170333.43833-3-philmd@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 23ea425c14)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-11 09:18:58 +03:00
Paolo Bonzini
237831f9ad rust: add --rust-target option for bindgen
Without it, recent bindgen will give an error

   error: extern block cannot be declared unsafe

if rustc is not new enough to support the "unsafe extern" construct.

Cc: qemu-rust@nongnu.org
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20250206111514.2134895-1-pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 131c58469f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-08 16:14:52 +03:00
Michael Tokarev
cac3fb4414 Update version for 9.2.1 release
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-08 14:26:21 +03:00
Dominik 'Disconnect3d' Czarnota
4404720764 gdbstub/user-target: fix gdbserver int format (%d -> %x)
This commit fixes an incorrect format string for formatting integers
provided to GDB when debugging a target run in QEMU user mode.

The correct format is hexadecimal for both success and errno values,
some of which can be seen here [0].

[0] e65a355022/gdbserver/hostio.cc (L196-L213)

Signed-off-by: Dominik 'Disconnect3d' Czarnota <dominik.b.czarnota@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Fixes: e282010b2e ("gdbstub: Add support for info proc mappings")
Cc: qemu-stable@nongnu.org
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 8b647bd352)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 12:21:08 +03:00
Laurent Vivier
7dc66ede71 net/dump: Correctly compute Ethernet packet offset
When a packet is sent with QEMU_NET_PACKET_FLAG_RAW by QEMU it
never includes virtio-net header even if qemu_get_vnet_hdr_len()
is not 0, and filter-dump is not managing this case.

The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self,
we can show the problem using it and tcpddump:

- QEMU parameters:

  .. -monitor stdio \
     -netdev bridge,id=netdev0,br=virbr0 \
     -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \
     -object filter-dump,netdev=netdev0,file=log.pcap,id=pcap0

- HMP command:

  (qemu) announce_self

- TCP dump:

  $ tcpdump -nxr log.pcap

  without the fix:

    08:00:06:04:00:03 > 2e:2f:80:35:00:01, ethertype Unknown (0x9a2b), length 50:
         0x0000:  2c2d 2e2f 0000 0000 9a2b 2c2d 2e2f 0000
         0x0010:  0000 0000 0000 0000 0000 0000 0000 0000
         0x0020:  0000 0000

  with the fix:

    ARP, Reverse Request who-is 9a:2b:2c:2d:2e:2f tell 9a:2b:2c:2d:2e:2f, length 46
         0x0000:  0001 0800 0604 0003 9a2b 2c2d 2e2f 0000
         0x0010:  0000 9a2b 2c2d 2e2f 0000 0000 0000 0000
         0x0020:  0000 0000 0000 0000 0000 0000 0000

Fixes: 481c52320a ("net: Strip virtio-net header when dumping")
Cc: akihiko.odaki@daynix.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit c6a1b591a6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 12:01:02 +03:00
Laurent Vivier
eec417351f net: Fix announce_self
b9ad513e18 ("net: Remove receive_raw()") adds an iovec entry
in qemu_deliver_packet_iov() to add the virtio-net header
in the data when QEMU_NET_PACKET_FLAG_RAW is set but forgets
to increase the number of iovec entries in the array, so
receive_iov() will only send the first entry (the virtio-net
entry, full of 0) and no data. The packet will be discarded.

The only user of QEMU_NET_PACKET_FLAG_RAW is announce_self.

We can see the problem with tcpdump:

- QEMU parameters:

  .. -monitor stdio \
     -netdev bridge,id=netdev0,br=virbr0 \
     -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \

- HMP command:

  (qemu) announce_self

- TCP dump:

  $ sudo tcpdump -nxi virbr0

  without the fix:

    <nothing>

  with the fix:

   ARP, Reverse Request who-is 9a:2b:2c:2d:2e:2f tell 9a:2b:2c:2d:2e:2f, length 46
        0x0000:  0001 0800 0604 0003 9a2b 2c2d 2e2f 0000
        0x0010:  0000 9a2b 2c2d 2e2f 0000 0000 0000 0000
        0x0020:  0000 0000 0000 0000 0000 0000 0000

Reported-by: Xiaohui Li <xiaohli@redhat.com>
Bug: https://issues.redhat.com/browse/RHEL-73891
Fixes: b9ad513e18 ("net: Remove receive_raw()")
Cc: akihiko.odaki@daynix.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 84dfdcbff3)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 12:00:13 +03:00
Ilya Leoshkevich
066b9de4b3 target/s390x: Fix MVC not always invalidating translation blocks
Node.js crashes in qemu-system-s390x with random SIGSEGVs / SIGILLs.

The v8 JIT used by Node.js can garbage collect and overwrite unused
code. Overwriting is performed by WritableJitAllocation::CopyCode(),
which ultimately calls memcpy(). For certain sizes, memcpy() uses the
MVC instruction.

QEMU implements MVC and other similar instructions using helpers. While
TCG store ops invalidate affected translation blocks automatically,
helpers must do this manually by calling probe_access_flags(). The MVC
helper does this using the access_prepare() -> access_prepare_nf() ->
s390_probe_access() -> probe_access_flags() call chain.

At the last step of this chain, the store size is replaced with 0. This
causes the probe_access_flags() -> notdirty_write() ->
tb_invalidate_phys_range_fast() chain to miss some translation blocks.

When this happens, QEMU executes a mix of old and new code. This
quickly leads to either a SIGSEGV or a SIGILL in case the old code
ends in the middle of a new instruction.

Fix by passing the true size.

Reported-by: Berthold Gunreben <azouhr@opensuse.org>
Cc: Sarah Kriesch <ada.lovelace@gmx.de>
Cc: qemu-stable@nongnu.org
Closes: https://bugzilla.opensuse.org/show_bug.cgi?id=1235709
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Fixes: e2faabee78 ("accel/tcg: Forward probe size on to notdirty_write")
Message-ID: <20250128001338.11474-1-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit e43ced8be1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 11:59:14 +03:00
Steve Sistare
7fd0224457 physmem: fix qemu_ram_alloc_from_fd size calculation
qemu_ram_alloc_from_fd allocates space if file_size == 0.  If non-zero,
it uses the existing space and verifies it is large enough, but the
verification was broken when the offset parameter was introduced.  As
a result, a file smaller than offset passes the verification and causes
errors later.  Fix that, and update the error message to include offset.

Peter provides this concise reproducer:

  $ touch ramfile
  $ truncate -s 64M ramfile
  $ ./qemu-system-x86_64 -object memory-backend-file,mem-path=./ramfile,offset=128M,size=128M,id=mem1,prealloc=on
  qemu-system-x86_64: qemu_prealloc_mem: preallocating memory failed: Bad address

With the fix, the error message is:
  qemu-system-x86_64: mem1 backing store size 0x4000000 is too small for 'size' option 0x8000000 plus 'offset' option 0x8000000

Cc: qemu-stable@nongnu.org
Fixes: 4b870dc4d0 ("hostmem-file: add offset option")
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/1736967650-129648-3-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 719168fba7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-02-01 11:56:57 +03:00
Hongren Zheng
e82fbf01b6 hw/usb/canokey: Fix buffer overflow for OUT packet
When USBPacket in OUT direction has larger payload
than the ep_out_buffer (of size 512), a buffer overflow
would occur.

It could be fixed by limiting the size of usb_packet_copy
to be at most buffer size. Further optimization gets rid
of the ep_out_buffer and directly uses ep_out as the target
buffer.

This is reported by a security researcher who artificially
constructed an OUT packet of size 2047. The report has gone
through the QEMU security process, and as this device is for
testing purpose and no deployment of it in virtualization
environment is observed, it is triaged not to be a security bug.

Cc: qemu-stable@nongnu.org
Fixes: d7d3491855 ("hw/usb: Add CanoKey Implementation")
Reported-by: Juan Jose Lopez Jaimez <thatjiaozi@gmail.com>
Signed-off-by: Hongren Zheng <i@zenithal.me>
Message-id: Z4TfMOrZz6IQYl_h@Sun
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 664280abdd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-29 22:29:03 +03:00
Peter Maydell
c806bbe8c1 target/arm: arm_reset_sve_state() should set FPSR, not FPCR
The pseudocode ResetSVEState() does:
    FPSR = ZeroExtend(0x0800009f<31:0>, 64);
but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident.

Before the advent of FEAT_AFP, this was only setting a collection of
RES0 bits, which vfp_set_fpsr() would then ignore, so the only effect
was that we didn't actually set the FPSR the way we are supposed to
do.  Once FEAT_AFP is implemented, setting the bottom bits of FPSR
will change the floating point behaviour.

Call vfp_set_fpsr(), as we ought to.

(Note for stable backports: commit 7f2a01e736 moved this function
from sme_helper.c to helper.c, but it had the same bug before the
move too.)

Cc: qemu-stable@nongnu.org
Fixes: f84734b874 ("target/arm: Implement SMSTART, SMSTOP")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250124162836.2332150-4-peter.maydell@linaro.org
(cherry picked from commit 1edc3d43f2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-29 22:25:22 +03:00
Zhao Liu
c597e6f26d stub: Fix build failure with --enable-user --disable-system --enable-tools
Configuring "--enable-user --disable-system --enable-tools" causes the
build failure with the following information:

/usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function `device_finalize':
/qemu/build/../hw/core/qdev.c:688: undefined reference to `qapi_event_send_device_deleted'
collect2: error: ld returned 1 exit status

To fix the above issue, add qdev.c stub when build with `have_tools`.

With this fix, QEMU could be successfully built in the following cases:
 --enable-user --disable-system --enable-tools
 --enable-user --disable-system --disable-tools
 --enable-user --disable-system

Cc: qemu-stable@nongnu.org
Fixes: 388b849fb6 ("stubs: avoid duplicate symbols in libqemuutil.a")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2766
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250121154318.214680-1-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 8113dbbcda)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-29 22:23:55 +03:00
Daniel P. Berrangé
dcb80cd908 crypto: fix bogus error benchmarking pbkdf on fast machines
We're seeing periodic reports of errors like:

$ qemu-img create -f luks --object secret,data=123456,id=sec0 \
                  -o key-secret=sec0 luks-info.img 1M
  Formatting 'luks-info.img', fmt=luks size=1048576 key-secret=sec0
  qemu-img: luks-info.img: Unable to get accurate CPU usage

This error message comes from a recent attempt to workaround a
kernel bug with measuring rusage in long running processes:

  commit c72cab5ad9
  Author: Tiago Pasqualini <tiago.pasqualini@canonical.com>
  Date:   Wed Sep 4 20:52:30 2024 -0300

    crypto: run qcrypto_pbkdf2_count_iters in a new thread

Unfortunately this has a subtle bug on machines which are very fast.

On the first time around the loop, the 'iterations' value is quite
small (1 << 15), and so will run quite fast. Testing has shown that
some machines can complete this benchmarking task in as little as
7 milliseconds.

Unfortunately the 'getrusage' data is not updated at the time of
the 'getrusage' call, it is done asynchronously by the scheduler.
The 7 millisecond completion time for the benchmark is short
enough that 'getrusage' sometimes reports 0 accumulated execution
time.

As a result the 'delay_ms == 0' sanity check in the above commit
is triggering non-deterministically on such machines.

The benchmarking loop intended to run multiple times, increasing
the 'iterations' value until the benchmark ran for > 500 ms, but
the sanity check doesn't allow this to happen.

To fix it, we keep a loop counter and only run the sanity check
after we've been around the loop more than 5 times. At that point
the 'iterations' value is high enough that even with infrequent
updates of 'getrusage' accounting data on fast machines, we should
see a non-zero value.

Fixes: https://lore.kernel.org/qemu-devel/ffe542bb-310c-4616-b0ca-13182f849fd1@redhat.com/
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2336437
Reported-by: Thomas Huth <thuth@redhat.com>
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20250109093746.1216300-1-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 145f12ea88)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-22 21:58:16 +03:00
Zhao Liu
2f5f6cb90a i386/cpu: Mark avx10_version filtered when prefix is NULL
In x86_cpu_filter_features(), if host doesn't support AVX10, the
configured avx10_version should be marked as filtered regardless of
whether prefix is NULL or not.

Check prefix before warn_report() instead of checking for
have_filtered_features.

Cc: qemu-stable@nongnu.org
Fixes: commit bccfb846fd ("target/i386: add AVX10 feature and AVX10 version property")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Tao Su <tao1.su@linux.intel.com>
Link: https://lore.kernel.org/r/20241106030728.553238-2-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit cf4c263551)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 21:54:51 +03:00
Paolo Bonzini
1032dccadb make-release: only leave tarball of wrap-file subprojects
The QEMU source archive is including the sources downloaded from crates.io
in both tarball form (in subprojects/packagecache) and expanded/patched
form (in the subprojects directory).  The former is the more authoritative
form, as it has a hash that can be verified in the wrap file and checked
against the download URL, so keep that one only.  This works also with
--disable-download; when building QEMU for the first time from the
tarball, Meson will print something like

    Using proc-macro2-1-rs source from cache.

for each subproject, and then go on to extract the tarball and apply the
overlay or the patches in subprojects/packagefiles.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2719
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit be27b5149c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 21:54:18 +03:00
Li Zhijian
acc4e8b69b hw/cxl: Fix msix_notify: Assertion vector < dev->msix_entries_nr
This assertion always happens when we sanitize the CXL memory device.
$ echo 1 > /sys/bus/cxl/devices/mem0/security/sanitize

It is incorrect to register an MSIX number beyond the device's capability.

Increase the device's MSIX number to cover the mailbox msix number(9).

Fixes: 43efb0bfad ("hw/cxl/mbox: Wire up interrupts for background completion")
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Message-Id: <20250115075834.167504-1-lizhijian@fujitsu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1ce979e726)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 10:57:59 +03:00
Igor Mammedov
73ca3ba37d tests: acpi: update expected blobs
_DSM function 7 AML should have followig change:

               If ((Arg2 == 0x07))
               {
  -                Local0 = Package (0x02)
  -                    {
  -                        Zero,
  -                        ""
  -                    }
                   Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One]
                       ))
  -                Local0 [Zero] = Local2
  +                Local0 = Package (0x02) {}
  +                If (!((Local2 == Zero) || (Local2 == 0xFFFFFFFF)))
  +                {
  +                    Local0 [Zero] = Local2
  +                    Local0 [One] = ""
  +                }
  +
                   Return (Local0)
               }
           }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20250115125342.3883374-4-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 9fb1c9a1bb)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: regenerate acpi tables for 9.2)
2025-01-17 09:58:21 +03:00
Igor Mammedov
7170aa66aa pci: acpi: Windows 'PCI Label Id' bug workaround
Current versions of Windows call _DSM(func=7) regardless
of whether it is supported or not. It leads to NICs having bogus
'PCI Label Id = 0', where none should be set at all.

Also presence of 'PCI Label Id' triggers another Windows bug
on localized versions that leads to hangs. The later bug is fixed
in latest updates for 'Windows Server' but not in consumer
versions of Windows (and there is no plans to fix it
as far as I'm aware).

Given it's easy, implement Microsoft suggested workaround
(return invalid Package) so that affected Windows versions
could boot on QEMU.
This would effectvely remove bogus 'PCI Label Id's on NICs,
but MS teem confirmed that flipping 'PCI Label Id' should not
change 'Network Connection' ennumeration, so it should be safe
for QEMU to change _DSM without any compat code.

Smoke tested with WinXP and WS2022
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/774
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20250115125342.3883374-3-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 0b05339198)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:30:54 +03:00
Igor Mammedov
b107128ea6 tests: acpi: whitelist expected blobs
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20250115125342.3883374-2-imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 1ad32644fe)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:30:47 +03:00
Nicholas Piggin
c8fb662a58 pci/msix: Fix msix pba read vector poll end calculation
The end vector calculation has a bug that results in polling fewer
than required vectors when reading at a non-zero offset in PBA memory.

Fixes: bbef882cc1 ("msi: add API to get notified about pending bit poll")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20241212120402.1475053-1-npiggin@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 42e2a7a0ab)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:26:23 +03:00
Sebastian Ott
91b2cb9a78 pci: ensure valid link status bits for downstream ports
PCI hotplug for downstream endpoints on arm fails because Linux'
PCIe hotplug driver doesn't like the QEMU provided LNKSTA:

  pcieport 0000:08:01.0: pciehp: Slot(2): Card present
  pcieport 0000:08:01.0: pciehp: Slot(2): Link Up
  pcieport 0000:08:01.0: pciehp: Slot(2): Cannot train link: status 0x2000

There's 2 cases where LNKSTA isn't setup properly:
* the downstream device has no express capability
* max link width of the bridge is 0

Move the sanity checks added via 88c869198a
("pci: Sanity test minimum downstream LNKSTA") outside of the
branch to make sure downstream ports always have a valid LNKSTA.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
Message-Id: <20241203121928.14861-1-sebott@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 694632fd44)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:22:13 +03:00
Phil Dennis-Jordan
4a3538e6f2 hw/usb/hcd-xhci-pci: Use modulo to select MSI vector as per spec
QEMU would crash with a failed assertion if the XHCI controller
attempted to raise the interrupt on an interrupter corresponding
to a MSI vector with a higher index than the highest configured
for the device by the guest driver.

This behaviour is correct on the MSI/PCI side: per PCI 3.0 spec,
devices must ensure they do not send MSI notifications for
vectors beyond the range of those allocated by the system/driver
software. Unlike MSI-X, there is no generic way for handling
aliasing in the case of fewer allocated vectors than requested,
so the specifics are up to device implementors. (Section
6.8.3.4. "Sending Messages")

It turns out the XHCI spec (Implementation Note in section 4.17,
"Interrupters") requires that the host controller signal the MSI
vector with the number computed by taking the interrupter number
modulo the number of enabled MSI vectors.

This change introduces that modulo calculation, fixing the
failed assertion. This makes the device work correctly in MSI mode
with macOS's XHCI driver, which only allocates a single vector.

Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250112210056.16658-2-phil@philjordan.eu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit bb5b7fced6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:16:01 +03:00
Gabriel Barrantes
69e29c484f backends/cryptodev-vhost-user: Fix local_error leaks
Do not propagate error to the upper, directly output the error
to avoid leaks.

Fixes: 2fda101de0 ("virtio-crypto: Support asynchronous mode")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2714
Signed-off-by: Gabriel Barrantes <gabriel.barrantes.dev@outlook.com>
Reviewed-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <DM8PR13MB50781054A4FDACE6F4FB6469B30F2@DM8PR13MB5078.namprd13.prod.outlook.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 78b0c15a56)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:16:01 +03:00
Philippe Mathieu-Daudé
3b9b5cbe0a tests/qtest/boot-serial-test: Correct HPPA machine name
Commit 7df6f75117 ("hw/hppa: Split out machine creation")
renamed the 'hppa' machine as 'B160L', but forgot to update
the boot serial test, which ended being skipped.

Cc: qemu-stable@nongnu.org
Fixes: 7df6f75117 ("hw/hppa: Split out machine creation")
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250102100340.43014-2-philmd@linaro.org>
(cherry picked from commit a87077316e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-17 09:16:01 +03:00
Keoseong Park
48876bfc47 hw/ufs: Adjust value to match CPU's endian format
In ufs_write_attr_value(), the value parameter is handled in the CPU's
endian format but provided in big-endian format by the caller. Thus, it
is converted to the CPU's endian format. The related test code is also
fixed to reflect this change.

Fixes: 7c85332a2b ("hw/ufs: minor bug fixes related to ufs-test")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Message-ID: <20250107084356epcms2p2af4d86432174d76ea57336933e46b4c3@epcms2p2>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 4572dacc33)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-15 15:53:53 +03:00
Philippe Mathieu-Daudé
bb6940dbad tests/functional/test_rx_gdbsim: Use stable URL for test_linux_sash
Yoshinori said [*] URL references on OSDN were stable, but they
appear not to be. Mirror the artifacts on GitHub to avoid failures
while testing on CI.

[*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg686487.html

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-ID: <20200630202631.7345-1-f4bug@amsat.org>
[huth: Adapt the patch to the new version in the functional framework]
Message-ID: <20241229083419.180423-1-huth@tuxfamily.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit ec2dfb7c38)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: fixup for missing v9.2.0-421-g65d35a4e27a8 "tests/functional: convert tests to new uncompress helper")
2025-01-13 12:28:59 +03:00
Yuan Liu
9a17a65066 multifd: bugfix for incorrect migration data with qatzip compression
When QPL compression is enabled on the migration channel and the same
dirty page changes from a normal page to a zero page in the iterative
memory copy, the dirty page will not be updated to a zero page again
on the target side, resulting in incorrect memory data on the source
and target sides.

The root cause is that the target side does not record the normal pages
to the receivedmap.

The solution is to add ramblock_recv_bitmap_set_offset in target side
to record the normal pages.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Jason Zeng <jason.zeng@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20241218091413.140396-4-yuan1.liu@intel.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit a523bc5216)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Yuan Liu
fcd5a157e6 multifd: bugfix for incorrect migration data with QPL compression
When QPL compression is enabled on the migration channel and the same
dirty page changes from a normal page to a zero page in the iterative
memory copy, the dirty page will not be updated to a zero page again
on the target side, resulting in incorrect memory data on the source
and target sides.

The root cause is that the target side does not record the normal pages
to the receivedmap.

The solution is to add ramblock_recv_bitmap_set_offset in target side
to record the normal pages.

Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Jason Zeng <jason.zeng@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20241218091413.140396-3-yuan1.liu@intel.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 2588a5f99b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Yuan Liu
7fb9ce40e7 multifd: bugfix for migration using compression methods
When compression is enabled on the migration channel and
the pages processed are all zero pages, these pages will
not be sent and updated on the target side, resulting in
incorrect memory data on the source and target sides.

The root cause is that all compression methods call
multifd_send_prepare_common to determine whether to compress
dirty pages, but multifd_send_prepare_common does not update
the IOV of MultiFDPacket_t when all dirty pages are zero pages.

The solution is to always update the IOV of MultiFDPacket_t
regardless of whether the dirty pages are all zero pages.

Fixes: 303e6f54f9 ("migration/multifd: Implement zero page transmission on the multifd thread.")
Cc: qemu-stable@nongnu.org #9.0+
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Jason Zeng <jason.zeng@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20241218091413.140396-2-yuan1.liu@intel.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit cdc3970f85)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Fabiano Rosas
82565fb6b3 migration: Fix arrays of pointers in JSON writer
Currently, if an array of pointers contains a NULL pointer, that
pointer will be encoded as '0' in the stream. Since the JSON writer
doesn't define a "pointer" type, that '0' will now be an uint8, which
is different from the original type being pointed to, e.g. struct.

(we're further calling uint8 "nullptr", but that's irrelevant to the
issue)

That mixed-type array shouldn't be compressed, otherwise data is lost
as the code currently makes the whole array have the type of the first
element:

css = {NULL, NULL, ..., 0x5555568a7940, NULL};

{"name": "s390_css", "instance_id": 0, "vmsd_name": "s390_css",
 "version": 1, "fields": [
    ...,
    {"name": "css", "array_len": 256, "type": "nullptr", "size": 1},
    ...,
]}

In the above, the valid pointer at position 254 got lost among the
compressed array of nullptr.

While we could disable the array compression when a NULL pointer is
found, the JSON part of the stream still makes part of downtime, so we
should avoid writing unecessary bytes to it.

Keep the array compression in place, but if NULL and non-NULL pointers
are mixed break the array into several type-contiguous pieces :

css = {NULL, NULL, ..., 0x5555568a7940, NULL};

{"name": "s390_css", "instance_id": 0, "vmsd_name": "s390_css",
 "version": 1, "fields": [
     ...,
     {"name": "css", "array_len": 254, "type": "nullptr", "size": 1},
     {"name": "css", "type": "struct", "struct": {"vmsd_name": "s390_css_img", ... }, "size": 768},
     {"name": "css", "type": "nullptr", "size": 1},
     ...,
]}

Now each type-discontiguous region will become a new JSON entry. The
reader should interpret this as a concatenation of values, all part of
the same field.

Parsing the JSON with analyze-script.py now shows the proper data
being pointed to at the places where the pointer is valid and
"nullptr" where there's NULL:

"s390_css (14)": {
    ...
    "css": [
        "nullptr",
        "nullptr",
        ...
        "nullptr",
        {
            "chpids": [
            {
                "in_use": "0x00",
                "type": "0x00",
                "is_virtual": "0x00"
            },
            ...
            ]
        },
        "nullptr",
    }

Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-7-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 35049eb0d2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Peter Xu
46f2af3e39 migration: Dump correct JSON format for nullptr replacement
QEMU plays a trick with null pointers inside an array of pointers in a VMSD
field.  See 07d4e69147 ("migration/vmstate: fix array of ptr with
nullptrs") for more details on why.  The idea makes sense in general, but
it may overlooked the JSON writer where it could write nothing in a
"struct" in the JSON hints section.

We hit some analyze-migration.py issues on s390 recently, showing that some
of the struct field contains nothing, like:

{"name": "css", "array_len": 256, "type": "struct", "struct": {}, "size": 1}

As described in details by Fabiano:

https://lore.kernel.org/r/87pll37cin.fsf@suse.de

It could be that we hit some null pointers there, and JSON was gone when
they're null pointers.

To fix it, instead of hacking around only at VMStateInfo level, do that
from VMStateField level, so that JSON writer can also be involved.  In this
case, JSON writer will replace the pointer array (which used to be a
"struct") to be the real representation of the nullptr field.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-6-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 9867c3a7ce)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Fabiano Rosas
3ba6e1164a migration: Rename vmstate_info_nullptr
Rename vmstate_info_nullptr from "uint64_t" to "nullptr". This vmstate
actually reads and writes just a byte, so the proper name would be
uint8. However, since this is a marker for a NULL pointer, it's
convenient to have a more explicit name that can be identified by the
consumers of the JSON part of the stream.

Change the name to "nullptr" and add support for it in the
analyze-migration.py script. Arbitrarily use the name of the type as
the value of the field to avoid the script showing 0x30 or '0', which
could be confusing for readers.

Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-5-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit f52965bf0e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Fabiano Rosas
e7a9d93428 s390x: Fix CSS migration
Commit a55ae46683 ("s390: move css_migration_enabled from machine to
css.c") disabled CSS migration globally instead of doing it
per-instance.

CC: Paolo Bonzini <pbonzini@redhat.com>
CC: qemu-stable@nongnu.org #9.1
Fixes: a55ae46683 ("s390: move css_migration_enabled from machine to css.c")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2704
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250109185249.23952-8-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit c76ee1f625)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Fabiano Rosas
e3839b0c19 migration: Fix parsing of s390 stream
The parsing for the S390StorageAttributes section is currently leaving
an unconsumed token that is later interpreted by the generic code as
QEMU_VM_EOF, cutting the parsing short.

The migration will issue a STATTR_FLAG_DONE between iterations, which
the script consumes correctly, but there's a final STATTR_FLAG_EOS at
.save_complete that the script is ignoring. Since the EOS flag is a
u64 0x1ULL and the stream is big endian, on little endian hosts a byte
read from it will be 0x0, the same as QEMU_VM_EOF.

Fixes: 81c2c9dd5d ("tests/qtest/migration-test: Fix analyze-migration.py for s390x")
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-4-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 69d1f78456)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Fabiano Rosas
abb738ad33 migration: Remove unused argument in vmsd_desc_field_end
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-3-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 2aead53d39)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 11:25:57 +03:00
Fabiano Rosas
ea3b821595 migration: Add more error handling to analyze-migration.py
The analyze-migration script was seen failing in s390x in misterious
ways. It seems we're reaching the VMSDFieldStruct constructor without
any fields, which would indicate an empty .subsection entry, a
VMSTATE_STRUCT with no fields or a vmsd with no fields. We don't have
any of those, at least not without the unmigratable flag set, so this
should never happen.

Add some debug statements so that we can see what's going on the next
time the issue happens.

Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20250109185249.23952-2-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit 86bee9e0c7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-13 09:44:33 +03:00
Fabiano Rosas
7e4480dde2 migration/multifd: Fix compat with QEMU < 9.0
Commit f5f48a7891 ("migration/multifd: Separate SYNC request with
normal jobs") changed the multifd source side to stop sending data
along with the MULTIFD_FLAG_SYNC, effectively introducing the concept
of a SYNC-only packet. Relying on that, commit d7e58f412c
("migration/multifd: Don't send ram data during SYNC") later came
along and skipped reading data from SYNC packets.

In a versions timeline like this:

  8.2 f5f48a7 9.0 9.1 d7e58f41 9.2

The issue arises that QEMUs < 9.0 still send data along with SYNC, but
QEMUs > 9.1 don't gather that data anymore. This leads to various
kinds of migration failures due to desync/missing data.

Stop checking for a SYNC packet on the destination and unconditionally
unfill the packet.

>From now on:

old -> new:
the source sends data + sync, destination reads normally

new -> new:
source sends only sync, destination reads zeros

new -> old:
source sends only sync, destination reads zeros

CC: qemu-stable@nongnu.org
Fixes: d7e58f412c ("migration/multifd: Don't send ram data during SYNC")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2720
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Message-Id: <20241213160120.23880-2-farosas@suse.de>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit b93d897ea2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-12 15:54:21 +03:00
Shameer Kolothum
f5827eb0ac migration/multifd: Fix compile error caused by page_size usage
>From Commit 90fa121c6c ("migration/multifd: Inline page_size and
page_count") onwards page_size is not part of MutiFD*Params but uses
an inline constant instead.

However, it missed updating an old usage, causing a compile error.

Fixes: 90fa121c6c ("migration/multifd: Inline page_size and page_count")
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-Id: <20241203124943.52572-1-shameerali.kolothum.thodi@huawei.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
(cherry picked from commit d127294f26)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2025-01-12 15:53:02 +03:00
Han Han
9bbaadbf9c target/i386/cpu: Fix notes for CPU models
Fixes: 644e3c5d81 ("missing vmx features for Skylake-Server and Cascadelake-Server")
Signed-off-by: Han Han <hhan@redhat.com>
Reviewed-by: Chenyi Qiang <chenyi.qiang@intel.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 93dcc9390e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-29 02:22:55 +03:00
Philippe Mathieu-Daudé
64092b3464 docs: Correct release of TCG trace-events removal
TCG trace-events were deprecated before the v6.2 release,
and removed for v7.0.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit b4859e8f33)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-29 01:57:11 +03:00
Philippe Mathieu-Daudé
ad09b3df7e docs: Correct '-runas' and '-fsdev/-virtfs proxy' indentation
Use the same style for deprecated / removed commands.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(cherry picked from commit 916f50172b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-29 01:56:59 +03:00
Bibo Mao
15eedfd2ff target/loongarch: Use actual operand size with vbsrl check
Hardcoded 32 bytes is used for vbsrl emulation check, there is
problem when options lsx=on,lasx=off is used for vbsrl.v instruction
in TCG mode. It injects LASX exception rather LSX exception.

Here actual operand size is used.

Cc: qemu-stable@nongnu.org
Fixes: df97f33807 ("target/loongarch: Implement xvreplve xvinsve0 xvpickve")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit d41989e754)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-29 01:50:54 +03:00
David Hildenbrand
9d913e012b s390x/s390-virtio-ccw: don't crash on weird RAM sizes
KVM is not happy when starting a VM with weird RAM sizes:

  # qemu-system-s390x --enable-kvm --nographic -m 1234K
  qemu-system-s390x: kvm_set_user_memory_region: KVM_SET_USER_MEMORY_REGION
    failed, slot=0, start=0x0, size=0x244000: Invalid argument
  kvm_set_phys_mem: error registering slot: Invalid argument
  Aborted (core dumped)

Let's handle that in a better way by rejecting such weird RAM sizes
right from the start:

  # qemu-system-s390x --enable-kvm --nographic -m 1234K
  qemu-system-s390x: ram size must be multiples of 1 MiB

Message-ID: <20241219144115.2820241-2-david@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
(cherry picked from commit 14e568ab48)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-24 15:31:54 +03:00
Yong-Xuan Wang
19484ed99a hw/intc/riscv_aplic: Fix APLIC in_clrip and clripnum write emulation
In the section "4.7 Precise effects on interrupt-pending bits"
of the RISC-V AIA specification defines that:

"If the source mode is Level1 or Level0 and the interrupt domain
is configured in MSI delivery mode (domaincfg.DM = 1):
The pending bit is cleared whenever the rectified input value is
low, when the interrupt is forwarded by MSI, or by a relevant
write to an in_clrip register or to clripnum."

Update the riscv_aplic_set_pending() to match the spec.

Fixes: bf31cf06eb ("hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode")
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20241029085349.30412-1-yongxuan.wang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
(cherry picked from commit 0d0141fadc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-22 11:39:16 +03:00
Maciej S. Szmigiero
2dc652961d target/i386: Reset TSCs of parked vCPUs too on VM reset
Since commit 5286c36622 ("target/i386: properly reset TSC on reset")
QEMU writes the special value of "1" to each online vCPU TSC on VM reset
to reset it.

However parked vCPUs don't get that handling and due to that their TSCs
get desynchronized when the VM gets reset.
This in turn causes KVM to turn off PVCLOCK_TSC_STABLE_BIT in its exported
PV clock.
Note that KVM has no understanding of vCPU being currently parked.

Without PVCLOCK_TSC_STABLE_BIT the sched clock is marked unstable in
the guest's kvm_sched_clock_init().
This causes a performance regressions to show in some tests.

Fix this issue by writing the special value of "1" also to TSCs of parked
vCPUs on VM reset.

Reproducing the issue:
1) Boot a VM with "-smp 2,maxcpus=3" or similar

2) device_add host-x86_64-cpu,id=vcpu,node-id=0,socket-id=0,core-id=2,thread-id=0

3) Wait a few seconds

4) device_del vcpu

5) Inside the VM run:
# echo "t" >/proc/sysrq-trigger; dmesg | grep sched_clock_stable
Observe the sched_clock_stable() value is 1.

6) Reboot the VM

7) Once the VM boots once again run inside it:
# echo "t" >/proc/sysrq-trigger; dmesg | grep sched_clock_stable
Observe the sched_clock_stable() value is now 0.

Fixes: 5286c36622 ("target/i386: properly reset TSC on reset")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Link: https://lore.kernel.org/r/5a605a88e9a231386dc803c60f5fed9b48108139.1734014926.git.maciej.szmigiero@oracle.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 3f2a05b31e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-22 11:18:15 +03:00
Thomas Huth
42490ac980 meson.build: Disallow libnfs v6 to fix the broken macOS build
The macOS builds in our CI (and possibly other very recent distros)
are currently broken since the update to libnfs version 6 there.
That version apparently comes with a big API breakage. v5.0.3 was
the final release of the old API (see the libnfs commit here:
https://github.com/sahlberg/libnfs/commit/4379837 ).

Disallow version 6.x for now to get the broken CI job working
again. Once somebody had enough time to adapt our code in
block/nfs.c, we can revert this change again.

Message-ID: <20241218065157.209020-1-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit e2d98f2571)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-20 21:37:30 +03:00
Peter Maydell
ad06bb324d hw/intc/arm_gicv3_its: Zero initialize local DTEntry etc structs
In the GICv3 ITS model, we have a common coding pattern which has a
local C struct like "DTEntry dte", which is a C representation of an
in-guest-memory data structure, and we call a function such as
get_dte() to read guest memory and fill in the C struct.  These
functions to read in the struct sometimes have cases where they will
leave early and not fill in the whole struct (for instance get_dte()
will set "dte->valid = false" and nothing else for the case where it
is passed an entry_addr implying that there is no L2 table entry for
the DTE).  This then causes potential use of uninitialized memory
later, for instance when we call a trace event which prints all the
fields of the struct.  Sufficiently advanced compilers may produce
-Wmaybe-uninitialized warnings about this, especially if LTO is
enabled.

Rather than trying to carefully separate out these trace events into
"only the 'valid' field is initialized" and "all fields can be
printed", zero-init all the structs when we define them. None of
these structs are large (the biggest is 24 bytes) and having
consistent behaviour is less likely to be buggy.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2718
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20241213182337.3343068-1-peter.maydell@linaro.org
(cherry picked from commit 9678b9c505)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-19 23:58:11 +03:00
Heinrich Schuchardt
fa232044a5 pc-bios: add missing riscv64 descriptor
Without descriptor libvirt cannot discover the EDK II binaries via
the qemu:///system connection.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Message-ID: <20241212090059.94167-1-heinrich.schuchardt@canonical.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 74dc38d0c6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-17 18:06:39 +03:00
Gerd Hoffmann
83daae51ee roms: re-add edk2-basetools target
Needed to build ipxe nic roms.

Reported-by: Liu Jaloo <liu.jaloo@gmail.com>
Fixes: 22e11539e1 ("edk2: replace build scripts")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20241212084408.1390728-1-kraxel@redhat.com>
(cherry picked from commit 0f5715e4b5)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-17 14:26:42 +03:00
Gerd Hoffmann
05e984c200 x86/loader: only patch linux kernels
If the binary loaded via -kernel is *not* a linux kernel (in which
case protocol == 0), do not patch the linux kernel header fields.

It's (a) pointless and (b) might break binaries by random patching
and (c) changes the binary hash which in turn breaks secure boot
verification.

Background: OVMF happily loads and runs not only linux kernels but
any efi binary via direct kernel boot.

Note: Breaking the secure boot verification is a problem for linux
kernels too, but fixed that is left for another day ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20240905141211.1253307-3-kraxel@redhat.com>
(cherry picked from commit 57e2cc9abf)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-17 14:14:38 +03:00
Roman Artemev
242376e872 tcg/riscv: Fix StoreStore barrier generation
On RISC-V to StoreStore barrier corresponds
`fence w, w` not `fence r, r`

Cc: qemu-stable@nongnu.org
Fixes: efbea94c76 ("tcg/riscv: Add slowpath load and store instructions")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Denis Tomashev <denis.tomashev@syntacore.com>
Signed-off-by: Roman Artemev <roman.artemev@syntacore.com>
Message-ID: <e2f2131e294a49e79959d4fa9ec02cf4@syntacore.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit b438362a14)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-13 15:54:32 +03:00
Richard Henderson
f838a7e365 tcg: Reset free_temps before tcg_optimize
When allocating new temps during tcg_optmize, do not re-use
any EBB temps that were used within the TB.  We do not have
any idea what span of the TB in which the temp was live.

Introduce tcg_temp_ebb_reset_freed and use before tcg_optimize,
as well as replacing the equivalent in plugin_gen_inject and
tcg_func_start.

Cc: qemu-stable@nongnu.org
Fixes: fb04ab7ddd ("tcg/optimize: Lower TCG_COND_TST{EQ,NE} if unsupported")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2711
Reported-by: wannacu <wannacu2049@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 04e006ab36)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-13 15:51:03 +03:00
Christian Schoenebeck
361f29fe1b 9pfs: fix regression regarding CVE-2023-2861
The released fix for this CVE:

  f6b0de53fb ("9pfs: prevent opening special files (CVE-2023-2861)")

caused a regression with security_model=passthrough. When handling a
'Tmknod' request there was a side effect that 'Tmknod' request could fail
as 9p server was trying to adjust permissions:

  #6  close_if_special_file (fd=30) at ../hw/9pfs/9p-util.h:140
  #7  openat_file (mode=<optimized out>, flags=2228224,
      name=<optimized out>, dirfd=<optimized out>) at
      ../hw/9pfs/9p-util.h:181
  #8  fchmodat_nofollow (dirfd=dirfd@entry=31,
      name=name@entry=0x5555577ea6e0 "mysocket", mode=493) at
      ../hw/9pfs/9p-local.c:360
  #9  local_set_cred_passthrough (credp=0x7ffbbc4ace10, name=0x5555577ea6e0
      "mysocket", dirfd=31, fs_ctx=0x55555811f528) at
      ../hw/9pfs/9p-local.c:457
  #10 local_mknod (fs_ctx=0x55555811f528, dir_path=<optimized out>,
      name=0x5555577ea6e0 "mysocket", credp=0x7ffbbc4ace10) at
      ../hw/9pfs/9p-local.c:702
  #11 v9fs_co_mknod (pdu=pdu@entry=0x555558121140,
      fidp=fidp@entry=0x5555574c46c0, name=name@entry=0x7ffbbc4aced0,
      uid=1000, gid=1000, dev=<optimized out>, mode=49645,
      stbuf=0x7ffbbc4acef0) at ../hw/9pfs/cofs.c:205
  #12 v9fs_mknod (opaque=0x555558121140) at ../hw/9pfs/9p.c:3711

That's because server was opening the special file to adjust permissions,
however it was using O_PATH and it would have not returned the file
descriptor to guest. So the call to close_if_special_file() on that branch
was incorrect.

Let's lift the restriction introduced by f6b0de53fb such that it would
allow to open special files on host if O_PATH flag is supplied, not only
for 9p server's own operations as described above, but also for any client
'Topen' request.

It is safe to allow opening special files with O_PATH on host, because
O_PATH only allows path based operations on the resulting file descriptor
and prevents I/O such as read() and write() on that file descriptor.

Fixes: f6b0de53fb ("9pfs: prevent opening special files (CVE-2023-2861)")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2337
Reported-by: Dirk Herrendorfer <d.herrendoerfer@de.ibm.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Dirk Herrendorfer <d.herrendoerfer@de.ibm.com>
Message-Id: <E1tJWbk-007BH4-OB@kylie.crudebyte.com>
(cherry picked from commit d06a9d843f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2024-12-13 00:21:17 +03:00
3123 changed files with 51782 additions and 92110 deletions

View File

@@ -1,14 +0,0 @@
#
# Common b4 settings that can be used to send patches to QEMU upstream.
# https://b4.docs.kernel.org/
#
[b4]
send-series-to = qemu-devel@nongnu.org
send-auto-to-cmd = echo
send-auto-cc-cmd = scripts/get_maintainer.pl --noroles --norolestats --nogit --nogit-fallback
am-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback -
prep-perpatch-check-cmd = scripts/checkpatch.pl -q --terse --no-summary --mailback -
searchmask = https://lore.kernel.org/qemu-devel/?x=m&t=1&q=%s
linkmask = https://lore.kernel.org/qemu-devel/%s
linktrailermask = Message-ID: <%s>

View File

@@ -47,16 +47,3 @@ emacs_mode = glsl
[*.json] [*.json]
indent_style = space indent_style = space
emacs_mode = python emacs_mode = python
# by default follow QEMU's style
[*.pl]
indent_style = space
indent_size = 4
emacs_mode = perl
# but user kernel "style" for imported scripts
[scripts/{kernel-doc,get_maintainer.pl,checkpatch.pl}]
indent_style = tab
indent_size = 8
emacs_mode = perl

View File

@@ -40,7 +40,7 @@ build-system-ubuntu:
job: amd64-ubuntu2204-container job: amd64-ubuntu2204-container
variables: variables:
IMAGE: ubuntu2204 IMAGE: ubuntu2204
CONFIGURE_ARGS: --enable-docs --enable-rust CONFIGURE_ARGS: --enable-docs
TARGETS: alpha-softmmu microblazeel-softmmu mips64el-softmmu TARGETS: alpha-softmmu microblazeel-softmmu mips64el-softmmu
MAKE_CHECK_ARGS: check-build MAKE_CHECK_ARGS: check-build
@@ -71,7 +71,7 @@ build-system-debian:
job: amd64-debian-container job: amd64-debian-container
variables: variables:
IMAGE: debian IMAGE: debian
CONFIGURE_ARGS: --with-coroutine=sigaltstack --enable-rust CONFIGURE_ARGS: --with-coroutine=sigaltstack
TARGETS: arm-softmmu i386-softmmu riscv64-softmmu sh4eb-softmmu TARGETS: arm-softmmu i386-softmmu riscv64-softmmu sh4eb-softmmu
sparc-softmmu xtensa-softmmu sparc-softmmu xtensa-softmmu
MAKE_CHECK_ARGS: check-build MAKE_CHECK_ARGS: check-build
@@ -131,12 +131,6 @@ build-system-fedora-rust-nightly:
CONFIGURE_ARGS: --disable-docs --enable-rust --enable-strict-rust-lints CONFIGURE_ARGS: --disable-docs --enable-rust --enable-strict-rust-lints
TARGETS: aarch64-softmmu TARGETS: aarch64-softmmu
MAKE_CHECK_ARGS: check-build MAKE_CHECK_ARGS: check-build
after_script:
- source scripts/ci/gitlab-ci-section
- section_start test "Running Rust doctests"
- cd build
- pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} test --doc -p qemu_api
allow_failure: true allow_failure: true
check-system-fedora: check-system-fedora:

View File

@@ -21,7 +21,7 @@ repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
print(f"adding upstream git repo @ {repourl}") print(f"adding upstream git repo @ {repourl}")
subprocess.check_call(["git", "remote", "add", "check-dco", repourl]) subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
subprocess.check_call(["git", "fetch", "--refetch", "check-dco", "master"]) subprocess.check_call(["git", "fetch", "check-dco", "master"])
ancestor = subprocess.check_output(["git", "merge-base", ancestor = subprocess.check_output(["git", "merge-base",
"check-dco/master", "HEAD"], "check-dco/master", "HEAD"],

View File

@@ -24,7 +24,7 @@ print(f"adding upstream git repo @ {repourl}")
# base for the user's branch. We thus need to figure out a common # base for the user's branch. We thus need to figure out a common
# ancestor between the user's branch and current git master. # ancestor between the user's branch and current git master.
subprocess.check_call(["git", "remote", "add", "check-patch", repourl]) subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
subprocess.check_call(["git", "fetch", "--refetch", "check-patch", "master"]) subprocess.check_call(["git", "fetch", "check-patch", "master"])
ancestor = subprocess.check_output(["git", "merge-base", ancestor = subprocess.check_output(["git", "merge-base",
"check-patch/master", "HEAD"], "check-patch/master", "HEAD"],

View File

@@ -1,66 +0,0 @@
#!/usr/bin/env python3
#
# check-units.py: check the number of compilation units and identify
# those that are rebuilt multiple times
#
# Copyright (C) 2025 Linaro Ltd.
#
# SPDX-License-Identifier: GPL-2.0-or-later
from os import access, R_OK, path
from sys import argv, exit
import json
from collections import Counter
def extract_build_units(cc_path):
"""
Extract the build units and their counds from compile_commands.json file.
Returns:
Hash table of ["unit"] = count
"""
j = json.load(open(cc_path, 'r'))
files = [f['file'] for f in j]
build_units = Counter(files)
return build_units
def analyse_units(build_units):
"""
Analyse the build units and report stats and the top 10 rebuilds
"""
print(f"Total source files: {len(build_units.keys())}")
print(f"Total build units: {sum(units.values())}")
# Create a sorted list by number of rebuilds
sorted_build_units = sorted(build_units.items(),
key=lambda item: item[1],
reverse=True)
print("Most rebuilt units:")
for unit, count in sorted_build_units[:20]:
print(f" {unit} built {count} times")
print("Least rebuilt units:")
for unit, count in sorted_build_units[-10:]:
print(f" {unit} built {count} times")
if __name__ == "__main__":
if len(argv) != 2:
script_name = path.basename(argv[0])
print(f"Usage: {script_name} <path_to_compile_commands.json>")
exit(1)
cc_path = argv[1]
if path.isfile(cc_path) and access(cc_path, R_OK):
units = extract_build_units(cc_path)
analyse_units(units)
exit(0)
else:
print(f"{cc_path} doesn't exist or isn't readable")
exit(1)

View File

@@ -15,17 +15,32 @@
stage: build stage: build
image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest
needs: [] needs: []
allow_failure:
exit_codes: 3
# 20 mins larger than "timeout_in" in cirrus/build.yml # 20 mins larger than "timeout_in" in cirrus/build.yml
# as there's often a 5-10 minute delay before Cirrus CI # as there's often a 5-10 minute delay before Cirrus CI
# actually starts the task # actually starts the task
timeout: 80m timeout: 80m
script: script:
- set -o allexport
- source .gitlab-ci.d/cirrus/$NAME.vars - source .gitlab-ci.d/cirrus/$NAME.vars
- set +o allexport - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
- cirrus-vars <.gitlab-ci.d/cirrus/build.yml >.gitlab-ci.d/cirrus/$NAME.yml -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
-e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
-e "s|[@]CIRRUS_VM_INSTANCE_TYPE@|$CIRRUS_VM_INSTANCE_TYPE|g"
-e "s|[@]CIRRUS_VM_IMAGE_SELECTOR@|$CIRRUS_VM_IMAGE_SELECTOR|g"
-e "s|[@]CIRRUS_VM_IMAGE_NAME@|$CIRRUS_VM_IMAGE_NAME|g"
-e "s|[@]CIRRUS_VM_CPUS@|$CIRRUS_VM_CPUS|g"
-e "s|[@]CIRRUS_VM_RAM@|$CIRRUS_VM_RAM|g"
-e "s|[@]UPDATE_COMMAND@|$UPDATE_COMMAND|g"
-e "s|[@]INSTALL_COMMAND@|$INSTALL_COMMAND|g"
-e "s|[@]PATH@|$PATH_EXTRA${PATH_EXTRA:+:}\$PATH|g"
-e "s|[@]PKG_CONFIG_PATH@|$PKG_CONFIG_PATH|g"
-e "s|[@]PKGS@|$PKGS|g"
-e "s|[@]MAKE@|$MAKE|g"
-e "s|[@]PYTHON@|$PYTHON|g"
-e "s|[@]PIP3@|$PIP3|g"
-e "s|[@]PYPI_PKGS@|$PYPI_PKGS|g"
-e "s|[@]CONFIGURE_ARGS@|$CONFIGURE_ARGS|g"
-e "s|[@]TEST_TARGETS@|$TEST_TARGETS|g"
<.gitlab-ci.d/cirrus/build.yml >.gitlab-ci.d/cirrus/$NAME.yml
- cat .gitlab-ci.d/cirrus/$NAME.yml - cat .gitlab-ci.d/cirrus/$NAME.yml
- cirrus-run -v --show-build-log always .gitlab-ci.d/cirrus/$NAME.yml - cirrus-run -v --show-build-log always .gitlab-ci.d/cirrus/$NAME.yml
variables: variables:

View File

@@ -8,7 +8,7 @@ env:
CI_REPOSITORY_URL: "@CI_REPOSITORY_URL@" CI_REPOSITORY_URL: "@CI_REPOSITORY_URL@"
CI_COMMIT_REF_NAME: "@CI_COMMIT_REF_NAME@" CI_COMMIT_REF_NAME: "@CI_COMMIT_REF_NAME@"
CI_COMMIT_SHA: "@CI_COMMIT_SHA@" CI_COMMIT_SHA: "@CI_COMMIT_SHA@"
PATH: "@PATH_EXTRA@:$PATH" PATH: "@PATH@"
PKG_CONFIG_PATH: "@PKG_CONFIG_PATH@" PKG_CONFIG_PATH: "@PKG_CONFIG_PATH@"
PYTHON: "@PYTHON@" PYTHON: "@PYTHON@"
MAKE: "@MAKE@" MAKE: "@MAKE@"

View File

@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
NINJA='/usr/local/bin/ninja' NINJA='/usr/local/bin/ninja'
PACKAGING_COMMAND='pkg' PACKAGING_COMMAND='pkg'
PIP3='/usr/local/bin/pip' PIP3='/usr/local/bin/pip'
PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache4 cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 vulkan-tools xorriso zstd' PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk-vnc gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson mtools ncurses nettle ninja opencv pixman pkgconf png py311-numpy py311-pillow py311-pip py311-pyyaml py311-sphinx py311-sphinx_rtd_theme py311-tomli python3 rpm2cpio rust rust-bindgen-cli sdl2 sdl2_image snappy sndio socat spice-protocol tesseract usbredir virglrenderer vte3 xorriso zstd'
PYPI_PKGS='' PYPI_PKGS=''
PYTHON='/usr/local/bin/python3' PYTHON='/usr/local/bin/python3'

View File

@@ -11,6 +11,6 @@ MAKE='/opt/homebrew/bin/gmake'
NINJA='/opt/homebrew/bin/ninja' NINJA='/opt/homebrew/bin/ninja'
PACKAGING_COMMAND='brew' PACKAGING_COMMAND='brew'
PIP3='/opt/homebrew/bin/pip3' PIP3='/opt/homebrew/bin/pip3'
PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd' PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 xorriso zlib zstd'
PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli' PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
PYTHON='/opt/homebrew/bin/python3' PYTHON='/opt/homebrew/bin/python3'

View File

@@ -61,7 +61,7 @@ cross-i686-tci:
variables: variables:
IMAGE: debian-i686-cross IMAGE: debian-i686-cross
ACCEL: tcg-interpreter ACCEL: tcg-interpreter
EXTRA_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,arm-softmmu,arm-linux-user,ppc-softmmu,ppc-linux-user --disable-plugins --disable-kvm EXTRA_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user --disable-plugins --disable-kvm
# Force tests to run with reduced parallelism, to see whether this # Force tests to run with reduced parallelism, to see whether this
# reduces the flakiness of this CI job. The CI # reduces the flakiness of this CI job. The CI
# environment by default shows us 8 CPUs and so we # environment by default shows us 8 CPUs and so we

View File

@@ -46,49 +46,3 @@ check-python-tox:
QEMU_JOB_OPTIONAL: 1 QEMU_JOB_OPTIONAL: 1
needs: needs:
job: python-container job: python-container
check-rust-tools-nightly:
extends: .base_job_template
stage: test
image: $CI_REGISTRY_IMAGE/qemu/fedora-rust-nightly:$QEMU_CI_CONTAINER_TAG
script:
- source scripts/ci/gitlab-ci-section
- section_start test "Running Rust code checks"
- cd build
- pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} fmt --check
- make clippy
- make rustdoc
- section_end test
variables:
GIT_DEPTH: 1
allow_failure: true
needs:
- job: build-system-fedora-rust-nightly
artifacts: true
artifacts:
when: on_success
expire_in: 2 days
paths:
- rust/target/doc
check-build-units:
extends: .base_job_template
stage: build
image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
needs:
job: amd64-debian-container
before_script:
- source scripts/ci/gitlab-ci-section
- section_start setup "Install Tools"
- apt install --assume-yes --no-install-recommends jq
- section_end setup
script:
- mkdir build
- cd build
- section_start configure "Running configure"
- ../configure
- cd ..
- section_end configure
- section_start analyse "Analyse"
- .gitlab-ci.d/check-units.py build/compile_commands.json
- section_end analyse

25
.gitmodules vendored
View File

@@ -1,12 +1,12 @@
[submodule "roms/seabios"] [submodule "roms/seabios"]
path = roms/seabios path = roms/seabios
url = https://gitlab.com/qemu-project/seabios.git/ url = https://github.com/openSUSE/qemu-seabios.git
[submodule "roms/SLOF"] [submodule "roms/SLOF"]
path = roms/SLOF path = roms/SLOF
url = https://gitlab.com/qemu-project/SLOF.git url = https://github.com/openSUSE/qemu-SLOF.git
[submodule "roms/ipxe"] [submodule "roms/ipxe"]
path = roms/ipxe path = roms/ipxe
url = https://gitlab.com/qemu-project/ipxe.git url = https://github.com/openSUSE/qemu-ipxe.git
[submodule "roms/openbios"] [submodule "roms/openbios"]
path = roms/openbios path = roms/openbios
url = https://gitlab.com/qemu-project/openbios.git url = https://gitlab.com/qemu-project/openbios.git
@@ -18,7 +18,7 @@
url = https://gitlab.com/qemu-project/u-boot.git url = https://gitlab.com/qemu-project/u-boot.git
[submodule "roms/skiboot"] [submodule "roms/skiboot"]
path = roms/skiboot path = roms/skiboot
url = https://gitlab.com/qemu-project/skiboot.git url = https://github.com/openSUSE/qemu-skiboot.git
[submodule "roms/QemuMacDrivers"] [submodule "roms/QemuMacDrivers"]
path = roms/QemuMacDrivers path = roms/QemuMacDrivers
url = https://gitlab.com/qemu-project/QemuMacDrivers.git url = https://gitlab.com/qemu-project/QemuMacDrivers.git
@@ -36,10 +36,25 @@
url = https://gitlab.com/qemu-project/opensbi.git url = https://gitlab.com/qemu-project/opensbi.git
[submodule "roms/qboot"] [submodule "roms/qboot"]
path = roms/qboot path = roms/qboot
url = https://gitlab.com/qemu-project/qboot.git url = https://github.com/openSUSE/qemu-qboot.git
[submodule "roms/vbootrom"] [submodule "roms/vbootrom"]
path = roms/vbootrom path = roms/vbootrom
url = https://gitlab.com/qemu-project/vbootrom.git url = https://gitlab.com/qemu-project/vbootrom.git
[submodule "tests/lcitool/libvirt-ci"] [submodule "tests/lcitool/libvirt-ci"]
path = tests/lcitool/libvirt-ci path = tests/lcitool/libvirt-ci
url = https://gitlab.com/libvirt/libvirt-ci.git url = https://gitlab.com/libvirt/libvirt-ci.git
[submodule "subprojects/berkeley-softfloat-3"]
path = subprojects/berkeley-softfloat-3
url = https://gitlab.com/qemu-project/berkeley-softfloat-3
[submodule "subprojects/berkeley-testfloat-3"]
path = subprojects/berkeley-testfloat-3
url = https://gitlab.com/qemu-project/berkeley-testfloat-3
[submodule "subprojects/dtc"]
path = subprojects/dtc
url = https://gitlab.com/qemu-project/dtc.git
[submodule "subprojects/libvfio-user"]
path = subprojects/libvfio-user
url = https://gitlab.com/qemu-project/libvfio-user.git
[submodule "subprojects/keycodemapdb"]
path = subprojects/keycodemapdb
url = https://gitlab.com/qemu-project/keycodemapdb.git

View File

@@ -67,7 +67,6 @@ Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> Andrey Drobyshev via <qemu-blo
BALATON Zoltan <balaton@eik.bme.hu> BALATON Zoltan via <qemu-ppc@nongnu.org> BALATON Zoltan <balaton@eik.bme.hu> BALATON Zoltan via <qemu-ppc@nongnu.org>
# Next, replace old addresses by a more recent one. # Next, replace old addresses by a more recent one.
Akihiko Odaki <akihiko.odaki@daynix.com> <akihiko.odaki@gmail.com>
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <aleksandar.markovic@mips.com> Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <aleksandar.markovic@mips.com>
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <aleksandar.markovic@imgtec.com> Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <aleksandar.markovic@imgtec.com>
Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <amarkovic@wavecomp.com> Aleksandar Markovic <aleksandar.qemu.devel@gmail.com> <amarkovic@wavecomp.com>
@@ -88,9 +87,8 @@ Huacai Chen <chenhuacai@kernel.org> <chenhc@lemote.com>
Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn> Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn>
James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com> James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
Juan Quintela <quintela@trasno.org> <quintela@redhat.com> Juan Quintela <quintela@trasno.org> <quintela@redhat.com>
Leif Lindholm <leif.lindholm@oss.qualcomm.com> <quic_llindhol@quicinc.com> Leif Lindholm <quic_llindhol@quicinc.com> <leif.lindholm@linaro.org>
Leif Lindholm <leif.lindholm@oss.qualcomm.com> <leif.lindholm@linaro.org> Leif Lindholm <quic_llindhol@quicinc.com> <leif@nuviainc.com>
Leif Lindholm <leif.lindholm@oss.qualcomm.com> <leif@nuviainc.com>
Luc Michel <luc@lmichel.fr> <luc.michel@git.antfield.fr> Luc Michel <luc@lmichel.fr> <luc.michel@git.antfield.fr>
Luc Michel <luc@lmichel.fr> <luc.michel@greensocs.com> Luc Michel <luc@lmichel.fr> <luc.michel@greensocs.com>
Luc Michel <luc@lmichel.fr> <lmichel@kalray.eu> Luc Michel <luc@lmichel.fr> <lmichel@kalray.eu>

47
.obs/workflows.yml Normal file
View File

@@ -0,0 +1,47 @@
pr_factory:
steps:
- branch_package:
source_project: Virtualization:Staging
source_package: qemu
target_project: Virtualization:Staging:PRs
filters:
event: pull_request
branches:
only:
- factory
rebuild_factory:
steps:
# Will automatically rebuild the package
- trigger_services:
project: Virtualization:Staging
package: qemu
filters:
event: push
branches:
only:
- factory
pr_staging_tdx:
steps:
- branch_package:
source_project: Virtualization:Staging:TDX
source_package: qemu
target_project: Virtualization:Staging:TDX:PRs
filters:
event: pull_request
branches:
only:
- v8.2.6-tdx
rebuild_staging_tdx:
steps:
# Will automatically rebuild the package
- trigger_services:
project: Virtualization:Staging:TDX
package: qemu
filters:
event: push
branches:
only:
- v8.2.6-tdx

View File

@@ -61,6 +61,3 @@ config HV_BALLOON_POSSIBLE
config HAVE_RUST config HAVE_RUST
bool bool
config MAC_PVG
bool

View File

@@ -72,14 +72,11 @@ R: Markus Armbruster <armbru@redhat.com>
R: Philippe Mathieu-Daudé <philmd@linaro.org> R: Philippe Mathieu-Daudé <philmd@linaro.org>
W: https://www.qemu.org/docs/master/devel/index.html W: https://www.qemu.org/docs/master/devel/index.html
S: Odd Fixes S: Odd Fixes
F: docs/devel/build-environment.rst
F: docs/devel/code-of-conduct.rst
F: docs/devel/codebase.rst
F: docs/devel/conflict-resolution.rst
F: docs/devel/style.rst F: docs/devel/style.rst
F: docs/devel/code-of-conduct.rst
F: docs/devel/conflict-resolution.rst
F: docs/devel/submitting-a-patch.rst F: docs/devel/submitting-a-patch.rst
F: docs/devel/submitting-a-pull-request.rst F: docs/devel/submitting-a-pull-request.rst
F: docs/glossary.rst
Responsible Disclosure, Reporting Security Issues Responsible Disclosure, Reporting Security Issues
------------------------------------------------- -------------------------------------------------
@@ -121,7 +118,7 @@ F: pc-bios/s390-ccw.img
F: target/s390x/ F: target/s390x/
F: docs/system/target-s390x.rst F: docs/system/target-s390x.rst
F: docs/system/s390x/ F: docs/system/s390x/
F: tests/qtest/migration/s390x/ F: tests/migration/s390x/
K: ^Subject:.*(?i)s390x? K: ^Subject:.*(?i)s390x?
L: qemu-s390x@nongnu.org L: qemu-s390x@nongnu.org
@@ -152,7 +149,10 @@ Overall TCG CPUs
M: Richard Henderson <richard.henderson@linaro.org> M: Richard Henderson <richard.henderson@linaro.org>
R: Paolo Bonzini <pbonzini@redhat.com> R: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained S: Maintained
F: system/cpus.c
F: system/watchpoint.c F: system/watchpoint.c
F: cpu-common.c
F: cpu-target.c
F: page-vary-target.c F: page-vary-target.c
F: page-vary-common.c F: page-vary-common.c
F: accel/tcg/ F: accel/tcg/
@@ -162,13 +162,17 @@ F: util/cacheflush.c
F: scripts/decodetree.py F: scripts/decodetree.py
F: docs/devel/decodetree.rst F: docs/devel/decodetree.rst
F: docs/devel/tcg* F: docs/devel/tcg*
F: include/exec/cpu*.h
F: include/exec/exec-all.h
F: include/exec/tb-flush.h F: include/exec/tb-flush.h
F: include/exec/target_long.h
F: include/exec/helper*.h F: include/exec/helper*.h
F: include/exec/helper*.h.inc F: include/exec/helper*.h.inc
F: include/exec/helper-info.c.inc F: include/exec/helper-info.c.inc
F: include/exec/page-protection.h F: include/exec/page-protection.h
F: include/system/tcg.h F: include/sysemu/cpus.h
F: include/accel/tcg/cpu-ops.h F: include/sysemu/tcg.h
F: include/hw/core/tcg-cpu-ops.h
F: host/include/*/host/cpuinfo.h F: host/include/*/host/cpuinfo.h
F: util/cpuinfo-*.c F: util/cpuinfo-*.c
F: include/tcg/ F: include/tcg/
@@ -222,7 +226,7 @@ F: target/avr/
F: tests/functional/test_avr_mega2560.py F: tests/functional/test_avr_mega2560.py
Hexagon TCG CPUs Hexagon TCG CPUs
M: Brian Cain <brian.cain@oss.qualcomm.com> M: Brian Cain <bcain@oss.qualcomm.com>
S: Supported S: Supported
F: target/hexagon/ F: target/hexagon/
X: target/hexagon/idef-parser/ X: target/hexagon/idef-parser/
@@ -244,7 +248,6 @@ F: target/hexagon/gen_idef_parser_funcs.py
HPPA (PA-RISC) TCG CPUs HPPA (PA-RISC) TCG CPUs
M: Richard Henderson <richard.henderson@linaro.org> M: Richard Henderson <richard.henderson@linaro.org>
M: Helge Deller <deller@gmx.de>
S: Maintained S: Maintained
F: target/hppa/ F: target/hppa/
F: disas/hppa.c F: disas/hppa.c
@@ -312,6 +315,7 @@ F: tests/functional/test_ppc_74xx.py
RISC-V TCG CPUs RISC-V TCG CPUs
M: Palmer Dabbelt <palmer@dabbelt.com> M: Palmer Dabbelt <palmer@dabbelt.com>
M: Alistair Francis <alistair.francis@wdc.com> M: Alistair Francis <alistair.francis@wdc.com>
M: Bin Meng <bmeng.cn@gmail.com>
R: Weiwei Li <liwei1518@gmail.com> R: Weiwei Li <liwei1518@gmail.com>
R: Daniel Henrique Barboza <dbarboza@ventanamicro.com> R: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
R: Liu Zhiwei <zhiwei_liu@linux.alibaba.com> R: Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
@@ -319,12 +323,9 @@ L: qemu-riscv@nongnu.org
S: Supported S: Supported
F: configs/targets/riscv* F: configs/targets/riscv*
F: docs/system/target-riscv.rst F: docs/system/target-riscv.rst
F: docs/specs/riscv-iommu.rst
F: target/riscv/ F: target/riscv/
F: hw/char/riscv_htif.c
F: hw/riscv/ F: hw/riscv/
F: hw/intc/riscv* F: hw/intc/riscv*
F: include/hw/char/riscv_htif.h
F: include/hw/riscv/ F: include/hw/riscv/
F: linux-user/host/riscv32/ F: linux-user/host/riscv32/
F: linux-user/host/riscv64/ F: linux-user/host/riscv64/
@@ -433,7 +434,7 @@ F: */*/kvm*
F: accel/kvm/ F: accel/kvm/
F: accel/stubs/kvm-stub.c F: accel/stubs/kvm-stub.c
F: include/hw/kvm/ F: include/hw/kvm/
F: include/system/kvm*.h F: include/sysemu/kvm*.h
F: scripts/kvm/kvm_flightrecorder F: scripts/kvm/kvm_flightrecorder
ARM KVM CPUs ARM KVM CPUs
@@ -446,7 +447,7 @@ MIPS KVM CPUs
M: Huacai Chen <chenhuacai@kernel.org> M: Huacai Chen <chenhuacai@kernel.org>
S: Odd Fixes S: Odd Fixes
F: target/mips/kvm* F: target/mips/kvm*
F: target/mips/system/ F: target/mips/sysemu/
PPC KVM CPUs PPC KVM CPUs
M: Nicholas Piggin <npiggin@gmail.com> M: Nicholas Piggin <npiggin@gmail.com>
@@ -480,10 +481,10 @@ Xen emulation on X86 KVM CPUs
M: David Woodhouse <dwmw2@infradead.org> M: David Woodhouse <dwmw2@infradead.org>
M: Paul Durrant <paul@xen.org> M: Paul Durrant <paul@xen.org>
S: Supported S: Supported
F: include/system/kvm_xen.h F: include/sysemu/kvm_xen.h
F: target/i386/kvm/xen* F: target/i386/kvm/xen*
F: hw/i386/kvm/xen* F: hw/i386/kvm/xen*
F: tests/functional/test_x86_64_kvm_xen.py F: tests/avocado/kvm_xen_guest.py
Guest CPU Cores (other accelerators) Guest CPU Cores (other accelerators)
------------------------------------ ------------------------------------
@@ -491,19 +492,12 @@ Overall
M: Richard Henderson <richard.henderson@linaro.org> M: Richard Henderson <richard.henderson@linaro.org>
R: Paolo Bonzini <pbonzini@redhat.com> R: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained S: Maintained
F: include/exec/cpu*.h
F: include/exec/exec-all.h
F: include/exec/target_long.h
F: include/qemu/accel.h F: include/qemu/accel.h
F: include/system/accel-*.h F: include/sysemu/accel-*.h
F: include/system/cpus.h F: include/hw/core/accel-cpu.h
F: include/accel/accel-cpu-target.h
F: accel/accel-*.c F: accel/accel-*.c
F: accel/Makefile.objs F: accel/Makefile.objs
F: accel/stubs/Makefile.objs F: accel/stubs/Makefile.objs
F: cpu-common.c
F: cpu-target.c
F: system/cpus.c
Apple Silicon HVF CPUs Apple Silicon HVF CPUs
M: Alexander Graf <agraf@csgraf.de> M: Alexander Graf <agraf@csgraf.de>
@@ -513,7 +507,6 @@ F: target/arm/hvf/
X86 HVF CPUs X86 HVF CPUs
M: Cameron Esfahani <dirty@apple.com> M: Cameron Esfahani <dirty@apple.com>
M: Roman Bolshakov <rbolshakov@ddn.com> M: Roman Bolshakov <rbolshakov@ddn.com>
R: Phil Dennis-Jordan <phil@philjordan.eu>
W: https://wiki.qemu.org/Features/HVF W: https://wiki.qemu.org/Features/HVF
S: Maintained S: Maintained
F: target/i386/hvf/ F: target/i386/hvf/
@@ -521,18 +514,17 @@ F: target/i386/hvf/
HVF HVF
M: Cameron Esfahani <dirty@apple.com> M: Cameron Esfahani <dirty@apple.com>
M: Roman Bolshakov <rbolshakov@ddn.com> M: Roman Bolshakov <rbolshakov@ddn.com>
R: Phil Dennis-Jordan <phil@philjordan.eu>
W: https://wiki.qemu.org/Features/HVF W: https://wiki.qemu.org/Features/HVF
S: Maintained S: Maintained
F: accel/hvf/ F: accel/hvf/
F: include/system/hvf.h F: include/sysemu/hvf.h
F: include/system/hvf_int.h F: include/sysemu/hvf_int.h
WHPX CPUs WHPX CPUs
M: Sunil Muthuswamy <sunilmut@microsoft.com> M: Sunil Muthuswamy <sunilmut@microsoft.com>
S: Supported S: Supported
F: target/i386/whpx/ F: target/i386/whpx/
F: include/system/whpx.h F: include/sysemu/whpx.h
Guest CPU Cores (Xen) Guest CPU Cores (Xen)
--------------------- ---------------------
@@ -558,8 +550,8 @@ F: hw/i386/xen/
F: hw/pci-host/xen_igd_pt.c F: hw/pci-host/xen_igd_pt.c
F: include/hw/block/dataplane/xen* F: include/hw/block/dataplane/xen*
F: include/hw/xen/ F: include/hw/xen/
F: include/system/xen.h F: include/sysemu/xen.h
F: include/system/xen-mapcache.h F: include/sysemu/xen-mapcache.h
F: stubs/xen-hw-stub.c F: stubs/xen-hw-stub.c
F: docs/system/arm/xenpvh.rst F: docs/system/arm/xenpvh.rst
F: docs/system/i386/xenpvh.rst F: docs/system/i386/xenpvh.rst
@@ -569,7 +561,7 @@ Guest CPU Cores (NVMM)
NetBSD Virtual Machine Monitor (NVMM) CPU support NetBSD Virtual Machine Monitor (NVMM) CPU support
M: Reinoud Zandijk <reinoud@netbsd.org> M: Reinoud Zandijk <reinoud@netbsd.org>
S: Maintained S: Maintained
F: include/system/nvmm.h F: include/sysemu/nvmm.h
F: target/i386/nvmm/ F: target/i386/nvmm/
Hosts Hosts
@@ -587,7 +579,7 @@ POSIX
M: Paolo Bonzini <pbonzini@redhat.com> M: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained S: Maintained
F: os-posix.c F: os-posix.c
F: include/system/os-posix.h F: include/sysemu/os-posix.h
F: util/*posix*.c F: util/*posix*.c
F: include/qemu/*posix*.h F: include/qemu/*posix*.h
@@ -641,7 +633,6 @@ F: include/hw/*/allwinner*
F: hw/arm/cubieboard.c F: hw/arm/cubieboard.c
F: docs/system/arm/cubieboard.rst F: docs/system/arm/cubieboard.rst
F: hw/misc/axp209.c F: hw/misc/axp209.c
F: tests/functional/test_arm_cubieboard.py
Allwinner-h3 Allwinner-h3
M: Niek Linnenbank <nieklinnenbank@gmail.com> M: Niek Linnenbank <nieklinnenbank@gmail.com>
@@ -729,7 +720,6 @@ S: Odd Fixes
F: hw/*/exynos* F: hw/*/exynos*
F: include/hw/*/exynos* F: include/hw/*/exynos*
F: docs/system/arm/exynos.rst F: docs/system/arm/exynos.rst
F: tests/functional/test_arm_smdkc210.py
Calxeda Highbank Calxeda Highbank
M: Rob Herring <robh@kernel.org> M: Rob Herring <robh@kernel.org>
@@ -787,7 +777,7 @@ F: docs/system/arm/kzm.rst
Integrator CP Integrator CP
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/arm/integratorcp.c F: hw/arm/integratorcp.c
F: hw/misc/arm_integrator_debug.c F: hw/misc/arm_integrator_debug.c
F: include/hw/misc/arm_integrator_debug.h F: include/hw/misc/arm_integrator_debug.h
@@ -820,21 +810,6 @@ F: hw/pci-host/designware.c
F: include/hw/pci-host/designware.h F: include/hw/pci-host/designware.h
F: docs/system/arm/mcimx7d-sabre.rst F: docs/system/arm/mcimx7d-sabre.rst
MCIMX8MP-EVK / i.MX8MP
M: Bernhard Beschow <shentey@gmail.com>
L: qemu-arm@nongnu.org
S: Maintained
F: hw/arm/imx8mp-evk.c
F: hw/arm/fsl-imx8mp.c
F: hw/misc/imx8mp_*.c
F: hw/pci-host/fsl_imx8m_phy.c
F: hw/rtc/rs5c372.c
F: include/hw/arm/fsl-imx8mp.h
F: include/hw/misc/imx8mp_*.h
F: include/hw/pci-host/fsl_imx8m_phy.h
F: docs/system/arm/imx8mp-evk.rst
F: tests/qtest/rs5c372-test.c
MPS2 / MPS3 MPS2 / MPS3
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
@@ -868,7 +843,7 @@ F: docs/system/arm/mps2.rst
Musca Musca
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/arm/musca.c F: hw/arm/musca.c
F: docs/system/arm/musca.rst F: docs/system/arm/musca.rst
@@ -893,10 +868,8 @@ F: include/hw/*/npcm*
F: tests/qtest/npcm* F: tests/qtest/npcm*
F: tests/qtest/adm1266-test.c F: tests/qtest/adm1266-test.c
F: pc-bios/npcm7xx_bootrom.bin F: pc-bios/npcm7xx_bootrom.bin
F: pc-bios/npcm8xx_bootrom.bin
F: roms/vbootrom F: roms/vbootrom
F: docs/system/arm/nuvoton.rst F: docs/system/arm/nuvoton.rst
F: tests/functional/test_arm_quanta_gsj.py
Raspberry Pi Raspberry Pi
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
@@ -916,7 +889,7 @@ F: tests/functional/test_aarch64_raspi4.py
Real View Real View
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/arm/realview* F: hw/arm/realview*
F: hw/cpu/realview_mpcore.c F: hw/cpu/realview_mpcore.c
F: hw/intc/realview_gic.c F: hw/intc/realview_gic.c
@@ -942,7 +915,8 @@ F: include/hw/ssi/imx_spi.h
SBSA-REF SBSA-REF
M: Radoslaw Biernacki <rad@semihalf.com> M: Radoslaw Biernacki <rad@semihalf.com>
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
R: Leif Lindholm <leif.lindholm@oss.qualcomm.com> R: Leif Lindholm <quic_llindhol@quicinc.com>
R: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Maintained S: Maintained
F: hw/arm/sbsa-ref.c F: hw/arm/sbsa-ref.c
@@ -966,7 +940,7 @@ F: tests/functional/test_arm_collie.py
Stellaris Stellaris
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/*/stellaris* F: hw/*/stellaris*
F: hw/display/ssd03* F: hw/display/ssd03*
F: include/hw/input/gamepad.h F: include/hw/input/gamepad.h
@@ -996,7 +970,7 @@ F: docs/system/arm/stm32.rst
Versatile Express Versatile Express
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/arm/vexpress.c F: hw/arm/vexpress.c
F: hw/display/sii9022.c F: hw/display/sii9022.c
F: docs/system/arm/vexpress.rst F: docs/system/arm/vexpress.rst
@@ -1005,7 +979,7 @@ F: tests/functional/test_arm_vexpress.py
Versatile PB Versatile PB
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/*/versatile* F: hw/*/versatile*
F: hw/i2c/arm_sbcon_i2c.c F: hw/i2c/arm_sbcon_i2c.c
F: include/hw/i2c/arm_sbcon_i2c.h F: include/hw/i2c/arm_sbcon_i2c.h
@@ -1019,7 +993,7 @@ S: Maintained
F: hw/arm/virt* F: hw/arm/virt*
F: include/hw/arm/virt.h F: include/hw/arm/virt.h
F: docs/system/arm/virt.rst F: docs/system/arm/virt.rst
F: tests/functional/test_aarch64_virt*.py F: tests/functional/test_aarch64_virt.py
F: tests/functional/test_aarch64_tuxrun.py F: tests/functional/test_aarch64_tuxrun.py
F: tests/functional/test_arm_tuxrun.py F: tests/functional/test_arm_tuxrun.py
@@ -1051,7 +1025,6 @@ F: hw/display/dpcd.c
F: include/hw/display/dpcd.h F: include/hw/display/dpcd.h
F: docs/system/arm/xlnx-versal-virt.rst F: docs/system/arm/xlnx-versal-virt.rst
F: docs/system/arm/xlnx-zcu102.rst F: docs/system/arm/xlnx-zcu102.rst
F: tests/functional/test_aarch64_xlnx_versal.py
Xilinx Versal OSPI Xilinx Versal OSPI
M: Francisco Iglesias <francisco.iglesias@amd.com> M: Francisco Iglesias <francisco.iglesias@amd.com>
@@ -1142,7 +1115,6 @@ L: qemu-arm@nongnu.org
S: Maintained S: Maintained
F: hw/arm/msf2-som.c F: hw/arm/msf2-som.c
F: docs/system/arm/emcraft-sf2.rst F: docs/system/arm/emcraft-sf2.rst
F: tests/functional/test_arm_emcraft_sf2.py
ASPEED BMCs ASPEED BMCs
M: Cédric Le Goater <clg@kaod.org> M: Cédric Le Goater <clg@kaod.org>
@@ -1174,7 +1146,6 @@ F: hw/*/microbit*.c
F: include/hw/*/nrf51*.h F: include/hw/*/nrf51*.h
F: include/hw/*/microbit*.h F: include/hw/*/microbit*.h
F: tests/qtest/microbit-test.c F: tests/qtest/microbit-test.c
F: tests/functional/test_arm_microbit.py
F: docs/system/arm/nrf.rst F: docs/system/arm/nrf.rst
ARM PL011 Rust device ARM PL011 Rust device
@@ -1206,10 +1177,9 @@ HP-PARISC Machines
------------------ ------------------
HP B160L, HP C3700 HP B160L, HP C3700
M: Richard Henderson <richard.henderson@linaro.org> M: Richard Henderson <richard.henderson@linaro.org>
M: Helge Deller <deller@gmx.de> R: Helge Deller <deller@gmx.de>
S: Maintained S: Odd Fixes
F: configs/devices/hppa-softmmu/default.mak F: configs/devices/hppa-softmmu/default.mak
F: hw/char/diva-gsp.c
F: hw/display/artist.c F: hw/display/artist.c
F: hw/hppa/ F: hw/hppa/
F: hw/input/lasips2.c F: hw/input/lasips2.c
@@ -1224,7 +1194,6 @@ F: include/hw/pci-host/astro.h
F: include/hw/pci-host/dino.h F: include/hw/pci-host/dino.h
F: pc-bios/hppa-firmware.img F: pc-bios/hppa-firmware.img
F: roms/seabios-hppa/ F: roms/seabios-hppa/
F: tests/functional/test_hppa_seabios.py
LoongArch Machines LoongArch Machines
------------------ ------------------
@@ -1310,7 +1279,6 @@ F: include/hw/intc/goldfish_pic.h
F: include/hw/intc/m68k_irqc.h F: include/hw/intc/m68k_irqc.h
F: include/hw/misc/virt_ctrl.h F: include/hw/misc/virt_ctrl.h
F: docs/specs/virt-ctlr.rst F: docs/specs/virt-ctlr.rst
F: tests/functional/test_m68k_tuxrun.py
MicroBlaze Machines MicroBlaze Machines
------------------- -------------------
@@ -1410,6 +1378,12 @@ F: hw/openrisc/openrisc_sim.c
PowerPC Machines PowerPC Machines
---------------- ----------------
405 (ref405ep)
L: qemu-ppc@nongnu.org
S: Orphan
F: hw/ppc/ppc405*
F: tests/functional/test_ppc_405.py
Bamboo Bamboo
L: qemu-ppc@nongnu.org L: qemu-ppc@nongnu.org
S: Orphan S: Orphan
@@ -1465,7 +1439,6 @@ F: include/hw/pci-host/uninorth.h
F: include/hw/input/adb* F: include/hw/input/adb*
F: pc-bios/qemu_vga.ndrv F: pc-bios/qemu_vga.ndrv
F: tests/functional/test_ppc_mac.py F: tests/functional/test_ppc_mac.py
F: tests/functional/test_ppc64_mac99.py
Old World (g3beige) Old World (g3beige)
M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> M: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
@@ -1540,7 +1513,6 @@ F: include/hw/ppc/pnv*
F: include/hw/pci-host/pnv* F: include/hw/pci-host/pnv*
F: include/hw/ssi/pnv_spi* F: include/hw/ssi/pnv_spi*
F: pc-bios/skiboot.lid F: pc-bios/skiboot.lid
F: pc-bios/pnv-pnor.bin
F: tests/qtest/pnv* F: tests/qtest/pnv*
F: tests/functional/test_ppc64_powernv.py F: tests/functional/test_ppc64_powernv.py
@@ -1573,7 +1545,6 @@ F: pc-bios/canyonlands.dt[sb]
F: pc-bios/u-boot-sam460ex-20100605.bin F: pc-bios/u-boot-sam460ex-20100605.bin
F: roms/u-boot-sam460ex F: roms/u-boot-sam460ex
F: docs/system/ppc/amigang.rst F: docs/system/ppc/amigang.rst
F: tests/functional/test_ppc_sam460ex.py
pegasos2 pegasos2
M: BALATON Zoltan <balaton@eik.bme.hu> M: BALATON Zoltan <balaton@eik.bme.hu>
@@ -1615,6 +1586,7 @@ F: include/hw/riscv/opentitan.h
F: include/hw/*/ibex_*.h F: include/hw/*/ibex_*.h
Microchip PolarFire SoC Icicle Kit Microchip PolarFire SoC Icicle Kit
M: Bin Meng <bmeng.cn@gmail.com>
L: qemu-riscv@nongnu.org L: qemu-riscv@nongnu.org
S: Supported S: Supported
F: docs/system/riscv/microchip-icicle-kit.rst F: docs/system/riscv/microchip-icicle-kit.rst
@@ -1641,6 +1613,7 @@ F: include/hw/char/shakti_uart.h
SiFive Machines SiFive Machines
M: Alistair Francis <Alistair.Francis@wdc.com> M: Alistair Francis <Alistair.Francis@wdc.com>
M: Bin Meng <bmeng.cn@gmail.com>
M: Palmer Dabbelt <palmer@dabbelt.com> M: Palmer Dabbelt <palmer@dabbelt.com>
L: qemu-riscv@nongnu.org L: qemu-riscv@nongnu.org
S: Supported S: Supported
@@ -1648,12 +1621,6 @@ F: docs/system/riscv/sifive_u.rst
F: hw/*/*sifive*.c F: hw/*/*sifive*.c
F: include/hw/*/*sifive*.h F: include/hw/*/*sifive*.h
AMD Microblaze-V Generic Board
M: Sai Pavan Boddu <sai.pavan.boddu@amd.com>
S: Maintained
F: hw/riscv/microblaze-v-generic.c
F: docs/system/riscv/microblaze-v-generic.rst
RX Machines RX Machines
----------- -----------
rx-gdbsim rx-gdbsim
@@ -1676,7 +1643,7 @@ F: hw/pci-host/sh_pci.c
F: hw/timer/sh_timer.c F: hw/timer/sh_timer.c
F: include/hw/sh4/sh_intc.h F: include/hw/sh4/sh_intc.h
F: include/hw/timer/tmu012.h F: include/hw/timer/tmu012.h
F: tests/functional/test_sh4*_r2d.py F: tests/functional/test_sh4_r2d.py
F: tests/functional/test_sh4_tuxrun.py F: tests/functional/test_sh4_tuxrun.py
SPARC Machines SPARC Machines
@@ -1894,7 +1861,7 @@ R: Yanan Wang <wangyanan55@huawei.com>
R: Zhao Liu <zhao1.liu@intel.com> R: Zhao Liu <zhao1.liu@intel.com>
S: Supported S: Supported
F: hw/core/cpu-common.c F: hw/core/cpu-common.c
F: hw/core/cpu-system.c F: hw/core/cpu-sysemu.c
F: hw/core/machine-qmp-cmds.c F: hw/core/machine-qmp-cmds.c
F: hw/core/machine.c F: hw/core/machine.c
F: hw/core/machine-smp.c F: hw/core/machine-smp.c
@@ -1907,7 +1874,7 @@ F: qapi/machine-target.json
F: include/hw/boards.h F: include/hw/boards.h
F: include/hw/core/cpu.h F: include/hw/core/cpu.h
F: include/hw/cpu/cluster.h F: include/hw/cpu/cluster.h
F: include/system/numa.h F: include/sysemu/numa.h
F: tests/functional/test_cpu_queries.py F: tests/functional/test_cpu_queries.py
F: tests/functional/test_empty_cpu_model.py F: tests/functional/test_empty_cpu_model.py
F: tests/unit/test-smp-parse.c F: tests/unit/test-smp-parse.c
@@ -1947,7 +1914,6 @@ F: tests/qtest/fuzz-sb16-test.c
Xilinx CAN Xilinx CAN
M: Francisco Iglesias <francisco.iglesias@amd.com> M: Francisco Iglesias <francisco.iglesias@amd.com>
M: Vikram Garhwal <vikram.garhwal@bytedance.com>
S: Maintained S: Maintained
F: hw/net/can/xlnx-* F: hw/net/can/xlnx-*
F: include/hw/net/xlnx-* F: include/hw/net/xlnx-*
@@ -2004,11 +1970,10 @@ F: include/hw/hyperv/vmbus*.h
OMAP OMAP
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
L: qemu-arm@nongnu.org L: qemu-arm@nongnu.org
S: Odd Fixes S: Maintained
F: hw/*/omap* F: hw/*/omap*
F: include/hw/arm/omap.h F: include/hw/arm/omap.h
F: docs/system/arm/sx1.rst F: docs/system/arm/sx1.rst
F: tests/functional/test_arm_sx1.py
IPack IPack
M: Alberto Garcia <berto@igalia.com> M: Alberto Garcia <berto@igalia.com>
@@ -2185,17 +2150,10 @@ M: Cédric Le Goater <clg@redhat.com>
S: Supported S: Supported
F: hw/vfio/* F: hw/vfio/*
F: include/hw/vfio/ F: include/hw/vfio/
F: docs/igd-assign.txt
F: docs/devel/migration/vfio.rst F: docs/devel/migration/vfio.rst
F: qapi/vfio.json F: qapi/vfio.json
vfio-igd
M: Alex Williamson <alex.williamson@redhat.com>
M: Cédric Le Goater <clg@redhat.com>
M: Tomita Moeko <tomitamoeko@gmail.com>
S: Supported
F: hw/vfio/igd.c
F: docs/igd-assign.txt
vfio-ccw vfio-ccw
M: Eric Farman <farman@linux.ibm.com> M: Eric Farman <farman@linux.ibm.com>
M: Matthew Rosato <mjrosato@linux.ibm.com> M: Matthew Rosato <mjrosato@linux.ibm.com>
@@ -2225,9 +2183,9 @@ M: Eric Auger <eric.auger@redhat.com>
M: Zhenzhong Duan <zhenzhong.duan@intel.com> M: Zhenzhong Duan <zhenzhong.duan@intel.com>
S: Supported S: Supported
F: backends/iommufd.c F: backends/iommufd.c
F: include/system/iommufd.h F: include/sysemu/iommufd.h
F: backends/host_iommu_device.c F: backends/host_iommu_device.c
F: include/system/host_iommu_device.h F: include/sysemu/host_iommu_device.h
F: include/qemu/chardev_open.h F: include/qemu/chardev_open.h
F: util/chardev_open.c F: util/chardev_open.c
F: docs/devel/vfio-iommufd.rst F: docs/devel/vfio-iommufd.rst
@@ -2237,16 +2195,12 @@ M: Michael S. Tsirkin <mst@redhat.com>
R: Stefano Garzarella <sgarzare@redhat.com> R: Stefano Garzarella <sgarzare@redhat.com>
S: Supported S: Supported
F: hw/*/*vhost* F: hw/*/*vhost*
F: docs/interop/vhost-user* F: docs/interop/vhost-user.json
F: docs/system/devices/vhost-user* F: docs/interop/vhost-user.rst
F: contrib/vhost-user-*/ F: contrib/vhost-user-*/
F: backends/*vhost* F: backends/vhost-user.c
F: include/system/vhost-user-backend.h F: include/sysemu/vhost-user-backend.h
F: include/hw/virtio/vhost*
F: include/*/vhost*
F: subprojects/libvhost-user/ F: subprojects/libvhost-user/
F: block/export/vhost-user*
F: util/vhost-user-server.c
vhost-shadow-virtqueue vhost-shadow-virtqueue
R: Eugenio Pérez <eperezma@redhat.com> R: Eugenio Pérez <eperezma@redhat.com>
@@ -2273,13 +2227,12 @@ F: docs/interop/virtio-balloon-stats.rst
F: hw/virtio/virtio-balloon*.c F: hw/virtio/virtio-balloon*.c
F: include/hw/virtio/virtio-balloon.h F: include/hw/virtio/virtio-balloon.h
F: system/balloon.c F: system/balloon.c
F: include/system/balloon.h F: include/sysemu/balloon.h
F: tests/qtest/virtio-balloon-test.c F: tests/qtest/virtio-balloon-test.c
F: tests/functional/test_virtio_balloon.py
virtio-9p virtio-9p
M: Greg Kurz <groug@kaod.org>
M: Christian Schoenebeck <qemu_oss@crudebyte.com> M: Christian Schoenebeck <qemu_oss@crudebyte.com>
R: Greg Kurz <groug@kaod.org>
S: Maintained S: Maintained
W: https://wiki.qemu.org/Documentation/9p W: https://wiki.qemu.org/Documentation/9p
F: hw/9pfs/ F: hw/9pfs/
@@ -2287,6 +2240,7 @@ X: hw/9pfs/xen-9p*
F: fsdev/ F: fsdev/
F: tests/qtest/virtio-9p-test.c F: tests/qtest/virtio-9p-test.c
F: tests/qtest/libqos/virtio-9p* F: tests/qtest/libqos/virtio-9p*
T: git https://gitlab.com/gkurz/qemu.git 9p-next
T: git https://github.com/cschoenebeck/qemu.git 9p.next T: git https://github.com/cschoenebeck/qemu.git 9p.next
virtio-blk virtio-blk
@@ -2298,7 +2252,6 @@ F: hw/block/virtio-blk.c
F: hw/block/dataplane/* F: hw/block/dataplane/*
F: include/hw/virtio/virtio-blk-common.h F: include/hw/virtio/virtio-blk-common.h
F: tests/qtest/virtio-blk-test.c F: tests/qtest/virtio-blk-test.c
F: tests/functional/test_x86_64_hotplug_blk.py
T: git https://github.com/stefanha/qemu.git block T: git https://github.com/stefanha/qemu.git block
virtio-ccw virtio-ccw
@@ -2356,7 +2309,7 @@ R: Amit Shah <amit@kernel.org>
S: Supported S: Supported
F: hw/virtio/virtio-rng.c F: hw/virtio/virtio-rng.c
F: include/hw/virtio/virtio-rng.h F: include/hw/virtio/virtio-rng.h
F: include/system/rng*.h F: include/sysemu/rng*.h
F: backends/rng*.c F: backends/rng*.c
F: tests/qtest/virtio-rng-test.c F: tests/qtest/virtio-rng-test.c
@@ -2417,9 +2370,6 @@ F: include/hw/virtio/virtio-crypto.h
virtio based memory device virtio based memory device
M: David Hildenbrand <david@redhat.com> M: David Hildenbrand <david@redhat.com>
S: Supported S: Supported
F: hw/s390x/virtio-ccw-md.c
F: hw/s390x/virtio-ccw-md.h
F: hw/s390x/virtio-ccw-md-stubs.c
F: hw/virtio/virtio-md-pci.c F: hw/virtio/virtio-md-pci.c
F: include/hw/virtio/virtio-md-pci.h F: include/hw/virtio/virtio-md-pci.h
F: stubs/virtio-md-pci.c F: stubs/virtio-md-pci.c
@@ -2431,8 +2381,6 @@ W: https://virtio-mem.gitlab.io/
F: hw/virtio/virtio-mem.c F: hw/virtio/virtio-mem.c
F: hw/virtio/virtio-mem-pci.h F: hw/virtio/virtio-mem-pci.h
F: hw/virtio/virtio-mem-pci.c F: hw/virtio/virtio-mem-pci.c
F: hw/s390x/virtio-ccw-mem.c
F: hw/s390x/virtio-ccw-mem.h
F: include/hw/virtio/virtio-mem.h F: include/hw/virtio/virtio-mem.h
virtio-snd virtio-snd
@@ -2545,7 +2493,8 @@ F: hw/i2c/i2c_mux_pca954x.c
F: include/hw/i2c/i2c_mux_pca954x.h F: include/hw/i2c/i2c_mux_pca954x.h
pcf8574 pcf8574
S: Orphaned M: Dmitrii Sharikhin <d.sharikhin@yadro.com>
S: Maintained
F: hw/gpio/pcf8574.c F: hw/gpio/pcf8574.c
F: include/gpio/pcf8574.h F: include/gpio/pcf8574.h
@@ -2562,7 +2511,7 @@ M: Alex Bennée <alex.bennee@linaro.org>
S: Maintained S: Maintained
F: hw/core/guest-loader.c F: hw/core/guest-loader.c
F: docs/system/guest-loader.rst F: docs/system/guest-loader.rst
F: tests/functional/test_aarch64_xen.py F: tests/avocado/boot_xen.py
Intel Hexadecimal Object File Loader Intel Hexadecimal Object File Loader
M: Su Hang <suhang16@mails.ucas.ac.cn> M: Su Hang <suhang16@mails.ucas.ac.cn>
@@ -2628,7 +2577,6 @@ F: hw/display/virtio-gpu*
F: hw/display/virtio-vga.* F: hw/display/virtio-vga.*
F: include/hw/virtio/virtio-gpu.h F: include/hw/virtio/virtio-gpu.h
F: docs/system/devices/virtio-gpu.rst F: docs/system/devices/virtio-gpu.rst
F: tests/functional/test_aarch64_virt_gpu.py
vhost-user-blk vhost-user-blk
M: Raphael Norwitz <raphael@enfabrica.net> M: Raphael Norwitz <raphael@enfabrica.net>
@@ -2664,11 +2612,6 @@ F: hw/display/edid*
F: include/hw/display/edid.h F: include/hw/display/edid.h
F: qemu-edid.c F: qemu-edid.c
macOS PV Graphics (apple-gfx)
M: Phil Dennis-Jordan <phil@philjordan.eu>
S: Maintained
F: hw/display/apple-gfx*
PIIX4 South Bridge (i82371AB) PIIX4 South Bridge (i82371AB)
M: Hervé Poussineau <hpoussin@reactos.org> M: Hervé Poussineau <hpoussin@reactos.org>
M: Philippe Mathieu-Daudé <philmd@linaro.org> M: Philippe Mathieu-Daudé <philmd@linaro.org>
@@ -2730,7 +2673,6 @@ F: include/hw/rx/
CAN bus subsystem and hardware CAN bus subsystem and hardware
M: Pavel Pisa <pisa@cmp.felk.cvut.cz> M: Pavel Pisa <pisa@cmp.felk.cvut.cz>
M: Francisco Iglesias <francisco.iglesias@amd.com> M: Francisco Iglesias <francisco.iglesias@amd.com>
M: Vikram Garhwal <vikram.garhwal@bytedance.com>
S: Maintained S: Maintained
W: https://canbus.pages.fel.cvut.cz/ W: https://canbus.pages.fel.cvut.cz/
F: net/can/* F: net/can/*
@@ -2816,27 +2758,6 @@ F: hw/hyperv/hv-balloon*.h
F: include/hw/hyperv/dynmem-proto.h F: include/hw/hyperv/dynmem-proto.h
F: include/hw/hyperv/hv-balloon.h F: include/hw/hyperv/hv-balloon.h
ivshmem-flat
M: Gustavo Romero <gustavo.romero@linaro.org>
S: Maintained
F: hw/misc/ivshmem-flat.c
F: include/hw/misc/ivshmem-flat.h
F: docs/system/devices/ivshmem-flat.rst
UEFI variable service
M: Gerd Hoffmann <kraxel@redhat.com>
S: Maintained
F: hw/uefi/
F: include/hw/uefi/
VMapple
M: Alexander Graf <agraf@csgraf.de>
M: Phil Dennis-Jordan <phil@philjordan.eu>
S: Maintained
F: hw/vmapple/*
F: include/hw/vmapple/*
F: docs/system/arm/vmapple.rst
Subsystems Subsystems
---------- ----------
Overall Audio backends Overall Audio backends
@@ -2845,7 +2766,7 @@ M: Marc-André Lureau <marcandre.lureau@redhat.com>
S: Odd Fixes S: Odd Fixes
F: audio/ F: audio/
X: audio/alsaaudio.c X: audio/alsaaudio.c
X: audio/coreaudio.m X: audio/coreaudio.c
X: audio/dsound* X: audio/dsound*
X: audio/jackaudio.c X: audio/jackaudio.c
X: audio/ossaudio.c X: audio/ossaudio.c
@@ -2867,7 +2788,7 @@ M: Philippe Mathieu-Daudé <philmd@linaro.org>
R: Christian Schoenebeck <qemu_oss@crudebyte.com> R: Christian Schoenebeck <qemu_oss@crudebyte.com>
R: Akihiko Odaki <akihiko.odaki@daynix.com> R: Akihiko Odaki <akihiko.odaki@daynix.com>
S: Odd Fixes S: Odd Fixes
F: audio/coreaudio.m F: audio/coreaudio.c
DSound Audio backend DSound Audio backend
M: Gerd Hoffmann <kraxel@redhat.com> M: Gerd Hoffmann <kraxel@redhat.com>
@@ -2913,7 +2834,7 @@ F: hw/block/
F: qapi/block*.json F: qapi/block*.json
F: qapi/transaction.json F: qapi/transaction.json
F: include/block/ F: include/block/
F: include/system/block-*.h F: include/sysemu/block-*.h
F: qemu-img* F: qemu-img*
F: docs/tools/qemu-img.rst F: docs/tools/qemu-img.rst
F: qemu-io* F: qemu-io*
@@ -3052,23 +2973,21 @@ M: Alistair Francis <alistair.francis@wdc.com>
R: David Gibson <david@gibson.dropbear.id.au> R: David Gibson <david@gibson.dropbear.id.au>
S: Maintained S: Maintained
F: system/device_tree.c F: system/device_tree.c
F: include/system/device_tree.h F: include/sysemu/device_tree.h
Dump Dump
S: Supported S: Supported
M: Marc-André Lureau <marcandre.lureau@redhat.com> M: Marc-André Lureau <marcandre.lureau@redhat.com>
R: Ani Sinha <anisinha@redhat.com>
F: dump/ F: dump/
F: hw/misc/vmcoreinfo.c F: hw/misc/vmcoreinfo.c
F: include/hw/misc/vmcoreinfo.h F: include/hw/misc/vmcoreinfo.h
F: include/qemu/win_dump_defs F: include/qemu/win_dump_defs
F: include/system/dump-arch.h F: include/sysemu/dump-arch.h
F: include/system/dump.h F: include/sysemu/dump.h
F: qapi/dump.json F: qapi/dump.json
F: scripts/dump-guest-memory.py F: scripts/dump-guest-memory.py
F: stubs/dump.c F: stubs/dump.c
F: docs/specs/vmcoreinfo.rst F: docs/specs/vmcoreinfo.rst
F: tests/qtest/vmcoreinfo-test.c
Error reporting Error reporting
M: Markus Armbruster <armbru@redhat.com> M: Markus Armbruster <armbru@redhat.com>
@@ -3110,7 +3029,7 @@ F: include/exec/memop.h
F: include/exec/memory.h F: include/exec/memory.h
F: include/exec/ram_addr.h F: include/exec/ram_addr.h
F: include/exec/ramblock.h F: include/exec/ramblock.h
F: include/system/memory_mapping.h F: include/sysemu/memory_mapping.h
F: system/dma-helpers.c F: system/dma-helpers.c
F: system/ioport.c F: system/ioport.c
F: system/memory.c F: system/memory.c
@@ -3163,8 +3082,8 @@ Main loop
M: Paolo Bonzini <pbonzini@redhat.com> M: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained S: Maintained
F: include/qemu/main-loop.h F: include/qemu/main-loop.h
F: include/system/runstate.h F: include/sysemu/runstate.h
F: include/system/runstate-action.h F: include/sysemu/runstate-action.h
F: util/main-loop.c F: util/main-loop.c
F: util/qemu-timer*.c F: util/qemu-timer*.c
F: system/vl.c F: system/vl.c
@@ -3227,7 +3146,7 @@ M: David Hildenbrand <david@redhat.com>
M: Igor Mammedov <imammedo@redhat.com> M: Igor Mammedov <imammedo@redhat.com>
S: Maintained S: Maintained
F: backends/hostmem*.c F: backends/hostmem*.c
F: include/system/hostmem.h F: include/sysemu/hostmem.h
F: docs/system/vm-templating.rst F: docs/system/vm-templating.rst
T: git https://gitlab.com/ehabkost/qemu.git machine-next T: git https://gitlab.com/ehabkost/qemu.git machine-next
@@ -3235,7 +3154,7 @@ Cryptodev Backends
M: Gonglei <arei.gonglei@huawei.com> M: Gonglei <arei.gonglei@huawei.com>
M: zhenwei pi <pizhenwei@bytedance.com> M: zhenwei pi <pizhenwei@bytedance.com>
S: Maintained S: Maintained
F: include/system/cryptodev*.h F: include/sysemu/cryptodev*.h
F: backends/cryptodev*.c F: backends/cryptodev*.c
F: qapi/cryptodev.json F: qapi/cryptodev.json
@@ -3273,6 +3192,8 @@ S: Supported
F: qapi/ F: qapi/
X: qapi/*.json X: qapi/*.json
F: include/qapi/ F: include/qapi/
X: include/qapi/qmp/
F: include/qapi/qmp/dispatch.h
F: tests/qapi-schema/ F: tests/qapi-schema/
F: tests/unit/test-*-visitor.c F: tests/unit/test-*-visitor.c
F: tests/unit/test-qapi-*.c F: tests/unit/test-qapi-*.c
@@ -3296,7 +3217,8 @@ QObject
M: Markus Armbruster <armbru@redhat.com> M: Markus Armbruster <armbru@redhat.com>
S: Supported S: Supported
F: qobject/ F: qobject/
F: include/qobject/ F: include/qapi/qmp/
X: include/qapi/qmp/dispatch.h
F: scripts/coccinelle/qobject.cocci F: scripts/coccinelle/qobject.cocci
F: tests/unit/check-qdict.c F: tests/unit/check-qdict.c
F: tests/unit/check-qjson.c F: tests/unit/check-qjson.c
@@ -3381,7 +3303,7 @@ M: Laurent Vivier <lvivier@redhat.com>
R: Paolo Bonzini <pbonzini@redhat.com> R: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained S: Maintained
F: system/qtest.c F: system/qtest.c
F: include/system/qtest.h F: include/sysemu/qtest.h
F: accel/qtest/ F: accel/qtest/
F: tests/qtest/ F: tests/qtest/
F: docs/devel/qgraph.rst F: docs/devel/qgraph.rst
@@ -3421,7 +3343,6 @@ F: rust/rustfmt.toml
Rust-related patches CC here Rust-related patches CC here
L: qemu-rust@nongnu.org L: qemu-rust@nongnu.org
F: tests/docker/test-rust
F: rust/ F: rust/
SLIRP SLIRP
@@ -3433,7 +3354,7 @@ T: git https://people.debian.org/~sthibault/qemu.git slirp
Stats Stats
S: Orphan S: Orphan
F: include/system/stats.h F: include/sysemu/stats.h
F: stats/ F: stats/
F: qapi/stats.json F: qapi/stats.json
@@ -3474,7 +3395,7 @@ S: Maintained
F: system/tpm* F: system/tpm*
F: hw/tpm/* F: hw/tpm/*
F: include/hw/acpi/tpm.h F: include/hw/acpi/tpm.h
F: include/system/tpm* F: include/sysemu/tpm*
F: qapi/tpm.json F: qapi/tpm.json
F: backends/tpm/ F: backends/tpm/
F: tests/qtest/*tpm* F: tests/qtest/*tpm*
@@ -3485,7 +3406,7 @@ SPDM
M: Alistair Francis <alistair.francis@wdc.com> M: Alistair Francis <alistair.francis@wdc.com>
S: Maintained S: Maintained
F: backends/spdm-socket.c F: backends/spdm-socket.c
F: include/system/spdm-socket.h F: include/sysemu/spdm-socket.h
Checkpatch Checkpatch
S: Odd Fixes S: Odd Fixes
@@ -3501,13 +3422,11 @@ F: include/migration/
F: include/qemu/userfaultfd.h F: include/qemu/userfaultfd.h
F: migration/ F: migration/
F: scripts/vmstate-static-checker.py F: scripts/vmstate-static-checker.py
F: tests/functional/test_migration.py
F: tests/vmstate-static-checker-data/ F: tests/vmstate-static-checker-data/
F: tests/qtest/migration/
F: tests/qtest/migration-* F: tests/qtest/migration-*
F: docs/devel/migration/ F: docs/devel/migration/
F: qapi/migration.json F: qapi/migration.json
F: tests/migration-stress/ F: tests/migration/
F: util/userfaultfd.c F: util/userfaultfd.c
X: migration/rdma* X: migration/rdma*
@@ -3521,10 +3440,10 @@ Migration dirty limit and dirty page rate
M: Hyman Huang <yong.huang@smartx.com> M: Hyman Huang <yong.huang@smartx.com>
S: Maintained S: Maintained
F: system/dirtylimit.c F: system/dirtylimit.c
F: include/system/dirtylimit.h F: include/sysemu/dirtylimit.h
F: migration/dirtyrate.c F: migration/dirtyrate.c
F: migration/dirtyrate.h F: migration/dirtyrate.h
F: include/system/dirtyrate.h F: include/sysemu/dirtyrate.h
F: docs/devel/migration/dirty-limit.rst F: docs/devel/migration/dirty-limit.rst
Detached LUKS header Detached LUKS header
@@ -3552,7 +3471,7 @@ Seccomp
M: Daniel P. Berrange <berrange@redhat.com> M: Daniel P. Berrange <berrange@redhat.com>
S: Odd Fixes S: Odd Fixes
F: system/qemu-seccomp.c F: system/qemu-seccomp.c
F: include/system/seccomp.h F: include/sysemu/seccomp.h
F: tests/unit/test-seccomp.c F: tests/unit/test-seccomp.c
Cryptography Cryptography
@@ -3657,22 +3576,21 @@ F: net/filter-mirror.c
F: tests/qtest/test-filter* F: tests/qtest/test-filter*
Record/replay Record/replay
M: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
R: Paolo Bonzini <pbonzini@redhat.com> R: Paolo Bonzini <pbonzini@redhat.com>
R: Alex Bennée <alex.bennee@linaro.org>
W: https://wiki.qemu.org/Features/record-replay W: https://wiki.qemu.org/Features/record-replay
S: Odd Fixes S: Supported
F: replay/* F: replay/*
F: block/blkreplay.c F: block/blkreplay.c
F: net/filter-replay.c F: net/filter-replay.c
F: include/exec/replay-core.h F: include/exec/replay-core.h
F: include/system/replay.h F: include/sysemu/replay.h
F: docs/devel/replay.rst F: docs/devel/replay.rst
F: docs/system/replay.rst F: docs/system/replay.rst
F: stubs/replay.c F: stubs/replay.c
F: tests/avocado/replay_kernel.py F: tests/avocado/replay_kernel.py
F: tests/avocado/replay_linux.py F: tests/avocado/replay_linux.py
F: tests/avocado/reverse_debugging.py F: tests/avocado/reverse_debugging.py
F: tests/functional/*replay*.py
F: qapi/replay.json F: qapi/replay.json
IOVA Tree IOVA Tree
@@ -3756,15 +3674,13 @@ S: Supported
F: hw/i386/intel_iommu.c F: hw/i386/intel_iommu.c
F: hw/i386/intel_iommu_internal.h F: hw/i386/intel_iommu_internal.h
F: include/hw/i386/intel_iommu.h F: include/hw/i386/intel_iommu.h
F: tests/functional/test_intel_iommu.py
F: tests/qtest/intel-iommu-test.c
AMD-Vi Emulation AMD-Vi Emulation
S: Orphan S: Orphan
F: hw/i386/amd_iommu.? F: hw/i386/amd_iommu.?
OpenSBI Firmware OpenSBI Firmware
L: qemu-riscv@nongnu.org M: Bin Meng <bmeng.cn@gmail.com>
S: Supported S: Supported
F: pc-bios/opensbi-* F: pc-bios/opensbi-*
F: .gitlab-ci.d/opensbi.yml F: .gitlab-ci.d/opensbi.yml
@@ -3786,7 +3702,7 @@ M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained S: Maintained
F: include/hw/resettable.h F: include/hw/resettable.h
F: include/hw/core/resetcontainer.h F: include/hw/core/resetcontainer.h
F: include/system/reset.h F: include/sysemu/reset.h
F: hw/core/reset.c F: hw/core/reset.c
F: hw/core/resettable.c F: hw/core/resettable.c
F: hw/core/resetcontainer.c F: hw/core/resetcontainer.c
@@ -3797,7 +3713,6 @@ Overall usermode emulation
M: Riku Voipio <riku.voipio@iki.fi> M: Riku Voipio <riku.voipio@iki.fi>
S: Maintained S: Maintained
F: accel/tcg/user-exec*.c F: accel/tcg/user-exec*.c
F: hw/core/cpu-user.c
F: include/user/ F: include/user/
F: common-user/ F: common-user/
@@ -4207,6 +4122,7 @@ M: Alex Bennée <alex.bennee@linaro.org>
T: git https://gitlab.com/stsquad/qemu testing/next T: git https://gitlab.com/stsquad/qemu testing/next
M: Philippe Mathieu-Daudé <philmd@linaro.org> M: Philippe Mathieu-Daudé <philmd@linaro.org>
M: Thomas Huth <thuth@redhat.com> M: Thomas Huth <thuth@redhat.com>
R: Wainer dos Santos Moschetta <wainersm@redhat.com>
S: Maintained S: Maintained
F: .github/workflows/lockdown.yml F: .github/workflows/lockdown.yml
F: .gitlab-ci.yml F: .gitlab-ci.yml
@@ -4234,8 +4150,6 @@ W: https://cirrus-ci.com/github/qemu/qemu
Functional testing framework Functional testing framework
M: Thomas Huth <thuth@redhat.com> M: Thomas Huth <thuth@redhat.com>
R: Philippe Mathieu-Daudé <philmd@linaro.org> R: Philippe Mathieu-Daudé <philmd@linaro.org>
R: Daniel P. Berrange <berrange@redhat.com>
F: docs/devel/testing/functional.rst
F: tests/functional/qemu_test/ F: tests/functional/qemu_test/
Windows Hosted Continuous Integration Windows Hosted Continuous Integration
@@ -4252,6 +4166,8 @@ F: tests/tcg/Makefile.target
Integration Testing with the Avocado framework Integration Testing with the Avocado framework
W: https://trello.com/b/6Qi1pxVn/avocado-qemu W: https://trello.com/b/6Qi1pxVn/avocado-qemu
R: Cleber Rosa <crosa@redhat.com> R: Cleber Rosa <crosa@redhat.com>
R: Philippe Mathieu-Daudé <philmd@linaro.org>
R: Wainer dos Santos Moschetta <wainersm@redhat.com>
S: Odd Fixes S: Odd Fixes
F: tests/avocado/ F: tests/avocado/
@@ -4323,7 +4239,6 @@ S: Orphan
F: po/*.po F: po/*.po
Sphinx documentation configuration and build machinery Sphinx documentation configuration and build machinery
M: John Snow <jsnow@redhat.com>
M: Peter Maydell <peter.maydell@linaro.org> M: Peter Maydell <peter.maydell@linaro.org>
S: Maintained S: Maintained
F: docs/conf.py F: docs/conf.py

View File

@@ -1 +1 @@
9.2.92 9.2.3

View File

@@ -16,5 +16,4 @@ config KVM
config XEN config XEN
bool bool
select FSDEV_9P if VIRTFS select FSDEV_9P if VIRTFS
select PCI_EXPRESS_GENERIC_BRIDGE
select XEN_BUS select XEN_BUS

View File

@@ -29,7 +29,7 @@
#include "qemu/thread.h" #include "qemu/thread.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "system/accel-blocker.h" #include "sysemu/accel-blocker.h"
static QemuLockCnt accel_in_ioctl_lock; static QemuLockCnt accel_in_ioctl_lock;
static QemuEvent accel_in_ioctl_event; static QemuEvent accel_in_ioctl_event;

View File

@@ -26,8 +26,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/accel.h" #include "qemu/accel.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "system/accel-ops.h" #include "sysemu/cpus.h"
#include "system/cpus.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "accel-system.h" #include "accel-system.h"

View File

@@ -27,7 +27,7 @@
#include "qemu/accel.h" #include "qemu/accel.h"
#include "cpu.h" #include "cpu.h"
#include "accel/accel-cpu-target.h" #include "hw/core/accel-cpu.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
#include "accel-system.h" #include "accel-system.h"
@@ -38,7 +38,6 @@ static const TypeInfo accel_type = {
.parent = TYPE_OBJECT, .parent = TYPE_OBJECT,
.class_size = sizeof(AccelClass), .class_size = sizeof(AccelClass),
.instance_size = sizeof(AccelState), .instance_size = sizeof(AccelState),
.abstract = true,
}; };
/* Lookup AccelClass from opt_name. Returns NULL if not found */ /* Lookup AccelClass from opt_name. Returns NULL if not found */
@@ -113,20 +112,22 @@ void accel_init_interfaces(AccelClass *ac)
void accel_cpu_instance_init(CPUState *cpu) void accel_cpu_instance_init(CPUState *cpu)
{ {
if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) { CPUClass *cc = CPU_GET_CLASS(cpu);
cpu->cc->accel_cpu->cpu_instance_init(cpu);
if (cc->accel_cpu && cc->accel_cpu->cpu_instance_init) {
cc->accel_cpu->cpu_instance_init(cpu);
} }
} }
bool accel_cpu_common_realize(CPUState *cpu, Error **errp) bool accel_cpu_common_realize(CPUState *cpu, Error **errp)
{ {
CPUClass *cc = CPU_GET_CLASS(cpu);
AccelState *accel = current_accel(); AccelState *accel = current_accel();
AccelClass *acc = ACCEL_GET_CLASS(accel); AccelClass *acc = ACCEL_GET_CLASS(accel);
/* target specific realization */ /* target specific realization */
if (cpu->cc->accel_cpu if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize
&& cpu->cc->accel_cpu->cpu_target_realize && !cc->accel_cpu->cpu_target_realize(cpu, errp)) {
&& !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) {
return false; return false;
} }

View File

@@ -13,7 +13,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/rcu.h" #include "qemu/rcu.h"
#include "system/cpus.h" #include "sysemu/cpus.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"

View File

@@ -54,11 +54,10 @@
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "gdbstub/enums.h" #include "gdbstub/enums.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "system/accel-ops.h" #include "sysemu/cpus.h"
#include "system/cpus.h" #include "sysemu/hvf.h"
#include "system/hvf.h" #include "sysemu/hvf_int.h"
#include "system/hvf_int.h" #include "sysemu/runstate.h"
#include "system/runstate.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
HVFState *hvf_state; HVFState *hvf_state;

View File

@@ -10,8 +10,8 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "system/hvf.h" #include "sysemu/hvf.h"
#include "system/hvf_int.h" #include "sysemu/hvf_int.h"
const char *hvf_return_string(hv_return_t ret) const char *hvf_return_string(hv_return_t ret)
{ {

View File

@@ -16,11 +16,10 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "system/accel-ops.h" #include "sysemu/kvm.h"
#include "system/kvm.h" #include "sysemu/kvm_int.h"
#include "system/kvm_int.h" #include "sysemu/runstate.h"
#include "system/runstate.h" #include "sysemu/cpus.h"
#include "system/cpus.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "qapi/error.h" #include "qapi/error.h"

View File

@@ -28,10 +28,10 @@
#include "hw/pci/msix.h" #include "hw/pci/msix.h"
#include "hw/s390x/adapter.h" #include "hw/s390x/adapter.h"
#include "gdbstub/enums.h" #include "gdbstub/enums.h"
#include "system/kvm_int.h" #include "sysemu/kvm_int.h"
#include "system/runstate.h" #include "sysemu/runstate.h"
#include "system/cpus.h" #include "sysemu/cpus.h"
#include "system/accel-blocker.h" #include "sysemu/accel-blocker.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "exec/memory.h" #include "exec/memory.h"
#include "exec/ram_addr.h" #include "exec/ram_addr.h"
@@ -42,15 +42,15 @@
#include "qapi/visitor.h" #include "qapi/visitor.h"
#include "qapi/qapi-types-common.h" #include "qapi/qapi-types-common.h"
#include "qapi/qapi-visit-common.h" #include "qapi/qapi-visit-common.h"
#include "system/reset.h" #include "sysemu/reset.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "system/hw_accel.h" #include "sysemu/hw_accel.h"
#include "kvm-cpus.h" #include "kvm-cpus.h"
#include "system/dirtylimit.h" #include "sysemu/dirtylimit.h"
#include "qemu/range.h" #include "qemu/range.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "system/stats.h" #include "sysemu/stats.h"
/* This check must be after config-host.h is included */ /* This check must be after config-host.h is included */
#ifdef CONFIG_EVENTFD #ifdef CONFIG_EVENTFD
@@ -1288,7 +1288,7 @@ static void kvm_unpoison_all(void *param)
QLIST_FOREACH_SAFE(page, &hwpoison_page_list, list, next_page) { QLIST_FOREACH_SAFE(page, &hwpoison_page_list, list, next_page) {
QLIST_REMOVE(page, list); QLIST_REMOVE(page, list);
qemu_ram_remap(page->ram_addr); qemu_ram_remap(page->ram_addr, TARGET_PAGE_SIZE);
g_free(page); g_free(page);
} }
} }
@@ -3010,17 +3010,17 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool to_private)
MemoryRegion *mr; MemoryRegion *mr;
RAMBlock *rb; RAMBlock *rb;
void *addr; void *addr;
int ret = -EINVAL; int ret = -1;
trace_kvm_convert_memory(start, size, to_private ? "shared_to_private" : "private_to_shared"); trace_kvm_convert_memory(start, size, to_private ? "shared_to_private" : "private_to_shared");
if (!QEMU_PTR_IS_ALIGNED(start, qemu_real_host_page_size()) || if (!QEMU_PTR_IS_ALIGNED(start, qemu_real_host_page_size()) ||
!QEMU_PTR_IS_ALIGNED(size, qemu_real_host_page_size())) { !QEMU_PTR_IS_ALIGNED(size, qemu_real_host_page_size())) {
return ret; return -1;
} }
if (!size) { if (!size) {
return ret; return -1;
} }
section = memory_region_find(get_system_memory(), start, size); section = memory_region_find(get_system_memory(), start, size);
@@ -3038,7 +3038,7 @@ int kvm_convert_memory(hwaddr start, hwaddr size, bool to_private)
if (!to_private) { if (!to_private) {
return 0; return 0;
} }
return ret; return -1;
} }
if (!memory_region_has_guest_memfd(mr)) { if (!memory_region_has_guest_memfd(mr)) {

View File

@@ -10,6 +10,8 @@
#ifndef KVM_CPUS_H #ifndef KVM_CPUS_H
#define KVM_CPUS_H #define KVM_CPUS_H
#include "sysemu/cpus.h"
int kvm_init_vcpu(CPUState *cpu, Error **errp); int kvm_init_vcpu(CPUState *cpu, Error **errp);
int kvm_cpu_exec(CPUState *cpu); int kvm_cpu_exec(CPUState *cpu);
void kvm_destroy_vcpu(CPUState *cpu); void kvm_destroy_vcpu(CPUState *cpu);

View File

@@ -18,9 +18,8 @@
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/config-file.h" #include "qemu/config-file.h"
#include "qemu/accel.h" #include "qemu/accel.h"
#include "system/accel-ops.h" #include "sysemu/qtest.h"
#include "system/qtest.h" #include "sysemu/cpus.h"
#include "system/cpus.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/kvm.h" #include "sysemu/kvm.h"
#include "hw/pci/msi.h" #include "hw/pci/msi.h"
KVMState *kvm_state; KVMState *kvm_state;

View File

@@ -14,6 +14,10 @@
#include "exec/tb-flush.h" #include "exec/tb-flush.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
void tb_flush(CPUState *cpu)
{
}
G_NORETURN void cpu_loop_exit(CPUState *cpu) G_NORETURN void cpu_loop_exit(CPUState *cpu)
{ {
g_assert_not_reached(); g_assert_not_reached();

View File

@@ -6,7 +6,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/xen.h" #include "sysemu/xen.h"
#include "qapi/qapi-commands-migration.h" #include "qapi/qapi-commands-migration.h"
bool xen_allowed; bool xen_allowed;

View File

@@ -18,45 +18,13 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "exec/log.h" #include "sysemu/cpus.h"
#include "system/tcg.h" #include "sysemu/tcg.h"
#include "qemu/plugin.h" #include "qemu/plugin.h"
#include "internal-common.h" #include "internal-common.h"
bool tcg_allowed; bool tcg_allowed;
bool tcg_cflags_has(CPUState *cpu, uint32_t flags)
{
return cpu->tcg_cflags & flags;
}
void tcg_cflags_set(CPUState *cpu, uint32_t flags)
{
cpu->tcg_cflags |= flags;
}
uint32_t curr_cflags(CPUState *cpu)
{
uint32_t cflags = cpu->tcg_cflags;
/*
* Record gdb single-step. We should be exiting the TB by raising
* EXCP_DEBUG, but to simplify other tests, disable chaining too.
*
* For singlestep and -d nochain, suppress goto_tb so that
* we can log -d cpu,exec after every TB.
*/
if (unlikely(cpu->singlestep_enabled)) {
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
} else if (qatomic_read(&one_insn_per_tb)) {
cflags |= CF_NO_GOTO_TB | 1;
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
cflags |= CF_NO_GOTO_TB;
}
return cflags;
}
/* exit the current TB, but without causing any exception to be raised */ /* exit the current TB, but without causing any exception to be raised */
void cpu_loop_exit_noexc(CPUState *cpu) void cpu_loop_exit_noexc(CPUState *cpu)
{ {

View File

@@ -21,27 +21,24 @@
#include "qemu/qemu-print.h" #include "qemu/qemu-print.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/type-helpers.h" #include "qapi/type-helpers.h"
#include "hw/core/cpu.h" #include "hw/core/tcg-cpu-ops.h"
#include "accel/tcg/cpu-ops.h"
#include "trace.h" #include "trace.h"
#include "disas/disas.h" #include "disas/disas.h"
#include "exec/cpu-common.h" #include "exec/exec-all.h"
#include "exec/page-protection.h"
#include "exec/translation-block.h"
#include "tcg/tcg.h" #include "tcg/tcg.h"
#include "qemu/atomic.h" #include "qemu/atomic.h"
#include "qemu/rcu.h" #include "qemu/rcu.h"
#include "exec/log.h" #include "exec/log.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "sysemu/cpus.h"
#include "exec/cpu-all.h" #include "exec/cpu-all.h"
#include "system/cpu-timers.h" #include "sysemu/cpu-timers.h"
#include "exec/replay-core.h" #include "exec/replay-core.h"
#include "system/tcg.h" #include "sysemu/tcg.h"
#include "exec/helper-proto-common.h" #include "exec/helper-proto-common.h"
#include "tb-jmp-cache.h" #include "tb-jmp-cache.h"
#include "tb-hash.h" #include "tb-hash.h"
#include "tb-context.h" #include "tb-context.h"
#include "tb-internal.h"
#include "internal-common.h" #include "internal-common.h"
#include "internal-target.h" #include "internal-target.h"
@@ -147,6 +144,38 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
} }
#endif /* CONFIG USER ONLY */ #endif /* CONFIG USER ONLY */
bool tcg_cflags_has(CPUState *cpu, uint32_t flags)
{
return cpu->tcg_cflags & flags;
}
void tcg_cflags_set(CPUState *cpu, uint32_t flags)
{
cpu->tcg_cflags |= flags;
}
uint32_t curr_cflags(CPUState *cpu)
{
uint32_t cflags = cpu->tcg_cflags;
/*
* Record gdb single-step. We should be exiting the TB by raising
* EXCP_DEBUG, but to simplify other tests, disable chaining too.
*
* For singlestep and -d nochain, suppress goto_tb so that
* we can log -d cpu,exec after every TB.
*/
if (unlikely(cpu->singlestep_enabled)) {
cflags |= CF_NO_GOTO_TB | CF_NO_GOTO_PTR | CF_SINGLE_STEP | 1;
} else if (qatomic_read(&one_insn_per_tb)) {
cflags |= CF_NO_GOTO_TB | 1;
} else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
cflags |= CF_NO_GOTO_TB;
}
return cflags;
}
struct tb_desc { struct tb_desc {
vaddr pc; vaddr pc;
uint64_t cs_base; uint64_t cs_base;
@@ -216,20 +245,7 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, vaddr pc,
return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp); return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
} }
/** /* Might cause an exception, so have a longjmp destination ready */
* tb_lookup:
* @cpu: CPU that will execute the returned translation block
* @pc: guest PC
* @cs_base: arch-specific value associated with translation block
* @flags: arch-specific translation block flags
* @cflags: CF_* flags
*
* Look up a translation block inside the QHT using @pc, @cs_base, @flags and
* @cflags. Uses @cpu's tb_jmp_cache. Might cause an exception, so have a
* longjmp destination ready.
*
* Returns: an existing translation block or NULL.
*/
static inline TranslationBlock *tb_lookup(CPUState *cpu, vaddr pc, static inline TranslationBlock *tb_lookup(CPUState *cpu, vaddr pc,
uint64_t cs_base, uint32_t flags, uint64_t cs_base, uint32_t flags,
uint32_t cflags) uint32_t cflags)
@@ -417,16 +433,6 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
return tb->tc.ptr; return tb->tc.ptr;
} }
/* Return the current PC from CPU, which may be cached in TB. */
static vaddr log_pc(CPUState *cpu, const TranslationBlock *tb)
{
if (tb_cflags(tb) & CF_PCREL) {
return cpu->cc->get_pc(cpu);
} else {
return tb->pc;
}
}
/* Execute a TB, and fix up the CPU state afterwards if necessary */ /* Execute a TB, and fix up the CPU state afterwards if necessary */
/* /*
* Disable CFI checks. * Disable CFI checks.
@@ -1068,13 +1074,11 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
if (!tcg_target_initialized) { if (!tcg_target_initialized) {
/* Check mandatory TCGCPUOps handlers */ /* Check mandatory TCGCPUOps handlers */
const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
assert(tcg_ops->cpu_exec_halt); assert(cpu->cc->tcg_ops->cpu_exec_halt);
assert(tcg_ops->cpu_exec_interrupt); assert(cpu->cc->tcg_ops->cpu_exec_interrupt);
#endif /* !CONFIG_USER_ONLY */ #endif /* !CONFIG_USER_ONLY */
assert(tcg_ops->translate_code); cpu->cc->tcg_ops->initialize();
tcg_ops->initialize();
tcg_target_initialized = true; tcg_target_initialized = true;
} }

View File

@@ -19,7 +19,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "accel/tcg/cpu-ops.h" #include "hw/core/tcg-cpu-ops.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/page-protection.h" #include "exec/page-protection.h"
#include "exec/memory.h" #include "exec/memory.h"
@@ -37,16 +37,16 @@
#include "exec/helper-proto-common.h" #include "exec/helper-proto-common.h"
#include "qemu/atomic.h" #include "qemu/atomic.h"
#include "qemu/atomic128.h" #include "qemu/atomic128.h"
#include "tb-internal.h" #include "exec/translate-all.h"
#include "trace.h" #include "trace.h"
#include "tb-hash.h" #include "tb-hash.h"
#include "tb-internal.h"
#include "internal-common.h" #include "internal-common.h"
#include "internal-target.h" #include "internal-target.h"
#ifdef CONFIG_PLUGIN #ifdef CONFIG_PLUGIN
#include "qemu/plugin-memory.h" #include "qemu/plugin-memory.h"
#endif #endif
#include "tcg/tcg-ldst.h" #include "tcg/tcg-ldst.h"
#include "tcg/oversized-guest.h"
/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ /* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */
/* #define DEBUG_TLB */ /* #define DEBUG_TLB */
@@ -104,15 +104,26 @@ static inline uint64_t tlb_read_idx(const CPUTLBEntry *entry,
{ {
/* Do not rearrange the CPUTLBEntry structure members. */ /* Do not rearrange the CPUTLBEntry structure members. */
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_read) != QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_read) !=
MMU_DATA_LOAD * sizeof(uintptr_t)); MMU_DATA_LOAD * sizeof(uint64_t));
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_write) != QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_write) !=
MMU_DATA_STORE * sizeof(uintptr_t)); MMU_DATA_STORE * sizeof(uint64_t));
QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_code) != QEMU_BUILD_BUG_ON(offsetof(CPUTLBEntry, addr_code) !=
MMU_INST_FETCH * sizeof(uintptr_t)); MMU_INST_FETCH * sizeof(uint64_t));
const uintptr_t *ptr = &entry->addr_idx[access_type]; #if TARGET_LONG_BITS == 32
/* Use qatomic_read, in case of addr_write; only care about low bits. */
const uint32_t *ptr = (uint32_t *)&entry->addr_idx[access_type];
ptr += HOST_BIG_ENDIAN;
return qatomic_read(ptr);
#else
const uint64_t *ptr = &entry->addr_idx[access_type];
# if TCG_OVERSIZED_GUEST
return *ptr;
# else
/* ofs might correspond to .addr_write, so use qatomic_read */ /* ofs might correspond to .addr_write, so use qatomic_read */
return qatomic_read(ptr); return qatomic_read(ptr);
# endif
#endif
} }
static inline uint64_t tlb_addr_write(const CPUTLBEntry *entry) static inline uint64_t tlb_addr_write(const CPUTLBEntry *entry)
@@ -892,8 +903,16 @@ static void tlb_reset_dirty_range_locked(CPUTLBEntry *tlb_entry,
addr &= TARGET_PAGE_MASK; addr &= TARGET_PAGE_MASK;
addr += tlb_entry->addend; addr += tlb_entry->addend;
if ((addr - start) < length) { if ((addr - start) < length) {
#if TARGET_LONG_BITS == 32
uint32_t *ptr_write = (uint32_t *)&tlb_entry->addr_write;
ptr_write += HOST_BIG_ENDIAN;
qatomic_set(ptr_write, *ptr_write | TLB_NOTDIRTY);
#elif TCG_OVERSIZED_GUEST
tlb_entry->addr_write |= TLB_NOTDIRTY;
#else
qatomic_set(&tlb_entry->addr_write, qatomic_set(&tlb_entry->addr_write,
tlb_entry->addr_write | TLB_NOTDIRTY); tlb_entry->addr_write | TLB_NOTDIRTY);
#endif
} }
} }
} }
@@ -1180,7 +1199,7 @@ void tlb_set_page_full(CPUState *cpu, int mmu_idx,
void tlb_set_page_with_attrs(CPUState *cpu, vaddr addr, void tlb_set_page_with_attrs(CPUState *cpu, vaddr addr,
hwaddr paddr, MemTxAttrs attrs, int prot, hwaddr paddr, MemTxAttrs attrs, int prot,
int mmu_idx, vaddr size) int mmu_idx, uint64_t size)
{ {
CPUTLBEntryFull full = { CPUTLBEntryFull full = {
.phys_addr = paddr, .phys_addr = paddr,
@@ -1195,35 +1214,12 @@ void tlb_set_page_with_attrs(CPUState *cpu, vaddr addr,
void tlb_set_page(CPUState *cpu, vaddr addr, void tlb_set_page(CPUState *cpu, vaddr addr,
hwaddr paddr, int prot, hwaddr paddr, int prot,
int mmu_idx, vaddr size) int mmu_idx, uint64_t size)
{ {
tlb_set_page_with_attrs(cpu, addr, paddr, MEMTXATTRS_UNSPECIFIED, tlb_set_page_with_attrs(cpu, addr, paddr, MEMTXATTRS_UNSPECIFIED,
prot, mmu_idx, size); prot, mmu_idx, size);
} }
/**
* tlb_hit_page: return true if page aligned @addr is a hit against the
* TLB entry @tlb_addr
*
* @addr: virtual address to test (must be page aligned)
* @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value)
*/
static inline bool tlb_hit_page(uint64_t tlb_addr, vaddr addr)
{
return addr == (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK));
}
/**
* tlb_hit: return true if @addr is a hit against the TLB entry @tlb_addr
*
* @addr: virtual address to test (need not be page aligned)
* @tlb_addr: TLB entry address (a CPUTLBEntry addr_read/write/code value)
*/
static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr)
{
return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK);
}
/* /*
* Note: tlb_fill_align() can trigger a resize of the TLB. * Note: tlb_fill_align() can trigger a resize of the TLB.
* This means that all of the caller's prior references to the TLB table * This means that all of the caller's prior references to the TLB table
@@ -1508,7 +1504,7 @@ void *probe_access(CPUArchState *env, vaddr addr, int size,
return host; return host;
} }
void *tlb_vaddr_to_host(CPUArchState *env, vaddr addr, void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
MMUAccessType access_type, int mmu_idx) MMUAccessType access_type, int mmu_idx)
{ {
CPUTLBEntryFull *full; CPUTLBEntryFull *full;

View File

@@ -27,16 +27,16 @@
#include "migration/vmstate.h" #include "migration/vmstate.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "system/cpus.h" #include "sysemu/cpus.h"
#include "system/qtest.h" #include "sysemu/qtest.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/seqlock.h" #include "qemu/seqlock.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "system/runstate.h" #include "sysemu/runstate.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "system/cpu-timers.h" #include "sysemu/cpu-timers.h"
#include "system/cpu-timers-internal.h" #include "sysemu/cpu-timers-internal.h"
/* /*
* ICOUNT: Instruction Counter * ICOUNT: Instruction Counter
@@ -48,8 +48,6 @@ static bool icount_sleep = true;
/* Arbitrarily pick 1MIPS as the minimum allowable speed. */ /* Arbitrarily pick 1MIPS as the minimum allowable speed. */
#define MAX_ICOUNT_SHIFT 10 #define MAX_ICOUNT_SHIFT 10
bool icount_align_option;
/* Do not count executed instructions */ /* Do not count executed instructions */
ICountMode use_icount = ICOUNT_DISABLED; ICountMode use_icount = ICOUNT_DISABLED;

View File

@@ -17,8 +17,6 @@ extern int64_t max_advance;
extern bool one_insn_per_tb; extern bool one_insn_per_tb;
extern bool icount_align_option;
/* /*
* Return true if CS is not running in parallel with other cpus, either * Return true if CS is not running in parallel with other cpus, either
* because there are no other cpus or we are within an exclusive context. * because there are no other cpus or we are within an exclusive context.
@@ -55,23 +53,7 @@ TranslationBlock *tb_link_page(TranslationBlock *tb);
void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
uintptr_t host_pc); uintptr_t host_pc);
/**
* tlb_init - initialize a CPU's TLB
* @cpu: CPU whose TLB should be initialized
*/
void tlb_init(CPUState *cpu);
/**
* tlb_destroy - destroy a CPU's TLB
* @cpu: CPU whose TLB should be destroyed
*/
void tlb_destroy(CPUState *cpu);
bool tcg_exec_realizefn(CPUState *cpu, Error **errp); bool tcg_exec_realizefn(CPUState *cpu, Error **errp);
void tcg_exec_unrealizefn(CPUState *cpu); void tcg_exec_unrealizefn(CPUState *cpu);
/* current cflags for hashing/comparison */
uint32_t curr_cflags(CPUState *cpu);
void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr);
#endif #endif

View File

@@ -10,9 +10,7 @@
#define ACCEL_TCG_INTERNAL_TARGET_H #define ACCEL_TCG_INTERNAL_TARGET_H
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/translation-block.h" #include "exec/translate-all.h"
#include "tb-internal.h"
#include "tcg-target-mo.h"
/* /*
* Access to the various translations structures need to be serialised * Access to the various translations structures need to be serialised
@@ -38,9 +36,50 @@ static inline void page_table_config_init(void) { }
void page_table_config_init(void); void page_table_config_init(void);
#endif #endif
#ifndef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
/*
* For user-only, page_protect sets the page read-only.
* Since most execution is already on read-only pages, and we'd need to
* account for other TBs on the same page, defer undoing any page protection
* until we receive the write fault.
*/
static inline void tb_lock_page0(tb_page_addr_t p0)
{
page_protect(p0);
}
static inline void tb_lock_page1(tb_page_addr_t p0, tb_page_addr_t p1)
{
page_protect(p1);
}
static inline void tb_unlock_page1(tb_page_addr_t p0, tb_page_addr_t p1) { }
static inline void tb_unlock_pages(TranslationBlock *tb) { }
#else
void tb_lock_page0(tb_page_addr_t);
void tb_lock_page1(tb_page_addr_t, tb_page_addr_t);
void tb_unlock_page1(tb_page_addr_t, tb_page_addr_t);
void tb_unlock_pages(TranslationBlock *);
#endif
#ifdef CONFIG_SOFTMMU
void tb_invalidate_phys_range_fast(ram_addr_t ram_addr,
unsigned size,
uintptr_t retaddr);
G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
#endif /* CONFIG_USER_ONLY */ #endif /* CONFIG_SOFTMMU */
bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc);
/* Return the current PC from CPU, which may be cached in TB. */
static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb)
{
if (tb_cflags(tb) & CF_PCREL) {
return cpu->cc->get_pc(cpu);
} else {
return tb->pc;
}
}
/** /**
* tcg_req_mo: * tcg_req_mo:

View File

@@ -1,13 +1,13 @@
common_ss.add(when: 'CONFIG_TCG', if_true: files( common_ss.add(when: 'CONFIG_TCG', if_true: files(
'cpu-exec-common.c', 'cpu-exec-common.c',
'tcg-runtime.c',
'tcg-runtime-gvec.c',
)) ))
tcg_specific_ss = ss.source_set() tcg_specific_ss = ss.source_set()
tcg_specific_ss.add(files( tcg_specific_ss.add(files(
'tcg-all.c', 'tcg-all.c',
'cpu-exec.c', 'cpu-exec.c',
'tb-maint.c', 'tb-maint.c',
'tcg-runtime-gvec.c',
'tcg-runtime.c',
'translate-all.c', 'translate-all.c',
'translator.c', 'translator.c',
)) ))
@@ -20,14 +20,17 @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_specific_ss)
specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files( specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files(
'cputlb.c', 'cputlb.c',
'watchpoint.c',
)) ))
system_ss.add(when: ['CONFIG_TCG'], if_true: files( system_ss.add(when: ['CONFIG_TCG'], if_true: files(
'icount-common.c', 'icount-common.c',
'monitor.c', 'monitor.c',
'tcg-accel-ops.c', ))
'tcg-accel-ops-icount.c',
'tcg-accel-ops-mttcg.c', tcg_module_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files(
'tcg-accel-ops-rr.c', 'tcg-accel-ops.c',
'watchpoint.c', 'tcg-accel-ops-mttcg.c',
'tcg-accel-ops-icount.c',
'tcg-accel-ops-rr.c',
)) ))

View File

@@ -13,8 +13,9 @@
#include "qapi/type-helpers.h" #include "qapi/type-helpers.h"
#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-machine.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include "system/cpu-timers.h" #include "sysemu/cpus.h"
#include "system/tcg.h" #include "sysemu/cpu-timers.h"
#include "sysemu/tcg.h"
#include "tcg/tcg.h" #include "tcg/tcg.h"
#include "internal-common.h" #include "internal-common.h"
#include "tb-context.h" #include "tb-context.h"

View File

@@ -102,15 +102,6 @@ static void gen_disable_mem_helper(void)
static TCGv_i32 gen_cpu_index(void) static TCGv_i32 gen_cpu_index(void)
{ {
/*
* Optimize when we run with a single vcpu. All values using cpu_index,
* including scoreboard index, will be optimized out.
* User-mode calls tb_flush when setting this flag. In system-mode, all
* vcpus are created before generating code.
*/
if (!tcg_cflags_has(current_cpu, CF_PARALLEL)) {
return tcg_constant_i32(current_cpu->cpu_index);
}
TCGv_i32 cpu_index = tcg_temp_ebb_new_i32(); TCGv_i32 cpu_index = tcg_temp_ebb_new_i32();
tcg_gen_ld_i32(cpu_index, tcg_env, tcg_gen_ld_i32(cpu_index, tcg_env,
-offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)); -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index));

View File

@@ -22,7 +22,6 @@
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/translation-block.h"
#include "qemu/xxhash.h" #include "qemu/xxhash.h"
#include "tb-jmp-cache.h" #include "tb-jmp-cache.h"

View File

@@ -1,89 +0,0 @@
/*
* TranslationBlock internal declarations (target specific)
*
* Copyright (c) 2003 Fabrice Bellard
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef ACCEL_TCG_TB_INTERNAL_TARGET_H
#define ACCEL_TCG_TB_INTERNAL_TARGET_H
#include "exec/cpu-all.h"
#include "exec/exec-all.h"
#include "exec/translation-block.h"
/*
* The true return address will often point to a host insn that is part of
* the next translated guest insn. Adjust the address backward to point to
* the middle of the call insn. Subtracting one would do the job except for
* several compressed mode architectures (arm, mips) which set the low bit
* to indicate the compressed mode; subtracting two works around that. It
* is also the case that there are no host isas that contain a call insn
* smaller than 4 bytes, so we don't worry about special-casing this.
*/
#define GETPC_ADJ 2
#ifdef CONFIG_SOFTMMU
#define CPU_TLB_DYN_MIN_BITS 6
#define CPU_TLB_DYN_DEFAULT_BITS 8
# if HOST_LONG_BITS == 32
/* Make sure we do not require a double-word shift for the TLB load */
# define CPU_TLB_DYN_MAX_BITS (32 - TARGET_PAGE_BITS)
# else /* HOST_LONG_BITS == 64 */
/*
* Assuming TARGET_PAGE_BITS==12, with 2**22 entries we can cover 2**(22+12) ==
* 2**34 == 16G of address space. This is roughly what one would expect a
* TLB to cover in a modern (as of 2018) x86_64 CPU. For instance, Intel
* Skylake's Level-2 STLB has 16 1G entries.
* Also, make sure we do not size the TLB past the guest's address space.
*/
# ifdef TARGET_PAGE_BITS_VARY
# define CPU_TLB_DYN_MAX_BITS \
MIN(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)
# else
# define CPU_TLB_DYN_MAX_BITS \
MIN_CONST(22, TARGET_VIRT_ADDR_SPACE_BITS - TARGET_PAGE_BITS)
# endif
# endif
#endif /* CONFIG_SOFTMMU */
#ifdef CONFIG_USER_ONLY
#include "user/page-protection.h"
/*
* For user-only, page_protect sets the page read-only.
* Since most execution is already on read-only pages, and we'd need to
* account for other TBs on the same page, defer undoing any page protection
* until we receive the write fault.
*/
static inline void tb_lock_page0(tb_page_addr_t p0)
{
page_protect(p0);
}
static inline void tb_lock_page1(tb_page_addr_t p0, tb_page_addr_t p1)
{
page_protect(p1);
}
static inline void tb_unlock_page1(tb_page_addr_t p0, tb_page_addr_t p1) { }
static inline void tb_unlock_pages(TranslationBlock *tb) { }
#else
void tb_lock_page0(tb_page_addr_t);
void tb_lock_page1(tb_page_addr_t, tb_page_addr_t);
void tb_unlock_page1(tb_page_addr_t, tb_page_addr_t);
void tb_unlock_pages(TranslationBlock *);
#endif
#ifdef CONFIG_SOFTMMU
void tb_invalidate_phys_range_fast(ram_addr_t ram_addr,
unsigned size,
uintptr_t retaddr);
#endif /* CONFIG_SOFTMMU */
bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc);
#endif

View File

@@ -25,17 +25,13 @@
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "exec/page-protection.h" #include "exec/page-protection.h"
#include "exec/tb-flush.h" #include "exec/tb-flush.h"
#include "tb-internal.h" #include "exec/translate-all.h"
#include "system/tcg.h" #include "sysemu/tcg.h"
#include "tcg/tcg.h" #include "tcg/tcg.h"
#include "tb-hash.h" #include "tb-hash.h"
#include "tb-context.h" #include "tb-context.h"
#include "tb-internal.h"
#include "internal-common.h" #include "internal-common.h"
#include "internal-target.h" #include "internal-target.h"
#ifdef CONFIG_USER_ONLY
#include "user/page-protection.h"
#endif
/* List iterators for lists of tagged pointers in TranslationBlock. */ /* List iterators for lists of tagged pointers in TranslationBlock. */

View File

@@ -24,11 +24,11 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "system/cpu-timers.h" #include "sysemu/cpu-timers.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "hw/core/cpu.h" #include "exec/exec-all.h"
#include "tcg-accel-ops.h" #include "tcg-accel-ops.h"
#include "tcg-accel-ops-icount.h" #include "tcg-accel-ops-icount.h"

View File

@@ -24,12 +24,13 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/tcg.h" #include "sysemu/tcg.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "system/cpu-timers.h" #include "sysemu/cpu-timers.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/notify.h" #include "qemu/notify.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "exec/exec-all.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "tcg/startup.h" #include "tcg/startup.h"
#include "tcg-accel-ops.h" #include "tcg-accel-ops.h"

View File

@@ -25,13 +25,13 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/lockable.h" #include "qemu/lockable.h"
#include "system/tcg.h" #include "sysemu/tcg.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "system/cpu-timers.h" #include "sysemu/cpu-timers.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/notify.h" #include "qemu/notify.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "exec/cpu-common.h" #include "exec/exec-all.h"
#include "tcg/startup.h" #include "tcg/startup.h"
#include "tcg-accel-ops.h" #include "tcg-accel-ops.h"
#include "tcg-accel-ops-rr.h" #include "tcg-accel-ops-rr.h"

View File

@@ -26,17 +26,15 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/accel-ops.h" #include "sysemu/tcg.h"
#include "system/tcg.h" #include "sysemu/replay.h"
#include "system/replay.h" #include "sysemu/cpu-timers.h"
#include "system/cpu-timers.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "exec/cputlb.h" #include "exec/exec-all.h"
#include "exec/hwaddr.h" #include "exec/hwaddr.h"
#include "exec/tb-flush.h" #include "exec/tb-flush.h"
#include "exec/translation-block.h"
#include "gdbstub/enums.h" #include "gdbstub/enums.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
@@ -121,9 +119,10 @@ static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
[GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS, [GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
}; };
CPUClass *cc = CPU_GET_CLASS(cpu);
int cputype = xlat[gdbtype]; int cputype = xlat[gdbtype];
if (cpu->cc->gdb_stop_before_watchpoint) { if (cc->gdb_stop_before_watchpoint) {
cputype |= BP_STOP_BEFORE_ACCESS; cputype |= BP_STOP_BEFORE_ACCESS;
} }
return cputype; return cputype;

View File

@@ -12,7 +12,7 @@
#ifndef TCG_ACCEL_OPS_H #ifndef TCG_ACCEL_OPS_H
#define TCG_ACCEL_OPS_H #define TCG_ACCEL_OPS_H
#include "system/cpus.h" #include "sysemu/cpus.h"
void tcg_cpu_destroy(CPUState *cpu); void tcg_cpu_destroy(CPUState *cpu);
int tcg_cpu_exec(CPUState *cpu); int tcg_cpu_exec(CPUState *cpu);

View File

@@ -24,24 +24,21 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/tcg.h" #include "sysemu/tcg.h"
#include "exec/replay-core.h" #include "exec/replay-core.h"
#include "system/cpu-timers.h" #include "sysemu/cpu-timers.h"
#include "tcg/startup.h" #include "tcg/startup.h"
#include "tcg/oversized-guest.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/accel.h" #include "qemu/accel.h"
#include "qemu/atomic.h" #include "qemu/atomic.h"
#include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-builtin-visit.h"
#include "qemu/units.h" #include "qemu/units.h"
#if defined(CONFIG_USER_ONLY) #if !defined(CONFIG_USER_ONLY)
#include "hw/qdev-core.h"
#else
#include "hw/boards.h" #include "hw/boards.h"
#endif #endif
#include "internal-common.h" #include "internal-common.h"
#include "cpu-param.h"
struct TCGState { struct TCGState {
AccelState parent_obj; AccelState parent_obj;
@@ -73,7 +70,7 @@ DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
static bool default_mttcg_enabled(void) static bool default_mttcg_enabled(void)
{ {
if (icount_enabled()) { if (icount_enabled() || TCG_OVERSIZED_GUEST) {
return false; return false;
} }
#ifdef TARGET_SUPPORTS_MTTCG #ifdef TARGET_SUPPORTS_MTTCG
@@ -127,10 +124,6 @@ static int tcg_init_machine(MachineState *ms)
tcg_prologue_init(); tcg_prologue_init();
#endif #endif
#ifdef CONFIG_USER_ONLY
qdev_create_fake_machine();
#endif
return 0; return 0;
} }
@@ -146,7 +139,9 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp)
TCGState *s = TCG_STATE(obj); TCGState *s = TCG_STATE(obj);
if (strcmp(value, "multi") == 0) { if (strcmp(value, "multi") == 0) {
if (icount_enabled()) { if (TCG_OVERSIZED_GUEST) {
error_setg(errp, "No MTTCG when guest word size > hosts");
} else if (icount_enabled()) {
error_setg(errp, "No MTTCG when icount is enabled"); error_setg(errp, "No MTTCG when icount is enabled");
} else { } else {
#ifndef TARGET_SUPPORTS_MTTCG #ifndef TARGET_SUPPORTS_MTTCG

View File

@@ -19,6 +19,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/host-utils.h" #include "qemu/host-utils.h"
#include "cpu.h"
#include "exec/helper-proto-common.h" #include "exec/helper-proto-common.h"
#include "tcg/tcg-gvec-desc.h" #include "tcg/tcg-gvec-desc.h"

View File

@@ -23,9 +23,13 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/host-utils.h" #include "qemu/host-utils.h"
#include "exec/cpu-common.h" #include "cpu.h"
#include "exec/helper-proto-common.h" #include "exec/helper-proto-common.h"
#include "accel/tcg/getpc.h" #include "exec/cpu_ldst.h"
#include "exec/exec-all.h"
#include "disas/disas.h"
#include "exec/log.h"
#include "tcg/tcg.h"
#define HELPER_H "accel/tcg/tcg-runtime.h" #define HELPER_H "accel/tcg/tcg-runtime.h"
#include "exec/helper-info.c.inc" #include "exec/helper-info.c.inc"

View File

@@ -44,8 +44,7 @@
#endif #endif
#include "exec/cputlb.h" #include "exec/cputlb.h"
#include "exec/page-protection.h" #include "exec/translate-all.h"
#include "tb-internal.h"
#include "exec/translator.h" #include "exec/translator.h"
#include "exec/tb-flush.h" #include "exec/tb-flush.h"
#include "qemu/bitmap.h" #include "qemu/bitmap.h"
@@ -54,14 +53,14 @@
#include "qemu/cacheinfo.h" #include "qemu/cacheinfo.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "exec/log.h" #include "exec/log.h"
#include "system/cpu-timers.h" #include "sysemu/cpus.h"
#include "system/tcg.h" #include "sysemu/cpu-timers.h"
#include "sysemu/tcg.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "accel/tcg/cpu-ops.h" #include "hw/core/tcg-cpu-ops.h"
#include "tb-jmp-cache.h" #include "tb-jmp-cache.h"
#include "tb-hash.h" #include "tb-hash.h"
#include "tb-context.h" #include "tb-context.h"
#include "tb-internal.h"
#include "internal-common.h" #include "internal-common.h"
#include "internal-target.h" #include "internal-target.h"
#include "tcg/perf.h" #include "tcg/perf.h"
@@ -275,10 +274,8 @@ static int setjmp_gen_code(CPUArchState *env, TranslationBlock *tb,
tcg_func_start(tcg_ctx); tcg_func_start(tcg_ctx);
CPUState *cs = env_cpu(env); tcg_ctx->cpu = env_cpu(env);
tcg_ctx->cpu = cs; gen_intermediate_code(env_cpu(env), tb, max_insns, pc, host_pc);
cs->cc->tcg_ops->translate_code(cs, tb, max_insns, pc, host_pc);
assert(tb->size != 0); assert(tb->size != 0);
tcg_ctx->cpu = NULL; tcg_ctx->cpu = NULL;
*max_insns = tb->icount; *max_insns = tb->icount;
@@ -365,7 +362,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
/* /*
* Overflow of code_gen_buffer, or the current slice of it. * Overflow of code_gen_buffer, or the current slice of it.
* *
* TODO: We don't need to re-do tcg_ops->translate_code, nor * TODO: We don't need to re-do gen_intermediate_code, nor
* should we re-do the tcg optimization currently hidden * should we re-do the tcg optimization currently hidden
* inside tcg_gen_code. All that should be required is to * inside tcg_gen_code. All that should be required is to
* flush the TBs, allocate a new TB, re-initialize it per * flush the TBs, allocate a new TB, re-initialize it per
@@ -530,32 +527,23 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
tb_reset_jump(tb, 1); tb_reset_jump(tb, 1);
} }
/*
* Insert TB into the corresponding region tree before publishing it
* through QHT. Otherwise rewinding happened in the TB might fail to
* lookup itself using host PC.
*/
tcg_tb_insert(tb);
/* /*
* If the TB is not associated with a physical RAM page then it must be * If the TB is not associated with a physical RAM page then it must be
* a temporary one-insn TB. * a temporary one-insn TB, and we have nothing left to do. Return early
* * before attempting to link to other TBs or add to the lookup table.
* Such TBs must be added to region trees in order to make sure that
* restore_state_to_opc() - which on some architectures is not limited to
* rewinding, but also affects exception handling! - is called when such a
* TB causes an exception.
*
* At the same time, temporary one-insn TBs must be executed at most once,
* because subsequent reads from, e.g., I/O memory may return different
* values. So return early before attempting to link to other TBs or add
* to the QHT.
*/ */
if (tb_page_addr0(tb) == -1) { if (tb_page_addr0(tb) == -1) {
assert_no_pages_locked(); assert_no_pages_locked();
return tb; return tb;
} }
/*
* Insert TB into the corresponding region tree before publishing it
* through QHT. Otherwise rewinding happened in the TB might fail to
* lookup itself using host PC.
*/
tcg_tb_insert(tb);
/* /*
* No explicit memory barrier is required -- tb_link_page() makes the * No explicit memory barrier is required -- tb_link_page() makes the
* TB visible in a consistent state. * TB visible in a consistent state.
@@ -630,7 +618,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
* to account for the re-execution of the branch. * to account for the re-execution of the branch.
*/ */
n = 1; n = 1;
cc = cpu->cc; cc = CPU_GET_CLASS(cpu);
if (cc->tcg_ops->io_recompile_replay_branch && if (cc->tcg_ops->io_recompile_replay_branch &&
cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) { cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) {
cpu->neg.icount_decr.u16.low++; cpu->neg.icount_decr.u16.low++;
@@ -641,10 +629,9 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr)
* Exit the loop and potentially generate a new TB executing the * Exit the loop and potentially generate a new TB executing the
* just the I/O insns. We also limit instrumentation to memory * just the I/O insns. We also limit instrumentation to memory
* operations only (which execute after completion) so we don't * operations only (which execute after completion) so we don't
* double instrument the instruction. Also don't let an IRQ sneak * double instrument the instruction.
* in before we execute it.
*/ */
cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | CF_NOIRQ | n; cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | n;
if (qemu_loglevel_mask(CPU_LOG_EXEC)) { if (qemu_loglevel_mask(CPU_LOG_EXEC)) {
vaddr pc = cpu->cc->get_pc(cpu); vaddr pc = cpu->cc->get_pc(cpu);

View File

@@ -15,11 +15,9 @@
#include "exec/cpu_ldst.h" #include "exec/cpu_ldst.h"
#include "exec/plugin-gen.h" #include "exec/plugin-gen.h"
#include "exec/cpu_ldst.h" #include "exec/cpu_ldst.h"
#include "exec/tswap.h"
#include "tcg/tcg-op-common.h" #include "tcg/tcg-op-common.h"
#include "internal-target.h" #include "internal-target.h"
#include "disas/disas.h" #include "disas/disas.h"
#include "tb-internal.h"
static void set_can_do_io(DisasContextBase *db, bool val) static void set_can_do_io(DisasContextBase *db, bool val)
{ {
@@ -104,11 +102,6 @@ static void gen_tb_end(const TranslationBlock *tb, uint32_t cflags,
} }
} }
bool translator_is_same_page(const DisasContextBase *db, vaddr addr)
{
return ((addr ^ db->pc_first) & TARGET_PAGE_MASK) == 0;
}
bool translator_use_goto_tb(DisasContextBase *db, vaddr dest) bool translator_use_goto_tb(DisasContextBase *db, vaddr dest)
{ {
/* Suppress goto_tb if requested. */ /* Suppress goto_tb if requested. */
@@ -117,7 +110,7 @@ bool translator_use_goto_tb(DisasContextBase *db, vaddr dest)
} }
/* Check for the dest on the same page as the start of the TB. */ /* Check for the dest on the same page as the start of the TB. */
return translator_is_same_page(db, dest); return ((db->pc_first ^ dest) & TARGET_PAGE_MASK) == 0;
} }
void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns, void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns,

View File

@@ -1,7 +1,6 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "exec/replay-core.h" #include "exec/replay-core.h"
#include "internal-common.h"
void cpu_resume(CPUState *cpu) void cpu_resume(CPUState *cpu)
{ {
@@ -19,16 +18,6 @@ void cpu_exec_reset_hold(CPUState *cpu)
{ {
} }
/* User mode emulation does not support softmmu yet. */
void tlb_init(CPUState *cpu)
{
}
void tlb_destroy(CPUState *cpu)
{
}
/* User mode emulation does not support record/replay yet. */ /* User mode emulation does not support record/replay yet. */
bool replay_exception(void) bool replay_exception(void)

View File

@@ -17,27 +17,22 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "accel/tcg/cpu-ops.h" #include "hw/core/tcg-cpu-ops.h"
#include "disas/disas.h" #include "disas/disas.h"
#include "exec/vaddr.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "tcg/tcg.h" #include "tcg/tcg.h"
#include "qemu/bitops.h" #include "qemu/bitops.h"
#include "qemu/rcu.h" #include "qemu/rcu.h"
#include "exec/cpu_ldst.h" #include "exec/cpu_ldst.h"
#include "user/cpu_loop.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "user/page-protection.h" #include "exec/translate-all.h"
#include "exec/page-protection.h" #include "exec/page-protection.h"
#include "exec/helper-proto.h" #include "exec/helper-proto.h"
#include "qemu/atomic128.h" #include "qemu/atomic128.h"
#include "qemu/bswap.h"
#include "qemu/int128.h"
#include "trace.h" #include "trace.h"
#include "tcg/tcg-ldst.h" #include "tcg/tcg-ldst.h"
#include "internal-common.h" #include "internal-common.h"
#include "internal-target.h" #include "internal-target.h"
#include "tb-internal.h"
__thread uintptr_t helper_retaddr; __thread uintptr_t helper_retaddr;
@@ -701,7 +696,7 @@ void page_protect(tb_page_addr_t address)
* immediately exited. (We can only return 2 if the 'pc' argument is * immediately exited. (We can only return 2 if the 'pc' argument is
* non-zero.) * non-zero.)
*/ */
int page_unprotect(tb_page_addr_t address, uintptr_t pc) int page_unprotect(target_ulong address, uintptr_t pc)
{ {
PageFlagsNode *p; PageFlagsNode *p;
bool current_tb_invalidated; bool current_tb_invalidated;
@@ -972,85 +967,6 @@ static void *cpu_mmu_lookup(CPUState *cpu, vaddr addr,
return ret; return ret;
} }
/* physical memory access (slow version, mainly for debug) */
int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
void *ptr, size_t len, bool is_write)
{
int flags;
vaddr l, page;
uint8_t *buf = ptr;
ssize_t written;
int ret = -1;
int fd = -1;
mmap_lock();
while (len > 0) {
page = addr & TARGET_PAGE_MASK;
l = (page + TARGET_PAGE_SIZE) - addr;
if (l > len) {
l = len;
}
flags = page_get_flags(page);
if (!(flags & PAGE_VALID)) {
goto out_close;
}
if (is_write) {
if (flags & PAGE_WRITE) {
memcpy(g2h(cpu, addr), buf, l);
} else {
/* Bypass the host page protection using ptrace. */
if (fd == -1) {
fd = open("/proc/self/mem", O_WRONLY);
if (fd == -1) {
goto out;
}
}
/*
* If there is a TranslationBlock and we weren't bypassing the
* host page protection, the memcpy() above would SEGV,
* ultimately leading to page_unprotect(). So invalidate the
* translations manually. Both invalidation and pwrite() must
* be under mmap_lock() in order to prevent the creation of
* another TranslationBlock in between.
*/
tb_invalidate_phys_range(addr, addr + l - 1);
written = pwrite(fd, buf, l,
(off_t)(uintptr_t)g2h_untagged(addr));
if (written != l) {
goto out_close;
}
}
} else if (flags & PAGE_READ) {
memcpy(buf, g2h(cpu, addr), l);
} else {
/* Bypass the host page protection using ptrace. */
if (fd == -1) {
fd = open("/proc/self/mem", O_RDONLY);
if (fd == -1) {
goto out;
}
}
if (pread(fd, buf, l,
(off_t)(uintptr_t)g2h_untagged(addr)) != l) {
goto out_close;
}
}
len -= l;
buf += l;
addr += l;
}
ret = 0;
out_close:
if (fd != -1) {
close(fd);
}
out:
mmap_unlock();
return ret;
}
#include "ldst_atomicity.c.inc" #include "ldst_atomicity.c.inc"
static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi, static uint8_t do_ld1_mmu(CPUState *cpu, vaddr addr, MemOpIdx oi,

View File

@@ -1,11 +1,6 @@
/* /*
* TaskState helpers for QEMU * SPDX-FileContributor: Philippe Mathieu-Daudé <philmd@linaro.org>
* * SPDX-FileCopyrightText: 2023 Linaro Ltd.
* Copyright (c) 2023 Linaro Ltd.
*
* Authors:
* Philippe Mathieu-Daudé
*
* SPDX-License-Identifier: GPL-2.0-or-later * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
#ifndef ACCEL_TCG_VCPU_STATE_H #ifndef ACCEL_TCG_VCPU_STATE_H

View File

@@ -19,15 +19,13 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "exec/breakpoint.h" #include "qemu/error-report.h"
#include "exec/cpu-interrupt.h" #include "exec/exec-all.h"
#include "exec/page-protection.h" #include "exec/translate-all.h"
#include "exec/translation-block.h" #include "sysemu/tcg.h"
#include "system/tcg.h" #include "sysemu/replay.h"
#include "system/replay.h" #include "hw/core/tcg-cpu-ops.h"
#include "accel/tcg/cpu-ops.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "internal-common.h"
/* /*
* Return true if this watchpoint address matches the specified * Return true if this watchpoint address matches the specified
@@ -68,6 +66,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
MemTxAttrs attrs, int flags, uintptr_t ra) MemTxAttrs attrs, int flags, uintptr_t ra)
{ {
CPUClass *cc = CPU_GET_CLASS(cpu);
CPUWatchpoint *wp; CPUWatchpoint *wp;
assert(tcg_enabled()); assert(tcg_enabled());
@@ -83,9 +82,9 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
return; return;
} }
if (cpu->cc->tcg_ops->adjust_watchpoint_address) { if (cc->tcg_ops->adjust_watchpoint_address) {
/* this is currently used only by ARM BE32 */ /* this is currently used only by ARM BE32 */
addr = cpu->cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len); addr = cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len);
} }
assert((flags & ~BP_MEM_ACCESS) == 0); assert((flags & ~BP_MEM_ACCESS) == 0);
@@ -117,8 +116,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
wp->hitattrs = attrs; wp->hitattrs = attrs;
if (wp->flags & BP_CPU if (wp->flags & BP_CPU
&& cpu->cc->tcg_ops->debug_check_watchpoint && cc->tcg_ops->debug_check_watchpoint
&& !cpu->cc->tcg_ops->debug_check_watchpoint(cpu, wp)) { && !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) {
wp->flags &= ~BP_WATCHPOINT_HIT; wp->flags &= ~BP_WATCHPOINT_HIT;
continue; continue;
} }

View File

@@ -18,10 +18,9 @@
#include "hw/xen/xen_igd.h" #include "hw/xen/xen_igd.h"
#include "chardev/char.h" #include "chardev/char.h"
#include "qemu/accel.h" #include "qemu/accel.h"
#include "system/accel-ops.h" #include "sysemu/cpus.h"
#include "system/cpus.h" #include "sysemu/xen.h"
#include "system/xen.h" #include "sysemu/runstate.h"
#include "system/runstate.h"
#include "migration/misc.h" #include "migration/misc.h"
#include "migration/global_state.h" #include "migration/global_state.h"
#include "hw/boards.h" #include "hw/boards.h"

View File

@@ -27,7 +27,7 @@
#include "monitor/hmp.h" #include "monitor/hmp.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
static QLIST_HEAD (capture_list_head, CaptureState) capture_head; static QLIST_HEAD (capture_list_head, CaptureState) capture_head;

View File

@@ -32,15 +32,15 @@
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-visit-audio.h" #include "qapi/qapi-visit-audio.h"
#include "qapi/qapi-commands-audio.h" #include "qapi/qapi-commands-audio.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/log.h" #include "qemu/log.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/help_option.h" #include "qemu/help_option.h"
#include "system/system.h" #include "sysemu/sysemu.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "system/runstate.h" #include "sysemu/runstate.h"
#include "ui/qemu-spice.h" #include "ui/qemu-spice.h"
#include "trace.h" #include "trace.h"

View File

@@ -43,10 +43,9 @@
#define DBUS_DISPLAY1_AUDIO_PATH DBUS_DISPLAY1_ROOT "/Audio" #define DBUS_DISPLAY1_AUDIO_PATH DBUS_DISPLAY1_ROOT "/Audio"
#define DBUS_DEFAULT_AUDIO_NSAMPLES 480 #define DBUS_AUDIO_NSAMPLES 1024 /* could be configured? */
typedef struct DBusAudio { typedef struct DBusAudio {
Audiodev *dev;
GDBusObjectManagerServer *server; GDBusObjectManagerServer *server;
bool p2p; bool p2p;
GDBusObjectSkeleton *audio; GDBusObjectSkeleton *audio;
@@ -152,18 +151,6 @@ dbus_init_out_listener(QemuDBusDisplay1AudioOutListener *listener,
G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL);
} }
static guint
dbus_audio_get_nsamples(DBusAudio *da)
{
AudiodevDBusOptions *opts = &da->dev->u.dbus;
if (opts->has_nsamples && opts->nsamples) {
return opts->nsamples;
} else {
return DBUS_DEFAULT_AUDIO_NSAMPLES;
}
}
static int static int
dbus_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque) dbus_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque)
{ {
@@ -173,7 +160,7 @@ dbus_init_out(HWVoiceOut *hw, struct audsettings *as, void *drv_opaque)
QemuDBusDisplay1AudioOutListener *listener = NULL; QemuDBusDisplay1AudioOutListener *listener = NULL;
audio_pcm_init_info(&hw->info, as); audio_pcm_init_info(&hw->info, as);
hw->samples = dbus_audio_get_nsamples(da); hw->samples = DBUS_AUDIO_NSAMPLES;
audio_rate_start(&vo->rate); audio_rate_start(&vo->rate);
g_hash_table_iter_init(&iter, da->out_listeners); g_hash_table_iter_init(&iter, da->out_listeners);
@@ -287,7 +274,7 @@ dbus_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque)
QemuDBusDisplay1AudioInListener *listener = NULL; QemuDBusDisplay1AudioInListener *listener = NULL;
audio_pcm_init_info(&hw->info, as); audio_pcm_init_info(&hw->info, as);
hw->samples = dbus_audio_get_nsamples(da); hw->samples = DBUS_AUDIO_NSAMPLES;
audio_rate_start(&vo->rate); audio_rate_start(&vo->rate);
g_hash_table_iter_init(&iter, da->in_listeners); g_hash_table_iter_init(&iter, da->in_listeners);
@@ -412,7 +399,6 @@ dbus_audio_init(Audiodev *dev, Error **errp)
{ {
DBusAudio *da = g_new0(DBusAudio, 1); DBusAudio *da = g_new0(DBusAudio, 1);
da->dev = dev;
da->out_listeners = g_hash_table_new_full(g_str_hash, g_str_equal, da->out_listeners = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_object_unref); g_free, g_object_unref);
da->in_listeners = g_hash_table_new_full(g_str_hash, g_str_equal, da->in_listeners = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -538,17 +524,11 @@ dbus_audio_register_listener(AudioState *s,
); );
} }
GDBusConnectionFlags flags =
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER;
#ifdef WIN32
flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
#endif
listener_conn = listener_conn =
g_dbus_connection_new_sync( g_dbus_connection_new_sync(
G_IO_STREAM(socket_conn), G_IO_STREAM(socket_conn),
guid, guid,
flags, G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER,
NULL, NULL, &err); NULL, NULL, &err);
if (err) { if (err) {
error_report("Failed to setup peer connection: %s", err->message); error_report("Failed to setup peer connection: %s", err->message);
@@ -666,7 +646,6 @@ dbus_audio_set_server(AudioState *s, GDBusObjectManagerServer *server, bool p2p)
"swapped-signal::handle-register-out-listener", "swapped-signal::handle-register-out-listener",
dbus_audio_register_out_listener, s, dbus_audio_register_out_listener, s,
NULL); NULL);
qemu_dbus_display1_audio_set_nsamples(da->iface, dbus_audio_get_nsamples(da));
g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(da->audio), g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(da->audio),
G_DBUS_INTERFACE_SKELETON(da->iface)); G_DBUS_INTERFACE_SKELETON(da->iface));

View File

@@ -28,8 +28,8 @@
#include "qemu/filemonitor.h" #include "qemu/filemonitor.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "qapi/qapi-visit-authz.h" #include "qapi/qapi-visit-authz.h"
#include "qobject/qjson.h" #include "qapi/qmp/qjson.h"
#include "qobject/qobject.h" #include "qapi/qmp/qobject.h"
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"

View File

@@ -13,7 +13,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/confidential-guest-support.h" #include "exec/confidential-guest-support.h"
OBJECT_DEFINE_ABSTRACT_TYPE(ConfidentialGuestSupport, OBJECT_DEFINE_ABSTRACT_TYPE(ConfidentialGuestSupport,
confidential_guest_support, confidential_guest_support,

View File

@@ -22,7 +22,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/cryptodev.h" #include "sysemu/cryptodev.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "standard-headers/linux/virtio_crypto.h" #include "standard-headers/linux/virtio_crypto.h"

View File

@@ -14,7 +14,7 @@
#include "monitor/hmp.h" #include "monitor/hmp.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include "qapi/qapi-commands-cryptodev.h" #include "qapi/qapi-commands-cryptodev.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
void hmp_info_cryptodev(Monitor *mon, const QDict *qdict) void hmp_info_cryptodev(Monitor *mon, const QDict *qdict)

View File

@@ -30,7 +30,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/queue.h" #include "qemu/queue.h"
#include "qom/object.h" #include "qom/object.h"
#include "system/cryptodev.h" #include "sysemu/cryptodev.h"
#include "standard-headers/linux/virtio_crypto.h" #include "standard-headers/linux/virtio_crypto.h"
#include <keyutils.h> #include <keyutils.h>
@@ -330,8 +330,6 @@ static void cryptodev_lkcf_execute_task(CryptoDevLKCFTask *task)
cryptodev_lkcf_set_op_desc(&session->akcipher_opts, op_desc, cryptodev_lkcf_set_op_desc(&session->akcipher_opts, op_desc,
sizeof(op_desc), &local_error) != 0) { sizeof(op_desc), &local_error) != 0) {
error_report_err(local_error); error_report_err(local_error);
status = -VIRTIO_CRYPTO_ERR;
goto out;
} else { } else {
key_id = add_key(KCTL_KEY_TYPE_PKEY, "lkcf-backend-priv-key", key_id = add_key(KCTL_KEY_TYPE_PKEY, "lkcf-backend-priv-key",
p8info, p8info_len, KCTL_KEY_RING); p8info, p8info_len, KCTL_KEY_RING);
@@ -348,7 +346,6 @@ static void cryptodev_lkcf_execute_task(CryptoDevLKCFTask *task)
session->key, session->keylen, session->key, session->keylen,
&local_error); &local_error);
if (!akcipher) { if (!akcipher) {
error_report_err(local_error);
status = -VIRTIO_CRYPTO_ERR; status = -VIRTIO_CRYPTO_ERR;
goto out; goto out;
} }

View File

@@ -27,9 +27,9 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "hw/virtio/vhost-user.h" #include "hw/virtio/vhost-user.h"
#include "standard-headers/linux/virtio_crypto.h" #include "standard-headers/linux/virtio_crypto.h"
#include "system/cryptodev-vhost.h" #include "sysemu/cryptodev-vhost.h"
#include "chardev/char-fe.h" #include "chardev/char-fe.h"
#include "system/cryptodev-vhost-user.h" #include "sysemu/cryptodev-vhost-user.h"
#include "qom/object.h" #include "qom/object.h"

View File

@@ -24,13 +24,13 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-bus.h"
#include "system/cryptodev-vhost.h" #include "sysemu/cryptodev-vhost.h"
#ifdef CONFIG_VHOST_CRYPTO #ifdef CONFIG_VHOST_CRYPTO
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "hw/virtio/virtio-crypto.h" #include "hw/virtio/virtio-crypto.h"
#include "system/cryptodev-vhost-user.h" #include "sysemu/cryptodev-vhost-user.h"
uint64_t uint64_t
cryptodev_vhost_get_max_queues( cryptodev_vhost_get_max_queues(

View File

@@ -22,8 +22,8 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/cryptodev.h" #include "sysemu/cryptodev.h"
#include "system/stats.h" #include "sysemu/stats.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qapi-commands-cryptodev.h" #include "qapi/qapi-commands-cryptodev.h"
#include "qapi/qapi-types-stats.h" #include "qapi/qapi-types-stats.h"
@@ -97,7 +97,7 @@ static int qmp_query_cryptodev_foreach(Object *obj, void *data)
QCryptodevInfoList *qmp_query_cryptodev(Error **errp) QCryptodevInfoList *qmp_query_cryptodev(Error **errp)
{ {
QCryptodevInfoList *list = NULL; QCryptodevInfoList *list = NULL;
Object *objs = object_get_container("objects"); Object *objs = container_get(object_get_root(), "/objects");
object_child_foreach(objs, qmp_query_cryptodev_foreach, &list); object_child_foreach(objs, qmp_query_cryptodev_foreach, &list);
@@ -557,7 +557,7 @@ static void cryptodev_backend_stats_cb(StatsResultList **result,
switch (target) { switch (target) {
case STATS_TARGET_CRYPTODEV: case STATS_TARGET_CRYPTODEV:
{ {
Object *objs = object_get_container("objects"); Object *objs = container_get(object_get_root(), "/objects");
StatsArgs stats_args; StatsArgs stats_args;
stats_args.result.stats = result; stats_args.result.stats = result;
stats_args.names = names; stats_args.names = names;

View File

@@ -10,7 +10,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/host_iommu_device.h" #include "sysemu/host_iommu_device.h"
OBJECT_DEFINE_ABSTRACT_TYPE(HostIOMMUDevice, OBJECT_DEFINE_ABSTRACT_TYPE(HostIOMMUDevice,
host_iommu_device, host_iommu_device,

View File

@@ -14,7 +14,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "system/hostmem.h" #include "sysemu/hostmem.h"
#include "hw/i386/hostmem-epc.h" #include "hw/i386/hostmem-epc.h"
static bool static bool
@@ -36,7 +36,7 @@ sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
backend->aligned = true; backend->aligned = true;
name = object_get_canonical_path(OBJECT(backend)); name = object_get_canonical_path(OBJECT(backend));
ram_flags = (backend->share ? RAM_SHARED : RAM_PRIVATE) | RAM_PROTECTED; ram_flags = (backend->share ? RAM_SHARED : 0) | RAM_PROTECTED;
return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name,
backend->size, ram_flags, fd, 0, errp); backend->size, ram_flags, fd, 0, errp);
} }

View File

@@ -15,7 +15,7 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/madvise.h" #include "qemu/madvise.h"
#include "system/hostmem.h" #include "sysemu/hostmem.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "qom/object.h" #include "qom/object.h"
#include "qapi/visitor.h" #include "qapi/visitor.h"
@@ -82,7 +82,7 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
backend->aligned = true; backend->aligned = true;
name = host_memory_backend_get_name(backend); name = host_memory_backend_get_name(backend);
ram_flags = backend->share ? RAM_SHARED : RAM_PRIVATE; ram_flags = backend->share ? RAM_SHARED : 0;
ram_flags |= fb->readonly ? RAM_READONLY_FD : 0; ram_flags |= fb->readonly ? RAM_READONLY_FD : 0;
ram_flags |= fb->rom == ON_OFF_AUTO_ON ? RAM_READONLY : 0; ram_flags |= fb->rom == ON_OFF_AUTO_ON ? RAM_READONLY : 0;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;

View File

@@ -11,13 +11,12 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/hostmem.h" #include "sysemu/hostmem.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "qemu/memfd.h" #include "qemu/memfd.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qom/object.h" #include "qom/object.h"
#include "migration/cpr.h"
OBJECT_DECLARE_SIMPLE_TYPE(HostMemoryBackendMemfd, MEMORY_BACKEND_MEMFD) OBJECT_DECLARE_SIMPLE_TYPE(HostMemoryBackendMemfd, MEMORY_BACKEND_MEMFD)
@@ -34,19 +33,15 @@ static bool
memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{ {
HostMemoryBackendMemfd *m = MEMORY_BACKEND_MEMFD(backend); HostMemoryBackendMemfd *m = MEMORY_BACKEND_MEMFD(backend);
g_autofree char *name = host_memory_backend_get_name(backend); g_autofree char *name = NULL;
int fd = cpr_find_fd(name, 0);
uint32_t ram_flags; uint32_t ram_flags;
int fd;
if (!backend->size) { if (!backend->size) {
error_setg(errp, "can't create backend with size 0"); error_setg(errp, "can't create backend with size 0");
return false; return false;
} }
if (fd >= 0) {
goto have_fd;
}
fd = qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size, fd = qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size,
m->hugetlb, m->hugetlbsize, m->seal ? m->hugetlb, m->hugetlbsize, m->seal ?
F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL : 0, F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL : 0,
@@ -54,11 +49,10 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
if (fd == -1) { if (fd == -1) {
return false; return false;
} }
cpr_save_fd(name, 0, fd);
have_fd:
backend->aligned = true; backend->aligned = true;
ram_flags = backend->share ? RAM_SHARED : RAM_PRIVATE; name = host_memory_backend_get_name(backend);
ram_flags = backend->share ? RAM_SHARED : 0;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0; ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name, return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend), name,

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/hostmem.h" #include "sysemu/hostmem.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
@@ -28,7 +28,7 @@ ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
} }
name = host_memory_backend_get_name(backend); name = host_memory_backend_get_name(backend);
ram_flags = backend->share ? RAM_SHARED : RAM_PRIVATE; ram_flags = backend->share ? RAM_SHARED : 0;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0; ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
return memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend), return memory_region_init_ram_flags_nomigrate(&backend->mr, OBJECT(backend),

View File

@@ -11,9 +11,8 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/hostmem.h" #include "sysemu/hostmem.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "migration/cpr.h"
#define TYPE_MEMORY_BACKEND_SHM "memory-backend-shm" #define TYPE_MEMORY_BACKEND_SHM "memory-backend-shm"
@@ -26,9 +25,11 @@ struct HostMemoryBackendShm {
static bool static bool
shm_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) shm_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{ {
g_autofree char *backend_name = host_memory_backend_get_name(backend); g_autoptr(GString) shm_name = g_string_new(NULL);
g_autofree char *backend_name = NULL;
uint32_t ram_flags; uint32_t ram_flags;
int fd = cpr_find_fd(backend_name, 0); int fd, oflag;
mode_t mode;
if (!backend->size) { if (!backend->size) {
error_setg(errp, "can't create shm backend with size 0"); error_setg(errp, "can't create shm backend with size 0");
@@ -40,18 +41,48 @@ shm_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
return false; return false;
} }
if (fd >= 0) { /*
goto have_fd; * Let's use `mode = 0` because we don't want other processes to open our
} * memory unless we share the file descriptor with them.
*/
mode = 0;
oflag = O_RDWR | O_CREAT | O_EXCL;
backend_name = host_memory_backend_get_name(backend);
fd = qemu_shm_alloc(backend->size, errp); /*
* Some operating systems allow creating anonymous POSIX shared memory
* objects (e.g. FreeBSD provides the SHM_ANON constant), but this is not
* defined by POSIX, so let's create a unique name.
*
* From Linux's shm_open(3) man-page:
* For portable use, a shared memory object should be identified
* by a name of the form /somename;"
*/
g_string_printf(shm_name, "/qemu-" FMT_pid "-shm-%s", getpid(),
backend_name);
fd = shm_open(shm_name->str, oflag, mode);
if (fd < 0) { if (fd < 0) {
error_setg_errno(errp, errno,
"failed to create POSIX shared memory");
return false;
}
/*
* We have the file descriptor, so we no longer need to expose the
* POSIX shared memory object. However it will remain allocated as long as
* there are file descriptors pointing to it.
*/
shm_unlink(shm_name->str);
if (ftruncate(fd, backend->size) == -1) {
error_setg_errno(errp, errno,
"failed to resize POSIX shared memory to %" PRIu64,
backend->size);
close(fd);
return false; return false;
} }
cpr_save_fd(backend_name, 0, fd);
have_fd:
/* Let's do the same as memory-backend-ram,share=on would do. */
ram_flags = RAM_SHARED; ram_flags = RAM_SHARED;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE; ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/hostmem.h" #include "sysemu/hostmem.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-builtin-visit.h"

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/iommufd.h" #include "sysemu/iommufd.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
@@ -167,6 +167,8 @@ int iommufd_backend_map_dma(IOMMUFDBackend *be, uint32_t ioas_id, hwaddr iova,
/* TODO: Not support mapping hardware PCI BAR region for now. */ /* TODO: Not support mapping hardware PCI BAR region for now. */
if (errno == EFAULT) { if (errno == EFAULT) {
warn_report("IOMMU_IOAS_MAP failed: %m, PCI BAR?"); warn_report("IOMMU_IOAS_MAP failed: %m, PCI BAR?");
} else {
error_report("IOMMU_IOAS_MAP failed: %m");
} }
} }
return ret; return ret;
@@ -201,6 +203,7 @@ int iommufd_backend_unmap_dma(IOMMUFDBackend *be, uint32_t ioas_id,
if (ret) { if (ret) {
ret = -errno; ret = -errno;
error_report("IOMMU_IOAS_UNMAP failed: %m");
} }
return ret; return ret;
} }

View File

@@ -6,11 +6,11 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/rng.h" #include "sysemu/rng.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/guest-random.h" #include "qemu/guest-random.h"
#include "qom/object.h" #include "qom/object.h"
#include "system/replay.h" #include "sysemu/replay.h"
OBJECT_DECLARE_SIMPLE_TYPE(RngBuiltin, RNG_BUILTIN) OBJECT_DECLARE_SIMPLE_TYPE(RngBuiltin, RNG_BUILTIN)

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/rng.h" #include "sysemu/rng.h"
#include "chardev/char-fe.h" #include "chardev/char-fe.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"

View File

@@ -11,8 +11,8 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/rng-random.h" #include "sysemu/rng-random.h"
#include "system/rng.h" #include "sysemu/rng.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/rng.h" #include "sysemu/rng.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"

View File

@@ -11,7 +11,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/spdm-socket.h" #include "sysemu/spdm-socket.h"
#include "qapi/error.h" #include "qapi/error.h"
static bool read_bytes(const int socket, uint8_t *buffer, static bool read_bytes(const int socket, uint8_t *buffer,

View File

@@ -13,9 +13,9 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/tpm_backend.h" #include "sysemu/tpm_backend.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "system/tpm.h" #include "sysemu/tpm.h"
#include "qemu/thread.h" #include "qemu/thread.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/module.h" #include "qemu/module.h"

View File

@@ -32,9 +32,9 @@
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "qemu/lockable.h" #include "qemu/lockable.h"
#include "io/channel-socket.h" #include "io/channel-socket.h"
#include "system/runstate.h" #include "sysemu/runstate.h"
#include "system/tpm_backend.h" #include "sysemu/tpm_backend.h"
#include "system/tpm_util.h" #include "sysemu/tpm_util.h"
#include "tpm_int.h" #include "tpm_int.h"
#include "tpm_ioctl.h" #include "tpm_ioctl.h"
#include "migration/blocker.h" #include "migration/blocker.h"

View File

@@ -13,7 +13,7 @@
#define BACKENDS_TPM_INT_H #define BACKENDS_TPM_INT_H
#include "qemu/option.h" #include "qemu/option.h"
#include "system/tpm.h" #include "sysemu/tpm.h"
#define TPM_STANDARD_CMDLINE_OPTS \ #define TPM_STANDARD_CMDLINE_OPTS \
{ \ { \

View File

@@ -26,8 +26,8 @@
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "system/tpm_backend.h" #include "sysemu/tpm_backend.h"
#include "system/tpm_util.h" #include "sysemu/tpm_util.h"
#include "tpm_int.h" #include "tpm_int.h"
#include "qapi/clone-visitor.h" #include "qapi/clone-visitor.h"
#include "qapi/qapi-visit-tpm.h" #include "qapi/qapi-visit-tpm.h"

View File

@@ -21,14 +21,13 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/cutils.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/visitor.h" #include "qapi/visitor.h"
#include "tpm_int.h" #include "tpm_int.h"
#include "exec/memory.h" #include "exec/memory.h"
#include "hw/qdev-properties.h" #include "hw/qdev-properties.h"
#include "system/tpm_backend.h" #include "sysemu/tpm_backend.h"
#include "system/tpm_util.h" #include "sysemu/tpm_util.h"
#include "trace.h" #include "trace.h"
/* tpm backend property */ /* tpm backend property */
@@ -47,7 +46,7 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque, static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp) Error **errp)
{ {
const Property *prop = opaque; Property *prop = opaque;
TPMBackend *s, **be = object_field_prop_ptr(obj, prop); TPMBackend *s, **be = object_field_prop_ptr(obj, prop);
char *str; char *str;
@@ -67,7 +66,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
static void release_tpm(Object *obj, const char *name, void *opaque) static void release_tpm(Object *obj, const char *name, void *opaque)
{ {
const Property *prop = opaque; Property *prop = opaque;
TPMBackend **be = object_field_prop_ptr(obj, prop); TPMBackend **be = object_field_prop_ptr(obj, prop);
if (*be) { if (*be) {
@@ -76,7 +75,7 @@ static void release_tpm(Object *obj, const char *name, void *opaque)
} }
const PropertyInfo qdev_prop_tpm = { const PropertyInfo qdev_prop_tpm = {
.type = "str", .name = "str",
.description = "ID of a tpm to use as a backend", .description = "ID of a tpm to use as a backend",
.get = get_tpm, .get = get_tpm,
.set = set_tpm, .set = set_tpm,
@@ -337,8 +336,8 @@ void tpm_sized_buffer_reset(TPMSizedBuffer *tsb)
void tpm_util_show_buffer(const unsigned char *buffer, void tpm_util_show_buffer(const unsigned char *buffer,
size_t buffer_size, const char *string) size_t buffer_size, const char *string)
{ {
g_autoptr(GString) str = NULL; size_t len, i;
size_t len, i, l; char *line_buffer, *p;
if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER_CONTENT)) { if (!trace_event_get_state_backends(TRACE_TPM_UTIL_SHOW_BUFFER_CONTENT)) {
return; return;
@@ -346,14 +345,19 @@ void tpm_util_show_buffer(const unsigned char *buffer,
len = MIN(tpm_cmd_get_size(buffer), buffer_size); len = MIN(tpm_cmd_get_size(buffer), buffer_size);
trace_tpm_util_show_buffer_header(string, len); trace_tpm_util_show_buffer_header(string, len);
for (i = 0; i < len; i += l) { /*
if (str) { * allocate enough room for 3 chars per buffer entry plus a
g_string_append_c(str, '\n'); * newline after every 16 chars and a final null terminator.
} */
l = MIN(len, 16); line_buffer = g_malloc(len * 3 + (len / 16) + 1);
str = qemu_hexdump_line(str, buffer, l, 1, 0);
}
g_string_ascii_up(str); for (i = 0, p = line_buffer; i < len; i++) {
trace_tpm_util_show_buffer_content(str->str); if (i && !(i % 16)) {
p += sprintf(p, "\n");
}
p += sprintf(p, "%.2X ", buffer[i]);
}
trace_tpm_util_show_buffer_content(line_buffer);
g_free(line_buffer);
} }

View File

@@ -15,8 +15,8 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "system/vhost-user-backend.h" #include "sysemu/vhost-user-backend.h"
#include "system/kvm.h" #include "sysemu/kvm.h"
#include "io/channel-command.h" #include "io/channel-command.h"
#include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-bus.h"

104
block.c
View File

@@ -36,13 +36,13 @@
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
#include "qobject/qjson.h" #include "qapi/qmp/qjson.h"
#include "qobject/qnull.h" #include "qapi/qmp/qnull.h"
#include "qobject/qstring.h" #include "qapi/qmp/qstring.h"
#include "qapi/qobject-output-visitor.h" #include "qapi/qobject-output-visitor.h"
#include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-core.h"
#include "system/block-backend.h" #include "sysemu/block-backend.h"
#include "qemu/notify.h" #include "qemu/notify.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/coroutine.h" #include "qemu/coroutine.h"
@@ -1296,6 +1296,7 @@ static void GRAPH_WRLOCK bdrv_backing_attach(BdrvChild *c)
parent->backing_blocker); parent->backing_blocker);
bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_BACKUP_TARGET, bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_BACKUP_TARGET,
parent->backing_blocker); parent->backing_blocker);
bdrv_op_unblock(backing_hd, BLOCK_OP_TYPE_INFO, parent->backing_blocker);
} }
static void bdrv_backing_detach(BdrvChild *c) static void bdrv_backing_detach(BdrvChild *c)
@@ -1573,10 +1574,6 @@ static void update_flags_from_options(int *flags, QemuOpts *opts)
if (qemu_opt_get_bool_del(opts, BDRV_OPT_AUTO_READ_ONLY, false)) { if (qemu_opt_get_bool_del(opts, BDRV_OPT_AUTO_READ_ONLY, false)) {
*flags |= BDRV_O_AUTO_RDONLY; *flags |= BDRV_O_AUTO_RDONLY;
} }
if (!qemu_opt_get_bool_del(opts, BDRV_OPT_ACTIVE, true)) {
*flags |= BDRV_O_INACTIVE;
}
} }
static void update_options_from_flags(QDict *options, int flags) static void update_options_from_flags(QDict *options, int flags)
@@ -1803,11 +1800,6 @@ QemuOptsList bdrv_runtime_opts = {
.type = QEMU_OPT_BOOL, .type = QEMU_OPT_BOOL,
.help = "Ignore flush requests", .help = "Ignore flush requests",
}, },
{
.name = BDRV_OPT_ACTIVE,
.type = QEMU_OPT_BOOL,
.help = "Node is activated",
},
{ {
.name = BDRV_OPT_READ_ONLY, .name = BDRV_OPT_READ_ONLY,
.type = QEMU_OPT_BOOL, .type = QEMU_OPT_BOOL,
@@ -3086,13 +3078,6 @@ bdrv_attach_child_common(BlockDriverState *child_bs,
assert(child_class->get_parent_desc); assert(child_class->get_parent_desc);
GLOBAL_STATE_CODE(); GLOBAL_STATE_CODE();
if (bdrv_is_inactive(child_bs) && (perm & ~BLK_PERM_CONSISTENT_READ)) {
g_autofree char *perm_names = bdrv_perm_names(perm);
error_setg(errp, "Permission '%s' unavailable on inactive node",
perm_names);
return NULL;
}
new_child = g_new(BdrvChild, 1); new_child = g_new(BdrvChild, 1);
*new_child = (BdrvChild) { *new_child = (BdrvChild) {
.bs = NULL, .bs = NULL,
@@ -3199,11 +3184,6 @@ bdrv_attach_child_noperm(BlockDriverState *parent_bs,
child_bs->node_name, child_name, parent_bs->node_name); child_bs->node_name, child_name, parent_bs->node_name);
return NULL; return NULL;
} }
if (bdrv_is_inactive(child_bs) && !bdrv_is_inactive(parent_bs)) {
error_setg(errp, "Inactive '%s' can't be a %s child of active '%s'",
child_bs->node_name, child_name, parent_bs->node_name);
return NULL;
}
bdrv_get_cumulative_perm(parent_bs, &perm, &shared_perm); bdrv_get_cumulative_perm(parent_bs, &perm, &shared_perm);
bdrv_child_perm(parent_bs, child_bs, NULL, child_role, NULL, bdrv_child_perm(parent_bs, child_bs, NULL, child_role, NULL,
@@ -6248,18 +6228,18 @@ BlockDriverState *bdrv_find_node(const char *node_name)
} }
/* Put this QMP function here so it can access the static graph_bdrv_states. */ /* Put this QMP function here so it can access the static graph_bdrv_states. */
BlockDeviceInfoList *bdrv_named_nodes_list(bool flat, BlockDeviceInfoList *coroutine_fn bdrv_co_named_nodes_list(bool flat,
Error **errp) Error **errp)
{ {
BlockDeviceInfoList *list; BlockDeviceInfoList *list;
BlockDriverState *bs; BlockDriverState *bs;
GLOBAL_STATE_CODE(); GLOBAL_STATE_CODE();
GRAPH_RDLOCK_GUARD_MAINLOOP(); GRAPH_RDLOCK_GUARD();
list = NULL; list = NULL;
QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) { QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) {
BlockDeviceInfo *info = bdrv_block_device_info(NULL, bs, flat, errp); BlockDeviceInfo *info = bdrv_co_block_device_info(NULL, bs, flat, errp);
if (!info) { if (!info) {
qapi_free_BlockDeviceInfoList(list); qapi_free_BlockDeviceInfoList(list);
return NULL; return NULL;
@@ -6845,10 +6825,6 @@ void bdrv_init_with_whitelist(void)
bdrv_init(); bdrv_init();
} }
bool bdrv_is_inactive(BlockDriverState *bs) {
return bs->open_flags & BDRV_O_INACTIVE;
}
int bdrv_activate(BlockDriverState *bs, Error **errp) int bdrv_activate(BlockDriverState *bs, Error **errp)
{ {
BdrvChild *child, *parent; BdrvChild *child, *parent;
@@ -6892,12 +6868,33 @@ int bdrv_activate(BlockDriverState *bs, Error **errp)
return ret; return ret;
} }
/*
* bdrv_invalidate_cache() calls bdrv_co_invalidate_cache(),
* which for qcow2 results in a partial clearing of the
* BDRVQcow2State structure. Before that structure has been
* completely repopulated, qcow2_do_open() will yield to wait
* for I/O while reading the qcow header, which allows a
* concurrent QMP query-block command to be dispatched on the
* same context. As a result of query-block,
* qcow2_get_specific_info() is executed and sees the partial
* BDRVQcow2State, leading to an assert. Block the query-info
* operation during this window. Note this needs to be done at
* this level because the invalidation functions run in
* coroutines and the op_block code is GS.
*/
Error *blocker = NULL;
error_setg(&blocker, "invalidating cached metadata");
bdrv_op_block(bs, BLOCK_OP_TYPE_INFO, blocker);
ret = bdrv_invalidate_cache(bs, errp); ret = bdrv_invalidate_cache(bs, errp);
if (ret < 0) { if (ret < 0) {
bs->open_flags |= BDRV_O_INACTIVE; bs->open_flags |= BDRV_O_INACTIVE;
return ret; return ret;
} }
bdrv_op_unblock(bs, BLOCK_OP_TYPE_INFO, blocker);
g_free(blocker);
FOR_EACH_DIRTY_BITMAP(bs, bm) { FOR_EACH_DIRTY_BITMAP(bs, bm) {
bdrv_dirty_bitmap_skip_store(bm, false); bdrv_dirty_bitmap_skip_store(bm, false);
} }
@@ -6980,8 +6977,7 @@ bdrv_has_bds_parent(BlockDriverState *bs, bool only_active)
return false; return false;
} }
static int GRAPH_RDLOCK static int GRAPH_RDLOCK bdrv_inactivate_recurse(BlockDriverState *bs)
bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
{ {
BdrvChild *child, *parent; BdrvChild *child, *parent;
int ret; int ret;
@@ -6999,14 +6995,7 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
return 0; return 0;
} }
/* assert(!(bs->open_flags & BDRV_O_INACTIVE));
* Inactivating an already inactive node on user request is harmless, but if
* a child is already inactive before its parent, that's bad.
*/
if (bs->open_flags & BDRV_O_INACTIVE) {
assert(top_level);
return 0;
}
/* Inactivate this node */ /* Inactivate this node */
if (bs->drv->bdrv_inactivate) { if (bs->drv->bdrv_inactivate) {
@@ -7032,9 +7021,7 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
return -EPERM; return -EPERM;
} }
bdrv_drained_begin(bs);
bs->open_flags |= BDRV_O_INACTIVE; bs->open_flags |= BDRV_O_INACTIVE;
bdrv_drained_end(bs);
/* /*
* Update permissions, they may differ for inactive nodes. * Update permissions, they may differ for inactive nodes.
@@ -7045,7 +7032,7 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
/* Recursively inactivate children */ /* Recursively inactivate children */
QLIST_FOREACH(child, &bs->children, next) { QLIST_FOREACH(child, &bs->children, next) {
ret = bdrv_inactivate_recurse(child->bs, false); ret = bdrv_inactivate_recurse(child->bs);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
@@ -7054,27 +7041,6 @@ bdrv_inactivate_recurse(BlockDriverState *bs, bool top_level)
return 0; return 0;
} }
int bdrv_inactivate(BlockDriverState *bs, Error **errp)
{
int ret;
GLOBAL_STATE_CODE();
GRAPH_RDLOCK_GUARD_MAINLOOP();
if (bdrv_has_bds_parent(bs, true)) {
error_setg(errp, "Node has active parent node");
return -EPERM;
}
ret = bdrv_inactivate_recurse(bs, true);
if (ret < 0) {
error_setg_errno(errp, -ret, "Failed to inactivate node");
return ret;
}
return 0;
}
int bdrv_inactivate_all(void) int bdrv_inactivate_all(void)
{ {
BlockDriverState *bs = NULL; BlockDriverState *bs = NULL;
@@ -7091,7 +7057,7 @@ int bdrv_inactivate_all(void)
if (bdrv_has_bds_parent(bs, false)) { if (bdrv_has_bds_parent(bs, false)) {
continue; continue;
} }
ret = bdrv_inactivate_recurse(bs, true); ret = bdrv_inactivate_recurse(bs);
if (ret < 0) { if (ret < 0) {
bdrv_next_cleanup(&it); bdrv_next_cleanup(&it);
break; break;

View File

@@ -27,7 +27,7 @@
#include "block/accounting.h" #include "block/accounting.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "system/qtest.h" #include "sysemu/qtest.h"
static QEMUClockType clock_type = QEMU_CLOCK_REALTIME; static QEMUClockType clock_type = QEMU_CLOCK_REALTIME;
static const int qtest_latency_ns = NANOSECONDS_PER_SECOND / 1000; static const int qtest_latency_ns = NANOSECONDS_PER_SECOND / 1000;

View File

@@ -23,7 +23,7 @@
#include "block/dirty-bitmap.h" #include "block/dirty-bitmap.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "system/block-backend.h" #include "sysemu/block-backend.h"
#include "qemu/bitmap.h" #include "qemu/bitmap.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"

View File

@@ -33,11 +33,11 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-core.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
#include "qobject/qlist.h" #include "qapi/qmp/qlist.h"
#include "qobject/qstring.h" #include "qapi/qmp/qstring.h"
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "system/qtest.h" #include "sysemu/qtest.h"
/* All APIs are thread-safe */ /* All APIs are thread-safe */

View File

@@ -16,9 +16,9 @@
#include "qemu/defer-call.h" #include "qemu/defer-call.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "system/block-backend.h" #include "sysemu/block-backend.h"
#include "exec/memory.h" /* for ram_block_discard_disable() */ #include "exec/memory.h" /* for ram_block_discard_disable() */
#include "block/block-io.h" #include "block/block-io.h"

View File

@@ -14,8 +14,8 @@
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */ #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "block/block-io.h" #include "block/block-io.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
#include "qobject/qstring.h" #include "qapi/qmp/qstring.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"

View File

@@ -13,7 +13,7 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "block/block-io.h" #include "block/block-io.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "qapi/error.h" #include "qapi/error.h"
typedef struct Request { typedef struct Request {

View File

@@ -12,8 +12,8 @@
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */ #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "block/block-io.h" #include "block/block-io.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "qobject/qdict.h" #include "qapi/qmp/qdict.h"
#include "qobject/qstring.h" #include "qapi/qmp/qstring.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"

View File

@@ -11,15 +11,15 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/block-backend.h" #include "sysemu/block-backend.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "block/blockjob.h" #include "block/blockjob.h"
#include "block/coroutines.h" #include "block/coroutines.h"
#include "block/throttle-groups.h" #include "block/throttle-groups.h"
#include "hw/qdev-core.h" #include "hw/qdev-core.h"
#include "system/blockdev.h" #include "sysemu/blockdev.h"
#include "system/runstate.h" #include "sysemu/runstate.h"
#include "system/replay.h" #include "sysemu/replay.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qapi-events-block.h" #include "qapi/qapi-events-block.h"
#include "qemu/id.h" #include "qemu/id.h"
@@ -253,7 +253,7 @@ static bool blk_can_inactivate(BlockBackend *blk)
* guest. For block job BBs that satisfy this, we can just allow * guest. For block job BBs that satisfy this, we can just allow
* it. This is the case for mirror job source, which is required * it. This is the case for mirror job source, which is required
* by libvirt non-shared block migration. */ * by libvirt non-shared block migration. */
if (!(blk->perm & ~BLK_PERM_CONSISTENT_READ)) { if (!(blk->perm & (BLK_PERM_WRITE | BLK_PERM_WRITE_UNCHANGED))) {
return true; return true;
} }
@@ -900,24 +900,14 @@ void blk_remove_bs(BlockBackend *blk)
int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp) int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp)
{ {
ThrottleGroupMember *tgm = &blk->public.throttle_group_member; ThrottleGroupMember *tgm = &blk->public.throttle_group_member;
uint64_t perm, shared_perm;
GLOBAL_STATE_CODE(); GLOBAL_STATE_CODE();
bdrv_ref(bs); bdrv_ref(bs);
bdrv_graph_wrlock(); bdrv_graph_wrlock();
if ((bs->open_flags & BDRV_O_INACTIVE) && blk_can_inactivate(blk)) {
blk->disable_perm = true;
perm = 0;
shared_perm = BLK_PERM_ALL;
} else {
perm = blk->perm;
shared_perm = blk->shared_perm;
}
blk->root = bdrv_root_attach_child(bs, "root", &child_root, blk->root = bdrv_root_attach_child(bs, "root", &child_root,
BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY,
perm, shared_perm, blk, errp); blk->perm, blk->shared_perm,
blk, errp);
bdrv_graph_wrunlock(); bdrv_graph_wrunlock();
if (blk->root == NULL) { if (blk->root == NULL) {
return -EPERM; return -EPERM;
@@ -1029,10 +1019,6 @@ DeviceState *blk_get_attached_dev(BlockBackend *blk)
return blk->dev; return blk->dev;
} }
/*
* The caller is responsible for releasing the value returned
* with g_free() after use.
*/
static char *blk_get_attached_dev_id_or_path(BlockBackend *blk, bool want_id) static char *blk_get_attached_dev_id_or_path(BlockBackend *blk, bool want_id)
{ {
DeviceState *dev = blk->dev; DeviceState *dev = blk->dev;
@@ -1047,15 +1033,15 @@ static char *blk_get_attached_dev_id_or_path(BlockBackend *blk, bool want_id)
return object_get_canonical_path(OBJECT(dev)) ?: g_strdup(""); return object_get_canonical_path(OBJECT(dev)) ?: g_strdup("");
} }
/*
* Return the qdev ID, or if no ID is assigned the QOM path, of the block
* device attached to the BlockBackend.
*/
char *blk_get_attached_dev_id(BlockBackend *blk) char *blk_get_attached_dev_id(BlockBackend *blk)
{ {
return blk_get_attached_dev_id_or_path(blk, true); return blk_get_attached_dev_id_or_path(blk, true);
} }
/*
* The caller is responsible for releasing the value returned
* with g_free() after use.
*/
static char *blk_get_attached_dev_path(BlockBackend *blk) static char *blk_get_attached_dev_path(BlockBackend *blk)
{ {
return blk_get_attached_dev_id_or_path(blk, false); return blk_get_attached_dev_id_or_path(blk, false);
@@ -2357,6 +2343,18 @@ void *blk_blockalign(BlockBackend *blk, size_t size)
return qemu_blockalign(blk ? blk_bs(blk) : NULL, size); return qemu_blockalign(blk ? blk_bs(blk) : NULL, size);
} }
bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp)
{
BlockDriverState *bs = blk_bs(blk);
GLOBAL_STATE_CODE();
GRAPH_RDLOCK_GUARD_MAINLOOP();
if (!bs) {
return false;
}
return bdrv_op_is_blocked(bs, op, errp);
}
/** /**
* Return BB's current AioContext. Note that this context may change * Return BB's current AioContext. Note that this context may change

View File

@@ -20,7 +20,7 @@
#include "block/block_int-io.h" #include "block/block_int-io.h"
#include "block/dirty-bitmap.h" #include "block/dirty-bitmap.h"
#include "block/reqlist.h" #include "block/reqlist.h"
#include "system/block-backend.h" #include "sysemu/block-backend.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/co-shared-resource.h" #include "qemu/co-shared-resource.h"
#include "qemu/coroutine.h" #include "qemu/coroutine.h"

View File

@@ -5,8 +5,8 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "system/block-backend.h" #include "sysemu/block-backend.h"
#include "system/block-ram-registrar.h" #include "sysemu/block-ram-registrar.h"
#include "qapi/error.h" #include "qapi/error.h"
static void ram_block_added(RAMBlockNotifier *n, void *host, size_t size, static void ram_block_added(RAMBlockNotifier *n, void *host, size_t size,

Some files were not shown because too many files have changed in this diff Show More