Re: [PATCH v5 5/5] gpu: nova-core: add ChannelIdPool
Yury Norov <[email protected]>
| Newsgroups | org.kernel.vger.rust-for-linux,dev.linux.lists.nova-gpu,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <an7bG2bEd28AbNRr@yury> |
On Fri, Aug 14, 2026 at 01:54:24PM +0900, Eliot Courtney wrote:
> > 1. Provide a nz! macro to create constant non-zero things. Provide some
> > constants for common alignments
> >
> > Potentially, we could use build_assert! for cases it is provably
> > non-zero but not a literal (although tbh not sure this is a good idea -
> > at least not do this initially).
> >
> > So either: nz!: const { NonZero::new(value).unwrap() }, or, nz!: some
> > build assert gated construction of NonZero. A general nz! macro could
> > also help ergonomics for other use cases too.
> >
> > That looks like this:
> >
> > pool.alloc_area(nz!(8), Alignment::AL_8)?;
>
> Actually found that if we implement SizeConstants for Alignment then we
> can get Alignment::SZ_4K etc almost for free.
Then maybe pass SZ_4K directly, and allow the alloc_area() to
calculate the alignment:
pool.alloc_area(nz!(8), SZ_4K)?;