qemu/rust/hw
Paolo Bonzini 64574f1c51 rust: pl011: switch from bilge to bitfield-struct
The bilge crate is heavily reliant on traits and, because trait functions
are never const, bilge and const mix about as well as water and oil.
In addition, it has support for the zerocopy crate that only works for an
older version, and is hard to update because the implementation doesn't
like that zerocopy::FromBits and bilge::FromBits are the same name.
zerocopy is definitely something that QEMU could use in the future.

The bitfield-struct crate, instead, is built from the ground up to
support const.  Its use is pretty much the same (device code does not
change at all, only register declarations do), with some things being
more verbose and others being simpler.  The code for the crate itself
is much smaller, too.

It does have two disadvantages: it does not let you annotate enums
as bitfields, and it does not integrate with arbitrary-int.  Thus, it
requires manual size annotations for anything that is not a bool, iNN
or uNN.  Lack of support for arbitrary-int is a very small deal, while
enums are a bit more annoying because they require some repetition
and an implementation of two functions from_bits() and into_bits().
However, the latter is already provided by the "bits!"  and
"#[derive(common::TryInto)]" utilities, and thus is not manual
in QEMU's case.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-08-20 09:24:57 +02:00
..
char rust: pl011: switch from bilge to bitfield-struct 2026-08-20 09:24:57 +02:00
core rust: use meson automatic parsing of Cargo.toml 2026-08-20 09:24:57 +02:00
timer rust: use meson automatic parsing of Cargo.toml 2026-08-20 09:24:57 +02:00
Kconfig i386: enable rust hpet for pc when rust is enabled 2025-02-13 12:51:34 +01:00
meson.build rust/timer/hpet: define hpet_fw_cfg 2025-02-13 12:51:34 +01:00