This series introduces a copy of the lossless integer conversion functions/traits of `nova-core` into the `kernel` crate, and makes `nova-core` use them.
This revision addresses the feedback received on v1 by making architecture-dependent conversions available via a dedicated `arch` sub-module to make it more obvious that they are not portable. This series is based on `rust-next`. Signed-off-by: Alexandre Courbot <[email protected]> --- Changes in v2: - Move architecture-dependent conversions into `arch` sub-module, and use dedicated trait names. - Use `use crate::` instead of `use kernel::` for kernel imports. - Replace use of `build_assert!` with `const_assert!` (Sashiko). - `#[inline]` all the functions (Sashiko). - Remove stray `#[allow(unused)]`. - Group kernel imports properly (Sashiko). - Do not reexport the contents of `casts` in `num`. - Link to v1: https://patch.msgid.link/[email protected] Changes in v1: - Update to latest version in `nova-core`. - Make `nova-core` use the kernel crate implementation and remove its own. - Link to RFC: https://lore.kernel.org/r/[email protected] --- Alexandre Courbot (2): rust: add functions and traits for lossless integer conversions gpu: nova-core: use kernel lossless integer conversion module drivers/gpu/nova-core/falcon.rs | 12 +- drivers/gpu/nova-core/falcon/fsp.rs | 4 +- drivers/gpu/nova-core/fb.rs | 2 +- drivers/gpu/nova-core/fb/hal/gb100.rs | 11 +- drivers/gpu/nova-core/firmware.rs | 8 +- drivers/gpu/nova-core/firmware/booter.rs | 10 +- drivers/gpu/nova-core/firmware/fwsec.rs | 2 +- drivers/gpu/nova-core/firmware/fwsec/bootloader.rs | 2 +- drivers/gpu/nova-core/firmware/gsp.rs | 7 +- drivers/gpu/nova-core/firmware/riscv.rs | 6 +- drivers/gpu/nova-core/fsp.rs | 4 +- drivers/gpu/nova-core/gsp.rs | 4 +- drivers/gpu/nova-core/gsp/cmdq.rs | 24 +- drivers/gpu/nova-core/gsp/fw.rs | 42 +-- drivers/gpu/nova-core/gsp/sequencer.rs | 2 +- drivers/gpu/nova-core/num.rs | 211 --------------- drivers/gpu/nova-core/vbios.rs | 2 +- rust/kernel/num.rs | 2 + rust/kernel/num/casts.rs | 298 +++++++++++++++++++++ 19 files changed, 373 insertions(+), 280 deletions(-) --- base-commit: dc01dfb37b34beeefcfe1c3055364d41a4070c7e change-id: 20251104-as_casts-6a8882ac0192 Best regards, -- Alexandre Courbot <[email protected]>
