Commit Graph

130567 Commits

Author SHA1 Message Date
Marc-André Lureau
d444e348b1 system/memory: move RamDiscardManager to separate compilation unit
Extract RamDiscardManager and RamDiscardSource from system/memory.c into
dedicated a unit.

This reduces coupling and allows code that only needs the
RamDiscardManager interface to avoid pulling in all of memory.h
dependencies.

rust-sys bindings are no longer generated for RamDiscardSourceClass at
this point, thus we drop the unneeded InterfaceClass use.

Reviewed-by: Peter Xu <peterx@redhat.com>
Acked-by: David Hildenbrand <david@kernel.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260604-rdm5-v5-2-5768e6a0943d@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Marc-André Lureau
43d1320c6c system/memory: split RamDiscardManager into source and manager
Refactor the RamDiscardManager interface into two distinct components:
- RamDiscardSource: An interface that state providers (virtio-mem,
  RamBlockAttributes) implement to provide discard state information
  (granularity, populated/discarded ranges, replay callbacks).
- RamDiscardManager: A concrete QOM object that wraps a source, owns
  the listener list, and handles listener registration/unregistration
  and notifications.

This separation moves the listener management logic from individual
source implementations into the central RamDiscardManager, reducing
code duplication between virtio-mem and RamBlockAttributes.

The change prepares for future work where a RamDiscardManager could
aggregate multiple sources.

Note, the original virtio-mem code had conditions before discard:
  if (vmem->size) {
      rdl->notify_discard(rdl, rdl->section);
  }
however, the new code calls discard unconditionally. This is considered
safe, since the populate/discard of sections are already asymmetrical
(unplug & unregister all listener section unconditionally).

Reviewed-by: Peter Xu <peterx@redhat.com>
Acked-by: David Hildenbrand <david@kernel.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260604-rdm5-v5-1-5768e6a0943d@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Peter Xu
4215370b91 migration/tests: Update a-b-boot images for all archs
We just added a GPLv2 licence identifier to __note, update all headers with
that.  When at this, s390 seems to generate a new binary with the latest
cross-compiler I have here:

 s390x-linux-gnu-gcc (GCC) 15.2.1 20250808 (Red Hat Cross 15.2.1-1)

The hope is the new generated should normally be better.  Update them.

Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Eric Farman <farman@linux.ibm.com>
Cc: Matthew Rosato <mjrosato@linux.ibm.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: qemu-s390x@nongnu.org
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Based-on: <20260611084312.70042-1-maobibo@loongson.cn>
Acked-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20260612155307.2172358-1-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Bibo Mao
94a75309f9 tests/qtest/migration: Add migration test on loongarch
Add migration qtest on loongarch64 system, the test passes to run with
the following result:
  qemu:qtest+qtest-loongarch64/qtest-loongarch64/migration-test OK 15.94s 9 subtests passed

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260611084312.70042-1-maobibo@loongson.cn
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Peter Xu
3aa3f65010 migration: Use OBJECT_DECLARE_SIMPLE_TYPE
Migration object's class has nothing special, switch to the newly
introduced macro.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/20260609172514.2037645-2-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Gavin Shan
cde9c44562 system/memory: Remove MAX_PHYS_ADDR
Remove MAX_PHYS_ADDR and MAX_PHYS_ADDR_SPACE_BITS as they're not used
since the addition by commit 052e87b073 ("memory: make section size
a 128-bit integer").

Signed-off-by: Gavin Shan <gshan@redhat.com>
Link: https://lore.kernel.org/r/20260608002303.851456-1-gshan@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Akihiko Odaki
dadd06e727 system/physmem: Synchronize ram_list accesses
Alex Bennée reported a ThreadSanitizer warning about a plain concurrent
access to ram_list [1]. Ensure the concurrent accesses to ram_list are
properly synchronized with atomic accesses, mutexes, or RCU.

First, the plain assignments of ram_list.mru_block are replaced with
qatomic_set(). A comment in qemu_get_ram_block() explains why the
ordering requirement is relaxed, but it still needs to be atomically
accessed. include/qemu/atomic.h says:

> The C11 memory model says that variables that are accessed from
> different threads should at least be done with __ATOMIC_RELAXED
> primitives or the result is undefined. Generally this has little to
> no effect on the generated code but not using the atomic primitives
> will get flagged by sanitizers as a violation.

Second, ram_list.version accesses are replaced with atomic operations
or protected with a mutex. Unlike ram_list.mru_block, ram_list.version
has tighter ordering requirements for one of its goals: ensuring that
the reader-held rs->last_seen_block value is invalidated whenever a RAM
block is reclaimed between two RCU reader critical sections. Below are
steps a reader and an updater follow:

Reader:

R-1. Enter the first RCU read-side critical section:
R-1-1. rs->last_version = qatomic_load_acquire(&ram_list.version)
R-1-2. rs->last_seen_block = an element of ram_list.blocks
R-2. Enter the second RCU read-side critical section:
R-2-1. if (qatomic_read(&ram_list.version) != rs->last_version)
R-2-2.     rs->last_seen_block = NULL

Updater:

W-1. Enter a ram_list.mutex critical section
W-1-1. Update ram_list.blocks
W-1-2. qatomic_store_release(&ram_list.version, ram_list.version + 1)
W-2. Enter another ram_list.mutex critical section
W-2-1. QLIST_REMOVE_RCU(block, next)
W-2-2. qatomic_store_release(&ram_list.version, ram_list.version + 1)
W-2-3. call_rcu(block, reclaim_ramblock, rcu)

W-1-2 represents the write observed by R-1-1.

ram_list.version is read non-atomically on the update side because the
update side is serialized with ram_list.mutex. The other ram_list
accesses in these steps are reasoned about in two cases.

When the grace period of W-2-3 contains R-2:
    qatomic_load_acquire() at R-1-1 and qatomic_store_release() at W-1-2
    enforce the following ordering:
        W-1-1 -> W-1-2 -> R-1-1 -> R-1-2
    The value of ram_list.blocks stored by W-1-1 or a newer value that
    was loaded by R-1-2 is still valid because of the grace period.

When the grace period of W-2-3 ends before R-2:
    call_rcu() at W-2-3 and the read-side critical section at R-2 ensure
    the following ordering:
        W-2-2 -> W-2-3 -> the grace period -> R-2 -> R-2-1
    The value of ram_list.version stored by W-2-2 or a newer value that
    was loaded by R-2-1 differs from rs->last_version and the reader
    invalidates rs->last_seen_block.

Together, these steps ensure that rs->last_seen_block is invalidated
whenever necessary. With added atomic operations, pre-existing memory
barriers are no longer necessary and are removed.

Any other ram_list accesses are already properly synchronized.

[1] https://lore.kernel.org/qemu-devel/878q9fbmap.fsf@draig.linaro.org/

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260523-tsan-v1-1-07d5eb9dcaa2@rsg.ci.i.u-tokyo.ac.jp
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Peter Xu
1d03e0db3a qapi/migration: Remove @cpr-exec-command doc in MigrationParameter
This parameter was developed during similar window when the deduplication
work was done in commit 2220c2b9ef ("qapi/migration: Don't document
MigrationParameter"), hence it was overlooked.

Remove the leftover parameter.  After all, MigrationParameter is already in
the exception list of the doc sanity checker.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/r/20260528201236.359452-1-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Maciej S. Szmigiero
2566b6e902 thread-pool: Allow at least 1 thread in thread_pool_adjust_max_threads_to_work()
thread_pool_adjust_max_threads_to_work() is supposed to give each task its
own thread by setting the pool max thread count limit accordingly.

However, if there aren't any tasks currently in the pool the pool max
thread count will be set to 0, which will trigger an assertion failure
in thread_pool_set_max_threads() - because setting this value would
completely block the pool by not allowing it to process any submitted
tasks.

This also can happen if a task is submitted via
thread_pool_submit_immediate() to an empty pool but the task completes so
quickly that by the time this function calls
thread_pool_adjust_max_threads_to_work() the pool again has no unfinished
tasks in it.

Quoting from Maciej on reproducing this issue:

  It's difficult to reproduce in most setups.

  My main VFIO live migration setup never hit it for more than a year,
  other similar setup hit it recently 3 times.

  On the other hand, putting sleep(5) in the middle of
  thread_pool_submit_immediate() makes it reproduce nearly always for me.

Fix this by making sure that the pool is allowed to create at least 1
thread.

Fixes: b5aa74968b ("thread-pool: Implement generic (non-AIO) pool support")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/r/b76c763f576b0fb8a35960a8e3c3da59701d2a74.1779390317.git.maciej.szmigiero@oracle.com
[peterx: added quote into commit message on reproduce details of the issue]
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Stefan Hajnoczi
b833716681 Merge tag 'pbouvier/pr/plugins-20260618' of https://gitlab.com/p-b-o/qemu into staging
Changes:
- [PATCH v2 0/1] plugins: fix syscall filter return value type (Ziyang Zhang <functioner@sjtu.edu.cn>)
  Link: https://lore.kernel.org/qemu-devel/20260618082426.790315-1-functioner@sjtu.edu.cn

# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmo0g58ACgkQtEQ30Zwo
# Yt8swQwAqqVmnVqOsIbF/XCO9/K26WfoQM7BSzPWS1khtCSRxWRU5y0L+ePhU8MY
# JWIT/dbCloVuAdeEkdU19AxMWjTqC3B9PANHVRDkDtciOn0597RuQ7BV4w+P7NyN
# ZPeVkn2Wx5ly01OxIDkvhkGcturuJK0+2R1EnuNPJt3sQyUrEVZK5ApbBOvi+EL/
# ZHFZfXkXM9kINiN7ptTfjEuRZc6jXWyMq8Jgb3177XCd8EiA0DbZjKUs2keprPzG
# hEu0p6VK7qnO3tMsRBxad8sddg3FEIlhz3aByfFY6Ct8kJfHGvuqWOJlmr8+i1uT
# r0zVM78Ra2AJxnwO0gMTGv+CPhIw7KD0LW4PrSjMvrZb5R/7iQZz200vwZecmghu
# gEZjG/BZbybhK5QVf8xgGq1SmEGMBZGVvPpVB0x2GGiJJq4+4a4Fm2s0chyrsCWi
# SCgGhlGh1t5RsmS+6turW3DmiAQw3tLox4qETc9WMcLM3WeFdhBMonB6Xm0JkU4J
# tW7juYvs
# =zqrs
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 18 Jun 2026 19:47:43 EDT
# gpg:                using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 37C1 5694 D8BA 9764 B197  3FDB B444 37D1 9C28 62DF

* tag 'pbouvier/pr/plugins-20260618' of https://gitlab.com/p-b-o/qemu:
  plugins: use int64_t for the syscall filter return value

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-19 15:00:01 -04:00
Stefan Hajnoczi
dc1667bf64 Merge tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa into staging
linux-user patches

One frame pointer memory locking fix for the xtensa architecture, a generic
loader fix for programs with modified headers, and two patches to emulate
/proc/cpuinfo for loogarch and m68k CPUs.

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCajRo/gAKCRD3ErUQojoP
# X+3IAQCPg/Z8KRa43miOMpOJVRxel3eg5h9+A/Sh4SwPp9Sk2gD/U6gh4l64Bl2O
# CT30o35Afd7rl1G1dD9rsB/H9tU/gwM=
# =mTKh
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 18 Jun 2026 17:54:06 EDT
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [unknown]
# gpg:                 aka "Helge Deller <deller@debian.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa:
  linux-user/xtensa: fix unlock of uninitialized frame pointer on sigreturn
  linux-user: Implement /proc/cpuinfo for m68k CPU
  linux-user: Implement /proc/cpuinfo for loongarch cpus
  linux-user: Fix AT_PHDR when program headers are relocated into their own segment

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-19 14:58:38 -04:00
Stefan Hajnoczi
49558dfc9f Merge tag 'tracing-pull-request' of https://gitlab.com/stefanha/qemu into staging
Pull request

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmo0MGQACgkQnKSrs4Gr
# c8h0Kwf7BUBMQJs+L6/turY8p29MPXuFPNFqG6RAqr/PfMeJ0qTlt7UQG+wGPCDc
# 0XJnUAUqfLBCIFg3tjCSvbPL5HXluy4UsyXK7T/e5ByVBf2CJRpSnJ1Ps1ZU8E70
# foEKjG8Z5MTCG6gGVb27Kmdz6Kvsu5obXrP6WTj6twF4SDQmaHMzWu/YMlOuGEP1
# 9pwZxBS38kDDQF20jHhyr5ra6xcoSQPpXMum37FJruXkchbFbsg2zVGxU15ENE0d
# 3ErBHSVwScWebKwgN2qSsAdv2PqLNQGdiWJzjD3fXAE3D9SvpgDrYPs+99Vjv9bN
# hkkIIs5vcCghYzDJYUdvlj59iyPsUQ==
# =F1HG
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 18 Jun 2026 13:52:36 EDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [ultimate]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [ultimate]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'tracing-pull-request' of https://gitlab.com/stefanha/qemu:
  trace/control: Fix -Wunused-but-set-global warning with clang 23+

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-19 14:58:10 -04:00
Ziyang Zhang
731525c276 plugins: use int64_t for the syscall filter return value
The syscall return value passed back through the syscall filter
callback is semantically signed: negative values encode errno codes.
Declaring the sysret pointer as uint64_t * is therefore misleading and
forces callers to launder the value through an unsigned temporary.

Change the sysret pointer to int64_t * across the public plugin API
typedef (qemu_plugin_vcpu_syscall_filter_cb_t), the internal
qemu_plugin_vcpu_syscall_filter() prototypes and stub, its
implementation in plugins/core.c, the linux-user caller, and the
in-tree example plugins.

Signed-off-by: Ziyang Zhang <functioner@sjtu.edu.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260618082426.790315-2-functioner@sjtu.edu.cn
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2026-06-18 16:47:12 -07:00
Matt Turner
54e08dbe8f linux-user/xtensa: fix unlock of uninitialized frame pointer on sigreturn
If lock_user_struct fails, frame is uninitialized but the badframe
label unconditionally calls unlock_user_struct on it. Handle the
lock failure inline so badframe is only reached with a valid lock.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
2026-06-18 23:43:35 +02:00
Helge Deller
0b0ef9060c linux-user: Implement /proc/cpuinfo for m68k CPU
Mimic the entries for /proc/cpuinfo to what can be seen on the debian
porterbox mitchy.debian.org.

Cc: Thomas Huth <th.huth+qemu@posteo.eu>
Cc: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Helge Deller <deller@gmx.de>
2026-06-18 23:43:35 +02:00
Helge Deller
13956e8244 linux-user: Implement /proc/cpuinfo for loongarch cpus
Mimic the entries for /proc/cpuinfo to what can be seen on the debian
porterbox loomis.debian.org.

Cc: Song Gao <gaosong@loongson.cn>
Cc: Bibo Mao <maobibo@loongson.cn>
Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Helge Deller <deller@gmx.de>
2026-06-18 23:43:35 +02:00
Akshit Yadav
156e536a7b linux-user: Fix AT_PHDR when program headers are relocated into their own segment
When a binary is patched or relocated such that the program header table is
moved into a separate PT_LOAD segment (rather than sitting at the start of the
first loadable segment), QEMU's AT_PHDR auxv entry becomes incorrect. The
loader was computing AT_PHDR as load_addr + e_phoff, which assumes the headers
are mapped 1:1 from file offset 0. This breaks when the headers are elsewhere.

The Linux kernel instead locates the PT_LOAD segment that contains e_phoff,
then computes the in-memory address as p_vaddr + (e_phoff - p_offset). This
correctly handles relocated headers.

Fix by:
1. Add phdr_addr field to image_info to cache the resolved address.
2. Initialize to load_addr + e_phoff (fallback for headers outside any PT_LOAD).
3. In the PT_LOAD mapping loop, detect if the segment contains e_phoff and
   override with the segment-relative address.
4. Use info->phdr_addr for AT_PHDR instead of the incorrect formula.

Signed-off-by: Akshit Yadav <valium7171@gmail.com>
Reviewed-by: Helge Deller <deller@gmx.de>
2026-06-18 23:43:35 +02:00
Stefan Hajnoczi
3b50303f95 Merge tag 'accel-20260618' of https://github.com/philmd/qemu into staging
Accelerators patches queue

- Avoid double hv_vcpu_destroy() call during teardown on HVF ARM
- Constify various AddressSpace/MemoryRegionCache arguments
- Clarify physical_memory_*() API in "system/physmem.h"
- Extract "accel/tcg/cpu-loop.h" out of "exec/cpu-common.h"
- Restrict few TCG-specific code
- Remove pre-C11 check
- Various header cleanups

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmoz5EIACgkQ4+MsLN6t
# wN4pJhAAtQ+qMRS49PoXnyBkPnuTZlnIjhy0gpXp7wRAiZiOQFjgIkX7F8YKz/aQ
# Hu15PIsbvH7mjzTiSfW48Km/3qzzCx0F0U9KsNaZLCJ+/HVctaN94slewgAfA6qc
# sEuVq6u70oaeGjYVM1wmUXhK3h2vfpWPnE81qjUJBnjsfC99T24TMmtY0CGw8f9J
# UJ6SpkwlES9B6YeJ0GFACCZMTMD0QiXuAtKzfL/2aD1Ts31qY9DG/bdlmDJJ3R0Y
# y/ZcWjvPQE4NDdcMfuW4/ywz7sAX/h0XreMIb2OL5ppE0qYDBqpB6SFGWjg4uQ5r
# yDhzVhdrPT2HxXl9LTYOjlAQEHrs3Pm0170G7OwCVs+gtlloZqV08sJ+61J2jv73
# OH2YsQh/sIy9QUPZxI+LloBRLApMg5mjY9KP5DPH2qmsOpvE4fj07hq+EXS3OCuz
# L+3TMD0fhxI+RHg8/zaqidc3+Xb4zN/H069Qkjx0wyQI7QMmfK4rU4CJV6MP6d9r
# r9qngtxVfbGfXpaDqan73TjKHx/ZnOgNQqrfaeypiAkiyIoOPRzeG3H6T17HlOBX
# S2Pz4vllzs0SS1vC4OKnS1BI2eEf6ge14ozKGQqh5qOvfKlTy4s8fXX/2MKIaqMG
# cVE4lkL2suLoxmOu2zsEvDBCVUaRLWZLJZib1J4B/UIvvC3rpQs=
# =Jj+Z
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 18 Jun 2026 08:27:46 EDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'accel-20260618' of https://github.com/philmd/qemu: (48 commits)
  accel/tcg: Restrict headers being TCG specific
  accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h'
  accel/tcg: Have cpu_loop_exit_requested() take const @cpu argument
  accel/tcg: Move cpu_restore_state() out of 'exec/cpu-common.h'
  accel/tcg: Move cpu_unwind_state_data() out of 'exec/cpu-common.h'
  accel/tcg: Move cpu_exec_step_atomic() out of 'exec/cpu-common.h'
  accel/tcg: Move cpu_exec() out of 'exec/cpu-common.h'
  accel/tcg: Remove cpu_loop_exit() stub
  hw/s390x/ipl: Remove TCG dependency in handle_diag_308()
  system/memory: Rename cpu_exec_init_all() -> machine_memory_init()
  system/memory: Remove unnecessary CONFIG_USER_ONLY guards
  exec/cpu-common.h: Avoid including unused exec/page-protection.h header
  exec/cpu-common.h: Avoid including unused 'tcg/debug-assert.h' header
  exec/cpu-common.h: Avoid including unused 'exec/vaddr.h' header
  exec/cpu-common.h: Include missing 'qemu/thread.h' header
  ui/cocoa: Use qemu_input_map_osx_to_linux
  util/cutils: drop qemu_strnlen() in favor of strnlen()
  configure: honor --extra-ldflags when forced to use objc_LINKER
  meson: build macOS signed binary as part of the default target
  accel/tcg: Restrict IOMMU declarations
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-18 16:28:12 -04:00
Tom Stellard
c0f8130a31 trace/control: Fix -Wunused-but-set-global warning with clang 23+
../trace/control.c:41:13: error: variable 'init_trace_on_startup' set but not used [-Werror,-Wunused-but-set-global]
   41 | static bool init_trace_on_startup;
      |             ^
1 error generated.

Signed-off-by: Tom Stellard <tstellar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20260617224145.1419961-1-tstellar@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-18 11:01:40 -04:00
Stefan Hajnoczi
34a7a3eda0 Merge tag 'pull-9p-20260617' of https://github.com/cschoenebeck/qemu into staging
9pfs changes:

- Fix guest-triggerable assertion fault (DoS) with the legacy Twstat
  rename handler.

- Code deduplication.

# -----BEGIN PGP SIGNATURE-----
#
# iQJLBAABCgA1FiEEltjREM96+AhPiFkBNMK1h2Wkc5UFAmoyv68XHHFlbXVfb3Nz
# QGNydWRlYnl0ZS5jb20ACgkQNMK1h2Wkc5V2iA/+JtfP5LZPp+UNPKtXquaJl+8P
# FPqU9Y6Vh8cbC/SetjCsVQGW0yhhsyJiGgd56qiz0WEQC5rm4katMJm7iqLR+GzA
# +S6IubuFifKTudiRCgu1rWuOhYWaHd7F9SeiMHXj5vq0bRNkI78DbjA6O6O81rvM
# o8IhTR7IoySK9wOZ57H/va6Kp/t7OeoZEVMjAqCBXPgIUBCnpJCecpvwgkIqK4qU
# MirRmgD94gSGJXrXUO+rx5hJUgcs1jwRuOvjptipLuRElCrd2L4bMXnhLSbyhT0C
# G25aUDy1VwnPmJZLuROPnsxdr+PCWDwLW5QdVM9kT4AWS9p1Y8A6v/FSdwt84D+5
# jlV0XpYGcfXUCoIqKEm0i7FXxr/FiZCh1ZUiAD85SI4PGbM770AgRZt3JA+1xoFT
# 0Ao+9jAtRCFQ1sjB9PTiudzCYNoNeal929ey7r8kkkquMfOUZvHqtAJnPSxFGvmj
# 5kUKGV198xbwbntetJVup/iiBMG4+9fnpFg4tHmcibCUHKfYtnFCnzjcd0DpvJRl
# BS1+0b4OLz5Mxt5N6jU0WZaHDDSgWA/W3GvAhNRTsIBMOPtqtVMejGs3l0LDR8+M
# PD3i3hiA/rmRUWlYqhy1PhJzpZ0TH66Dblv9F2Ve87h6QsEa1HhESjcBY9e7TI8t
# hu5c7lGx3D3uaiXU2xQ=
# =2xaR
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Jun 2026 11:39:27 EDT
# gpg:                using RSA key 96D8D110CF7AF8084F88590134C2B58765A47395
# gpg:                issuer "qemu_oss@crudebyte.com"
# gpg: Good signature from "Christian Schoenebeck <qemu_oss@crudebyte.com>" [unknown]
# gpg: Note: This key has expired!
# Primary key fingerprint: ECAB 1A45 4014 1413 BA38  4926 30DB 47C3 A012 D5F4
#      Subkey fingerprint: 96D8 D110 CF7A F808 4F88  5901 34C2 B587 65A4 7395

* tag 'pull-9p-20260617' of https://github.com/cschoenebeck/qemu:
  hw/9pfs: consolidate name validation with check_name()
  hw/9pfs: reject . and .. in Twstat rename
  hw/9pfs: fix abort due to illegal name with Twstat rename

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-18 09:47:35 -04:00
Stefan Hajnoczi
407a769aa8 Merge tag 'ui-input-pr-v1' of https://gitlab.com/marcandre.lureau/qemu into staging
UI patches for 2026-06-17

- retire input-legacy.c
- sdl2 fixes

To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmoyu8oACgkQ2ujhCXWW
# nOX6RA//TQRZhYpHWGZSKsBWkC1UXPSHXfsbaMrrv9L8U66nXxN9FZgqukisw8rq
# udUNHzdhfRVlTOcEDYscgNeGTIIZ/2phFrNOE0759Q4BIg7CNaEBhvjNmzp/tAVV
# XImS3RzzVdE2RJKN8DAaFKqCAIa2NF8ZPr7NtjIK/VwUPQ0AtfY/plVGtfkChSTx
# +WZt2gTkli0WMGYFz0ZXttqtfuts1fCTxyNUwBItNQkgXzM9+lPmIHYOSF4huPa1
# ek03WVrA6k9ke+A9lNpSl1l/a6g8FBOfHSzSBBWhjT8pQN0iChLzxzkBXWKbvBOk
# PhprHBTNVzY1ogLp3WupVcXTDl/bgaHS/4cv75plR5qHrZC7Z0sDachr7MtVvrDW
# SsSV7Ni2ggiXJ8EspGPKNQ1PFV69TmwSeRVGaJUlXUDdr25k6sN59sqLpwBMZb/O
# UwxeqUI3LXmFdjzGoGHmHdB4UneENOEHoTBTqj/lkHjm+sxB504/ZIewhK7bjtlr
# efi11fRB3+XAUZVrC9BCmaeD+ZZANqQ5PXex8KfZpD5+H7VuJVEnAIIvCQqNCg4i
# UGDuqWV7qxsVP6jMdidtUYKPiKZEGChAYGsYNvoJ+mXusebkJLHY6zUyIcMEcJCL
# Bu/oFF9PaPYBBvvS45hzn5MVgR//ylWZpEFqtqRzXYrxCzruvRE=
# =VcKS
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Jun 2026 11:22:50 EDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'ui-input-pr-v1' of https://gitlab.com/marcandre.lureau/qemu: (27 commits)
  ui/sdl2: Set GL ES profile before creating initial GL context
  ui/sdl2: Explicitly specify EGL platform
  ui/pixman: fix zero rowstride in qemu_pixman_image_new_shareable()
  ui/input: Have qemu_input_is_absolute() take a const QemuConsole
  tools/qemu-vnc: Have console_get_mouse/keyboard take const QemuConsole
  ui/input: remove old LED handler broadcast queue
  ui/dbus: switch LED handling to Notifier-based input API
  ui/spice: switch LED handling to Notifier-based input API
  ui/vnc: switch LED handling to Notifier-based input API
  hw/input/virtio-input-hid: use qemu_input_handler_set_leds_mask() for LED state
  hw/input/hid: use qemu_input_handler_set_leds_mask() for LED state
  hw/input/ps2: use qemu_input_handler_set_leds_mask() for LED state
  ui/input: qemu_input_handler_register to warn for unused result
  hw/m68k: keep QemuInputHandlerState in next-kbd
  hw/input: keep QemuInputHandlerState in stellaris
  hw/input: keep QemuInputHandlerState in adb-kbd
  hw/arm: keep QemuInputHandlerState in musicpal
  hw/input/ps2: keep QemuInputHandlerState in PS2State
  ui/input: add LED state tracking to QemuInputHandlerState
  ui/input: remove dead declaration
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-18 09:47:17 -04:00
Stefan Hajnoczi
44f7c85be4 Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* GNU/Hurd support
* More patches to support qemu-ga builds with clang-cl
* gdbstub: Update x86 control register bits
* rust: fix incorrect dependency in Cargo.toml
* target/i386: apply mod to immediate count of an RCL/RCR operation

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmoynoYUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroNaIgf8D6Nb0jy5hP2t43s6ZT5VEM+k889p
# 89TiRelrnzvcrZ8GhfB+JeA87LCd0pNn0nIspsMzA6butOzO/tlft2vLlNEXevli
# MNhZVdj2PNGwN3TqW4EM4zM1VmLFxMshEEtAcBtHkUCCxlkscju+zSmwnJ0zzHy/
# fQpOAXO3HtDlHEzLF1QWjjpHQd6IorjeWqRVzH8i+djlgk6YGn51mNYOwgvBOSUZ
# IET2FVabLpJkoQWlr11mt3woL+cxi5tKeVFAUzHB6q6rvkbLp85tyDx2nW4O+M8C
# G7Hb82z/nV6Rh0E6ehq3x0DDdYTxt1ARyljnx3QQIsZo5uAVP+1WtqIgkg==
# =nh+D
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Jun 2026 09:17:58 EDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  qga/vss: Drop unused define uuid(x)
  qga/vss: Remove unused undefs
  qga/vss: Use MAX_PATH instead of PATH_MAX
  qga/meson: Allow to use MSVC message compiler 'mc'
  qga/meson: Use windows.compile_resources instead of custom_target
  qga/meson: Remove unused lib stdc++
  qga/win: Use swprintf instead of snwprintf
  Make copy_file_range non-static on GNU/Hurd
  block/file-posix: Clean up sys/ioctl import
  tpm: Add conditional to not compile ioctls on GNU/Hurd
  Add GNU/Hurd host_os=gnu
  Include new arbitrary limits if not already defined
  gdbstub: Update x86 control register bits
  target/i386: add more easy cases to gen_eflags_adcox
  target/i386: apply mod to immediate count of an RCL/RCR operation
  rust: fix incorrect dependency in Cargo.toml

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-18 09:46:49 -04:00
Philippe Mathieu-Daudé
1eaae985d4 accel/tcg: Restrict headers being TCG specific
Forbid including TCG-specific headers in non-TCG builds.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-12-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
2368ea9744 accel/tcg: Move cpu_loop_exit_*() out of 'exec/cpu-common.h'
Move the following TCG-specific cpu_loop_exit_*() declarations
out of the generic "exec/cpu-common.h" header, to the recently
created "accel/tcg/cpu-loop.h" one, documenting them:

 - cpu_loop_exit_noexc()
 - cpu_loop_exit_atomic()
 - cpu_loop_exit_restore()
 - cpu_loop_exit()

Include "accel/tcg/cpu-loop.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-11-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
f6ff0d1ffc accel/tcg: Have cpu_loop_exit_requested() take const @cpu argument
Since the CPUState argument is simply read-only accessed, make it const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-9-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
e1883d1a32 accel/tcg: Move cpu_restore_state() out of 'exec/cpu-common.h'
Move the TCG-specific cpu_restore_state() declaration out
of the generic "exec/cpu-common.h" header, to the recently
created "accel/tcg/cpu-loop.h" one.

Include "accel/tcg/cpu-loop.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-8-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
adec7aed17 accel/tcg: Move cpu_unwind_state_data() out of 'exec/cpu-common.h'
Move the TCG-specific cpu_unwind_state_data() declaration out
of the generic "exec/cpu-common.h" header, to the recently
created "accel/tcg/cpu-loop.h" one.

Include "accel/tcg/cpu-loop.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-7-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
0ffd9742fb accel/tcg: Move cpu_exec_step_atomic() out of 'exec/cpu-common.h'
Move the TCG-specific cpu_exec_step_atomic() declaration out
of the generic "exec/cpu-common.h" header, to the recently
created "accel/tcg/cpu-loop.h" one.

Include "accel/tcg/cpu-loop.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-6-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
77bdae789a accel/tcg: Move cpu_exec() out of 'exec/cpu-common.h'
In order to keep TCG-specific functions under a TCG
API namespace, add the "accel/tcg/cpu-loop.h" header
and move cpu_exec() declaration to it. Add a bit of
documentation.

Include "accel/tcg/cpu-loop.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-5-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
7ca3f8a84b accel/tcg: Remove cpu_loop_exit() stub
Last commit removed the last non-TCG use of cpu_loop_exit().
This method is now only called within TCG files, so we can
remove its stub for non-TCG accelerators.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-4-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
d51fcd7fb8 hw/s390x/ipl: Remove TCG dependency in handle_diag_308()
Rather than calling a TCG specific method in s390_ipl_reset_request(),
have handle_diag_308() return whether a vCPU reset is pending, and use
that in the TCG DIAG helper to return to the main loop.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Jared Rossi <jrossi@linux.ibm.com>
Message-Id: <20260617164035.70788-4-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
104e8391dd system/memory: Rename cpu_exec_init_all() -> machine_memory_init()
cpu_exec_init_all() is system specific: it initializes globals
for the memory subsystem. Rename it as machine_memory_init()
and restrict its declaration to 'system/' namespace.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260616153754.93545-3-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
44b774858e system/memory: Remove unnecessary CONFIG_USER_ONLY guards
This header is only used when building system units,
checking for CONFIG_USER_ONLY is pointless.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260616153754.93545-2-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
67e17ab2b3 exec/cpu-common.h: Avoid including unused exec/page-protection.h header
Since commit e74781c0888e ("exec/cpu: Extract page-protection
definitions to page-protection.h") the "exec/cpu-common.h" isn't
using anything defined in "exec/page-protection.h"; remove it.

Include it in few files where it is currently pulled in indirectly,
otherwise we'd get:

  linux-user/qemu.h:182:22: error: ‘PAGE_READ’ undeclared
    182 | #define VERIFY_READ  PAGE_READ
        |                      ^~~~~~~~~
  target/loongarch/cpu_helper.c:329:25: error: use of undeclared identifier 'PAGE_READ'
    329 |         context->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
        |                         ^
  target/loongarch/cpu_helper.c:329:37: error: use of undeclared identifier 'PAGE_WRITE'
    329 |         context->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
        |                                     ^
  target/loongarch/cpu_helper.c:329:50: error: use of undeclared identifier 'PAGE_EXEC'
    329 |         context->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
        |                                                  ^
  target/ppc/mmu-hash32.h:98:20: error: use of undeclared identifier 'PAGE_READ'
     98 |             prot = PAGE_READ | PAGE_WRITE;
        |                    ^
  target/ppc/mmu-hash32.h:98:32: error: use of undeclared identifier 'PAGE_WRITE'
     98 |             prot = PAGE_READ | PAGE_WRITE;
        |                                ^
  hw/ppc/ppc_booke.c:39:17: error: use of undeclared identifier 'PAGE_RWX'
     39 |     tlb->prot = PAGE_RWX << 4 | PAGE_VALID;
        |                 ^
  hw/ppc/ppc_booke.c:39:33: error: use of undeclared identifier 'PAGE_VALID'
     39 |     tlb->prot = PAGE_RWX << 4 | PAGE_VALID;
        |                                 ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617160426.64461-6-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
8f01515380 exec/cpu-common.h: Avoid including unused 'tcg/debug-assert.h' header
Since commit efe25c260c ("include/exec: Split out
accel/tcg/cpu-mmu-index.h") the "exec/cpu-common.h" isn't using
anything defined in "tcg/debug-assert.h".

Include it in target/loongarch/tcg/tcg_cpu.c however, where it
is required but included indirectly, otherwise we'd get:

  target/loongarch/tcg/tcg_cpu.c:291:5: error: call to undeclared function 'tcg_debug_assert'
  291 |     tcg_debug_assert(!tcg_cflags_has(cs, CF_PCREL));
      |     ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617160426.64461-5-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
f81c9c1320 exec/cpu-common.h: Avoid including unused 'exec/vaddr.h' header
We neglected to remove the "exec/vaddr.h" header when moving
cpu_memory_rw_debug() around in commit e9048f099b ("exec/cpu:
Declare cpu_memory_rw_debug() in 'hw/core/cpu.h' and document").

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617160426.64461-4-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
60cfd6da28 exec/cpu-common.h: Include missing 'qemu/thread.h' header
Unfortunately we need to include "qemu/thread.h" -- which is
currently indirectly pulled in -- to get the QemuMutex type
definition:

  extern QemuMutex qemu_cpu_list_lock;

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617160426.64461-3-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Akihiko Odaki
7d9f051410 ui/cocoa: Use qemu_input_map_osx_to_linux
ui/cocoa used to have a conversion table from macOS keycode to Linux
key code. It is an unnecessary redundancy as ui/input-keymap.c already
has such a table. Worse, I added an incorrect mapping of kVK_JIS_Eisu and
kVK_JIS_Kana with commit 708b72557f ("ui/cocoa: Support unique keys of
JIS keyboards").

According to the following documentations, the definitions in
ui/keycodemapdb/keymaps.csv, which ui/input-keymap.c uses, are correct:
https://developer.apple.com/documentation/uikit/uikeyboardhidusage/uikeyboardhidusagekeyboardlang1?language=objc
https://developer.apple.com/documentation/uikit/uikeyboardhidusage/uikeyboardhidusagekeyboardlang2?language=objc
https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/keyboard-japan-ime

Use qemu_input_map_osx_to_linux to eliminate the redundancy and
incorrect mappings.

Fixes: 708b72557f ("ui/cocoa: Support unique keys of JIS keyboards")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com>
Message-ID: <20260604-osx-v3-1-453b4ee0e072@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Bin Guo
66ac993bda util/cutils: drop qemu_strnlen() in favor of strnlen()
There are only three call sites, and strnlen() is available on all
supported platforms (POSIX.1-2008, Windows via UCRT, MinGW).  Remove
the hand-rolled wrapper and use the standard function directly.

While here, align bsd-user/uaccess.c to use size_t for max_len/len,
matching linux-user/uaccess.c and eliminating a signed/unsigned mismatch.

Also remove the stale qemu_strnlen() entry from docs/devel/style.rst.

Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-ID: <20260530062816.59206-1-guobin@linux.alibaba.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Matt Jacobson
19db5c1daf configure: honor --extra-ldflags when forced to use objc_LINKER
3220b38a8d had the side effect of making the individual target link steps
use objc_LINKER on macOS, because `coreaudio.m` became visible to Meson as
a source file.  (The preexisting presence of `cocoa.m` is masked by the
fact that it gets built into libsystem and then extracted back out as an
object file.)

`configure` correctly passes `$EXTRA_LDFLAGS` to the "C linker" and "C++
linker", but it neglected to do so for the "Objective-C linker".  Fix that.

Signed-off-by: Matt Jacobson <mhjacobson@me.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20260615045547.23422-1-mhjacobson@me.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Emmanuel Blot
eef29e060d meson: build macOS signed binary as part of the default target
Signed-off-by: Emmanuel Blot <eblot@meta.com>
Tested-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260609-macos-default-signed-bin-v1-1-e013ccb5ccb7@meta.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
ffbc5b17a2 accel/tcg: Restrict IOMMU declarations
Move the two TCG-specific IOMMU method declarations from the
generic "exec/cpu-common.h" header to "accel/tcg/iommu.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260616153633.93267-1-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Osama Abdelkader
464e0ff099 accel/tcg: remove duplicate include
tb-internal.h is included twice

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Tested-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20251126214322.64855-1-osama.abdelkader@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Philippe Mathieu-Daudé
e5590b5378 accel/hvf: Reduce hvf_kernel_irqchip_override scope
hvf_kernel_irqchip_override is only used within the
accel/hvf/hvf-all.c file, no need to expose the symbol.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Message-Id: <20260613145356.88410-1-philmd@oss.qualcomm.com>
2026-06-18 14:27:21 +02:00
Matheus Tavares Bernardino
9f721c9e3c accel/hvf: fix double hv_vcpu_destroy() causing teardown error on ARM
The following callstack causes hv_vcpu_destroy() to be called twice,
producing HV_BAD_ARGUMENT on the already-destroyed handler:

hvf_vcpu_destroy
 |
 |_ hv_vcpu_destroy
 |
 |_ hvf_arch_vcpu_destroy
     |
     |_ hv_vcpu_destroy

The first hv_vcpu_destroy call covers both x86 and arm. Let's remove the
second one, as it is redundant.

This reverts commit feee55d36a.

Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <ee6f642af1dab29aaf99f86ac9254ddd25765bf8.1776172276.git.matheus.bernardino@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:19 +02:00
Philippe Mathieu-Daudé
68ca5a7a69 target/sparc: Include missing 'accel/tcg/cpu-ops.h' header in cpu.c
target/sparc/cpu.c implement a TCGCPUOps structure, which is
defined in "accel/tcg/cpu-ops.h":

  1040 static const TCGCPUOps sparc_tcg_ops = {
  ...

While this header is currently included indirectly, make the
inclusion explicit to avoid issue when refactoring unrelated
headers.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617160426.64461-2-philmd@oss.qualcomm.com>
2026-06-18 14:27:18 +02:00
Philippe Mathieu-Daudé
6df98ffe86 target/loongarch: Remove unused 'accel/accel-cpu-target.h' header
"accel/accel-cpu-target.h" is to register accelerator target
specific hooks via TypeInfo::ACCEL_CPU_NAME(), which LoongArch
TCG frontend does not. Remove as unused header.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260529194940.97143-2-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-06-18 14:27:16 +02:00
Philippe Mathieu-Daudé
3632840c3b target/ppc: Restrict TCGTBCPUState to TCG
TCGTBCPUState is a structure used during TCG translation,
therefore not needed when TCG is not available.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260616153432.92939-4-philmd@oss.qualcomm.com>
2026-06-18 14:27:15 +02:00
Philippe Mathieu-Daudé
7ffe6b81f0 target/arm: Restrict TCG specific headers
Avoid including TCG-specific headers in non-TCG builds.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-2-philmd@oss.qualcomm.com>
2026-06-18 14:27:15 +02:00
Philippe Mathieu-Daudé
2ed7af8213 target/arm/ptw: Restrict PMSAv8 code to TCG
Armv8-M Protected Memory System Architecture can only be emulated,
therefore restrict it to TCG to avoid compiling it on hardware
accelerators.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20260616153432.92939-3-philmd@oss.qualcomm.com>
2026-06-18 14:27:15 +02:00