From nobody Tue Feb 10 10:54:58 2026 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 B64A3369960 for ; Fri, 30 Jan 2026 10:44:59 +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=1769769902; cv=none; b=aJ9KDuFGujUGh2Gh9RerSb1ZAlmKPYsDaQsnTN0wdJPQq9E481gzwyAVPQPNPG0ORNZegEWwxPZdktxDvNyOVyGnWsGH0Ebc+bVgtd0sYEjSoIQ4wpoj8q6yxfq6vh6M1IltKaCyrz5Qw+EJgrC6I8iQAzoUT/mLTP4d4gWR9yg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769769902; c=relaxed/simple; bh=mhi0ypVvTwkXgTPywGnN+5DdBGkkVxPMBnQ/6sopdVs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sbye4TNPEZMA9jK+qezKs6Kpsrlh3IdvryROgcIihg7Wh4JcoOLjZzO/2xAfDLkONi2ygZueunyJnlZ4xmIJfuelAnkJaTyT0+y2pw3TwMrJXbmk+ROF7vuq4yTCdSIRkmNXDFqKX4FmCSfbqQgCq/EhHOazQSjbbrtGIfw7nRY= 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=O0gfw2vE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=W6XZV881; 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="O0gfw2vE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="W6XZV881" 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 60U4tOov2294942 for ; Fri, 30 Jan 2026 10:44:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= NxU1VPQmj/sT37QTIhQa/VeITSABn0pkgP2cxL7fA4s=; b=O0gfw2vEj3UCSkaf tp7fygSj1QMkrcTCQIpHfdAi9rzhEaThZ75iJO9BL9cGH2OhV3BntYpuFUrY/qWm AWHyMQrK+9K4M2wrNa0ZlTVeyLhMZ0JzOGwKBxfzvDc61F6ueyBwnwbkdYcQUSU4 AqFbFPnvkN0w8pYd3QF54ALTaViyOq6Goo4/5gzdTiCYBmGHX4M19F9PPeagJNhz w9sBIO6nMUian1yZ2APOga6jFVoz/9b7BF7qr2EZwF9HmjLhzE3xhGiv+FneEQlb 9MnYvWDS6UVuVnfFODh0ikzrzIhJ7jhIyci7doMDtbQZSnNJsAHxRtqh73Cmbf0E v7Tc6w== 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 4c0p1x8ymr-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 30 Jan 2026 10:44:57 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2a08cbeb87eso22576485ad.3 for ; Fri, 30 Jan 2026 02:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769769897; x=1770374697; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NxU1VPQmj/sT37QTIhQa/VeITSABn0pkgP2cxL7fA4s=; b=W6XZV881PMJ8FBq40vV/fLhl+6chGXAJbWkrx2R/cN28O0Svsj1rSLiAgvwOkb7qo6 XZLqX13/Oa5EN3brkwG694cKViKBz/NG1AfG2wGLAGB26C29nswXbHClA216j6ZJKgNb /5wsu8xpMiQD0HfD5NwUVbhieMDnHXhgIAIKvAOvIfDwb45GqjvBoT/5QAJ1xTWkVbCU kam005l726okupNwWsD+BIU0pJemxq0EFjVUunTyRj4kYUVA3F2CVaB8tns3atBtIj8C AGHwM9gu3EZKCadF6ctRxmK5V/mD6mgA2e5lk/GIu/Tkpnaj+cbMMFqcmNDjIySnTIWX iUfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769769897; x=1770374697; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=NxU1VPQmj/sT37QTIhQa/VeITSABn0pkgP2cxL7fA4s=; b=jc2ZoqcPqcAJ6X8jzQ5NCgFo8gc9KgJlW1jqkEiKNPPWEKTJh4e4XkC8MNLF94qsNq BYPZleEPwYUvn39i9yQwnITLp8vq2cFYxofNHUH6bZUkcj/ioDm5VwYoxjroO/v6j2V1 /2GzYIgDrTyEStppconig2o2glxagYo7uvVL3V2vGvQcDsN4C7vTAuj0tSQXPOlLuHlQ ikm8bR7rOsMbqSmLAzLRBV68xy5wyh5MgzOtwkPhdSMTwxikO2aDIII9RHF5Z8r/fVa1 /Q68uKVS+jE7nM3ZUNYqZaKBYgHV1X8+gD+wconSoPVWn5CO5rLMRN9VWhTB0GoRv4Sj /qAg== X-Forwarded-Encrypted: i=1; AJvYcCVAHUvaN4a7hqDSG9r8w6s6cIFAgwNzOQIv1F/3p1UTVWpavNgJcilY8cJh416QrSXSfDRyPhj6inImGt0=@vger.kernel.org X-Gm-Message-State: AOJu0Yx33zBvYPYUf4kUZfcbrWHwDoAKSubydJ9j8kX7XN3lAc/BDarV nnq8F57NHB0UjbLgKYxUj6pkZqsTj42drn0cPTuL6RzLLflD+Gsud/Oa1POAPkmtQjsPPVqytjL liFOo5uMMsmQXFTS3Hfcv9kvxFGY+AoTTbueE4dL9cjAMtRAdokJwV4PNqtHizSrONtc= X-Gm-Gg: AZuq6aKBbiN9tP3MnVvvfwiiYlGn2gdcchhp/c3iCgSaVGvs480riTzEfDH1HqPIA/8 c7AyCEnY7cZd9tE8MgVKTAesR3anwjc0Mcy3uwhIjNiNkVQP6CGrwZ6wvMXrzLZFtz7GfAsKutY 4VkKbGPn1MKPhd3it+mJABSk3dChIsP7SZwWC/1gpzX+O88ahkM26XqzMNtaYfvUgQ1+WnJmD7K v2YfVwQX77ax/RPtwUG8cRx+HaWGYo8cCiGblFspfdZw2xK3tkq9VtM2O03CQBQ0s/onWE66H0Q 6May+hSyg+8sd6nqB+qGs/hkqusjWLUK/BlXIQMdfKJGd1Bh1hEBnFJeDxMUYhvpfRuy6CNuojN aLTTYNsWNf77vdztP7o/K+O7MVa3zPQ/gJze5V+tZ4M6Rf9JfogSDy27IRAagu6C6yQrYuxFjvs qMaFNkc59oDvDSVA/FH8hzC/aosGXhf4f7lsmegUvdYGIe X-Received: by 2002:a17:902:d4c8:b0:29f:2ec4:83e5 with SMTP id d9443c01a7336-2a8d9594d22mr20622095ad.12.1769769896500; Fri, 30 Jan 2026 02:44:56 -0800 (PST) X-Received: by 2002:a17:902:d4c8:b0:29f:2ec4:83e5 with SMTP id d9443c01a7336-2a8d9594d22mr20621875ad.12.1769769895947; Fri, 30 Jan 2026 02:44:55 -0800 (PST) Received: from hu-kathirav-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a88b5d92a9sm71231465ad.69.2026.01.30.02.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 02:44:55 -0800 (PST) From: Kathiravan Thirumoorthy Date: Fri, 30 Jan 2026 16:14:33 +0530 Subject: [PATCH v6 4/5] watchdog: qcom: add support to get the bootstatus from IMEM Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260130-wdt_reset_reason-v6-4-417ab789cd97@oss.qualcomm.com> References: <20260130-wdt_reset_reason-v6-0-417ab789cd97@oss.qualcomm.com> In-Reply-To: <20260130-wdt_reset_reason-v6-0-417ab789cd97@oss.qualcomm.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Wim Van Sebroeck , Guenter Roeck , Rajendra Nayak Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, Kathiravan Thirumoorthy X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1769769874; l=4107; i=kathiravan.thirumoorthy@oss.qualcomm.com; s=20230906; h=from:subject:message-id; bh=mhi0ypVvTwkXgTPywGnN+5DdBGkkVxPMBnQ/6sopdVs=; b=tfzANnApupJpzTGirf7jVWsxryfSISOhUf+sDTuUssKxFECsN8ATjkWjoJyZd/OewOf6NkNVR 7MkaUFHyHANANZwftMx+8h8Cm4QYz9HD6XbOVHqtCHoMZRQekxb319u X-Developer-Key: i=kathiravan.thirumoorthy@oss.qualcomm.com; a=ed25519; pk=xWsR7pL6ch+vdZ9MoFGEaP61JUaRf0XaZYWztbQsIiM= X-Proofpoint-GUID: 6bTDW3zROT0_1Zoq1qPqg1PbUogq03Yn X-Proofpoint-ORIG-GUID: 6bTDW3zROT0_1Zoq1qPqg1PbUogq03Yn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTMwMDA4NyBTYWx0ZWRfX1Vr5dfwj9ZpN /Uql4WXrvWCA9dZm8IzW+kMKD85oBKesmO/kP/+x/bJVmTO7a/mP5AxPzEe+904u8t4nT4LqB9M Axl4ug4KusPJ6/LuKisguKmH02iz+i/5jbB2rev60TGWbkQWxL+07Fv3gJRV/xOHQJWSh2VMY22 6L3mrlAHhncPp3iz3ISWF211gwI7Fp5VRr+PwMbz0u00JwDl6I+M1gF+7RZTJt5QhaEGylAMcE3 lcGofskTjaeDqqdcsGuNA60/nJvxtWQ+5dJZIWlZFFYg4ClQsulwhYuBxNOoTpIXAal+PrIC7hP tlU+jWaqjPO5tlzlTk9IZlk5dArKhFrFk2OyN30z80GbVAhCHo6ELFSNnMRusQgcsOO9UVjU31b BG2mSfhxo0eYXRh7dSVsrVG77lN7tA5In1jwmayXXPvEviiWOV5BZMQ3jsjZrx4Ioe2Pzre1UtQ Hih+HQyNRcRh/ZG1Eww== X-Authority-Analysis: v=2.4 cv=G5cR0tk5 c=1 sm=1 tr=0 ts=697c8ba9 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=tIxvoA3mxl7b6XSbyz0A:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-30_01,2026-01-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601300087 When the system boots up after a watchdog reset, the EXPIRED_STATUS bit in the WDT_STS register is cleared. To identify if the system was restarted due to WDT expiry, XBL update the information in the IMEM region. Update the driver to read the restart reason from IMEM and populate the bootstatus accordingly. With the CONFIG_WATCHDOG_SYSFS enabled, user can extract the information as below: cat /sys/devices/platform/soc@0/f410000.watchdog/watchdog/watchdog0/bootsta= tus 32 For backward compatibility, keep the EXPIRED_STATUS bit check. Add a new function qcom_wdt_get_bootstatus() to read the restart reason from IMEM. Signed-off-by: Kathiravan Thirumoorthy --- Changes in v6: - Reworked to get the restart reason code from SRAM region Changes in v5: - Use dev_err_probe instead of dev_err Changes in v4: - Kept only WDIOF_CARDRESET and dropped other codes - Renamed qcom_wdt_get_reason_reason() to qcom_wdt_get_bootstatus() - Moved the existing check inside qcom_wdt_get_bootstatus() - Dropped the device data and put all the details in the DT node Changes in v3: - Split the introduction of device data into separate patch - s/bootloaders/XBL - for clarity of which bootloader is involved - Mention the sysfs path on to extract this information - s/compatible/imem_compatible in the device data structure to avoid the confusion / better naming Changes in v2: - Use the syscon API to access the IMEM region - Handle the error cases returned by qcom_wdt_get_restart_reason - Define device specific data to retrieve the IMEM compatible, offset and the value for non secure WDT, which allows to extend the support for other SoCs --- drivers/watchdog/qcom-wdt.c | 43 +++++++++++++++++++++++++++++++++++++++++= -- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/qcom-wdt.c b/drivers/watchdog/qcom-wdt.c index dfaac5995c84c1f377023e6e62770c5548528a4c..14853162d57ccae3092fb1c0161= 6fdfca0108e74 100644 --- a/drivers/watchdog/qcom-wdt.c +++ b/drivers/watchdog/qcom-wdt.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include =20 @@ -42,6 +43,7 @@ struct qcom_wdt_match_data { const u32 *offset; bool pretimeout; u32 max_tick_count; + u32 wdt_reason_val; }; =20 struct qcom_wdt { @@ -185,6 +187,7 @@ static const struct qcom_wdt_match_data match_data_ipq5= 424 =3D { .offset =3D reg_offset_data_kpss, .pretimeout =3D true, .max_tick_count =3D 0xFFFFFU, + .wdt_reason_val =3D 5, }; =20 static const struct qcom_wdt_match_data match_data_kpss =3D { @@ -193,6 +196,41 @@ static const struct qcom_wdt_match_data match_data_kps= s =3D { .max_tick_count =3D 0xFFFFFU, }; =20 +static int qcom_wdt_get_bootstatus(struct device *dev, struct qcom_wdt *wd= t, + u32 val) +{ + struct device_node *imem; + struct resource res; + void __iomem *addr; + int ret; + + imem =3D of_parse_phandle(dev->of_node, "sram", 0); + if (!imem) { + + /* Fallback to the existing check */ + if (readl(wdt_addr(wdt, WDT_STS)) & 1) + wdt->wdd.bootstatus =3D WDIOF_CARDRESET; + + return 0; + } + + ret =3D of_address_to_resource(imem, 0, &res); + of_node_put(imem); + if (ret) + return ret; + + addr =3D ioremap(res.start, resource_size(&res)); + if (!addr) + return -ENOMEM; + + if (readl(addr) =3D=3D val) + wdt->wdd.bootstatus =3D WDIOF_CARDRESET; + + iounmap(addr); + + return 0; +} + static int qcom_wdt_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; @@ -273,8 +311,9 @@ static int qcom_wdt_probe(struct platform_device *pdev) wdt->wdd.parent =3D dev; wdt->layout =3D data->offset; =20 - if (readl(wdt_addr(wdt, WDT_STS)) & 1) - wdt->wdd.bootstatus =3D WDIOF_CARDRESET; + ret =3D qcom_wdt_get_bootstatus(dev, wdt, data->wdt_reason_val); + if (ret) + return ret; =20 /* * If 'timeout-sec' unspecified in devicetree, assume a 30 second --=20 2.34.1