On Fri Dec 19, 2025 at 7:51 AM JST, Timur Tabi wrote:
> On Thu, 2025-12-18 at 20:54 +0900, Alexandre Courbot wrote:
>> +/// On Turing and GA100, the entries in the `LibosMemoryRegionInitArgument`
>> +/// must all be a multiple of GSP_PAGE_SIZE in size, so add padding to 
>> force it
>> +/// to that size.
>> +#[repr(C)]
>> +pub(crate) struct GspArgumentsAligned {
>> +    pub(crate) inner: GspArgumentsCached,
>> +    _padding: [u8; GSP_PAGE_SIZE - 
>> core::mem::size_of::<bindings::GSP_ARGUMENTS_CACHED>()],
>> +}
>
> Shouldn't I also remove the _padding from GspArgumentsCached:
>
> pub(crate) struct GspArgumentsCached(
>     bindings::GSP_ARGUMENTS_CACHED,
>     [u8; GSP_PAGE_SIZE - 
> core::mem::size_of::<bindings::GSP_ARGUMENTS_CACHED>()],
> );

Yes, the patch I sent in my previous message was in replacement of
yours, not to be applied on top - I should have mentioned that.

>
> and with the padding removed, doesn't this
>
>         dma_write!(rmargs[0].inner = fw::GspArgumentsCached::new(&cmdq))?;
>
> now only copy the args and leave the padding completely uninitialized?  
> That's okay, I think, I just
> want to make sure I'm not missing anything.

Since we call `alloc_coherent` with `__GFP_ZERO`, all memory will be
initialized to zero before that line is run. It's not 100% ideal but
does work.

Reply via email to