Re: [PATCH v2 4/9] drm/panthor: Implement optional reset

Marek Vasut
2025-09-04T14:46:20Z

On 9/4/25 4:39 PM, Alexander Stein wrote:
> Hi,
>
> Am Donnerstag, 4. September 2025, 15:52:38 CEST schrieb Marek Vasut:
>> On 9/4/25 8:36 AM, Alexander Stein wrote:
>>
>> Hello Alexander,
>>
>>>>> Maybe the GPU remains halted because
>>>>> setting the GLB_HALT stops command stream processing, and the GPU never
>>>>> samples the clearing of GLB_HALT and therefore remains halted forever ?
>>>>
>>>> Exactly that, and that's expected.
>>>
>>> FYI: in a new release of system manager software (starting from lf-6.12.3-1.0.0),
>>> the GPU reset is reasserted in SM software already [1] and access to GPU
>>> block control has been removed from Cortex-A [2]. Starting from B0 step this
>>> version is required AFAIK.
>>
>> I don't think the SM is involved in this, because if I do the following
>> test, the MCU also fails to boot unless I do a reset:
>
> Is this some other reset than BLK_CTRL_GPUMIX? If so, it might be required.
> Don't know much about internal details though.
Yes

296 /**
297 * panthor_gpu_soft_reset() - Issue a soft-reset
298 * @ptdev: Device.
299 *
300 * Return: 0 on success, a negative error code otherwise.
301 */
302 int panthor_gpu_soft_reset(struct panthor_device *ptdev)
303 {
304 bool timedout = false;
305 unsigned long flags;
306
307 spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags);
308 if (!drm_WARN_ON(&ptdev->base,
309 ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED)) {
310 ptdev->gpu->pending_reqs |= GPU_IRQ_RESET_COMPLETED;
311 gpu_write(ptdev, GPU_INT_CLEAR, GPU_IRQ_RESET_COMPLETED);
312 gpu_write(ptdev, GPU_CMD, GPU_SOFT_RESET);
313 }
314 spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags);
315
316 if (!wait_event_timeout(ptdev->gpu->reqs_acked,
317 !(ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED),
318 msecs_to_jiffies(100))) {
319 spin_lock_irqsave(&ptdev->gpu->reqs_lock, flags);
320 if ((ptdev->gpu->pending_reqs & GPU_IRQ_RESET_COMPLETED) != 0 &&
321 !(gpu_read(ptdev, GPU_INT_RAWSTAT) & GPU_IRQ_RESET_COMPLETED))
322 timedout = true;
323 else
324 ptdev->gpu->pending_reqs &= ~GPU_IRQ_RESET_COMPLETED;
325 spin_unlock_irqrestore(&ptdev->gpu->reqs_lock, flags);
326 }
327
328 if (timedout) {
329 drm_err(&ptdev->base, "Soft reset timeout");
330 return -ETIMEDOUT;
331 }
332
333 return 0;
334 }