- * [PATCH 1/5] rust: transmute: add `from_bytes_prefix` family of methods
  2025-10-28 15:07 [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures Alexandre Courbot
@ 2025-10-28 15:07 ` Alexandre Courbot
  2025-10-28 15:07 ` [PATCH 2/5] gpu: nova-core: vbios: use FromBytes for PmuLookupTable header Alexandre Courbot
                   ` (4 subsequent siblings)
  5 siblings, 0 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
The `from_bytes*` family of functions expect a slice of the exact same
size as the requested type. This can be sometimes cumbersome for callers
that deal with dynamic stream of data that needs to be manually cut
before each invocation of `from_bytes`.
To simplify such callers, introduce a new `from_bytes*_prefix` family of
methods, which split the input slice at the index required for the
equivalent `from_bytes` method to succeed, and return its result
alongside with the remainder of the slice.
This design is inspired by zerocopy's `try_*_from_prefix` family of
methods.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 rust/kernel/transmute.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
diff --git a/rust/kernel/transmute.rs b/rust/kernel/transmute.rs
index cfc37d81adf2..00cd3092c7cc 100644
--- a/rust/kernel/transmute.rs
+++ b/rust/kernel/transmute.rs
@@ -58,6 +58,26 @@ fn from_bytes(bytes: &[u8]) -> Option<&Self>
         }
     }
 
+    /// Converts the beginning of `bytes` to a reference to `Self`.
+    ///
+    /// This method is similar to [`Self::from_bytes`], with the difference that `bytes` does not
+    /// need to be the same size of `Self` - the appropriate portion is cut from the beginning of
+    /// `bytes`, and the remainder returned alongside the result.
+    fn from_bytes_prefix(bytes: &[u8]) -> Option<(&Self, &[u8])>
+    where
+        Self: Sized,
+    {
+        if bytes.len() < size_of::<Self>() {
+            None
+        } else {
+            // We checked that `bytes.len() >= size_of::<Self>`, thus `split_at` cannot panic.
+            // TODO: replace with `split_at_checked` once the MSRV is >= 1.80.
+            let (prefix, remainder) = bytes.split_at(size_of::<Self>());
+
+            Self::from_bytes(prefix).map(|s| (s, remainder))
+        }
+    }
+
     /// Converts a mutable slice of bytes to a reference to `Self`.
     ///
     /// Succeeds if the reference is properly aligned, and the size of `bytes` is equal to that of
@@ -80,6 +100,26 @@ fn from_bytes_mut(bytes: &mut [u8]) -> Option<&mut Self>
         }
     }
 
+    /// Converts the beginning of `bytes` to a mutable reference to `Self`.
+    ///
+    /// This method is similar to [`Self::from_bytes_mut`], with the difference that `bytes` does
+    /// not need to be the same size of `Self` - the appropriate portion is cut from the beginning
+    /// of `bytes`, and the remainder returned alongside the result.
+    fn from_bytes_mut_prefix(bytes: &mut [u8]) -> Option<(&mut Self, &mut [u8])>
+    where
+        Self: AsBytes + Sized,
+    {
+        if bytes.len() < size_of::<Self>() {
+            None
+        } else {
+            // We checked that `bytes.len() >= size_of::<Self>`, thus `split_at_mut` cannot panic.
+            // TODO: replace with `split_at_mut_checked` once the MSRV is >= 1.80.
+            let (prefix, remainder) = bytes.split_at_mut(size_of::<Self>());
+
+            Self::from_bytes_mut(prefix).map(|s| (s, remainder))
+        }
+    }
+
     /// Creates an owned instance of `Self` by copying `bytes`.
     ///
     /// Unlike [`FromBytes::from_bytes`], which requires aligned input, this method can be used on
@@ -97,6 +137,26 @@ fn from_bytes_copy(bytes: &[u8]) -> Option<Self>
             None
         }
     }
+
+    /// Creates an owned instance of `Self` from the beginning of `bytes`.
+    ///
+    /// This method is similar to [`Self::from_bytes_copy`], with the difference that `bytes` does
+    /// not need to be the same size of `Self` - the appropriate portion is cut from the beginning
+    /// of `bytes`, and the remainder returned alongside the result.
+    fn from_bytes_copy_prefix(bytes: &[u8]) -> Option<(Self, &[u8])>
+    where
+        Self: Sized,
+    {
+        if bytes.len() < size_of::<Self>() {
+            None
+        } else {
+            // We checked that `bytes.len() >= size_of::<Self>`, thus `split_at` cannot panic.
+            // TODO: replace with `split_at_checked` once the MSRV is >= 1.80.
+            let (prefix, remainder) = bytes.split_at(size_of::<Self>());
+
+            Self::from_bytes_copy(prefix).map(|s| (s, remainder))
+        }
+    }
 }
 
 macro_rules! impl_frombytes {
-- 
2.51.0
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * [PATCH 2/5] gpu: nova-core: vbios: use FromBytes for PmuLookupTable header
  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 ` Alexandre Courbot
  2025-10-28 15:07 ` [PATCH 3/5] gpu: nova-core: vbios: use FromBytes for PcirStruct Alexandre Courbot
                   ` (3 subsequent siblings)
  5 siblings, 0 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
Use `from_bytes_copy_prefix` to create the `PmuLookupTable` header
instead of building it ourselves from the bytes stream. This lets us
remove a few `as` conversions and array accesses.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/vbios.rs | 44 ++++++++++++++++++++++--------------------
 1 file changed, 23 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index 46da51b9f6b0..b6c20627a5e3 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -10,6 +10,7 @@
 use kernel::error::Result;
 use kernel::prelude::*;
 use kernel::ptr::{Alignable, Alignment};
+use kernel::transmute::FromBytes;
 use kernel::types::ARef;
 
 /// The offset of the VBIOS ROM in the BAR0 space.
@@ -866,29 +867,36 @@ fn new(data: &[u8]) -> Result<Self> {
     }
 }
 
+#[repr(C)]
+struct PmuLookupTableHeader {
+    version: u8,
+    header_len: u8,
+    entry_len: u8,
+    entry_count: u8,
+}
+
+// SAFETY: all bit patterns are valid for `PmuLookupTableHeader`.
+unsafe impl FromBytes for PmuLookupTableHeader {}
+
 /// The [`PmuLookupTableEntry`] structure is used to find the [`PmuLookupTableEntry`] for a given
 /// application ID.
 ///
 /// The table of entries is pointed to by the falcon data pointer in the BIT table, and is used to
 /// locate the Falcon Ucode.
-#[expect(dead_code)]
 struct PmuLookupTable {
-    version: u8,
-    header_len: u8,
-    entry_len: u8,
-    entry_count: u8,
+    header: PmuLookupTableHeader,
     table_data: KVec<u8>,
 }
 
 impl PmuLookupTable {
     fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {
-        if data.len() < 4 {
-            return Err(EINVAL);
-        }
+        let header = PmuLookupTableHeader::from_bytes_copy_prefix(data)
+            .ok_or(EINVAL)?
+            .0;
 
-        let header_len = usize::from(data[1]);
-        let entry_len = usize::from(data[2]);
-        let entry_count = usize::from(data[3]);
+        let header_len = usize::from(header.header_len);
+        let entry_len = usize::from(header.entry_len);
+        let entry_count = usize::from(header.entry_count);
 
         let required_bytes = header_len + (entry_count * entry_len);
 
@@ -909,27 +917,21 @@ fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {
             dev_dbg!(dev, "PMU entry: {:02x?}\n", &data[i..][..entry_len]);
         }
 
-        Ok(PmuLookupTable {
-            version: data[0],
-            header_len: header_len as u8,
-            entry_len: entry_len as u8,
-            entry_count: entry_count as u8,
-            table_data,
-        })
+        Ok(PmuLookupTable { header, table_data })
     }
 
     fn lookup_index(&self, idx: u8) -> Result<PmuLookupTableEntry> {
-        if idx >= self.entry_count {
+        if idx >= self.header.entry_count {
             return Err(EINVAL);
         }
 
-        let index = (usize::from(idx)) * usize::from(self.entry_len);
+        let index = (usize::from(idx)) * usize::from(self.header.entry_len);
         PmuLookupTableEntry::new(&self.table_data[index..])
     }
 
     // find entry by type value
     fn find_entry_by_type(&self, entry_type: u8) -> Result<PmuLookupTableEntry> {
-        for i in 0..self.entry_count {
+        for i in 0..self.header.entry_count {
             let entry = self.lookup_index(i)?;
             if entry.application_id == entry_type {
                 return Ok(entry);
-- 
2.51.0
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * [PATCH 3/5] gpu: nova-core: vbios: use FromBytes for PcirStruct
  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 ` Alexandre Courbot
  2025-10-28 15:07 ` [PATCH 4/5] gpu: nova-core: vbios: use FromBytes for BitHeader Alexandre Courbot
                   ` (2 subsequent siblings)
  5 siblings, 0 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
Use `from_bytes_copy_prefix` to create `PcirStruct` instead of building
it ourselves from the bytes stream. This lets us remove a few array
accesses and results in shorter code.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/vbios.rs | 40 ++++++++++++----------------------------
 1 file changed, 12 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index b6c20627a5e3..b02a1997306f 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -314,45 +314,29 @@ struct PcirStruct {
     max_runtime_image_len: u16,
 }
 
+// SAFETY: all bit patterns are valid for `PcirStruct`.
+unsafe impl FromBytes for PcirStruct {}
+
 impl PcirStruct {
     fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {
-        if data.len() < core::mem::size_of::<PcirStruct>() {
-            dev_err!(dev, "Not enough data for PcirStruct\n");
-            return Err(EINVAL);
-        }
-
-        let mut signature = [0u8; 4];
-        signature.copy_from_slice(&data[0..4]);
+        let pcir = PcirStruct::from_bytes_copy_prefix(data).ok_or(EINVAL)?.0;
 
         // Signature should be "PCIR" (0x52494350) or "NPDS" (0x5344504e).
-        if &signature != b"PCIR" && &signature != b"NPDS" {
-            dev_err!(dev, "Invalid signature for PcirStruct: {:?}\n", signature);
+        if &pcir.signature != b"PCIR" && &pcir.signature != b"NPDS" {
+            dev_err!(
+                dev,
+                "Invalid signature for PcirStruct: {:?}\n",
+                pcir.signature
+            );
             return Err(EINVAL);
         }
 
-        let mut class_code = [0u8; 3];
-        class_code.copy_from_slice(&data[13..16]);
-
-        let image_len = u16::from_le_bytes([data[16], data[17]]);
-        if image_len == 0 {
+        if pcir.image_len == 0 {
             dev_err!(dev, "Invalid image length: 0\n");
             return Err(EINVAL);
         }
 
-        Ok(PcirStruct {
-            signature,
-            vendor_id: u16::from_le_bytes([data[4], data[5]]),
-            device_id: u16::from_le_bytes([data[6], data[7]]),
-            device_list_ptr: u16::from_le_bytes([data[8], data[9]]),
-            pci_data_struct_len: u16::from_le_bytes([data[10], data[11]]),
-            pci_data_struct_rev: data[12],
-            class_code,
-            image_len,
-            vendor_rom_rev: u16::from_le_bytes([data[18], data[19]]),
-            code_type: data[20],
-            last_image: data[21],
-            max_runtime_image_len: u16::from_le_bytes([data[22], data[23]]),
-        })
+        Ok(pcir)
     }
 
     /// Check if this is the last image in the ROM.
-- 
2.51.0
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * [PATCH 4/5] gpu: nova-core: vbios: use FromBytes for BitHeader
  2025-10-28 15:07 [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures Alexandre Courbot
                   ` (2 preceding siblings ...)
  2025-10-28 15:07 ` [PATCH 3/5] gpu: nova-core: vbios: use FromBytes for PcirStruct Alexandre Courbot
@ 2025-10-28 15:07 ` 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
  5 siblings, 0 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
Use `from_bytes_copy_prefix` to create `BitHeader` instead of building
it ourselves from the bytes stream. This lets us remove a few array
accesses and results in shorter code.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/vbios.rs | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index b02a1997306f..ade99c90dd3d 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -374,30 +374,19 @@ struct BitHeader {
     checksum: u8,
 }
 
+// SAFETY: all bit patterns are valid for `BitHeader`.
+unsafe impl FromBytes for BitHeader {}
+
 impl BitHeader {
     fn new(data: &[u8]) -> Result<Self> {
-        if data.len() < core::mem::size_of::<Self>() {
-            return Err(EINVAL);
-        }
-
-        let mut signature = [0u8; 4];
-        signature.copy_from_slice(&data[2..6]);
+        let header = BitHeader::from_bytes_copy_prefix(data).ok_or(EINVAL)?.0;
 
         // Check header ID and signature
-        let id = u16::from_le_bytes([data[0], data[1]]);
-        if id != 0xB8FF || &signature != b"BIT\0" {
+        if header.id != 0xB8FF || &header.signature != b"BIT\0" {
             return Err(EINVAL);
         }
 
-        Ok(BitHeader {
-            id,
-            signature,
-            bcd_version: u16::from_le_bytes([data[6], data[7]]),
-            header_size: data[8],
-            token_size: data[9],
-            token_entries: data[10],
-            checksum: data[11],
-        })
+        Ok(header)
     }
 }
 
-- 
2.51.0
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * [PATCH 5/5] gpu: nova-core: vbios: use FromBytes for NpdeStruct
  2025-10-28 15:07 [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures Alexandre Courbot
                   ` (3 preceding siblings ...)
  2025-10-28 15:07 ` [PATCH 4/5] gpu: nova-core: vbios: use FromBytes for BitHeader Alexandre Courbot
@ 2025-10-28 15:07 ` Alexandre Courbot
  2025-10-28 20:24 ` [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures John Hubbard
  5 siblings, 0 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
Use `from_bytes_copy_prefix` to create `NpdeStruct` instead of building
it ourselves from the bytes stream. This lets us remove a few array
accesses and results in shorter code.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/gpu/nova-core/vbios.rs | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs
index ade99c90dd3d..8d143df46ede 100644
--- a/drivers/gpu/nova-core/vbios.rs
+++ b/drivers/gpu/nova-core/vbios.rs
@@ -537,35 +537,29 @@ struct NpdeStruct {
     last_image: u8,
 }
 
+// SAFETY: all bit patterns are valid for `NpdeStruct`.
+unsafe impl FromBytes for NpdeStruct {}
+
 impl NpdeStruct {
     fn new(dev: &device::Device, data: &[u8]) -> Option<Self> {
-        if data.len() < core::mem::size_of::<Self>() {
-            dev_dbg!(dev, "Not enough data for NpdeStruct\n");
-            return None;
-        }
-
-        let mut signature = [0u8; 4];
-        signature.copy_from_slice(&data[0..4]);
+        let npde = NpdeStruct::from_bytes_copy_prefix(data)?.0;
 
         // Signature should be "NPDE" (0x4544504E).
-        if &signature != b"NPDE" {
-            dev_dbg!(dev, "Invalid signature for NpdeStruct: {:?}\n", signature);
+        if &npde.signature != b"NPDE" {
+            dev_dbg!(
+                dev,
+                "Invalid signature for NpdeStruct: {:?}\n",
+                npde.signature
+            );
             return None;
         }
 
-        let subimage_len = u16::from_le_bytes([data[8], data[9]]);
-        if subimage_len == 0 {
+        if npde.subimage_len == 0 {
             dev_dbg!(dev, "Invalid subimage length: 0\n");
             return None;
         }
 
-        Some(NpdeStruct {
-            signature,
-            npci_data_ext_rev: u16::from_le_bytes([data[4], data[5]]),
-            npci_data_ext_len: u16::from_le_bytes([data[6], data[7]]),
-            subimage_len,
-            last_image: data[10],
-        })
+        Some(npde)
     }
 
     /// Check if this is the last image in the ROM.
-- 
2.51.0
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * Re: [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures
  2025-10-28 15:07 [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures Alexandre Courbot
                   ` (4 preceding siblings ...)
  2025-10-28 15:07 ` [PATCH 5/5] gpu: nova-core: vbios: use FromBytes for NpdeStruct Alexandre Courbot
@ 2025-10-28 20:24 ` John Hubbard
  2025-10-28 21:49   ` Alexandre Courbot
  5 siblings, 1 reply; 9+ messages in thread
From: John Hubbard @ 2025-10-28 20:24 UTC (permalink / raw)
  To: Alexandre Courbot, 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: Alistair Popple, Joel Fernandes, Timur Tabi, Edwin Peer,
	rust-for-linux, linux-kernel, nouveau, dri-devel
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,
^ permalink raw reply	[flat|nested] 9+ messages in thread
- * Re: [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures
  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
  0 siblings, 1 reply; 9+ messages in thread
From: Alexandre Courbot @ 2025-10-28 21:49 UTC (permalink / raw)
  To: John Hubbard, 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: Alistair Popple, Joel Fernandes, Timur Tabi, Edwin Peer,
	rust-for-linux, linux-kernel, nouveau, dri-devel, Nouveau
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,
^ permalink raw reply	[flat|nested] 9+ messages in thread 
- * Re: [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures
  2025-10-28 21:49   ` Alexandre Courbot
@ 2025-10-28 21:56     ` John Hubbard
  0 siblings, 0 replies; 9+ messages in thread
From: John Hubbard @ 2025-10-28 21:56 UTC (permalink / raw)
  To: Alexandre Courbot, 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: Alistair Popple, Joel Fernandes, Timur Tabi, Edwin Peer,
	rust-for-linux, linux-kernel, nouveau, dri-devel, Nouveau
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
^ permalink raw reply	[flat|nested] 9+ messages in thread