On Tue, 28 Nov 2023 16:42:25 +0100 AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx> wrote: > >> > >>>> panfrost_device_reset(pfdev); > >>>> panfrost_devfreq_resume(pfdev); > >>>> > >>>> @@ -421,6 +422,9 @@ static int panfrost_device_runtime_suspend(struct device *dev) > >>>> return -EBUSY; > >>>> > >>>> panfrost_devfreq_suspend(pfdev); > >>>> + panfrost_job_suspend_irq(pfdev); > >>>> + panfrost_mmu_suspend_irq(pfdev); > >>>> + panfrost_gpu_suspend_irq(pfdev); > >>>> panfrost_gpu_power_off(pfdev); > >>>> > >>>> return 0; > >>>> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h > >>>> index 54a8aad54259..29f89f2d3679 100644 > >>>> --- a/drivers/gpu/drm/panfrost/panfrost_device.h > >>>> +++ b/drivers/gpu/drm/panfrost/panfrost_device.h > >>>> @@ -25,6 +25,12 @@ struct panfrost_perfcnt; > >>>> #define NUM_JOB_SLOTS 3 > >>>> #define MAX_PM_DOMAINS 5 > >>>> > >>>> +enum panfrost_drv_comp_bits { > >>>> + PANFROST_COMP_BIT_MMU, > >>>> + PANFROST_COMP_BIT_JOB, > >>>> + PANFROST_COMP_BIT_MAX > >>>> +}; > >>>> + > >>>> /** > >>>> * enum panfrost_gpu_pm - Supported kernel power management features > >>>> * @GPU_PM_CLK_DIS: Allow disabling clocks during system suspend > >>>> @@ -109,6 +115,7 @@ struct panfrost_device { > >>>> > >>>> struct panfrost_features features; > >>>> const struct panfrost_compatible *comp; > >>>> + DECLARE_BITMAP(is_suspending, PANFROST_COMP_BIT_MAX); > >>> > >>> nit: Maybe s/is_suspending/suspended_irqs/, given the state remains > >>> until the device is resumed. > >> > >> If we keep the `is_suspending` name, we can use this one more generically in > >> case we ever need to, what do you think? > > > > I'm lost. Why would we want to reserve a name for something we don't > > know about? My comment was mostly relating to the fact this bitmap > > doesn't reflect the is_suspending state, but rather is_suspended, > > because it remains set until the device is resumed. And we actually want > > it to reflect the is_suspended state, so we can catch interrupts that > > are not for us without reading regs in the hard irq handler, when the > > GPU is suspended. > > `is_suspended` (fun story: that's the first name I gave it) looks good to me, > the doubt I raised was about calling it `suspended_irqs` instead, as I would > prefer to keep names "more generic", but that's just personal preference at > this point anyway. Ah, sure, is_suspended is fine.