]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
7 weeks agomeson: Use has_header_symbol() to check getcpu()
Akihiko Odaki [Thu, 24 Apr 2025 04:50:11 +0000 (13:50 +0900)] 
meson: Use has_header_symbol() to check getcpu()

The use of gnu_source_prefix in the detection of getcpu() was
ineffective because the header file that declares getcpu() when
_GNU_SOURCE is defined was not included. Pass sched.h to
has_header_symbol() so that the existence of the declaration will be
properly checked.

Cc: qemu-stable@nongnu.org
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250424-buildsys-v1-1-97655e3b25d7@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agopc-bios: Move device tree files in their own subdir
BALATON Zoltan [Wed, 23 Apr 2025 10:02:21 +0000 (12:02 +0200)] 
pc-bios: Move device tree files in their own subdir

We have several device tree files already and may have more in the
future so add a new dtb subdirectory and move device tree files there
so they are not mixed with ROM binaries.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <57f179bd3904c1f2ca062ca4d4ff9592bb4f4daa.1745402140.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agosystem/datadir: Add new type constant for DTB files
BALATON Zoltan [Wed, 23 Apr 2025 10:02:20 +0000 (12:02 +0200)] 
system/datadir: Add new type constant for DTB files

Currently DTB files are mixed with ROMs under BIOS type. Separate them
under a new type constant and turn defines into an enum while at it.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <ae793d1f81e3577605759c43871722324a1ef2cb.1745402140.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agosystem/memory: Remove DEVICE_HOST_ENDIAN definition
Philippe Mathieu-Daudé [Wed, 23 Apr 2025 11:11:31 +0000 (13:11 +0200)] 
system/memory: Remove DEVICE_HOST_ENDIAN definition

Since the previous commit ("exec/memory.h: make devend_memop
"target defines" agnostic") there is a single use of the
DEVICE_HOST_ENDIAN definition in ram_device_mem_ops: inline
it and remove its definition altogether.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250423111625.10424-1-philmd@linaro.org>

7 weeks agosystem/vl: Fix type conflict of GLib function pointers
Kohei Tokunaga [Tue, 22 Apr 2025 05:27:07 +0000 (14:27 +0900)] 
system/vl: Fix type conflict of GLib function pointers

On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <e9a50b76c54cc64fc9985186f0aef3fcc2024da6.1745295397.git.ktokunaga.mail@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agocontrib/plugins: Fix type conflict of GLib function pointers
Kohei Tokunaga [Tue, 22 Apr 2025 05:27:10 +0000 (14:27 +0900)] 
contrib/plugins: Fix type conflict of GLib function pointers

On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <0fcddfca16ca8da2bdaa7b2c114476f5b73d032b.1745295397.git.ktokunaga.mail@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agohw/net/can: Fix type conflict of GLib function pointers
Kohei Tokunaga [Tue, 22 Apr 2025 05:27:11 +0000 (14:27 +0900)] 
hw/net/can: Fix type conflict of GLib function pointers

On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Francisco Iglesias <francisco.iglesias@amd.com>
Message-ID: <4d47a75c5768c9a6dc5d8b3504e78837577ad70d.1745295397.git.ktokunaga.mail@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agohw/core/loader: Fix type conflict of GLib function pointers
Kohei Tokunaga [Tue, 22 Apr 2025 05:27:05 +0000 (14:27 +0900)] 
hw/core/loader: Fix type conflict of GLib function pointers

On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <26dfe9191154ca65dca6ef51ce768ad2a0c30d5f.1745295397.git.ktokunaga.mail@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agohw/intc/i8259: Remove unused DEBUG_PIC define
BALATON Zoltan [Wed, 23 Apr 2025 10:11:25 +0000 (12:11 +0200)] 
hw/intc/i8259: Remove unused DEBUG_PIC define

The debug printfs were converted to traces so this define is now unused.

Fixes: 0880a87300 (i8259: convert DPRINTFs into trace)
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Message-ID: <20250423101125.B243A55C592@zero.eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agohw/usb/hcd-xhci: Unmap canceled packet
Akihiko Odaki [Fri, 18 Apr 2025 05:51:48 +0000 (14:51 +0900)] 
hw/usb/hcd-xhci: Unmap canceled packet

When the Stop Endpoint Command is received, packets running
asynchronously are canceled and then all packets are cleaned up. Packets
running asynchronously hold the DMA mapping so cleaning the packets leak
the mapping. Remove the mapping after canceling packets to fix the leak.

Fixes: 62c6ae04cf43 ("xhci: Initial xHCI implementation")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250418-xhc-v1-1-bb32dab6a67e@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agoexec: Rename target_words_bigendian() -> target_big_endian()
Philippe Mathieu-Daudé [Thu, 17 Apr 2025 07:31:24 +0000 (09:31 +0200)] 
exec: Rename target_words_bigendian() -> target_big_endian()

In commit 98ed8ecfc9d ("exec: introduce target_words_bigendian()
helper") target_words_bigendian() was matching the definition it
was depending on (TARGET_WORDS_BIGENDIAN). Later in commit
ee3eb3a7ce7 ("Replace TARGET_WORDS_BIGENDIAN") the definition was
renamed as TARGET_BIG_ENDIAN but we didn't update the helper.
Do it now mechanically using:

  $ sed -i -e s/target_words_bigendian/target_big_endian/g \
        $(git grep -wl target_words_bigendian)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250417210025.68322-1-philmd@linaro.org>

7 weeks agotarget/mips: Fix MIPS16e translation
Hauke Mehrtens [Sat, 12 Apr 2025 19:40:03 +0000 (21:40 +0200)] 
target/mips: Fix MIPS16e translation

Fix a wrong conversion to gen_op_addr_addi(). The framesize should be
added like it was done before.

This bug broke booting OpenWrt MIPS32 BE malta Linux system images
generated by OpenWrt.

Cc: qemu-stable@nongnu.org
Fixes: d0b24b7f50e1 ("target/mips: Use gen_op_addr_addi() when possible")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250412194003.181411-1-hauke@hauke-m.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agotarget/arm: Replace target_ulong -> vaddr for CPUWatchpoint
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 22:25:06 +0000 (00:25 +0200)] 
target/arm: Replace target_ulong -> vaddr for CPUWatchpoint

CPUWatchpoint::vaddr/len are of type vaddr.

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: <20250415172246.79470-4-philmd@linaro.org>

7 weeks agotarget/arm: Replace target_ulong -> hwaddr in ARMMMUFaultInfo
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 22:19:59 +0000 (00:19 +0200)] 
target/arm: Replace target_ulong -> hwaddr in ARMMMUFaultInfo

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: <20250415172246.79470-2-philmd@linaro.org>

7 weeks agotarget/arm: Handle AArch64 gdb read/write regs in TYPE_ARM_CPU
Peter Maydell [Mon, 17 Mar 2025 14:28:15 +0000 (14:28 +0000)] 
target/arm: Handle AArch64 gdb read/write regs in TYPE_ARM_CPU

Instead of having the TYPE_AARCH64_CPU subclass set
CPUClass::gdb_read_register and ::gdb_write_register to different
methods from those of the TYPE_ARM_CPU parent class, have the
TYPE_ARM_CPU methods handle either AArch32 or AArch64 at runtime.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250317142819.900029-6-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agotarget/arm: Handle gdb_core_xml_file in TYPE_ARM_CPU
Peter Maydell [Mon, 17 Mar 2025 14:28:14 +0000 (14:28 +0000)] 
target/arm: Handle gdb_core_xml_file in TYPE_ARM_CPU

Instead of having the TYPE_AARCH64_CPU subclass set
CPUClass:gdb_core_xml_file to a different value from that that
TYPE_ARM_CPU uses, implement the gdb_get_core_xml_file method in the
TYPE_ARM_CPU class to return either the AArch64 or AArch32 XML file
name.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250317142819.900029-5-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agotarget/arm: Handle AArch64 in TYPE_ARM_CPU gdb_arch_name
Peter Maydell [Mon, 17 Mar 2025 14:28:13 +0000 (14:28 +0000)] 
target/arm: Handle AArch64 in TYPE_ARM_CPU gdb_arch_name

Instead of having the TYPE_AARCH64_CPU subclass set
CPUClass::gdb_arch_name to a different function, make the
TYPE_ARM_CPU implementation of the method handle AArch64.

For the moment we make the "is this AArch64?" function test "is the
CPU of TYPE_AARCH64_CPU?", so that this produces no behavioural
change.  When we've moved all the gdbstub related methods across to
the base class, we will be able to change this to be "does the CPU
have the ARM_FEATURE_AARCH64 feature?".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250317142819.900029-4-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agogdbstub: Allow gdb_core_xml_file to be set at runtime
Peter Maydell [Mon, 17 Mar 2025 14:28:12 +0000 (14:28 +0000)] 
gdbstub: Allow gdb_core_xml_file to be set at runtime

Currently the CPUClass:gdb_core_xml_file setting is a simple 'const
char *' which the CPU class must set to a fixed string.  Allow the
CPU class to instead set a new method gdb_get_core_xml_file() which
returns this string.

This will allow Arm CPUs to use different XML files for AArch32 vs
AArch64 without having to have an extra AArch64-specific class type
purely to give somewhere to set cc->gdb_core_xml_file differently.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250317142819.900029-3-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agohw/core/cpu: gdb_arch_name string should not be freed
Peter Maydell [Mon, 17 Mar 2025 14:28:11 +0000 (14:28 +0000)] 
hw/core/cpu: gdb_arch_name string should not be freed

The documentation for the CPUClass::gdb_arch_name method claims that
the returned string should be freed with g_free().  This is not
correct: in commit a650683871ba728 we changed this method to
instead return a simple constant string, but forgot to update
the documentation.

Make the documentation match the new semantics.

Fixes: a650683871ba728 ("hw/core/cpu: Return static value with gdb_arch_name()")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250317142819.900029-2-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agohw/core: Get default_cpu_type calling machine_class_default_cpu_type()
Philippe Mathieu-Daudé [Tue, 22 Apr 2025 08:32:31 +0000 (10:32 +0200)] 
hw/core: Get default_cpu_type calling machine_class_default_cpu_type()

Since commit 62b4a227a33 the default cpu type can come from the
valid_cpu_types[] array. Call the machine_class_default_cpu_type()
instead of accessing MachineClass::default_cpu_type field.

Cc: qemu-stable@nongnu.org
Fixes: 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250422084114.39499-1-philmd@linaro.org>

7 weeks agoqom/object: Fix type conflict of GLib function pointers
Kohei Tokunaga [Tue, 22 Apr 2025 05:27:06 +0000 (14:27 +0900)] 
qom/object: Fix type conflict of GLib function pointers

On Emscripten, function pointer casts can result in runtime failures due to
strict function signature checks. This affects the use of g_list_sort and
g_slist_sort, which internally perform function pointer casts that are not
supported by Emscripten. To avoid these issues, g_list_sort_with_data and
g_slist_sort_with_data should be used instead, as they do not rely on
function pointer casting.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <8ca13f4e2b9eba9d1f6030b0afb442a24330e463.1745295397.git.ktokunaga.mail@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agoqom: Make InterfaceInfo[] uses const
Philippe Mathieu-Daudé [Wed, 23 Apr 2025 16:46:19 +0000 (18:46 +0200)] 
qom: Make InterfaceInfo[] uses const

Mechanical change using:

  $ sed -i -E 's/\(InterfaceInfo.?\[/\(const InterfaceInfo\[/g' \
              $(git grep -lE '\(InterfaceInfo.?\[\]\)')

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250424194905.82506-7-philmd@linaro.org>

7 weeks agoqom: Constify TypeInfo::interfaces
Philippe Mathieu-Daudé [Wed, 23 Apr 2025 16:44:12 +0000 (18:44 +0200)] 
qom: Constify TypeInfo::interfaces

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250424194905.82506-6-philmd@linaro.org>

7 weeks agoqom: Constify TypeInfo::class_data
Philippe Mathieu-Daudé [Mon, 10 Feb 2025 08:56:56 +0000 (09:56 +0100)] 
qom: Constify TypeInfo::class_data

All callers now correctly expect a const class data.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250424194905.82506-5-philmd@linaro.org>

7 weeks agoqom: Have class_init() take a const data argument
Philippe Mathieu-Daudé [Sun, 9 Feb 2025 22:47:35 +0000 (23:47 +0100)] 
qom: Have class_init() take a const data argument

Mechanical change using gsed, then style manually adapted
to pass checkpatch.pl script.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250424194905.82506-4-philmd@linaro.org>

7 weeks agoqom: Have class_base_init() take a const data argument
Philippe Mathieu-Daudé [Sun, 9 Feb 2025 21:15:54 +0000 (22:15 +0100)] 
qom: Have class_base_init() take a const data argument

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250424194905.82506-3-philmd@linaro.org>

7 weeks agohw/misc/edu: Convert type_init() -> DEFINE_TYPES()
Philippe Mathieu-Daudé [Wed, 23 Apr 2025 17:00:39 +0000 (19:00 +0200)] 
hw/misc/edu: Convert type_init() -> DEFINE_TYPES()

Prefer DEFINE_TYPES() macro over type_init() to register
QOM types.

Initialize the .interfaces struct field as compound literal
casted to InterfaceInfo type like the rest of our code base.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250424194905.82506-2-philmd@linaro.org>

7 weeks agohw/pci-host/designware: Use deposit/extract API
Philippe Mathieu-Daudé [Mon, 31 Mar 2025 15:15:47 +0000 (17:15 +0200)] 
hw/pci-host/designware: Use deposit/extract API

Prefer the safer (less bug-prone) deposit/extract API
to access lower/upper 32-bit of 64-bit registers.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gustavo Romero <gustavo.romero@linaro.org>
Message-Id: <20250331152041.74533-3-philmd@linaro.org>

7 weeks agocpus: Remove #ifdef check on cpu_list definition
Philippe Mathieu-Daudé [Sun, 23 Mar 2025 15:24:29 +0000 (16:24 +0100)] 
cpus: Remove #ifdef check on cpu_list definition

Since we removed all definitions of cpu_list, the #ifdef
check is always true. Remove it, inlining cpu_list().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250324185837.46506-7-philmd@linaro.org>

7 weeks agotarget/s390x: Register CPUClass:list_cpus
Philippe Mathieu-Daudé [Mon, 24 Mar 2025 18:29:03 +0000 (19:29 +0100)] 
target/s390x: Register CPUClass:list_cpus

Both s390_cpu_list() and s390_set_qemu_cpu_model() are
defined in cpu_models.c, move their declarations in the
related "cpu_models.h" header. Use full path to header
in s390-virtio-ccw.c file.

Register s390_cpu_list() as CPUClass:list_cpus callback
and remove the cpu_list definition.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250324185837.46506-6-philmd@linaro.org>

7 weeks agotarget/sparc: Register CPUClass:list_cpus
Philippe Mathieu-Daudé [Sun, 23 Mar 2025 15:15:35 +0000 (16:15 +0100)] 
target/sparc: Register CPUClass:list_cpus

Register sparc_cpu_list() as CPUClass:list_cpus callback.
Reduce its scope and remove the cpu_list definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250324185837.46506-5-philmd@linaro.org>

7 weeks agotarget/ppc: Register CPUClass:list_cpus
Philippe Mathieu-Daudé [Sun, 23 Mar 2025 15:22:41 +0000 (16:22 +0100)] 
target/ppc: Register CPUClass:list_cpus

Register ppc_cpu_list() as CPUClass:list_cpus callback.
Reduce its scope and remove the cpu_list definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250324185837.46506-4-philmd@linaro.org>

7 weeks agotarget/i386: Register CPUClass:list_cpus
Philippe Mathieu-Daudé [Sun, 23 Mar 2025 15:18:00 +0000 (16:18 +0100)] 
target/i386: Register CPUClass:list_cpus

Register x86_cpu_list() as CPUClass:list_cpus callback.
Reduce its scope and remove the cpu_list definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250324185837.46506-3-philmd@linaro.org>

7 weeks agocpus: Introduce CPUClass::list_cpus() callback
Philippe Mathieu-Daudé [Sun, 23 Mar 2025 15:09:06 +0000 (16:09 +0100)] 
cpus: Introduce CPUClass::list_cpus() callback

Some targets define cpu_list to a method listing their
CPUs on stdout. In order to make list_cpus() generic,
introduce the CPUClass::list_cpus() callback.
When no callback is registered, list_cpus() defaults
to the cpu_list definition.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250324185837.46506-2-philmd@linaro.org>

7 weeks agotarget/i386: Replace MO_TE* -> MO_LE*
Philippe Mathieu-Daudé [Wed, 12 Mar 2025 09:18:42 +0000 (10:18 +0100)] 
target/i386: Replace MO_TE* -> MO_LE*

The x86 architecture is only implemented as little-endian.
The MO_TE definition always expands to MO_LE.

Replace:
 - MO_TEUQ -> MO_LEUQ
 - MO_TE   -> MO_LE

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250312142124.15138-1-philmd@linaro.org>

7 weeks agotarget/hexagon: Replace MO_TE -> MO_LE
Philippe Mathieu-Daudé [Wed, 12 Mar 2025 09:42:31 +0000 (10:42 +0100)] 
target/hexagon: Replace MO_TE -> MO_LE

We only build the Hexagon target using little endianness order.
The MO_TE definition always expands to MO_LE. Use the latter to
simplify.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20250312103238.99981-3-philmd@linaro.org>

7 weeks agotarget/hexagon: Explode MO_TExx -> MO_TE | MO_xx
Philippe Mathieu-Daudé [Wed, 12 Mar 2025 09:16:53 +0000 (10:16 +0100)] 
target/hexagon: Explode MO_TExx -> MO_TE | MO_xx

Extract the implicit MO_TE definition in order to replace
it in the next commit.

Mechanical change using:

  $ for n in UW UL UQ UO SW SL SQ; do \
      sed -i -e "s/MO_TE$n/MO_TE | MO_$n/" \
           $(git grep -l MO_TE$n target/hexagon); \
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20250312103238.99981-2-philmd@linaro.org>

7 weeks agoMerge tag 'pull-misc-2025-04-24' of https://repo.or.cz/qemu/armbru into staging
Stefan Hajnoczi [Thu, 24 Apr 2025 17:44:57 +0000 (13:44 -0400)] 
Merge tag 'pull-misc-2025-04-24' of https://repo.or.cz/qemu/armbru into staging

Miscellaneous patches for 2025-04-24

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmgJ7dYSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTiZIP/1PFAg/s3SoiLQwH/ZrjyUkm1kiKnjOH
# CC5Stw6I9tuYnDAhASAdSymofLv0NNydNe5ai6ZZAWRyRYjIcfNigKAGK4Di+Uhe
# nYxT0Yk8hNGwMhl6NnBp4mmCUNCwcbjT9uXdiYQxFYO/qqYR1388xJjeN3c362l3
# AaLrE5bX5sqa6TAkTeRPjeIqxlyGT7jnCrN7I1hMhDvbc3ITF3AMfYFMjnmAQgr+
# mTWGS1QogqqkloODbR1DKD1CAWOlpK+0HibhNF+lz71P0HlwVvy+HPXso505Wf0B
# dMwlSrZ1DnqNVF/y5IhMEMslahKajbjbFVhBjmrGl/8T821etCxxgB20c0vyFRy8
# qTyJGwBZaEo0VWr70unSmq45TRoeQvdHAw/e+GtilR0ci80q2ly4gbObnw7L8le+
# gqZo4IWmrwp2sbPepE57sYKQpEndwbRayf/kcFd0LPPpeINu9ZooXkYX0pOo6Cdg
# vDKMaEB1/fmPhjSlknxkKN9LZdR+nDw8162S1CKsUdWanAOjmP8haN19aoHhIekZ
# q+r2qUq/U827yNy9/qbInmsoFYDz9s6sAOE63jibd5rZZ9Anei6NOSgLzA4CqCR1
# +d0+TXp19gP9mLMFs7/ZclwkXCz47OQYhXYphjI3wM9x+xbdRcI4n+DOH5u5coKx
# AsA6+2n0GF4Y
# =GaoH
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 24 Apr 2025 03:52:54 EDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-misc-2025-04-24' of https://repo.or.cz/qemu/armbru:
  cleanup: Drop pointless label at end of function
  cleanup: Drop pointless return at end of function
  cleanup: Re-run return_directly.cocci

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'pull-loongarch-20250424' of https://github.com/gaosong715/qemu into staging
Stefan Hajnoczi [Thu, 24 Apr 2025 17:44:39 +0000 (13:44 -0400)] 
Merge tag 'pull-loongarch-20250424' of https://github.com/gaosong715/qemu into staging

pull-loongarch-20230424

# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEKAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCaAmmRQAKCRBAov/yOSY+
# 3yZoA/4udi9ZmLsaiPqfKCS+0eF8XScIT493lVD359lFTBTT7mshh9PPhTLzdtiC
# 8fcfYi7jSjfC9gGTjPgnNCOzKIg3Gbdl61AFDgIwd8q/5HQAgonHAywTUtmqDaPK
# bXZ/JkkJQby2dla6015XKQS/d/EXWHgYjrcb1JZIRoaLworZPw==
# =zBCJ
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 23 Apr 2025 22:47:33 EDT
# gpg:                using RSA key B8FF1DA0D2FDCB2DA09C6C2C40A2FFF239263EDF
# gpg: Good signature from "Song Gao <m17746591750@163.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: B8FF 1DA0 D2FD CB2D A09C  6C2C 40A2 FFF2 3926 3EDF

* tag 'pull-loongarch-20250424' of https://github.com/gaosong715/qemu:
  target/loongarch: Guard BCEQZ/BCNEZ instructions with FP feature
  target/loongarch: Add CRC feature flag and use it to gate CRC instructions
  linux-user/loongarch64: Decode BRK break codes for FPE signals
  target/loongarch: Move definition of TCG specified function to tcg directory
  target/loongarch: Add static definition with function loongarch_tlb_search()
  target/loongarch: Move function loongarch_tlb_search to directory tcg
  target/loongarch: Define function loongarch_get_addr_from_tlb() non-static
  target/loongarch: Set function loongarch_map_address() with common code
  target/loongarch: Add stub function loongarch_get_addr_from_tlb
  target/loongarch: Move function get_dir_base_width to common directory
  target/loongarch: Add function loongarch_get_addr_from_tlb
  target/loongarch: Move header file helper.h to directory tcg
  hw/intc/loongarch_pch_msi: Remove gpio input handler

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'pull-tcg-20250423' of https://gitlab.com/rth7680/qemu into staging
Stefan Hajnoczi [Thu, 24 Apr 2025 17:44:28 +0000 (13:44 -0400)] 
Merge tag 'pull-tcg-20250423' of https://gitlab.com/rth7680/qemu into staging

meson: Introduce top-level libuser_ss and libsystem_ss
meson: Add hw_common_arch dictionary
accel/tcg: Lots of cleanups to enable build once for:
    user-exec-stub.c,
    plugin-gen.c,
    translator.c
page-vary: Restrict scope of TARGET_PAGE_BITS_MIN
tcg: Always define TARGET_INSN_START_EXTRA_WORDS
tcg: Convert TARGET_GUEST_DEFAULT_MO to TCGCPUOps::guest_default_memory_order
tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
target/riscv: Do not expose rv128 CPU on user mode emulation

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmgJikUdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+t0gf9E9OWD3oQ7NIl+azS
# imEFCKwuDxR0g07fH0aM9DW6e01mPQjxe3bmfxuYZbGUu0aJ/WzTbzfkX4qAiPeV
# S32e5wwuYOknzDgoI9r8QTFUdelvBgxtVbxyZWJcWZFbLu4oPUhVUvpLJTWaxefo
# VUL0g1LgJEYcWnzKFerb9kuiMXeDLsMd4eEX9g4XMAclHEDihND0hPKc3X7sYsmX
# N/MtZUY1Zth0c53aq7bP5MBwNIH3tH3o+xAFcBhxiBQ/HxfX7qeNgOTIKo92ApfL
# xcQul1AA/q9uQhCKsgfCxZDU4BhcR6sfmCOiDiTTEs+4zlWVDWjWwYtoednhf7ok
# v3l9+A==
# =qyvX
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 23 Apr 2025 20:48:05 EDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-tcg-20250423' of https://gitlab.com/rth7680/qemu: (148 commits)
  tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
  target/i386: Remove AccelCPUClass::cpu_class_init need
  target/riscv: Remove AccelCPUClass::cpu_class_init need
  accel/tcg: Move mttcg warning to tcg_init_machine
  tcg: Convert TCGState::mttcg_enabled to TriState
  accel/tcg: Remove mttcg_enabled
  tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h'
  tcg: Pass max_threads not max_cpus to tcg_init
  tcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h'
  tcg: Remove the TCG_GUEST_DEFAULT_MO definition globally
  tcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order
  tcg: Propagate CPUState argument to cpu_req_mo()
  tcg: Remove use of TCG_GUEST_DEFAULT_MO in tb_gen_code()
  tcg: Define guest_default_memory_order in TCGCPUOps
  tcg: Simplify tcg_req_mo() macro
  tcg: Always define TCG_GUEST_DEFAULT_MO
  exec: Do not include 'accel/tcg/cpu-ldst.h' in 'exec-all.h'
  exec: Restrict 'cpu_ldst.h' to accel/tcg/
  exec: Restrict 'cpu-ldst-common.h' to accel/tcg/
  tcg: Always define TARGET_INSN_START_EXTRA_WORDS
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agocleanup: Drop pointless label at end of function
Markus Armbruster [Mon, 7 Apr 2025 08:26:43 +0000 (10:26 +0200)] 
cleanup: Drop pointless label at end of function

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Corey Minyard <cminyard@mvista.com>
Message-ID: <20250407082643.2310002-4-armbru@redhat.com>

7 weeks agocleanup: Drop pointless return at end of function
Markus Armbruster [Mon, 7 Apr 2025 08:26:42 +0000 (10:26 +0200)] 
cleanup: Drop pointless return at end of function

A few functions now end with a label.  The next commit will clean them
up.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250407082643.2310002-3-armbru@redhat.com>
[Straightforward conflict with commit 988ad4ccebb6 (hw/loongarch/virt:
Fix cpuslot::cpu set at last in virt_cpu_plug()) resolved]

7 weeks agocleanup: Re-run return_directly.cocci
Markus Armbruster [Mon, 7 Apr 2025 08:26:41 +0000 (10:26 +0200)] 
cleanup: Re-run return_directly.cocci

Coccinelle's indentation of virt_create_plic() results in a long line.
Avoid that by mimicking the old indentation manually.

Don't touch tests/tcg/mips/user/.  I'm not sure these files are ours
to make style cleanups on.  They might be imported third-party code,
which we should leave as is to not complicate future updates.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250407082643.2310002-2-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7 weeks agotarget/loongarch: Guard BCEQZ/BCNEZ instructions with FP feature
WANG Rui [Fri, 18 Apr 2025 08:21:02 +0000 (16:21 +0800)] 
target/loongarch: Guard BCEQZ/BCNEZ instructions with FP feature

The BCEQZ and BCNEZ instructions depend on access to condition codes
from floating-point comparisons. Previously, these instructions were
unconditionally enabled for 64-bit targets.

This patch updates their translation to be gated under the `FP` feature
flag instead, ensuring they are only available when the floating-point
unit is present.

This improves correctness for CPUs lacking floating-point support.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Message-Id: <20250418082103.447780-3-wangrui@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Add CRC feature flag and use it to gate CRC instructions
WANG Rui [Fri, 18 Apr 2025 08:21:01 +0000 (16:21 +0800)] 
target/loongarch: Add CRC feature flag and use it to gate CRC instructions

This patch replaces the obsolete IOCSR_BRD bit with CRC in cpucfg1[25],
in both LA464 and LA132 CPU initialization functions. The corresponding
field macro in `cpu.h` is updated to reflect this change.

Additionally, the availability macro `avail_CRC()` is introduced in
`translate.h` to check the CRC feature flag.

All CRC-related instruction translations are updated to be gated by
the new CRC feature flag instead of hardcoded CPU features.

This ensures correctness and configurability when enabling CRC
instructions based on hardware capabilities.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250418082103.447780-2-wangrui@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agolinux-user/loongarch64: Decode BRK break codes for FPE signals
WANG Rui [Mon, 14 Apr 2025 07:49:52 +0000 (15:49 +0800)] 
linux-user/loongarch64: Decode BRK break codes for FPE signals

Handle specific LoongArch BRK break codes in user-mode emulation
to deliver accurate floating-point exception signals. Specifically,
BRK_OVERFLOW (6) triggers TARGET_FPE_INTOVF, and BRK_DIVZERO (7)
triggers TARGET_FPE_INTDIV. Other BRK codes fall back to a generic
SIGTRAP.

This improves correctness for programs that rely on BRK to signal
overflow or divide-by-zero conditions.

Signed-off-by: WANG Rui <wangrui@loongson.cn>
Acked-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20250414074952.6253-1-wangrui@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Move definition of TCG specified function to tcg directory
Bibo Mao [Wed, 23 Apr 2025 08:04:17 +0000 (16:04 +0800)] 
target/loongarch: Move definition of TCG specified function to tcg directory

Function loongarch_cpu_tlb_fill() only works in TCG mode, move its
definition from header file internals.h to file tcg/tcg_loongarch.h

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-10-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Add static definition with function loongarch_tlb_search()
Bibo Mao [Wed, 23 Apr 2025 08:04:16 +0000 (16:04 +0800)] 
target/loongarch: Add static definition with function loongarch_tlb_search()

Function loongarch_tlb_search() is only referenced in file tcg/tlb_helper.c,
define this function with static attribution.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-9-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Move function loongarch_tlb_search to directory tcg
Bibo Mao [Wed, 23 Apr 2025 08:04:15 +0000 (16:04 +0800)] 
target/loongarch: Move function loongarch_tlb_search to directory tcg

Function loongarch_tlb_search() and loongarch_map_tlb_entry() works
only in TCG mode, move these functions to directory tcg.

There is no any function change, only code moving.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-8-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Define function loongarch_get_addr_from_tlb() non-static
Bibo Mao [Wed, 23 Apr 2025 08:04:14 +0000 (16:04 +0800)] 
target/loongarch: Define function loongarch_get_addr_from_tlb() non-static

Define function loongarch_get_addr_from_tlb() non-static, and add its
definition in header file tcg/tcg_loongarch.h

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-7-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Set function loongarch_map_address() with common code
Bibo Mao [Wed, 23 Apr 2025 08:04:13 +0000 (16:04 +0800)] 
target/loongarch: Set function loongarch_map_address() with common code

Function loongarch_map_address is to get physical address from virtual
address, it is used by qmp commands to dump memory from virtual
address.

It is used by kvm mode also, here move function loongarch_map_address()
out of macro CONFIG_TCG. And it is common code, the similar with
function loongarch_page_table_walker().

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-6-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Add stub function loongarch_get_addr_from_tlb
Bibo Mao [Wed, 23 Apr 2025 08:04:12 +0000 (16:04 +0800)] 
target/loongarch: Add stub function loongarch_get_addr_from_tlb

Stub function loongarch_get_addr_from_tlb() is added if option
CONFIG_TCG is not enabled, so this function can be called in KVM
only mode.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-5-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Move function get_dir_base_width to common directory
Bibo Mao [Wed, 23 Apr 2025 08:04:11 +0000 (16:04 +0800)] 
target/loongarch: Move function get_dir_base_width to common directory

Function get_dir_base_width() is used by loongarch_page_table_walker(),
so it is used by KVM mode also, here move this function from directory
tcg to common directory.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-4-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Add function loongarch_get_addr_from_tlb
Bibo Mao [Wed, 23 Apr 2025 08:04:10 +0000 (16:04 +0800)] 
target/loongarch: Add function loongarch_get_addr_from_tlb

Function loongarch_get_addr_from_tlb() is added to get physical address
from TLB tables. TLB table only works in TCG mode, in future this
function will be moved to TCG directory.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-3-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotarget/loongarch: Move header file helper.h to directory tcg
Bibo Mao [Wed, 23 Apr 2025 08:04:09 +0000 (16:04 +0800)] 
target/loongarch: Move header file helper.h to directory tcg

Header file helper.h is specified for tcg mode, move this file to
directory tcg. And create new file helper.h to include header
file in tcg mode.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250423080417.3739809-2-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agohw/intc/loongarch_pch_msi: Remove gpio input handler
Bibo Mao [Thu, 10 Apr 2025 08:50:04 +0000 (16:50 +0800)] 
hw/intc/loongarch_pch_msi: Remove gpio input handler

MSI interrupt is triggered by writing message on specified memory address.
In generic it is used by PCI devices, and no device is connected pch MSI
irqchip with GPIO pin line method, here remove gpio input setting for MSI
controller.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Tested-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20250410085004.3577627-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
7 weeks agotcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field
Philippe Mathieu-Daudé [Sat, 5 Apr 2025 16:13:20 +0000 (18:13 +0200)] 
tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field

Instead of having a compile-time TARGET_SUPPORTS_MTTCG definition,
have each target set the 'mttcg_supported' field in the TCGCPUOps
structure.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250405161320.76854-17-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotarget/i386: Remove AccelCPUClass::cpu_class_init need
Philippe Mathieu-Daudé [Sat, 5 Apr 2025 16:13:06 +0000 (18:13 +0200)] 
target/i386: Remove AccelCPUClass::cpu_class_init need

Expose x86_tcg_ops symbol, then directly set it as
CPUClass::tcg_ops in TYPE_X86_CPU's class_init(),
using CONFIG_TCG #ifdef'ry. No need for the
AccelCPUClass::cpu_class_init() handler anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250405161320.76854-3-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotarget/riscv: Remove AccelCPUClass::cpu_class_init need
Philippe Mathieu-Daudé [Sat, 5 Apr 2025 16:13:05 +0000 (18:13 +0200)] 
target/riscv: Remove AccelCPUClass::cpu_class_init need

Expose riscv_tcg_ops symbol, then directly set it as
CPUClass::tcg_ops in TYPE_RISCV_CPU's class_init(),
using CONFIG_TCG #ifdef'ry. No need for the
AccelCPUClass::cpu_class_init() handler anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250405161320.76854-2-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agoaccel/tcg: Move mttcg warning to tcg_init_machine
Richard Henderson [Sat, 5 Apr 2025 01:52:36 +0000 (18:52 -0700)] 
accel/tcg: Move mttcg warning to tcg_init_machine

Delay the warning to tcg_init_machine, because we will
have resolved the CPUClass at that point.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Convert TCGState::mttcg_enabled to TriState
Philippe Mathieu-Daudé [Wed, 2 Apr 2025 14:48:24 +0000 (16:48 +0200)] 
tcg: Convert TCGState::mttcg_enabled to TriState

Use the OnOffAuto type as 3-state.

Since the TCGState instance is zero-initialized, the
mttcg_enabled is initialzed as AUTO (ON_OFF_AUTO_AUTO).

In tcg_init_machine(), if mttcg_enabled is still AUTO,
set a default value (effectively inlining the
default_mttcg_enabled() method content).

In the tcg_get_thread() getter, consider AUTO / OFF states
as "single", otherwise ON is "multi".

Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agoaccel/tcg: Remove mttcg_enabled
Richard Henderson [Sat, 5 Apr 2025 01:10:53 +0000 (18:10 -0700)] 
accel/tcg: Remove mttcg_enabled

In qemu_tcg_mttcg_enabled, read the value from TCGState
and eliminate the separate global variable.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h'
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 22:04:16 +0000 (00:04 +0200)] 
tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h'

qemu_tcg_mttcg_enabled() is specific to 1/ TCG and
2/ system emulation. Move the prototype declaration
to "system/tcg.h", reducing 'mttcg_enabled' variable
scope.

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: <20250403220420.78937-17-philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Pass max_threads not max_cpus to tcg_init
Richard Henderson [Fri, 4 Apr 2025 23:30:57 +0000 (16:30 -0700)] 
tcg: Pass max_threads not max_cpus to tcg_init

In effect, hoist the check for mttcg from tcg_n_regions()
to tcg_init_machine().

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h'
Philippe Mathieu-Daudé [Sun, 23 Mar 2025 17:45:29 +0000 (18:45 +0100)] 
tcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h'

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Remove the TCG_GUEST_DEFAULT_MO definition globally
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 18:02:35 +0000 (19:02 +0100)] 
tcg: Remove the TCG_GUEST_DEFAULT_MO definition globally

By directly using TCGCPUOps::guest_default_memory_order,
we don't need the TCG_GUEST_DEFAULT_MO definition anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 11:18:26 +0000 (12:18 +0100)] 
tcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order

In order to use TCG with multiple targets, replace the
compile time use of TCG_GUEST_DEFAULT_MO by a runtime access
to TCGCPUOps::guest_default_memory_order via CPUState.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Propagate CPUState argument to cpu_req_mo()
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 17:52:37 +0000 (18:52 +0100)] 
tcg: Propagate CPUState argument to cpu_req_mo()

In preparation of having tcg_req_mo() access CPUState in
the next commit, pass it to cpu_req_mo(), its single caller.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Remove use of TCG_GUEST_DEFAULT_MO in tb_gen_code()
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 18:05:31 +0000 (19:05 +0100)] 
tcg: Remove use of TCG_GUEST_DEFAULT_MO in tb_gen_code()

Use TCGCPUOps::guest_default_memory_order to set TCGContext::guest_mo.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Define guest_default_memory_order in TCGCPUOps
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 18:01:52 +0000 (19:01 +0100)] 
tcg: Define guest_default_memory_order in TCGCPUOps

Add the TCGCPUOps::guest_default_memory_order field and have
each target initialize it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Simplify tcg_req_mo() macro
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 11:16:28 +0000 (12:16 +0100)] 
tcg: Simplify tcg_req_mo() macro

Now that TCG_GUEST_DEFAULT_MO is always defined,
simplify the tcg_req_mo() macro.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Always define TCG_GUEST_DEFAULT_MO
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 11:10:45 +0000 (12:10 +0100)] 
tcg: Always define TCG_GUEST_DEFAULT_MO

We only require the TCG_GUEST_DEFAULT_MO for MTTCG-enabled
frontends, otherwise we use a default value of TCG_MO_ALL.

In order to simplify, require the definition for all targets,
defining it for hexagon, m68k, rx, sh4 and tricore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agoexec: Do not include 'accel/tcg/cpu-ldst.h' in 'exec-all.h'
Philippe Mathieu-Daudé [Tue, 1 Apr 2025 08:27:42 +0000 (10:27 +0200)] 
exec: Do not include 'accel/tcg/cpu-ldst.h' in 'exec-all.h'

Only 2 files requiring "accel/tcg/cpu-ldst.h" API do not
include it:
- accel/tcg/cpu-exec.c
- target/arm/tcg/sve_helper.c
Include it there and remove it from "exec/exec-all.h".

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>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agoexec: Restrict 'cpu_ldst.h' to accel/tcg/
Philippe Mathieu-Daudé [Tue, 1 Apr 2025 08:14:36 +0000 (10:14 +0200)] 
exec: Restrict 'cpu_ldst.h' to accel/tcg/

Mechanical change using:

  $ sed -i -e 's,exec/cpu_ldst,accel/tcg/cpu-ldst,' \
        $(git grep -l exec/cpu_ldst.h)

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>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agoexec: Restrict 'cpu-ldst-common.h' to accel/tcg/
Philippe Mathieu-Daudé [Tue, 1 Apr 2025 08:13:20 +0000 (10:13 +0200)] 
exec: Restrict 'cpu-ldst-common.h' to accel/tcg/

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>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Always define TARGET_INSN_START_EXTRA_WORDS
Philippe Mathieu-Daudé [Wed, 19 Mar 2025 11:46:55 +0000 (12:46 +0100)] 
tcg: Always define TARGET_INSN_START_EXTRA_WORDS

Do not define TARGET_INSN_START_EXTRA_WORDS under the
hood, have each target explicitly define it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Declare TARGET_INSN_START_EXTRA_WORDS in 'cpu-param.h'
Philippe Mathieu-Daudé [Wed, 19 Mar 2025 11:46:47 +0000 (12:46 +0100)] 
tcg: Declare TARGET_INSN_START_EXTRA_WORDS in 'cpu-param.h'

To avoid including the huge "cpu.h" for a simple definition,
move TARGET_INSN_START_EXTRA_WORDS to "cpu-param.h".

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotcg: Include missing 'cpu.h' in translate-all.c
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 21:37:54 +0000 (23:37 +0200)] 
tcg: Include missing 'cpu.h' in translate-all.c

tb_check_watchpoint() calls cpu_get_tb_cpu_state(),
which is declared in each "cpu.h" header. It is indirectly
included via "tcg/insn-start-words.h". Since we want to
rework "tcg/insn-start-words.h", removing "cpu.h" in the
next commit, add the missing header now, otherwise we'd
get:

  accel/tcg/translate-all.c:598:9: error: call to undeclared function 'cpu_get_tb_cpu_state' [-Wimplicit-function-declaration]
  598 |         cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
      |         ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotarget/riscv: Do not expose rv128 CPU on user mode emulation
Philippe Mathieu-Daudé [Wed, 2 Apr 2025 14:37:26 +0000 (15:37 +0100)] 
target/riscv: Do not expose rv128 CPU on user mode emulation

As Richard mentioned:

  We should allow RV128 in user-mode at all until there's a
  kernel abi for it.

Remove the experimental 'x-rv128' CPU on user emulation
(since it is experimental, no deprecation period is required).

Reported-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agohw/arm: make most of the compilation units common
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:14 +0000 (21:59 -0700)] 
hw/arm: make most of the compilation units common

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-30-pierrick.bouvier@linaro.org>

7 weeks agohw/arm/xlnx-versal: prepare compilation unit to be common
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:13 +0000 (21:59 -0700)] 
hw/arm/xlnx-versal: prepare compilation unit to be common

Remove kvm unused headers.

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

7 weeks agohw/arm/xlnx-zynqmp: prepare compilation unit to be common
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:12 +0000 (21:59 -0700)] 
hw/arm/xlnx-zynqmp: prepare compilation unit to be common

Remove kvm unused headers.

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

7 weeks agohw/arm/digic_boards: prepare compilation unit to be common
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:11 +0000 (21:59 -0700)] 
hw/arm/digic_boards: prepare compilation unit to be common

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-27-pierrick.bouvier@linaro.org>

7 weeks agohw/arm/boot: make compilation unit hw common
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:09 +0000 (21:59 -0700)] 
hw/arm/boot: make compilation unit hw common

Now we eliminated poisoned identifiers from headers, this file can now
be compiled once for all arm targets.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-25-pierrick.bouvier@linaro.org>

7 weeks agomeson: add common hw files
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:08 +0000 (21:59 -0700)] 
meson: add common hw files

Those files will be compiled once per base architecture ("arm" in this
case), instead of being compiled for every variant/bitness of
architecture.

We make sure to not include target cpu definitions (exec/cpu-defs.h) by
defining header guard directly. This way, a given compilation unit can
access a specific cpu definition, but not access to compile time defines
associated.

Previous commits took care to clean up some headers to not rely on
cpu-defs.h content.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-24-pierrick.bouvier@linaro.org>

7 weeks agotarget/arm: Expose Aarch64 helpers unconditionally
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 23:58:18 +0000 (01:58 +0200)] 
target/arm: Expose Aarch64 helpers unconditionally

At worst, for 32-bit arm binary, using these methods will
now produce a link time error, instead of a compile time one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250403235821.9909-37-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agotarget/arm/cpu: remove inline stubs for aarch32 emulation
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:07 +0000 (21:59 -0700)] 
target/arm/cpu: remove inline stubs for aarch32 emulation

Directly condition associated calls in target/arm/helper.c for now.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-23-pierrick.bouvier@linaro.org>

7 weeks agotarget/arm/cpu: define same set of registers for aarch32 and aarch64
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:06 +0000 (21:59 -0700)] 
target/arm/cpu: define same set of registers for aarch32 and aarch64

To eliminate TARGET_AARCH64, we need to make various definitions common
between 32 and 64 bit Arm targets.
Added registers are used only by aarch64 code, and the only impact is on
the size of CPUARMState, and added zarray
(ARMVectorReg zarray[ARM_MAX_VQ * 16]) member (+64KB)

It could be eventually possible to allocate this array only for aarch64
emulation, but I'm not sure it's worth the hassle to save a few KB per
vcpu. Running qemu-system takes already several hundreds of MB of
(resident) memory, and qemu-user takes dozens of MB of (resident) memory
anyway.

As part of this, we define ARM_MAX_VQ once for aarch32 and aarch64,
which will affect zregs field for aarch32.
This field is used for MVE and SVE implementations. MVE implementation
is clipping index value to 0 or 1 for zregs[*].d[],
so we should not touch the rest of data in this case anyway.

This change is safe regarding migration, because aarch64 registers still
have the same size, and for aarch32, only zregs is modified.
Migration code explicitly specify a size of 2 for env.vfp.zregs[0].d,
VMSTATE_UINT64_SUB_ARRAY(env.vfp.zregs[0].d, ARMCPU, 0, 2). So extending
the storage size has no impact.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-22-pierrick.bouvier@linaro.org>

7 weeks agotarget/arm/cpu: flags2 is always uint64_t
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:05 +0000 (21:59 -0700)] 
target/arm/cpu: flags2 is always uint64_t

Do not rely on target dependent type, but use a fixed type instead.
Since the original type is unsigned, it is safe to extend its size
without any side effect.

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

7 weeks agotarget/arm/cpu: always define kvm related registers
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:04 +0000 (21:59 -0700)] 
target/arm/cpu: always define kvm related registers

This does not hurt, even if they are not used.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-20-pierrick.bouvier@linaro.org>

7 weeks agoexec/poison: KVM_HAVE_MCE_INJECTION can now be poisoned
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:03 +0000 (21:59 -0700)] 
exec/poison: KVM_HAVE_MCE_INJECTION can now be poisoned

We prevent common code to use this define by mistake.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-19-pierrick.bouvier@linaro.org>

7 weeks agoaccel/kvm: move KVM_HAVE_MCE_INJECTION define to kvm-all.c
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:02 +0000 (21:59 -0700)] 
accel/kvm: move KVM_HAVE_MCE_INJECTION define to kvm-all.c

This define is used only in accel/kvm/kvm-all.c, so we push directly the
definition there. Add more visibility to kvm_arch_on_sigbus_vcpu() to
allow removing this define from any header.

The architectures defining KVM_HAVE_MCE_INJECTION are i386, x86_64 and
aarch64.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-18-pierrick.bouvier@linaro.org>

7 weeks agoexec/cpu-all: remove this header
Pierrick Bouvier [Tue, 25 Mar 2025 04:59:00 +0000 (21:59 -0700)] 
exec/cpu-all: remove this header

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-16-pierrick.bouvier@linaro.org>

7 weeks agoexec/cpu-all: transfer exec/cpu-common include to cpu.h headers
Pierrick Bouvier [Tue, 25 Mar 2025 04:58:59 +0000 (21:58 -0700)] 
exec/cpu-all: transfer exec/cpu-common include to cpu.h headers

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

7 weeks agoexec/cpu-all: remove exec/target_page include
Pierrick Bouvier [Mon, 31 Mar 2025 21:40:55 +0000 (16:40 -0500)] 
exec/cpu-all: remove exec/target_page include

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7 weeks agoexec/cpu-all: remove cpu include
Pierrick Bouvier [Tue, 25 Mar 2025 04:58:58 +0000 (21:58 -0700)] 
exec/cpu-all: remove cpu include

Now we made sure important defines are included using their direct
path, we can remove cpu.h from cpu-all.h.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-14-pierrick.bouvier@linaro.org>

7 weeks agoaccel/tcg: fix missing includes for TARGET_HAS_PRECISE_SMC
Pierrick Bouvier [Tue, 25 Mar 2025 04:58:57 +0000 (21:58 -0700)] 
accel/tcg: fix missing includes for TARGET_HAS_PRECISE_SMC

We prepare to remove cpu.h from cpu-all.h, which will transitively
remove it from accel/tcg/tb-internal.h, and thus from most of tcg
compilation units.

Note: this was caught by a test regression for s390x-softmmu.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-13-pierrick.bouvier@linaro.org>

7 weeks agoaccel/tcg: fix missing includes for TCG_GUEST_DEFAULT_MO
Pierrick Bouvier [Tue, 25 Mar 2025 04:58:56 +0000 (21:58 -0700)] 
accel/tcg: fix missing includes for TCG_GUEST_DEFAULT_MO

We prepare to remove cpu.h from cpu-all.h, which will transitively
remove it from accel/tcg/tb-internal.h, and thus from most of tcg
compilation units.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-12-pierrick.bouvier@linaro.org>

7 weeks agoexec/cpu-all: remove exec/cpu-interrupt include
Pierrick Bouvier [Tue, 25 Mar 2025 04:58:52 +0000 (21:58 -0700)] 
exec/cpu-all: remove exec/cpu-interrupt include

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-8-pierrick.bouvier@linaro.org>

7 weeks agoexec/cpu-all: remove tswap include
Pierrick Bouvier [Tue, 25 Mar 2025 04:58:51 +0000 (21:58 -0700)] 
exec/cpu-all: remove tswap include

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250325045915.994760-7-pierrick.bouvier@linaro.org>