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: <abicharluq6bm7gbngkbdc2hobcfifcmazh7oukcoufsrpcpse@ml2wccwe6s7i>
Date: Mon, 3 Nov 2025 19:01:51 -0600
From: Bjorn Andersson <andersson@...nel.org>
To: Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>
Cc: 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>, 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 04:03:44PM +0530, Hrishabh Rajput wrote:
> 
> On 11/2/2025 12:15 AM, Bjorn Andersson wrote:
> > On Fri, Oct 31, 2025 at 10:18:13AM +0000, 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.
> > > 
> > > 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.
> > E.g. qcom-apq8064.dtsi doesn't define either qcom,kpss-wdt, nor
> > arm,sbsa-gwdt, does that imply that it implements the Gunyah watchdog?
> 
> 
> It doesn't implement Gunyah watchdog. For platforms like these we've kept a
> STATUS SMC call in the gunyah_wdt_probe().
> 

I think it would be good to make that call before registering the
platform driver.

> The SMC Call is expected to fail on platforms which do not have support for
> SMC based Gunyah watchdog, which in turn will fail the probe.
> 

Perhaps I'm missing something, just looked quickly and it's been a while
since I looked at this code, but you're making a HVC (or SMC) call with
the function:

  ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_32, ARM_SMCCC_OWNER_VENDOR_HYP, 6)

which doesn't look unique to Gunyah in my eyes.

If I read correctly, the ARM_SMCCC_SMC_32 is the only bit (literally)
that differentiates this from being a __vgic_v3_get_gic_config() call in
KVM, just as an example.

Regards,
Bjorn

> Let us know if there's a better way to handle this.
> 
> > > +	 */
> > > +	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.
> > > +	 */
> > Why? I don't see why the code needs to encode such policy, please
> > explain.
> 
> 
> You're right, there is no such need. We're at wrong here. We had an
> incorrect understanding of watchdog drivers being persistent. We will be
> implementing the module_exit() for the Gunyah watchdog making it not
> persistent.
> 
> 
> Thanks,
> 
> Hrishabh
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ