Re: [PATCH v4 2/9] gpu: nova-core: gsp: add mechanism to wait for space on command queue
From: Eliot Courtney
Date: Mon Mar 02 2026 - 22:09:04 EST
On Mon Mar 2, 2026 at 11:18 PM JST, Gary Guo wrote:
> On Mon Mar 2, 2026 at 11:42 AM GMT, Eliot Courtney wrote:
>> Add a timeout to `allocate_command` which waits for space on the GSP
>> command queue. It uses a similar timeout to nouveau.
>>
>> This lets `send_command` wait for space to free up in the command queue.
>> This is required to support continuation records which can fill up the
>> queue.
>
> Any reason that this isn't implemented as a `poll_allocate_command` which just
> returns a `EAGAIN`, and then a wrapper function that just waits for space to be
> ready when it got one? This way the logic is cleaner.
This kind of structure is what I originally did (see
https://lore.kernel.org/all/DGHRDFE9M6P7.L7JEOCLL3VS9@xxxxxxxxxx/)
although it wasn't quite as nice since `allocate_command` takes
&mut self and isn't callable from `read_poll_timeout`. Alex suggested
merging these into one as it simplifies a few things. But maybe I am
missing some better way to do it.