On 26-08-01 09:17:31, Shawn Guo wrote:
> qcom_pas_attach() unmasks the handover IRQ and marks handover_issued
> even though this driver instance never runs qcom_q6v5_prepare() for
> the boot it is attaching to. This was believed necessary to flush a
> stale interrupt latched at the interrupt controller while masked, but
> the handover IRQ is a Qualcomm SMP2P soft IRQ, not a real edge-latched
> hardware interrupt. The Linux SMP2P driver updates its cached value
> unconditionally on every notification and only delivers the nested IRQ
> for bits currently enabled in its own software bitmap, so a transition
> that happens while masked is simply dropped, never replayed on a later
> unmask.
> 
> Since there is nothing to flush, and this driver instance never takes
> the proxy power-domain/clock/regulator votes that the handover
> callback would tear down, there is no need to unmask the IRQ in
> attach() at all. Drop the enable_irq()/disable_irq() pair; setting
> handover_issued = true is sufficient to keep the flag consistent for
> the eventual qcom_q6v5_unprepare()/qcom_q6v5_prepare() cycle.
> 
> It fixes the following unbalanced runtime PM usage and IRQ enable
> warnings seen on Nord ADSP (probed as attached), after commit bb7c5d6f5b41
> ("remoteproc: qcom: q6v5: Make handover IRQ one-shot") comes in place.
> 
> root@iq10-rrd:~# cat /sys/class/remoteproc/remoteproc0/state
> attached
> root@iq10-rrd:~# echo stop > /sys/class/remoteproc/remoteproc0/state
> [   40.004874] genpd genpd:0:4c00000.remoteproc: Runtime PM usage count 
> underflow!
> [   40.012409] genpd genpd:1:4c00000.remoteproc: Runtime PM usage count 
> underflow!
> [   40.050074] remoteproc remoteproc0: stopped remote processor adsp
> root@iq10-rrd:~# echo start > /sys/class/remoteproc/remoteproc0/state
> [   44.350298] remoteproc remoteproc0: powering up adsp
> [   44.375769] remoteproc remoteproc0: Booting fw image qcom/nord/adsp.mbn, 
> size 8241816
> [   44.389850] PDM: no support for the platform, userspace daemon might be 
> required.
> [   44.397864] ------------[ cut here ]------------
> [   44.402633] Unbalanced enable for IRQ 363
> [   44.406779] WARNING: kernel/irq/manage.c:775 at __enable_irq+0x4c/0x7c, 
> CPU#9: sh/791
> ...
> 
> Suggested-by: Stephan Gerhold <[email protected]>
> Signed-off-by: Shawn Guo <[email protected]>

Thanks for fixing this.

Reviewed-by: Abel Vesa <[email protected]>

Reply via email to