Re: [PATCH 19/23] dmaengine: sdxi: Provide context start and stop APIs
From: Lynch, Nathan
Date: Tue Apr 21 2026 - 15:57:21 EST
On 4/20/2026 3:50 AM, Frank Li wrote:
> On Fri, Apr 10, 2026 at 08:07:29AM -0500, Nathan Lynch wrote:
>>
>> +int sdxi_start_cxt(struct sdxi_cxt *cxt)
>> +{
>> + struct sdxi_cxt *adm = to_admin_cxt(cxt);
>> + struct sdxi_desc *desc;
>> + struct sdxi_ring_resv resv;
>> + int err;
>> +
>> + might_sleep();
>> +
>> + struct sdxi_completion *sc __free(sdxi_completion) =
>> + sdxi_completion_alloc(cxt->sdxi);
>> +
>> + if (!sc)
>> + return -ENOMEM;
>> +
>> + /* This is not how to start the admin context. */
>> + if (WARN_ON(adm == cxt))
>> + return -EINVAL;
>> +
>> + err = sdxi_ring_reserve(adm->ring_state, 1, &resv);
>> + if (err)
>> + return err;
>> +
>> + desc = sdxi_ring_resv_next(&resv);
>> + sdxi_encode_cxt_start(desc, &(const struct sdxi_cxt_start) {
>> + .range = sdxi_cxt_range_single(cxt->id),
>> + });
>> + sdxi_completion_attach(desc, sc);
>> + sdxi_desc_make_valid(desc);
>> + sdxi_cxt_push_doorbell(adm, sdxi_ring_resv_dbval(&resv));
>> + sdxi_completion_poll(sc);
>
> Do check polll timeout?
Well, sdxi_completion_poll() will spin indefinitely as currently written.
That's not great, and I'm reminded that maybe it ought to be checking
the context status while polling the completion block as well.
Ultimately I want to convert administrative actions like this to
interrupt-based completion signaling though.