From 542a9ffb1cb41d7ca344d15d4d39b1d0bebba681 Mon Sep 17 00:00:00 2001 From: Ani Sinha Date: Tue, 10 Mar 2026 15:14:48 +0530 Subject: [PATCH 1/4] runstate: handle return code of EOPNOTSUPP properly from rebuild_guest() If rebuild_guest() accelerator callback returns EOPNOTSUPP, this means that the accelerator does not support rebuilding the guest state. Handle this case properly and separately from other error return codes. Fixes: 4003e5e65fe0("hw/accel: add a per-accelerator callback to change VM accelerator handle") Reported-by: Harsh Prateek Bora Signed-off-by: Ani Sinha Link: https://lore.kernel.org/r/20260310094450.35861-2-anisinha@redhat.com Signed-off-by: Paolo Bonzini --- system/runstate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/runstate.c b/system/runstate.c index 77cb14ae02..2d4e95a216 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -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."); From 42949e4a9c2d06dd3b7da7dd59bee000a49112a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 11 Feb 2026 14:33:05 +0400 Subject: [PATCH 2/4] build-sys: use the "run" variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid unused variables and hand-written path, this should also help meson to figure out the relation between the commands. Signed-off-by: Marc-André Lureau Link: https://lore.kernel.org/r/20260211103305.3112657-1-marcandre.lureau@redhat.com Signed-off-by: Paolo Bonzini --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 11139f540b..de00fddb2d 100644 --- a/meson.build +++ b/meson.build @@ -3504,7 +3504,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') From e4ff2106daddc112fea8621d2afd89dff75b93ee Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 14 Mar 2026 08:50:51 +0100 Subject: [PATCH 3/4] rust: fix build when --disable-rust and meson < 1.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit e65030ed50ee moved rust_std and build.rust_std from per-target override_options into the project's default_options, in order to avoid repetition. However, default_options are validated unconditionally at project initialization, even when Rust is disabled. This breaks builds with meson < 1.9.0 which does not know about "build.rust_std": meson.build:1:0: ERROR: Unknown option: "build.rust_std". Make the options conditional on the meson version, since Rust only supports new versions of Meson anyway. Fixes: e65030ed50ee ("rust: remove unnecessary repetitive options") Reported-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- meson.build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index de00fddb2d..d016482db1 100644 --- a/meson.build +++ b/meson.build @@ -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, From 6257754bb9b00b52018951096a9fba28b98a5b0d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 18 Mar 2026 08:35:21 +0100 Subject: [PATCH 4/4] rust: suggest passing --locked to "cargo install" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the option, cargo will try using the latest version of the dependencies of bindgen-cli. While it will obviously respect the constraints in Cargo.toml, old versions of Cargo do not have version-constrained resolution and will choke on dependencies that need Rust 2024. Cc: Daniel P. Berrangé Cc: Peter Maydell Signed-off-by: Paolo Bonzini --- docs/about/build-platforms.rst | 2 +- meson.build | 2 +- tests/docker/dockerfiles/fedora-rust-nightly.docker | 2 +- tests/docker/dockerfiles/ubuntu2204.docker | 2 +- tests/lcitool/refresh | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst index 6e3088d524..3d23dfbd77 100644 --- a/docs/about/build-platforms.rst +++ b/docs/about/build-platforms.rst @@ -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 diff --git a/meson.build b/meson.build index d016482db1..62fab727f4 100644 --- a/meson.build +++ b/meson.build @@ -114,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.') diff --git a/tests/docker/dockerfiles/fedora-rust-nightly.docker b/tests/docker/dockerfiles/fedora-rust-nightly.docker index 043b42a0a9..38381ef8f5 100644 --- a/tests/docker/dockerfiles/fedora-rust-nightly.docker +++ b/tests/docker/dockerfiles/fedora-rust-nightly.docker @@ -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 diff --git a/tests/docker/dockerfiles/ubuntu2204.docker b/tests/docker/dockerfiles/ubuntu2204.docker index 23b33d6ad4..44e763f571 100644 --- a/tests/docker/dockerfiles/ubuntu2204.docker +++ b/tests/docker/dockerfiles/ubuntu2204.docker @@ -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 diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh index 259e6ea072..79a280feab 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -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 = [