From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35A583F1ACC for ; Tue, 9 Jun 2026 10:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781000594; cv=none; b=qsoWXzt0Knlpbcv/adEFX2Ywp3jNOND00ADIfzYupoMFU+UDP0PonvB2kQQ4sMghN++AIoPaUKfeUflXCnSqhnDjG6C4PK7z+U2GwyvIqXMQ7nCgtG8Bzm2t/mvaJ7j5G6yHewSWOxc588YE2fkf7C3Lhyo+yssECGo8krCSuKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781000594; c=relaxed/simple; bh=kCOJWtO9F47+b3gcGs0sqsq2t7/rJoV4159sYbTNwBk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RrXTn5PHx9iRETYb55aeZJWdx9E95HVax/a6rcTdAqIAc0/Lo/ak1gd86g3cRISpKgTTeHAf2/qbbZ0LYEywdiLuHdwZv+OEieA8tOg6tlI0Km0aUe8kfM9dppnE8FWyKfZZw17HJfMy54pZcZRkbz2jNx/JfKH9LrpGWpRLAJA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XJxaiRNT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=PiCaM8YT; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XJxaiRNT"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="PiCaM8YT" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6599xY372320446 for ; Tue, 9 Jun 2026 10:23:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=e6543jtmJUE 4LrGeqokz4NTAuP6hzn3dMwJfSvMTunc=; b=XJxaiRNTSqd5roaNqNiPS/EZIgK VJf1nzyeNjzj6k9/oSLDrjylCqGas0knhhYoN7jc60SCm/240dYUnQE7Wf9TNmw8 s3N119IvtVzw4GTDzgDru2+CFBJejd2MDbI6mRcIXK9GTS7mjtxbW3m63kM7KJhF Y79Y6Y0A0xftorUVp0+LU8j0cVkIOHRkwA40g3JQW2Aq6TXBY8F5aeS5JnHuPfaf YITLG8+CeV8jOApDzkayCjrrZtfudZD2K3FT2bzaLiJkBhAcgdfUXhxvZ/Kc7GVi iF+ZtNY24EgC7etkf0Rppw55RwkYtzYhkpDciNtLikijD/VHZMan++4Xz9w== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4epeearq1r-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 09 Jun 2026 10:23:12 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2c0b1bb53a8so41017295ad.0 for ; Tue, 09 Jun 2026 03:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781000591; x=1781605391; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e6543jtmJUE4LrGeqokz4NTAuP6hzn3dMwJfSvMTunc=; b=PiCaM8YT3pAGD5UpVDWNACRXFkXw2FZNRVBF3VFerszgY8uS5sOWujb+vl/bg5mtse bLw5xNFO6+gd07c3G+VpTKpqJr5uNr6VhxxB20xM3we4SAJiUJLNO7cQGwnxEftxH59k 4+3+JgbAokCxE84EsGtvL5c1qkqOSIJEK2SO+juJsJ20U/vKjnMKL0EZRRC/NrAOF4bw fwDEYg8aCATb9dqKlGx1O1oG+QONWlLQ7ABSVAWrFf4QOCOd80ZmFmpXiEZy9R7ZoHum 3s5+jzCvPTr43LO/QeLjAN03RLk94l15KpVihjJHvs48h2oyVPBS626TyJVktOawffxp KWTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781000591; x=1781605391; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=e6543jtmJUE4LrGeqokz4NTAuP6hzn3dMwJfSvMTunc=; b=BrivyM3WR1vre3YxW66TRHwa7JDfaTgVKS9pODxKibfBhRXDIQApbFpdytFOmy2SAi HR9J+tPjR1AXuorgh6gDPDL0NTPS6KpgvpjEjNJujiJrLNcpIoRX8+ZX5xx+f2ehRnzp wH9qDVlmvsPTB5X12NH+wYmnDJAluP30qqCLHUl8cKHVnBspbt1gwabImMZwcpENYGGp uQg+32OKLb5J/jnLBWCUA27djry7EBl8fr8ygz/bYHYfjSfRB1L1U/CI5wYy/uMktnDL Jhstt45CC4JMW+3xq2C4oGGDU4AUQ1KjMOOp0iB/l4uuoZQZI+qH/iVyx6YTe7cmjexJ zazg== X-Forwarded-Encrypted: i=1; AFNElJ+Mq8eop8tqOltm0SzSwAPIj1e0pt2uK5DI+bTNwqE0B29/5n6cl5Q5BxHRod3ehmpdc1Iqcs/wrkHkSFY=@vger.kernel.org X-Gm-Message-State: AOJu0YyrklhWMvww0ASep5ZXzFlowHDGDeLpRPx9meGvoWvdzFbI1vFU r55fzZzSfMkh71JLSIramA1r99+iflO9yQp+8izv5gYnFxvhkE4zP0AdW15/iOzFgjyAbZozoE5 vzvVo9bxHawFxq6hqTs3Fch8PS1R5xkTfge0HhjK5yFtoT5+65/NJLvVRAz4d1ke9xI4= X-Gm-Gg: Acq92OGl7yCITIjejzGODot/XCeJLovgDn/RA09bqfmAMji/tQA/0KqWenlJljAJal8 jGk+ZWknS0+8cBAVgqWOcrPQc0oOV2y+yDb8lGXZc80qHDMW+7Tnh36eTyjPocIfJrVCE+39eaY XJJPrf6V6STRAb/zgFrS0wBg9AoV5PlkfIe43+qFzSLAz2pg7Y0T7TKpp9lvFgGeLRD82ggMHzi kS6smGFh4EFHarbJBpWCrhz97bBCsLo0wnLQ1/VDXKx8U/T86IrgIGyJX3L2RD/3Gs+w+VBZIOE MQg0qlM0IduJkiPjSP2evf7nCwh+fJwX9Yqxr30L91KQIN5Ttv5y6QZa7nCEvL4umekoznbYeni kJFpLR3ppJH6Bhbv1aB1lgUoAYwyxllj4pmnsv8AUc4lFdWAQJ6CSwUIpa/0= X-Received: by 2002:a17:902:c403:b0:2c0:c262:b924 with SMTP id d9443c01a7336-2c1ec920ec1mr171681625ad.13.1781000590915; Tue, 09 Jun 2026 03:23:10 -0700 (PDT) X-Received: by 2002:a17:902:c403:b0:2c0:c262:b924 with SMTP id d9443c01a7336-2c1ec920ec1mr171681235ad.13.1781000590335; Tue, 09 Jun 2026 03:23:10 -0700 (PDT) Received: from hu-mojha-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c164f6e86dsm213121685ad.8.2026.06.09.03.23.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 03:23:09 -0700 (PDT) From: Mukesh Ojha To: Bjorn Andersson , Mathieu Poirier , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Mukesh Ojha Subject: [PATCH 2/3] remoteproc: abort subdev stop sequence on first failure Date: Tue, 9 Jun 2026 15:52:52 +0530 Message-ID: <20260609102254.2671238-3-mukesh.ojha@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260609102254.2671238-1-mukesh.ojha@oss.qualcomm.com> References: <20260609102254.2671238-1-mukesh.ojha@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: EBnXXVKEXGGnQ-U6KlWrqJV_NQl4oP1p X-Authority-Analysis: v=2.4 cv=Iey3n2qa c=1 sm=1 tr=0 ts=6a27e990 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=BqsRjhFJy6yuMY8SxUQA:9 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjA5MDA5NiBTYWx0ZWRfX/g+R9jhwUq2Q th3wTjLTb1VgN6w5CIZPdidl3HbvLCVWEYKPAclVn79m4PUGPfh4YfbCpkM7O1SWcfKBY4keJH7 yhcXouOJSmdba7eCNaZYZaIp0rU1RgC8mqnyGSDXcswt8+b5cTytkcfxlrSMw6gGqpf1tv1+s5N XSJGqm7IhE8JLWum6OMqByNAHoar/BMwETSI7rR5pNtimV5xpDzShvBWUYvVDlmlw2DZknfFcCN GkpWH5SeEX2+9bc3cU0pwh3cckuVamASQtMVcabZ+Ay51K2peu5UsCsuvn6nDvUOVQSe/iq20Lk I7G4mM90wOef8eq6YLjUpWVDe2DNIcYIiAmrumcoiP0T4Xq/CAV7eIC0vENqEiH5PvhMG7ceNvh ssIG860Vifhsl4WMxB52UxonyCmBybdPH7rSlkTuig2d2+1I7KjeBcYdjtB9J1euolCgS78MH4j wwx3cY/FLkgufDF6FLQ== X-Proofpoint-GUID: EBnXXVKEXGGnQ-U6KlWrqJV_NQl4oP1p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-09_02,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 spamscore=0 bulkscore=0 phishscore=0 clxscore=1015 priorityscore=1501 adultscore=0 suspectscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606090096 If a subdevice fails to stop, it indicates broken communication with the DSP. Continuing to stop further subdevices against an unresponsive remote processor could close rpmsg devices that could remove the memory mapping from HLOS and in case if remote processor touches those memory can result in SMMU fault. Change rproc_stop_subdevices() to return int and abort on the first failing subdev. Propagate the error through rproc_stop() and __rproc_detach() so callers are aware the teardown did not complete cleanly. Signed-off-by: Mukesh Ojha --- drivers/remoteproc/remoteproc_core.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 21127d972bff..77c4f09c7604 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -1110,7 +1110,7 @@ static int rproc_start_subdevices(struct rproc *rproc) return ret; } -static void rproc_stop_subdevices(struct rproc *rproc, bool crashed) +static int rproc_stop_subdevices(struct rproc *rproc, bool crashed) { struct rproc_subdev *subdev; int ret; @@ -1118,10 +1118,14 @@ static void rproc_stop_subdevices(struct rproc *rproc, bool crashed) list_for_each_entry_reverse(subdev, &rproc->subdevs, node) { if (subdev->stop) { ret = subdev->stop(subdev, crashed); - if (ret) - dev_warn(&rproc->dev, "subdev stop failed: %d\n", ret); + if (ret) { + dev_err(&rproc->dev, "subdev stop failed: %d\n", ret); + return ret; + } } } + + return 0; } static void rproc_unprepare_subdevices(struct rproc *rproc) @@ -1712,7 +1716,12 @@ static int rproc_stop(struct rproc *rproc, bool crashed) return -EINVAL; /* Stop any subdevices for the remote processor */ - rproc_stop_subdevices(rproc, crashed); + ret = rproc_stop_subdevices(rproc, crashed); + if (ret) { + dev_err(dev, "failed to stop subdevices for %s: %d\n", + rproc->name, ret); + return ret; + } /* the installed resource table is no longer accessible */ ret = rproc_reset_rsc_table_on_stop(rproc); @@ -1751,7 +1760,12 @@ static int __rproc_detach(struct rproc *rproc) return -EINVAL; /* Stop any subdevices for the remote processor */ - rproc_stop_subdevices(rproc, false); + ret = rproc_stop_subdevices(rproc, false); + if (ret) { + dev_err(dev, "failed to stop subdevices for %s: %d\n", + rproc->name, ret); + return ret; + } /* the installed resource table is no longer accessible */ ret = rproc_reset_rsc_table_on_detach(rproc); -- 2.53.0