[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bzyh2jfmga4zk2x3sb3bhex5d25hnhcdti3gneso4nys36k5as@nnkzk6ersyqi>
Date: Mon, 3 Nov 2025 18:38:42 -0600
From: Bjorn Andersson <andersson@...nel.org>
To: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
Cc: Guenter Roeck <linux@...ck-us.net>,
Konrad Dybcio <konradybcio@...nel.org>, Wim Van Sebroeck <wim@...ux-watchdog.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, 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>
Subject: Re: [PATCH v4 1/2] soc: qcom: smem: Register gunyah watchdog device
On Mon, Nov 03, 2025 at 03:23:27PM +0530, Hrishabh Rajput wrote:
>
> On 11/2/2025 12:20 AM, Bjorn Andersson wrote:
> > On Fri, Oct 31, 2025 at 08:24:44AM -0700, Guenter Roeck wrote:
> > > On 10/31/25 03:18, Hrishabh Rajput via B4 Relay wrote:
> > > > From: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
> > > >
> > > > To restrict gunyah watchdog initialization to Qualcomm platforms,
> > > > register the watchdog device in the SMEM 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. If none of these device nodes are detected,
> > > > we register the SMC-based Gunyah watchdog device.
> > > >
> > > There should also be an explanation why there is no "qcom,gunyah-wdt"
> > > devicetree node, both here and in the file.
> > >
> > > > Signed-off-by: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
> > > > ---
> > > > drivers/soc/qcom/smem.c | 37 +++++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 37 insertions(+)
> > > >
> > > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> > > > index cf425930539e..40e4749fab02 100644
> > > > --- a/drivers/soc/qcom/smem.c
> > > > +++ b/drivers/soc/qcom/smem.c
> > > > @@ -1118,6 +1118,34 @@ static int qcom_smem_resolve_mem(struct qcom_smem *smem, const char *name,
> > > > return 0;
> > > > }
> > > > +static int register_gunyah_wdt_device(void)
> > > > +{
> > > > + struct platform_device *gunyah_wdt_dev;
> > > > + struct device_node *np;
> > > > +
> > > > + /*
> > > > + * When Gunyah is not present or Gunyah is emulating a memory-mapped
> > > > + * watchdog, either of Qualcomm watchdog or ARM SBSA watchdog will be
> > > > + * present. Skip initialization of SMC-based Gunyah watchdog if that is
> > > > + * the case.
> > > > + */
> > > > + np = of_find_compatible_node(NULL, NULL, "qcom,kpss-wdt");
> > > > + if (np) {
> > > > + of_node_put(np);
> > > > + return 0;
> > > > + }
> > > > +
> > > > + np = of_find_compatible_node(NULL, NULL, "arm,sbsa-gwdt");
> > > > + if (np) {
> > > > + of_node_put(np);
> > > > + return 0;
> > > > + }
> > > > +
> > > > + gunyah_wdt_dev = platform_device_register_simple("gunyah-wdt", -1,
> > > > + NULL, 0);
> > > > + return PTR_ERR_OR_ZERO(gunyah_wdt_dev);
> > > > +}
> > > > +
> > > > static int qcom_smem_probe(struct platform_device *pdev)
> > > > {
> > > > struct smem_header *header;
> > > > @@ -1236,11 +1264,20 @@ static int qcom_smem_probe(struct platform_device *pdev)
> > > > if (IS_ERR(smem->socinfo))
> > > > dev_dbg(&pdev->dev, "failed to register socinfo device\n");
> > > > + ret = register_gunyah_wdt_device();
> > > > + if (ret)
> > > > + dev_dbg(&pdev->dev, "failed to register watchdog device\n");
> > > > +
> > > > return 0;
> > > > }
> > > > static void qcom_smem_remove(struct platform_device *pdev)
> > > > {
> > > > + /*
> > > > + * Gunyah watchdog is intended to be a persistent module. Hence, the
> > > > + * watchdog device is not unregistered.
> > > > + */
> > > > +
> > > Odd explanation.
> > > I would assume that the smem device is supposed to be
> > > persistent as well.
> > Yes, but it's perfectly possible to run a modern Qualcomm device without
> > SMEM, with a fair amount of functionality. So, the reevaluation of this
> > decision is grinding in the back of my mind...
>
> One option can be the SCM driver which was suggested by Neil in v3 [1].
>
> Let us know if you have any suggestions where we can register the watchdog
> device?
>
I think it makes more sense to tie it to the SCM driver, it's after all
related to the HVC-interface, which SMEM isn't.
But I don't think that answers our question of how do you determine if
Gunyah is there or not. Because qcom,scm-sc7280 is regardless of Linux
running under Gunyah, KVM, or directly in EL2.
I can't help feeling that this is a property of the hardware/firmware
interface that the OS finds itself in, which should be expressed in
DeviceTree - unless there's a bulletproof "Gunyah, are you there?"
check.
Regards,
Bjorn
> [1]:
> https://lore.kernel.org/lkml/321f5289-64c0-48f1-91b5-c45e82396ca9@linaro.org/
>
> Thanks,
>
> Hrishabh
>
Powered by blists - more mailing lists