[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2e926e17-f8c1-47cf-8864-b0ef97b145ff@oss.qualcomm.com>
Date: Mon, 6 Oct 2025 15:47:55 +0200
From: Konrad Dybcio <konrad.dybcio@....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>
Subject: Re: [PATCH v2] watchdog: Add driver for Gunyah Watchdog
On 10/6/25 9:37 AM, Hrishabh Rajput via B4 Relay wrote:
> From: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
>
> On Qualcomm SoCs running under the Gunyah hypervisor, access to watchdog
> through MMIO is not available on all platforms. Depending on the
> hypervisor configuration, the watchdog is either fully emulated or
> exposed via ARM's SMC Calling Conventions (SMCCC) through the Vendor
> Specific Hypervisor Service Calls space.
>
> When Gunyah is not present or Gunyah emulates MMIO-based watchdog, we
> expect MMIO watchdog device to be present in the devicetree. If we
> detect this device node, we don't proceed ahead. Otherwise, we go ahead
> and invoke GUNYAH_WDT_STATUS SMC to initiate the discovery of the
> SMC-based watchdog.
>
> Add driver to support the SMC-based watchdog provided by the Gunyah
> Hypervisor. module_exit() is intentionally not implemented as this
> driver is intended to be a persistent module.
>
> Signed-off-by: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
> ---
[...]
> +enum gunyah_error {
> + GUNYAH_ERROR_OK = 0,
> + GUNYAH_ERROR_UNIMPLEMENTED = -1,
> + GUNYAH_ERROR_RETRY = -2,
> +
> + GUNYAH_ERROR_ARG_INVAL = 1,
> + GUNYAH_ERROR_ARG_SIZE = 2,
> + GUNYAH_ERROR_ARG_ALIGN = 3,
> +
> + GUNYAH_ERROR_NOMEM = 10,
> +
> + GUNYAH_ERROR_ADDR_OVFL = 20,
> + GUNYAH_ERROR_ADDR_UNFL = 21,
> + GUNYAH_ERROR_ADDR_INVAL = 22,
> +
> + GUNYAH_ERROR_DENIED = 30,
> + GUNYAH_ERROR_BUSY = 31,
> + GUNYAH_ERROR_IDLE = 32,
> +
> + GUNYAH_ERROR_IRQ_BOUND = 40,
> + GUNYAH_ERROR_IRQ_UNBOUND = 41,
> +
> + GUNYAH_ERROR_CSPACE_CAP_NULL = 50,
> + GUNYAH_ERROR_CSPACE_CAP_REVOKED = 51,
> + GUNYAH_ERROR_CSPACE_WRONG_OBJ_TYPE = 52,
> + GUNYAH_ERROR_CSPACE_INSUF_RIGHTS = 53,
> + GUNYAH_ERROR_CSPACE_FULL = 54,
> +
> + GUNYAH_ERROR_MSGQUEUE_EMPTY = 60,
> + GUNYAH_ERROR_MSGQUEUE_FULL = 61,
> +};
Can the calls we make in this driver produce all of these errors?
I'm asking only because we want to minimize the footprint
[...]
> +static unsigned int gunyah_wdt_get_timeleft(struct watchdog_device *wdd)
> +{
> + struct arm_smccc_res res;
> + unsigned int seconds_since_last_ping;
> + int ret;
> +
> + ret = gunyah_wdt_call(GUNYAH_WDT_STATUS, 0, 0, &res);
> + if (ret)
> + return 0;
> +
> + seconds_since_last_ping = res.a2 / 1000;
> +static int __init gunyah_wdt_init(void)
> +{
> + struct arm_smccc_res res;
> + struct watchdog_device *wdd;
> + struct device_node *np;
> + int ret;
> +
> + np = of_find_compatible_node(NULL, NULL, "qcom,kpss-wdt");
> + if (np) {
> + of_node_put(np);
> + return -ENODEV;
> + }
> +
> + np = of_find_compatible_node(NULL, NULL, "arm,sbsa-gwdt");
> + if (np) {
> + of_node_put(np);
> + return -ENODEV;
> + }
Please add a comment about how the above two compatibles tie into our logic
(e.g. "Some builds of Gunyah expose a memory-mapped legacy-Qualcomm or Arm
SBSA watchdog instance instead")
Konrad
Powered by blists - more mailing lists