lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88e538ee-9e70-4249-bee5-5127d344edad@oss.qualcomm.com>
Date: Tue, 18 Nov 2025 16:48:14 +0530
From: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@....qualcomm.com>
To: hrishabh.rajput@....qualcomm.com, Bjorn Andersson <andersson@...nel.org>,
        Konrad Dybcio <konradybcio@...nel.org>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>,
        Guenter Roeck
 <linux@...ck-us.net>, Rob Herring <robh@...nel.org>,
        Krzysztof Kozlowski <krzk+dt@...nel.org>,
        Conor Dooley <conor+dt@...nel.org>
Cc: linux-arm-msm@...r.kernel.org, linux-watchdog@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Pavan Kondeti <pavan.kondeti@....qualcomm.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>,
        Shivendra Pratap <shivendra.pratap@....qualcomm.com>
Subject: Re: [PATCH v8 1/2] firmware: qcom: scm: Register gunyah watchdog
 device


On 11/18/2025 4:10 PM, Hrishabh Rajput via B4 Relay wrote:
> From: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
>
> 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 <dmitry.baryshkov@....qualcomm.com>
> Tested-by: Shivendra Pratap <shivendra.pratap@....qualcomm.com>
> Tested-by: Neil Armstrong <neil.armstrong@...aro.org>
> Signed-off-by: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
> ---
>   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;
>   }
>   
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ