On Wed, 14 Oct 2026 09:00:38 +0200, Shawn Guo <[email protected]> said: > When qcom_pas_attach() finds the fatal SMP2P bit already set, it reports > a crash and then fails the attach. The core unwinds the attach while the > crash work is queued: rproc_boot() drops the power refcount back to 0, > and __rproc_attach()/rproc_attach() unprepare the subdevices, clean up > the resource table and disable the IOMMU. Once rproc_boot() releases > rproc->lock, the crash handler finds the rproc still RPROC_DETACHED, > marks it RPROC_CRASHED and runs rproc_boot_recovery() on top of that > torn-down state: > > - the subdevices are unprepared a second time by rproc_stop(), so SSR > and sysmon notifiers see a duplicate shutdown; > - qcom_pas_stop() and the subsequent rproc_start() operate on resources > that rproc_attach() already released, e.g. iommu_unmap() on a > disabled domain for rproc->has_iommu; > - recovery leaves the rproc RPROC_RUNNING with power == 0. A later > "stop" via sysfs takes power to -1 and returns success without > stopping anything, so the remote stays running. A following "start" > then boots the firmware again on the running remote and fails to > re-add the still registered subdevices: > > sysfs: cannot create duplicate filename '.../qcom_common.pd-mapper.0' > remoteproc remoteproc0: failed to prepare subdevices for adsp: -17 > remoteproc remoteproc0: Boot failed: -17 > > A crash found at attach time is no different from one reported by the > fatal interrupt right after attaching. Factor the crash handling out of > q6v5_fatal_interrupt() into qcom_q6v5_report_fatal(), which logs the > SMEM crash reason, clears q6v5.running and reports the crash, and call > it from qcom_pas_attach() before letting the attach succeed. The core > completes the attach with balanced bookkeeping, and the crash handler > then recovers the subsystem through the regular RPROC_ATTACHED -> > RPROC_CRASHED path. With running cleared, qcom_q6v5_request_stop() does > not wait for a stop ack the dead remote cannot send, and handover_issued > already prevents a spurious handover on stop. > > Assisted-by: LLM > Fixes: 16472c99f469 ("remoteproc: qcom: pas: Add late attach support for > subsystems") > Reviewed-by: Stephan Gerhold <[email protected]> > Signed-off-by: Shawn Guo <[email protected]> > ---
Reviewed-by: Bartosz Golaszewski <[email protected]>

