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

* runstate: handle return code of EOPNOTSUPP properly from rebuild_guest()
* meson: do not hardcode paths to generated files
* rust: fix build when --disable-rust and meson < 1.9
* rust: suggest passing --locked to "cargo install"

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmm6YIAUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroMUCgf/W4sL/UM7+SWErMtpO5pHFu+bM15F
# 4wDq7DcGi0xD9CbjSfLy089+kDT5zhCU3/CFTWLRe78V4gEyNBAmRsb03M8NNyrw
# cw3iDoOMeHnMdhhJXIb2eZrohq9oavvvGAaOSMfH8FxMlhH+548MNQcgRLA4UgFS
# gcgYBoD7o+o4WLEgS7yCe904h3lX89wptv8ULMNLpBXxc7LFOXggwX6d1+An9pZO
# UAFW2qQnxg+OH0TIh7gH/GweGZLQsDMg39NMnJNpoRg4W91bZYZZAo1AoVMOIILE
# JPPQ73xNRAFSgao9s9+ObuLPdyxycxnSzrAZBlePvBqIbTgiCdQ1Xe7ysQ==
# =BEea
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Mar 18 08:21:20 2026 GMT
# 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:
  rust: suggest passing --locked to "cargo install"
  rust: fix build when --disable-rust and meson < 1.9
  build-sys: use the "run" variable
  runstate: handle return code of EOPNOTSUPP properly from rebuild_guest()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell
2026-03-18 09:16:26 +00:00
6 changed files with 16 additions and 10 deletions

View File

@@ -114,7 +114,7 @@ Rust build dependencies
bindgen tool, which is too big to package and distribute. The minimum
supported version of bindgen is 0.60.x. For distributions that do not
include bindgen or have an older version, it is recommended to install
a newer version using ``cargo install bindgen-cli``.
a newer version using ``cargo install --locked bindgen-cli``.
QEMU requires Rust 1.83.0. This is available on all supported platforms
except for the ``mips64el`` architecture on Debian bookworm. For all other

View File

@@ -1,7 +1,11 @@
project('qemu', ['c'], meson_version: '>=1.5.0',
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++23', 'b_colorout=auto',
'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true',
'rust_std=2021', 'build.rust_std=2021'],
'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true'] +
# build.rust_std breaks with older meson, but Rust does not
# support old meson anyway
(meson.version().version_compare('>= 1.9') ? ['rust_std=2021', 'build.rust_std=2021'] : []),
version: files('VERSION'))
add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true,
@@ -110,7 +114,7 @@ if have_rust
bindgen = find_program('bindgen', required: get_option('rust'))
if not bindgen.found() or bindgen.version().version_compare('<0.60.0')
if get_option('rust').enabled()
error('bindgen version ' + bindgen.version() + ' is unsupported. You can install a new version with "cargo install bindgen-cli"')
error('bindgen version ' + bindgen.version() + ' is unsupported. You can install a new version with "cargo install --locked bindgen-cli"')
else
if bindgen.found()
warning('bindgen version ' + bindgen.version() + ' is unsupported, disabling Rust compilation.')
@@ -3491,7 +3495,7 @@ run_config = configuration_data({'build_dir': meson.current_build_dir()})
run = configure_file(input: 'run.in',
output: 'run',
configuration: run_config)
run_command('chmod', 'a+x', meson.current_build_dir() / 'run', check: true)
run_command('chmod', 'a+x', run, check: true)
hxtool = find_program('scripts/hxtool')
shaderinclude = find_program('scripts/shaderinclude.py')

View File

@@ -531,10 +531,12 @@ void qemu_system_reset(ShutdownCause reason)
(force_vmfd_change || !cpus_are_resettable())) {
if (ac->rebuild_guest) {
ret = ac->rebuild_guest(current_machine);
if (ret < 0) {
if (ret < 0 && ret != -EOPNOTSUPP) {
error_report("unable to rebuild guest: %s(%d)",
strerror(-ret), ret);
vm_stop(RUN_STATE_INTERNAL_ERROR);
} else if (ret == -EOPNOTSUPP) {
error_report("accelerator does not support reset!");
} else {
info_report("virtual machine state has been rebuilt with new "
"guest file handle.");

View File

@@ -179,7 +179,7 @@ RUN set -eux && \
test "$RUSTDOC" = "$(/usr/local/cargo/bin/rustup +nightly which rustdoc)" && \
test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"
ENV PATH=$CARGO_HOME/bin:$PATH
RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli
RUN /usr/local/cargo/bin/rustup run nightly cargo install --locked bindgen-cli
RUN $CARGO --list
# As a final step configure the user (if env is defined)
ARG USER

View File

@@ -162,7 +162,7 @@ ENV CARGO_HOME=/usr/local/cargo
ENV PATH=$CARGO_HOME/bin:$PATH
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
apt install -y --no-install-recommends cargo
RUN cargo install bindgen-cli
RUN cargo install --locked bindgen-cli
# As a final step configure the user (if env is defined)
ARG USER
ARG UID

View File

@@ -147,7 +147,7 @@ fedora_rustup_nightly_extras = [
' test "$RUSTDOC" = "$(/usr/local/cargo/bin/rustup +nightly which rustdoc)" && \\\n',
' test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"\n',
'ENV PATH=$CARGO_HOME/bin:$PATH\n',
'RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli\n',
'RUN /usr/local/cargo/bin/rustup run nightly cargo install --locked bindgen-cli\n',
'RUN $CARGO --list\n',
]
@@ -158,7 +158,7 @@ ubuntu2204_rust_extras = [
'ENV PATH=$CARGO_HOME/bin:$PATH\n',
"RUN DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
" apt install -y --no-install-recommends cargo\n",
'RUN cargo install bindgen-cli\n',
'RUN cargo install --locked bindgen-cli\n',
]
debian_all_test_cross_compilers = [