RustInQemu

From QEMU
(Redirected from Features/Rust)

For the old RustInQemu page, see RustInQemu/2022

Active effort

Past efforts

  • [RFC v3 00/32] Rust binding for QAPI and qemu-ga QMP handler examples
    on patchew on lore
  • Subject: [RFC 0/6] scripts: Rewrite simpletrace printer in Rust
    Date: Mon, 27 May 2024 16:14:15 +0800
    RFC v1

Work in progress

To be merged

needs const_refs_static in Rust 1.83.0:

  • complete vmstate bindings
  • first round of typesafe qdev property generation

Paolo

  • Improving Cargo support in Meson
  • Tracing (summer of code 2025)

Manos

  • generate qdev properties via macros

Zhao

  • vm-memory integration

Kevin

Bugs

  • Add BQL abstraction for tests - avoid running them with "--test-threads 1"

Possible project targets

Projects with some code

Check if distros package the dependent Rust crates

Mostly useful for distros to enable Rust when building QEMU.

  • Missing in Fedora: arbitrary-int, bilge, bilge-impl, foreign
    • Fedora does have bitfield-struct, which is a bit inferior to bilge in some respects but smaller
  • Debian?

Cleanups

  • split qemu_api into multiple crates (each with its own prelude, too)
  • look into replacing pointer and BqlCell usage in HPET with self_cell (e.g. BqlRefCell<SelfCell<HPETRegisters, [HPETTimer; 8]>>).

Nice things to have

  • Remove need for manual "meson subprojects update --reset" when updating packagefiles/
  • Improve tool integration
    • Run code checks a la "meson test --suite codecheck"? (clippy and rustfmt)
  • Place rustdoc output for master somewhere?
    • Or generate with sphinx, with something like sphinx-rust
  • More bindings: I2C?

New code to write

Improved clippy coverage in CI?

  • run clippy as part of "make check"
  • add to CI a fallible job that runs on nightly clippy with -Dclippy::complexity -Dclippy::perf -Dclippy::suspicious -Dclippy::style -Dunknown_lints. the job should generally pass, and if a new lint triggers it probably should be added to Cargo.toml as either "allow" (rare) or "deny" (possibly after adding #[allow()] to the source).

Miscellanea

  • qemu-bridge-helper.c Re-write SUID C executable with useful features.

Devices

  • hw/block/pflash_cfi01.c, hw/block/pflash_cfi02.c (claimed, WIP)
    • needs block bindings
  • hw/timer/i8254.c (claimed, WIP)
  • hw/mem/nvdimm.c (suggested by Manos)