dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures
@ 2025-10-28 15:07 Alexandre Courbot
  2025-10-28 15:07 ` [PATCH 1/5] rust: transmute: add `from_bytes_prefix` family of methods Alexandre Courbot
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Alexandre Courbot @ 2025-10-28 15:07 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, David Airlie, Simona Vetter
  Cc: John Hubbard, Alistair Popple, Joel Fernandes, Timur Tabi,
	Edwin Peer, rust-for-linux, linux-kernel, nouveau, dri-devel,
	Alexandre Courbot

This series spawns from the discussion in [1], where it was noticed that
several structures of the VBIOS could just be read using `FromBytes`
instead of being built manually.

While implementing it, I also noticed that we were repeating the
following pattern quite a bit in the code:

    slice
        .get(..size_of::<TargetType>())
        .and_then(TargetType::from_bytes_copy)

... which begs for dedicated methods doing this in the `FromBytes`
trait. This is what the first patch does, taking inspiration from a
similar feature in the `zerocopy` crate.

The remaining patches leverage these new methods to simplify the VBIOS
code a bit, accordingly.

If patch 1 is deemed a valid idea, I hope we can merge it into the DRM
tree along with the rest of this series.

The base for this work is `drm-rust-next`, with [2] applied.

[1] https://lore.kernel.org/rust-for-linux/DDTRW1P2I4PB.10ZTZDY95JBC5@nvidia.com/
[2] https://lore.kernel.org/rust-for-linux/20251026-nova-as-v1-1-60c78726462d@nvidia.com/

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
Alexandre Courbot (5):
      rust: transmute: add `from_bytes_prefix` family of methods
      gpu: nova-core: vbios: use FromBytes for PmuLookupTable header
      gpu: nova-core: vbios: use FromBytes for PcirStruct
      gpu: nova-core: vbios: use FromBytes for BitHeader
      gpu: nova-core: vbios: use FromBytes for NpdeStruct

 drivers/gpu/nova-core/vbios.rs | 137 ++++++++++++++++-------------------------
 rust/kernel/transmute.rs       |  60 ++++++++++++++++++
 2 files changed, 113 insertions(+), 84 deletions(-)
---
base-commit: 639291d7c30cec5cf0d9a79371021c2e4404cfc9
change-id: 20251028-nova-vbios-frombytes-eb0cbb6a2f11

Best regards,
-- 
Alexandre Courbot <acourbot@nvidia.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-28 21:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 15:07 [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures Alexandre Courbot
2025-10-28 15:07 ` [PATCH 1/5] rust: transmute: add `from_bytes_prefix` family of methods Alexandre Courbot
2025-10-28 15:07 ` [PATCH 2/5] gpu: nova-core: vbios: use FromBytes for PmuLookupTable header Alexandre Courbot
2025-10-28 15:07 ` [PATCH 3/5] gpu: nova-core: vbios: use FromBytes for PcirStruct Alexandre Courbot
2025-10-28 15:07 ` [PATCH 4/5] gpu: nova-core: vbios: use FromBytes for BitHeader Alexandre Courbot
2025-10-28 15:07 ` [PATCH 5/5] gpu: nova-core: vbios: use FromBytes for NpdeStruct Alexandre Courbot
2025-10-28 20:24 ` [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures John Hubbard
2025-10-28 21:49   ` Alexandre Courbot
2025-10-28 21:56     ` John Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).