[PATCH 07/14] gpu: nova-core: firmware: use `zerocopy` for `BootloaderDmemDescV2`

From: Eliot Courtney

Date: Mon Nov 30 2026 - 04:29:37 EST


This removes an unsafe impl of `AsBytes`.

Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
drivers/gpu/nova-core/firmware/gen_bootloader.rs | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/nova-core/firmware/gen_bootloader.rs b/drivers/gpu/nova-core/firmware/gen_bootloader.rs
index a598eb451665..7e53f287ca2a 100644
--- a/drivers/gpu/nova-core/firmware/gen_bootloader.rs
+++ b/drivers/gpu/nova-core/firmware/gen_bootloader.rs
@@ -12,9 +12,9 @@
TryIntoBounded, //
},
prelude::*,
- ptr::Alignable,
- transmute::AsBytes, //
+ ptr::Alignable, //
};
+use zerocopy_derive::Immutable;

use crate::{
falcon::{
@@ -46,7 +46,7 @@
/// This has to be filled by the GPU driver and copied into DMEM at offset
/// [`BootloaderDesc.dmem_load_off`].
#[repr(C, packed)]
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, IntoBytes, Immutable)]
pub(crate) struct BootloaderDmemDescV2 {
/// Reserved, should always be first element.
reserved: [u32; 4],
@@ -123,9 +123,6 @@ pub(super) fn new(desc: &FalconUCodeDescV2, code_dma_base: u64, data_dma_base: u
}
}

-// SAFETY: This struct doesn't contain uninitialized bytes and doesn't have interior mutability.
-unsafe impl AsBytes for BootloaderDmemDescV2 {}
-
/// The generic falcon bootloader image and its IMEM load parameters.
pub(crate) struct GenericBootloader {
/// Bootloader code, zero-padded to a whole number of falcon memory blocks.

--
2.56.1