On Wed Dec 2, 2026 at 5:28 PM JST, Alok Kumar wrote: > From: Zhi Wang <[email protected]> > > Channel ID reservations need a GPU-owned pool shared by vGPU instances. > > The pool must remain at a stable address while its reservations exist. > Its storage also needs to remain available throughout GPU cleanup. > > Create a private pinned ChannelIdPool with a single 2048-channel > capacity constant. > > Cc: Alexandre Courbot <[email protected]> > Suggested-by: Eliot Courtney <[email protected]> > Signed-off-by: Zhi Wang <[email protected]> > Signed-off-by: Alok Kumar <[email protected]> > --- > drivers/gpu/nova-core/gpu.rs | 8 ++++++++ > drivers/gpu/nova-core/gpu/channel.rs | 4 ++++ > 2 files changed, 12 insertions(+) > > diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs > index debfc8089b2e..829ef9cea00b 100644 > --- a/drivers/gpu/nova-core/gpu.rs > +++ b/drivers/gpu/nova-core/gpu.rs > @@ -29,6 +29,10 @@ > }, > fb::SysmemFlush, > fsp::Fsp, > + gpu::channel::{ > + ChannelIdPool, > + TOTAL_CHANNELS, // > + }, > gsp::{ > self, > cmdq::Cmdq, > @@ -402,6 +406,8 @@ pub(crate) struct Gpu<'gpu> { > /// GSP and its resources. > #[pin] > gsp_resources: GspResources<'gpu>, > + #[pin] > + chid_pool: ChannelIdPool, > /// System memory page required for flushing all pending GPU-side memory > writes done through > /// PCIE into system memory, via sysmembar (A GPU-initiated HW > memory-barrier operation). > /// > @@ -479,6 +485,8 @@ pub(crate) fn new<'a>( > // Initialize this early because `gsp_resources` depends on it. > sysmem_flush: SysmemFlush::register(dev, bar, spec.chipset)?, > > + chid_pool <- ChannelIdPool::new(cv!(TOTAL_CHANNELS)), > + > gsp_resources <- try_pin_init!(GspResources { > device: pdev, > > diff --git a/drivers/gpu/nova-core/gpu/channel.rs > b/drivers/gpu/nova-core/gpu/channel.rs > index 7263bb4227d8..790d9be7c26c 100644 > --- a/drivers/gpu/nova-core/gpu/channel.rs > +++ b/drivers/gpu/nova-core/gpu/channel.rs > @@ -21,6 +21,10 @@ > }, // > }; > > +// TODO: Query the channel capacity through GMCAPI once an equivalent of > +// NV2080_CTRL_CMD_INTERNAL_FIFO_GET_NUM_CHANNELS is available. > +pub(super) const TOTAL_CHANNELS: u32 = 2048;
Think we can just do: ``` pub(super) const TOTAL_CHANNELS: NonZero<usize> = cv!(2048); ``` This should also simplify some code later I think.
