On Tue Dec 1, 2026 at 11:22 PM JST, Danilo Krummrich wrote:
> On Tue Dec 1, 2026 at 9:15 AM CET, Alexandre Courbot wrote:
>> +/// Writer for the `LibosMemoryRegionInitArgument` array passed to the GSP
>> bootloader.
>> +struct LibosInitArgs<'a> {
>> + buf: CoherentBox<'a, [LibosMemoryRegionInitArgument]>,
>> + len: usize,
>> +}
>> +
>> +impl<'a> LibosInitArgs<'a> {
>> + /// Allocates a zeroed `LibosMemoryRegionInitArgument` array for `dev`.
>> + fn new(dev: &'a device::Device<device::Bound>) -> Result<Self> {
>> + Ok(Self {
>> + buf: CoherentBox::zeroed_slice(
>> + dev,
>> + GSP_PAGE_SIZE / size_of::<LibosMemoryRegionInitArgument>(),
>> + GFP_KERNEL,
>> + )?,
>> + len: 0,
>> + })
>> + }
>> +
>> + /// Appends an entry to the array.
>> + fn push(&mut self, arg: impl Init<LibosMemoryRegionInitArgument>) ->
>> Result {
>> + self.buf.init_at(self.len, arg)?;
>> + self.len += 1;
>> + Ok(())
>> + }
>> +
>> + /// Consumes the writer and returns the underlying coherent DMA
>> allocation.
>> + fn finish(self) -> Coherent<'a, [LibosMemoryRegionInitArgument]> {
>> + self.buf.into()
>> + }
>> +}
>
> NIT: Should this be named LibosBuilder instead? Or since it's not exactly the
> builder pattern maybe just LibosWriter?
Let's go with `LibosWriter`, that's the most descriptive name imho.