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 49CC034E761 for ; Tue, 18 Nov 2025 11:18:23 +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=1763464705; cv=none; b=IK3HZUNjsu3wu7ALq1cFpd+uoUfvn49I4t+bf0JN7GYE0QGJQe9ST/QldJNlqigpAmTaMyddSvFIa9eRUVF1nxQFVkoQrg+hgzE70xKArH0k4yk9lkOLs+Miap8787iD2sarxmkvkqKVZRxeCYCZb+9gzt9IhgcO4o6Nf+QAEro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763464705; c=relaxed/simple; bh=j1X8Bcz0tw2PQAuMnopNpJHPrzfuraBENhrJ0hqo3H8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=C2hmmncJ9KiwfyO4cIxms1iwU3q2xRSe1jLrw6L6KVgcPtboeg8lS2tzVmeS/FV7XX46PUVsqxNlPhMX2c9KP8g6gY3UEI298S1Qn+Y1BmsIhhEKGoLp4li7rcCy/tcBTbcMXnqLqtUQsdEvsZgOFolhsQM6NAstx9r0yvxCOhM= 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=kbCQi1y0; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TNQjG4eW; 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="kbCQi1y0"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TNQjG4eW" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5AI6fQ0O2272055 for ; Tue, 18 Nov 2025 11:18:22 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= BT6MxSCrefLxE5wv9+3d366R21cpjkB5npT66y5AUFc=; b=kbCQi1y00SlDlSVz UWKyI+N+b1O32Qrzw90az9OtW28Km9edlZ/8UVAd6wdO1+dWx8/hlDUMFacaUcVd s9W7FlC4V4t96OBOPodVnnRjeY4pG7cjpp6fy4x6Fe1WaC/QncEEdxYSdkmxzCTD 9mmSN0NTKxc9oBmysZxa9ILofLFwy0Y8ejKHzxbOAAaCkXbB87/yADuGszZ0Y1Yg s5YSAc4Fs2HfpkfPFeC9fpVMJCS/Af4UDPsJvLtXsfMPV1yRph86D9Q7yzYaopxr Mqo5OgJVBB3vkGwNCgZXPwm9+8dpvFBwfaenrmaTOS6NFjAurX8nSyHxg2hosYoi PtjCCw== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4agkrmgter-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 18 Nov 2025 11:18:22 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-7ba92341f38so5012014b3a.0 for ; Tue, 18 Nov 2025 03:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1763464701; x=1764069501; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BT6MxSCrefLxE5wv9+3d366R21cpjkB5npT66y5AUFc=; b=TNQjG4eW9B2DQbdkvXQbHHcP/dm/yTpxywk7gIUFO87rK7SekzG7/D3J8qzN/m6Hmx RGiecJrp/sdCzxy9A3FRB3wmFUeAS03rgRj0SiThSWjn9gQ5jp2JC10UHBRQ1RIW1vFD x09lucffgML1C06T0F7LWtfqkbKZPC8O0t7toFS+ydg9dlhmz1P2IMSYWPo/1dpjg10d ZSebto/xuaYAg6WK1OtpELIGOJPZ0fA0n5YbxVeQvTr7wP4OagXs/ZPsY73pL5T/viBP cSTYdR/hzBovPm3pQAbItLjj0T+pUYLbbzuPmpK6Jjekvxc+PWwFbBE63x4lr32IPYG6 noow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763464701; x=1764069501; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BT6MxSCrefLxE5wv9+3d366R21cpjkB5npT66y5AUFc=; b=ATWhtCrFH8lLgO4wMTLXq4S+p+yWUyA3Vk045g6wyIifCuU8+3GKQv32pHqxBrlKHe 0iqv/3fVVAe89nkJXKgRrMvxoyZPws50bHi8wM4mhj96HkkGlmjM+bSaGDB6rUPW9At7 l18cC4ToAPgrr9apIlwFUKKRHcpBsXQzCZ8GuOUZMRFM7GP9QBdPlYI++WfHMQcD+mnM 2+qvaqVMe5Ve61VOdUrNbhI5t8ZHO8cCezt4gn0U3GE0TLFcWR3hZbWD6PshlKrSZFm5 OfbeLv0YCblingIiTbavdGWFN1zqiSU6HfzfD9j8758IBLxcdCQM+kVZeNOkheLSI1oS /pIA== X-Forwarded-Encrypted: i=1; AJvYcCW/alJ/mk1o47PFLVflHRVUECXS6ac+i1n0ZzWdVZ+bDpUvoxPh/krDjanTJ4mnHB7uYwglx5KP/xmjEMs=@vger.kernel.org X-Gm-Message-State: AOJu0YyyqqSLLRb8BhEiC2sTM7jLE6QVreemWVgUxG9cQCc3+Iw0Yy7M qDIU9R8HC+ulsyQhNy12q/iuzG/vQcSBuFc7Yff59hEl0aGLrhJI64yys19RGjJlse1qVk9AjG8 Ke6dV/UlIe3ega138sG7+1u5LqvBn5vx6aejMoadFPxIMrv9ac+AW95FNxwUEzBISn6Q= X-Gm-Gg: ASbGnctBOeZXlAA1KKEXhjPUV75SKXT3J+lz0JySlabwt0cGEJHAIpUDpPv8bQdpPB2 H9Na2RH5x2YSJ8RE5zfl3+pRFwpZuYKVJNMjACo+K6DubG+Vwlq2K7H70N3czAODaedQvBSHyBQ 2AcKQQvI9CZSHhdtzq9htHf/sx6X0ddHEz4Pgyz9SJNNQmtygd+BXwcvuD9IoWKTNS+zkE09eU7 Xtbc092YFJlRvdmfmRjaFVc/cSbMoSIufdak57svtNaqy6FK1Kmg3sJnXM1x3tZYSkiwdNixZeo 1NT538SvzjkFjLjikvhzYqSWMG5a7hJaD5snKHyiiS3G1jmRmH+HF0iUJ7GSMV/Mxd8if9i9Ob/ Y8PUv5tyFBIBpnSKv5wnICUXIEbekDELw375wjpssr3xcQepQaOY02Q== X-Received: by 2002:a05:6a00:a28:b0:7a2:6eb3:71ee with SMTP id d2e1a72fcca58-7ba39beb4dfmr17045011b3a.9.1763464701112; Tue, 18 Nov 2025 03:18:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IEK4YICEHIj1nlKnQLiop2iPzyANBvxiVZ7gJKumRb5uJP3w+uf6eq9GE2MS8ZF5xQcO4gnLw== X-Received: by 2002:a05:6a00:a28:b0:7a2:6eb3:71ee with SMTP id d2e1a72fcca58-7ba39beb4dfmr17044997b3a.9.1763464700610; Tue, 18 Nov 2025 03:18:20 -0800 (PST) Received: from [10.151.37.217] ([202.46.23.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7bedbb2a1d2sm7339512b3a.41.2025.11.18.03.18.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Nov 2025 03:18:20 -0800 (PST) Message-ID: <88e538ee-9e70-4249-bee5-5127d344edad@oss.qualcomm.com> Date: Tue, 18 Nov 2025 16:48:14 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 1/2] firmware: qcom: scm: Register gunyah watchdog device To: hrishabh.rajput@oss.qualcomm.com, Bjorn Andersson , Konrad Dybcio , Wim Van Sebroeck , Guenter Roeck , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-msm@vger.kernel.org, linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Pavan Kondeti , Neil Armstrong , Dmitry Baryshkov , Shivendra Pratap References: <20251118-gunyah_watchdog-v8-0-e5de12e2eef5@oss.qualcomm.com> <20251118-gunyah_watchdog-v8-1-e5de12e2eef5@oss.qualcomm.com> Content-Language: en-US From: Kathiravan Thirumoorthy In-Reply-To: <20251118-gunyah_watchdog-v8-1-e5de12e2eef5@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE4MDA5MCBTYWx0ZWRfX/pDKFegRifFY mUhowx7Mx0OfFM+EikVoiUQk2e5IBtgPZ4gieoQhmF+cOEnAd2JAoV37A/jOpBBvXcx3DGz3Spe CzUx5x0en2Eefcwtfhi4MKuemOxLPYljeV4RMIIe7AzMphIwOEU7rSheiDB6ceNmejP20hUxYIy /QhLvMfswhsfasVmRL/3KZ+/nKd3zgPDA3er2ssBmvvIJv8iHAJ3PVcishL8xmkb+x22Pu3TdWx QtPEP2GLnzyMwi3jzc5j4ghV78rA+gc42OtK0j4F7f0T3JqxKqqg/BSR+Lisf2XDASDpl4CYLdb t4ws7CHPHRyLyII7xT6SNUgkD9ILb6uOsY/Lu1vJHxWws4gstxMQQhb0xGiH6usgO+TU0M6/aEf 1HhilI8ce5kVoQUPrgHtHZ5H5RitYw== X-Proofpoint-ORIG-GUID: h_vMkgoB93CpuB0B5BXRqt8E7HW6v6kc X-Proofpoint-GUID: h_vMkgoB93CpuB0B5BXRqt8E7HW6v6kc X-Authority-Analysis: v=2.4 cv=JfWxbEKV c=1 sm=1 tr=0 ts=691c55fe cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=j4ogTh8yFefVWWEFDRgCtg==:17 a=IkcTkHD0fZMA:10 a=6UeiqGixMTsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=h6q1wd228mELy5tlGgAA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-17_04,2025-11-13_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2511180090 On 11/18/2025 4:10 PM, Hrishabh Rajput via B4 Relay wrote: > From: Hrishabh Rajput > > To restrict Gunyah watchdog initialization to Qualcomm platforms running > under the Gunyah Hypervisor, register the watchdog device in the QCOM > SCM driver. > > When Gunyah is not present or Gunyah emulates MMIO-based watchdog, we > expect Qualcomm watchdog or ARM SBSA watchdog device to be present in > the devicetree. First, we make sure we're running under the Gunyah > Hypervisor. Then we move to check if any of the above mentioned > watchdog device nodes are present, if not then we proceed to register > the SMC-based Gunyah watchdog device. > > Reviewed-by: Dmitry Baryshkov > Tested-by: Shivendra Pratap > Tested-by: Neil Armstrong > Signed-off-by: Hrishabh Rajput > --- > drivers/firmware/qcom/qcom_scm.c | 53 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c > index e777b7cb9b12..14d0663316e6 100644 > --- a/drivers/firmware/qcom/qcom_scm.c > +++ b/drivers/firmware/qcom/qcom_scm.c > @@ -2182,6 +2182,56 @@ int qcom_scm_qtee_callback_response(phys_addr_t buf, size_t buf_size, > } > EXPORT_SYMBOL(qcom_scm_qtee_callback_response); > > +static void qcom_scm_gunyah_wdt_free(void *data) > +{ > + struct platform_device *gunyah_wdt_dev = data; > + > + platform_device_unregister(gunyah_wdt_dev); > +} > + > +static void qcom_scm_gunyah_wdt_init(struct qcom_scm *scm) > +{ > + struct platform_device *gunyah_wdt_dev; > + struct device_node *np; nit: Can we use the __cleanup() attribute for device_node like below and drop the explicit of_node_put()? struct device_node *np __free(device_node) = NULL; FYI - I submitted the patch which takes care of this in the SCM driver[1]. [1] https://lore.kernel.org/linux-arm-msm/20251117-scm_cleanup_of_node_put-v1-1-307d36d6b849@oss.qualcomm.com/ > + bool of_wdt_available; > + int i; > + static const uuid_t gunyah_uuid = UUID_INIT(0xc1d58fcd, 0xa453, 0x5fdb, > + 0x92, 0x65, 0xce, 0x36, > + 0x67, 0x3d, 0x5f, 0x14); > + static const char * const of_wdt_compatible[] = { > + "qcom,kpss-wdt", > + "arm,sbsa-gwdt", > + }; > + > + /* Bail out if we are not running under Gunyah */ > + if (!IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY) || > + !arm_smccc_hypervisor_has_uuid(&gunyah_uuid)) > + return; > + > + /* > + * Gunyah emulates either of Qualcomm watchdog or ARM SBSA watchdog on > + * newer platforms. Bail out if we find them in the devicetree. > + */ > + for (i = 0; i < ARRAY_SIZE(of_wdt_compatible); i++) { > + np = of_find_compatible_node(NULL, NULL, of_wdt_compatible[i]); > + of_wdt_available = of_device_is_available(np); > + of_node_put(np); > + if (of_wdt_available) > + return; > + } > + > + gunyah_wdt_dev = platform_device_register_simple("gunyah-wdt", -1, > + NULL, 0); > + if (IS_ERR(gunyah_wdt_dev)) { > + dev_err(scm->dev, "Failed to register Gunyah watchdog device: %ld\n", > + PTR_ERR(gunyah_wdt_dev)); > + return; > + } > + > + devm_add_action_or_reset(scm->dev, qcom_scm_gunyah_wdt_free, > + gunyah_wdt_dev); > +} > + > static void qcom_scm_qtee_free(void *data) > { > struct platform_device *qtee_dev = data; > @@ -2448,6 +2498,9 @@ static int qcom_scm_probe(struct platform_device *pdev) > /* Initialize the QTEE object interface. */ > qcom_scm_qtee_init(scm); > > + /* Initialize the Gunyah watchdog platform device. */ > + qcom_scm_gunyah_wdt_init(scm); > + > return 0; > } > >