RustInQemu: Difference between revisions

From QEMU
(Add pflash devices to Possible project targets)
 
(15 intermediate revisions by 2 users not shown)
Line 3: Line 3:
== Active efforts in 2024 ==
== Active efforts in 2024 ==


* <code>Subject: [RFC 0/6] scripts: Rewrite simpletrace printer in Rust</code><br /><code>Date: Mon, 27 May 2024 16:14:15 +0800</code><br />https://lore.kernel.org/qemu-devel/20240527081421.2258624-1-zhao1.liu@intel.com/
* <code>Subject: [RFC 0/6] scripts: Rewrite simpletrace printer in Rust</code><br /><code>Date: Mon, 27 May 2024 16:14:15 +0800</code><br />[https://lore.kernel.org/qemu-devel/20240527081421.2258624-1-zhao1.liu@intel.com/ RFC v1]
* ARM PL011 UART device model in Rust<br /><code>Subject: [RFC PATCH v1 0/6] Implement ARM PL011 in Rust</code><br /><code>Date: Mon, 10 Jun 2024 21:22:35 +0300</code><br />https://lore.kernel.org/qemu-devel/cover.rust-pl011-rfc-v1.git.manos.pitsidianakis@linaro.org/<br />https://gitlab.com/epilys/rust-for-qemu
* ARM PL011 UART device model in Rust<br /><code>Subject: [RFC PATCH v1 0/6] Implement ARM PL011 in Rust</code><br /><code>Date: Mon, 10 Jun 2024 21:22:35 +0300</code><br />[https://lore.kernel.org/qemu-devel/cover.rust-pl011-rfc-v1.git.manos.pitsidianakis@linaro.org/ RFC v1] [https://lore.kernel.org/qemu-devel/rust-pl011-rfc-v2.git.manos.pitsidianakis@linaro.org v2]
** Meson integration
** Meson integration
** Bindings generation
** Bindings generation
Line 10: Line 10:
== Past efforts ==
== Past efforts ==


* <code>[RFC v3 00/32] Rust binding for QAPI and qemu-ga QMP handler examples</code> https://patchew.org/QEMU/20210907121943.3498701-1-marcandre.lureau@redhat.com/
* <code>[RFC v3 00/32] Rust binding for QAPI and qemu-ga QMP handler examples</code><br />[https://patchew.org/QEMU/20210907121943.3498701-1-marcandre.lureau@redhat.com/ on patchew] [https://lore.kernel.org/qemu-devel/20210907121943.3498701-1-marcandre.lureau@redhat.com/ on lore]
 
== Minimum supported version ==
* 1.56.0: 2021 edition
* 1.59.0: const <tt>CStr::from_bytes_with_nul_unchecked</tt> (needed by cstr crate, see below)
* 1.64.0: <tt>std::ffi::c_char</tt>
* 1.74.0: Clippy can be configured in Cargo.toml
* 1.77.0: C string literals, offset_of!
**alternative: cstr crate, [https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=10a22a9b8393abd7b541d8fc844bc0df with_offsets macro]
 
== TODO ==
Before commit:
* [https://lore.kernel.org/qemu-devel/1c53f8d2-3b33-404c-bb1c-38475087d7ae@redhat.com/ single cargo build]
After commit:
* integrate experiments at https://github.com/bonzini/rust-qemu
** lower minimum supported version (Debian needs 1.63.0)
** Bindings part 1: Generic Rust<->C interop, Error, QOM
** lints (see below)
* Bindings part 2: MemoryRegion, Chardev, SysbusDevice
 
== Ideas for lints without breaking CI ==
See https://github.com/bonzini/rust-qemu/commit/95b25f7c5f4e2694a85a5503050cc98da7562c7c
* run clippy as part of "make check", possibly only if Rust is newer than some version (1.74.0 so that clippy can be configured in Cargo.toml?)
* deny many individual lints, do not deny groups (complexity, perf, style, suspicious) on regular builds. allow unknown_lints.
* add to CI a fallible job that runs on nightly clippy with <tt>-Dclippy::complexity -Dclippy::perf -Dclippy::suspicious -Dclippy::style -Dunknown_lints</tt>. 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).


== Possible project targets ==
== Possible project targets ==
Line 20: Line 44:
=== Devices  ===
=== Devices  ===


- <code>hw/block/pflash_cfi01.c</code>, <code>hw/block/pflash_cfi02.c</code> ([[User:Manos|Manos]])
- <code>hw/block/pflash_cfi01.c</code>, <code>hw/block/pflash_cfi02.c</code> (claimed, WIP)
 
- <code>hw/mem/nvdimm.c</code> (suggested by [[User:Manos|Manos]])
 
- <code>hw/timer/i8254.c</code> (claimed, WIP)


[[Category:RustInQemu]]
[[Category:RustInQemu]]

Latest revision as of 11:34, 28 June 2024

For the old RustInQemu page, see RustInQemu/2022

Active efforts in 2024

  • Subject: [RFC 0/6] scripts: Rewrite simpletrace printer in Rust
    Date: Mon, 27 May 2024 16:14:15 +0800
    RFC v1
  • ARM PL011 UART device model in Rust
    Subject: [RFC PATCH v1 0/6] Implement ARM PL011 in Rust
    Date: Mon, 10 Jun 2024 21:22:35 +0300
    RFC v1 v2
    • Meson integration
    • Bindings generation

Past efforts

  • [RFC v3 00/32] Rust binding for QAPI and qemu-ga QMP handler examples
    on patchew on lore

Minimum supported version

  • 1.56.0: 2021 edition
  • 1.59.0: const CStr::from_bytes_with_nul_unchecked (needed by cstr crate, see below)
  • 1.64.0: std::ffi::c_char
  • 1.74.0: Clippy can be configured in Cargo.toml
  • 1.77.0: C string literals, offset_of!

TODO

Before commit:

After commit:

  • integrate experiments at https://github.com/bonzini/rust-qemu
    • lower minimum supported version (Debian needs 1.63.0)
    • Bindings part 1: Generic Rust<->C interop, Error, QOM
    • lints (see below)
  • Bindings part 2: MemoryRegion, Chardev, SysbusDevice

Ideas for lints without breaking CI

See https://github.com/bonzini/rust-qemu/commit/95b25f7c5f4e2694a85a5503050cc98da7562c7c

  • run clippy as part of "make check", possibly only if Rust is newer than some version (1.74.0 so that clippy can be configured in Cargo.toml?)
  • deny many individual lints, do not deny groups (complexity, perf, style, suspicious) on regular builds. allow unknown_lints.
  • 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).

Possible project targets

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)

- hw/mem/nvdimm.c (suggested by Manos)

- hw/timer/i8254.c (claimed, WIP)