Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* cleanup include/hw headers
* cleanup memory headers
* rust: preludes
* rust: support for dtrace
* rust/hpet: first part of reorganization
* meson: small cleanups
* target/i386: Diamond Rapids CPU model including CET, APX, AVX10.2

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmlPov8UHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroPN1wf9HCceQ1273g7HbNeamay2bSaqypyM
# sEUBk4ipwO0dp7AYaaX5MeJ8NxeYcK82oFgm35WLY1tMOv0BZG5ez02dLoh5C4fb
# Bmy3kV1aY9cxF0IwTyD4dIADlZoaMnGgMElUKFY2/EixjxOUMLe90b1MO2KczqFa
# jvC4gmjx5PC1r+BHycSEdKm2Rbunueb/5eSkKeyTX7rjxQ/Eij0uGjrWrZkMWtgs
# ERJ2xo+D6a38w/uJ88KuqUV1BqYxNNwKmvOwVBU2xFB9o9bm20TNOJZ3+D+Ki8Aj
# idv+rU0XY1bWseo4USuozsqxfkjLJ5lj2YYUkSVO/I1wJmuO7Bq6xzrCxg==
# =/nIt
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 27 Dec 2025 08:12:31 PM AEDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [unknown]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# 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: (152 commits)
  block: rename block/aio-wait.h to qemu/aio-wait.h
  block: rename block/aio.h to qemu/aio.h
  block: reduce files included by block/aio.h
  block: extract include/qemu/aiocb.h out of include/block/aio.h
  hw: add missing includes hidden by block/aio.h
  qmp: Fix thread race
  thread-pool: Fix thread race
  dosc/cpu-models-x86: Add documentation for DiamondRapids
  i386/cpu: Add CPU model for Diamond Rapids
  i386/cpu: Define dependency for VMX_VM_ENTRY_LOAD_IA32_FRED
  i386/cpu: Add an option in X86CPUDefinition to control CPUID 0x1f
  i386/cpu: Allow cache to be shared at thread level
  i386/cpu: Allow unsupported avx10_version with x-force-features
  i386/cpu: Add a helper to get host avx10 version
  i386/cpu: Support AVX10.2 with AVX10 feature models
  i386/cpu: Add support for AVX10_VNNI_INT in CPUID enumeration
  i386/cpu: Add CPUID.0x1E.0x1 subleaf for AMX instructions
  i386/cpu: Add support for MOVRS in CPUID enumeration
  run: introduce a script for running devel commands
  gitlab-ci: enable rust for msys2-64bit
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson
2025-12-29 09:10:39 +11:00
1844 changed files with 6409 additions and 4738 deletions

View File

@@ -46,13 +46,13 @@ grep_include() {
}
echo Found $(find . -name "*.d" | wc -l) object files
echo $(grep_include -F 'hw/hw.h') files include hw/hw.h
echo $(grep_include -F 'hw/core/hw-error.h') files include hw/core/hw-error.h
echo $(grep_include 'target/[a-z0-9]*/cpu\.h') files include cpu.h
echo $(grep_include -F 'qapi-types.h') files include qapi-types.h
echo $(grep_include -F 'trace/generated-tracers.h') files include generated-tracers.h
echo $(grep_include -F 'qapi/error.h') files include qapi/error.h
echo $(grep_include -F 'qom/object.h') files include qom/object.h
echo $(grep_include -F 'block/aio.h') files include block/aio.h
echo $(grep_include -F 'qemu/aio.h') files include block/aio.h
echo $(grep_include -F 'system/memory.h') files include system/memory.h
echo $(grep_include -F 'fpu/softfloat.h') files include fpu/softfloat.h
echo $(grep_include -F 'qemu/bswap.h') files include qemu/bswap.h
@@ -85,8 +85,8 @@ analyze() {
echo osdep.h:
analyze ../include/qemu/osdep.h
echo hw/hw.h:
analyze -include ../include/qemu/osdep.h ../include/hw/hw.h
echo hw/core/hw-error.h:
analyze -include ../include/qemu/osdep.h ../include/hw/core/hw-error.h
echo trace/generated-tracers.h:
analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
@@ -94,5 +94,5 @@ analyze -include ../include/qemu/osdep.h trace/generated-tracers.h
echo target/i386/cpu.h:
analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h
echo hw/hw.h + COMPILING_PER_TARGET:
analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
echo hw/core/hw-error.h + COMPILING_PER_TARGET:
analyze -DCOMPILING_PER_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/core/hw-error.h

View File

@@ -41,6 +41,7 @@ subprojects=(
keycodemapdb
libc-0.2-rs
libvfio-user
probe-0.5-rs
proc-macro-error-1-rs
proc-macro-error-attr-1-rs
proc-macro2-1-rs

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Script to compare machine type compatible properties (include/hw/boards.h).
# Script to compare machine type compatible properties (include/hw/core/boards.h).
# compat_props are applied to the driver during initialization to change
# default values, for instance, to maintain compatibility.
# This script constructs table with machines and values of their compat_props

View File

@@ -42,7 +42,7 @@ fi
SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs attrs-0.2-rs bilge-0.2-rs
bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
libc-0.2-rs proc-macro2-1-rs
libc-0.2-rs probe-0.5-rs proc-macro2-1-rs
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
syn-2-rs unicode-ident-1-rs"

View File

@@ -6,6 +6,7 @@ cat <<EOF
// @generated
// This file is autogenerated by scripts/rust/rust_root_crate.sh
#![no_main]
EOF
for crate in $*; do

View File

@@ -35,8 +35,6 @@ try:
except ImportError:
import tomli as tomllib
STRICT_LINTS = {"unknown_lints", "warnings"}
class CargoTOML:
tomldata: Mapping[Any, Any]
@@ -82,7 +80,7 @@ class LintFlag:
priority: int
def generate_lint_flags(cargo_toml: CargoTOML, strict_lints: bool) -> Iterable[str]:
def generate_lint_flags(cargo_toml: CargoTOML) -> Iterable[str]:
"""Converts Cargo.toml lints to rustc -A/-D/-F/-W flags."""
toml_lints = cargo_toml.lints
@@ -103,13 +101,7 @@ def generate_lint_flags(cargo_toml: CargoTOML, strict_lints: bool) -> Iterable[s
flag = "-F"
else:
raise Exception(f"invalid level {level} for {prefix}{lint}")
if not (strict_lints and lint in STRICT_LINTS):
lint_list.append(LintFlag(flags=[flag, prefix + lint], priority=priority))
if strict_lints:
for lint in STRICT_LINTS:
lint_list.append(LintFlag(flags=["-D", lint], priority=1000000))
lint_list.append(LintFlag(flags=[flag, prefix + lint], priority=priority))
lint_list.sort(key=lambda x: x.priority)
for lint in lint_list:
@@ -187,13 +179,6 @@ def main() -> None:
required=False,
default="1.0.0",
)
parser.add_argument(
"--strict-lints",
action="store_true",
dest="strict_lints",
help="apply stricter checks (for nightly Rust)",
default=False,
)
args = parser.parse_args()
if args.verbose:
logging.basicConfig(level=logging.DEBUG)
@@ -207,7 +192,7 @@ def main() -> None:
cargo_toml = CargoTOML(args.cargo_toml, None)
if args.lints:
for tok in generate_lint_flags(cargo_toml, args.strict_lints):
for tok in generate_lint_flags(cargo_toml):
print(tok)
if rustc_version >= (1, 80):

View File

@@ -461,6 +461,7 @@ class Event(object):
QEMU_TRACE = "trace_%(name)s"
QEMU_TRACE_TCG = QEMU_TRACE + "_tcg"
QEMU_RUST_DSTATE = "trace_%(name)s_enabled"
QEMU_DSTATE = "_TRACE_%(NAME)s_DSTATE"
QEMU_BACKEND_DSTATE = "TRACE_%(NAME)s_BACKEND_DSTATE"
QEMU_EVENT = "_TRACE_%(NAME)s_EVENT"

View File

@@ -70,3 +70,34 @@ def generate_h(event, group):
def generate_h_backend_dstate(event, group):
out(' QEMU_%(uppername)s_ENABLED() || \\',
uppername=event.name.upper())
def generate_rs_begin(events, group):
out('use std::cell::UnsafeCell;',
'',
'extern "C" {')
# These are the Rust declarations of the .probes section semaphores
# generated by dtrace(1) in its .o file output.
for e in events:
if 'disable' in e.properties:
continue
out(' #[allow(dead_code)]',
f' static qemu_{e.name}_semaphore: UnsafeCell<u16>;')
out('}',
'')
def generate_rs(event, group):
args = event.args.rust_call_extern()
if args:
args = ', ' + args
out(f' ::trace::probe!(qemu, {event.name}{args});')
def generate_rs_backend_dstate(event, group):
# Rust does not have access to the <provider>_<name>_ENABLED() macro from
# the dtrace(1) generated .h file. Use the matching semaphore declarations
# generated by generate_rs_begin() instead.
out(' (unsafe {qemu_%(n)s_semaphore.get().read_volatile()}) != 0 ||',
n=event.name)

View File

@@ -24,25 +24,43 @@ def generate(events, backend, group):
'#[allow(unused_imports)]',
'use util::bindings;',
'',
'#[allow(dead_code)]',
'#[inline(always)]',
'fn trace_event_state_is_enabled(dstate: u16) -> bool {',
' (unsafe { trace_events_enabled_count }) != 0 && dstate != 0',
'}',
'',
'extern "C" {',
' #[allow(dead_code)]',
' static mut trace_events_enabled_count: u32;',
'}',)
out('extern "C" {')
for e in events:
out(' static mut %s: u16;' % e.api(e.QEMU_DSTATE))
out('}')
out(' #[allow(dead_code)]',
' static mut %s: u16;' % e.api(e.QEMU_DSTATE))
out('}',
'')
backend.generate_begin(events, group)
for e in events:
out('',
out('#[inline(always)]',
'#[allow(dead_code)]',
'pub fn %(api)s() -> bool',
'{',
api=e.api(e.QEMU_RUST_DSTATE))
if "disable" not in e.properties:
backend.generate_backend_dstate(e, group)
if backend.check_trace_event_get_state:
out(' trace_event_state_is_enabled(unsafe { _%(event_id)s_DSTATE}) ||',
event_id = 'TRACE_' + e.name.upper())
out(' false',
'}',
'',
'#[inline(always)]',
'#[allow(dead_code)]',
'pub fn %(api)s(%(args)s)',
@@ -59,6 +77,7 @@ def generate(events, backend, group):
api=e.api())
backend.generate(e, group, check_trace_event_get_state=True)
out(' }')
out('}')
out('}',
'')
backend.generate_end(events, group)