drivers/gpu/nova-core/vbios.rs | 137 ++++++++++++++++------------------------- rust/kernel/transmute.rs | 60 ++++++++++++++++++ 2 files changed, 113 insertions(+), 84 deletions(-)
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>
On Wed Oct 29, 2025 at 12:07 AM JST, Alexandre Courbot wrote: > 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> Pushed to drm-rust-next, thanks for the reviews!
On Wed, Oct 29, 2025 at 12:07:35AM +0900, Alexandre Courbot wrote: > 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> Once the nit I suggested in patch 1 is discussed, for all patches: Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com> thanks, - Joel > --- > 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> >
On 10/28/25 8:07 AM, Alexandre Courbot wrote: ... > The base for this work is `drm-rust-next`, with [2] applied. Taking a look now, but unable to apply, using those steps. Do you have anything else perhaps in your tree? thanks, John Hubbard > > [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,
On Wed Oct 29, 2025 at 5:24 AM JST, John Hubbard wrote: > On 10/28/25 8:07 AM, Alexandre Courbot wrote: > ... >> The base for this work is `drm-rust-next`, with [2] applied. > > Taking a look now, but unable to apply, using those steps. Do you have > anything else perhaps in your tree? I tried checking out `drm-rust-next`, applying [2] (single patch, not the whole series), then this series, and it applied for me - with the caveat that the posted version of said patch does not build. :/ Yet more evidence that we should maintain the good habit of publishing trees for our patch series, which I unexcusably omitted here, so here it is: https://github.com/Gnurou/linux/tree/nova-vbios-frombytes > > > thanks, > John Hubbard > >> >> [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,
On 10/28/25 2:49 PM, Alexandre Courbot wrote: > On Wed Oct 29, 2025 at 5:24 AM JST, John Hubbard wrote: >> On 10/28/25 8:07 AM, Alexandre Courbot wrote: >> ... > I tried checking out `drm-rust-next`, applying [2] (single patch, not > the whole series), then this series, and it applied for me - with the Ah, that's the problem: I (and b4) thought that that reference meant "apply the series". Mystery solved. > caveat that the posted version of said patch does not build. :/ > > Yet more evidence that we should maintain the good habit of publishing > trees for our patch series, which I unexcusably omitted here, so here it > is: > > https://github.com/Gnurou/linux/tree/nova-vbios-frombytes > Yes, for things that have dependencies, a tree is a real lifeline, just in case. thanks, -- John Hubbard
© 2016 - 2026 Red Hat, Inc.