[PATCH] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable

2025-07-15 Thread Rhys Lloyd
Separating the header allows the use of `size_of::()` instead of the magic number 4. Signed-off-by: Rhys Lloyd --- drivers/gpu/nova-core/vbios.rs | 56 +- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu

[PATCH v2] gpu: nova-core: vbios: change PmuLookupTableEntry to relax alignment

2025-07-15 Thread Rhys Lloyd
Instead of the data field containing a u32 and changing the alignment, change data to [u8; 4] and convert to u32 with a helper function. Removes another magic number by making the struct the same size as the data it needs to read, allowing the use of `size_of::()` Signed-off-by: Rhys Lloyd

[PATCH] gpu: nova-core: vbios: use size_of instead of magic number

2025-07-15 Thread Rhys Lloyd
12 is identical to the value of `size_of::()`, so use the latter instead. Signed-off-by: Rhys Lloyd --- drivers/gpu/nova-core/vbios.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs index 663fc50e8b66

[PATCH] gpu: nova-core: vbios: change PmuLookupTableEntry to relax alignment

2025-07-15 Thread Rhys Lloyd
Instead of the data field containing a u32 and changing the alignment, change data to [u8; 4] and convert to u32 with a helper function. Removes another magic number by making the struct the same size as the data it needs to read, allowing the use of `size_of::()` Signed-off-by: Rhys Lloyd

[PATCH] gpu: nova-core: define named constants for magic numbers

2025-07-14 Thread Rhys Lloyd
Introduce an associated constant `MIN_LEN` for each struct that checks the length of the input data in its constructor against a magic number. Signed-off-by: Rhys Lloyd --- Changes in v2: - Add commit description - Fix author to match SoB - Add base commit --- drivers/gpu/nova-core/vbios.rs

[PATCH] gpu: nova-core: fix bounds check in PmuLookupTableEntry::new

2025-07-14 Thread Rhys Lloyd
data is sliced from 2..6, but the bounds check data.len() < 5 does not satisfy those bounds. Fixes: 47c4846e4319 ("gpu: nova-core: vbios: Add support for FWSEC ucode extraction") Signed-off-by: Rhys Lloyd --- Changes in v2: - Ensure commit description does not spill into commit

Re: [PATCH] gpu: nova-core: define named constants for magic numbers

2025-07-14 Thread Rhys Lloyd
On 7/13/25 8:11 PM, Alexandre Courbot wrote: On Sun Jul 13, 2025 at 11:51 AM JST, Rhys Lloyd wrote: Introduce an associated constant `MIN_LEN` for each struct that checks the length of the input data in its constructor against a magic number. Signed-off-by: Rhys Lloyd As I mentioned in [1

[PATCH v3] gpu: nova-core: vbios: change PmuLookupTableEntry to use size_of

2025-07-18 Thread Rhys Lloyd
Annotate the PmuLookupTableEntry with an `#[repr(C, packed)]` attribute. Removes another magic number by making the struct the same size as the data it needs to read, allowing the use of `size_of::()` Signed-off-by: Rhys Lloyd --- Changes in v2: - get_data helper function renamed to data Changes

[PATCH v2] gpu: nova-core: vbios: use size_of instead of magic number

2025-07-18 Thread Rhys Lloyd
12 is identical to the value of `size_of::()`, so use the latter instead. Signed-off-by: Rhys Lloyd --- Changes in v2: - Added `#[repr(C)]` to `BitHeader` --- drivers/gpu/nova-core/vbios.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nova-core/vbios.rs b

[PATCH] gpu: nova-core: vbios: use offset_of in PmuLookupTableHeader::new

2025-07-18 Thread Rhys Lloyd
Use the offset_of macro for each struct field, annotate the `PmuLookupTableHeader` struct with `#[repr(C)]` attribute, and add a TODO message to use FromBytes when available. Signed-off-by: Rhys Lloyd --- drivers/gpu/nova-core/vbios.rs | 10 ++ 1 file changed, 6 insertions(+), 4

Re: [PATCH] gpu: nova-core: vbios: use offset_of in PmuLookupTableHeader::new

2025-07-27 Thread Rhys Lloyd
On Fri, Jul 25, 2025 at 7:04 AM Danilo Krummrich wrote: > > On 7/25/25 3:35 PM, Alexandre Courbot wrote: > > This chunk does not apply - on nova-next PmuLookupTableHeader does not > > seem to exist. I think I remember you split PmuLookupTableHeader in > > another patch, so can you send all the rel

[PATCH 1/2] gpu: nova-core: vbios: split out PmuLookupTableHeader from PmuLookupTable

2025-07-27 Thread Rhys Lloyd
Separating the header allows the use of `size_of::()` instead of the magic number 4. Signed-off-by: Rhys Lloyd --- drivers/gpu/nova-core/vbios.rs | 56 +- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu

[PATCH 2/2] gpu: nova-core: vbios: use offset_of in PmuLookupTableHeader::new

2025-07-27 Thread Rhys Lloyd
Use the offset_of macro for each struct field, annotate the `PmuLookupTableHeader` struct with `#[repr(C)]` attribute, and add a TODO message to use FromBytes when available. Signed-off-by: Rhys Lloyd --- drivers/gpu/nova-core/vbios.rs | 10 ++ 1 file changed, 6 insertions(+), 4