On Tue, 2025-12-02 at 15:40 -0800, John Hubbard wrote:
> In fact, I just finished looking through my Hopper/Blackwell PIO code, which
> also needs 4-byte alignment, and concluded that returning -EINVAL for 
> misaligned
> data seems to be the appropriate way to handle things.

I've added this for v3:

        // Rejecting misaligned images here allows us to avoid checking
        // inside the loops.
        if img.len() % 4 != 0 {
            return Err(EINVAL);
        }

And I manually create the &[u8; 4] now:

            for word in block.chunks_exact(4) {
                let w = [word[0], word[1], word[2], word[3]];
                regs::NV_PFALCON_FALCON_IMEMD::default()
                    .set_data(u32::from_le_bytes(w))
                    .write(bar, &E::ID, port);

word[3] will always exist because of chunks_exact(4).

Reply via email to