[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2ef1d795-5cdd-4465-9333-16a02207a806@quicinc.com>
Date: Tue, 4 Nov 2025 10:33:52 +0530
From: Pavan Kondeti <pavan.kondeti@....qualcomm.com>
To: Bjorn Andersson <andersson@...nel.org>
Cc: Pavan Kondeti <pavan.kondeti@....qualcomm.com>,
Hrishabh Rajput <hrishabh.rajput@....qualcomm.com>,
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,
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 09:52:25PM -0600, Bjorn Andersson wrote:
> On Tue, Nov 04, 2025 at 09:00:27AM +0530, Pavan Kondeti wrote:
> > On Mon, Nov 03, 2025 at 07:01:51PM -0600, Bjorn Andersson wrote:
> > > 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.
> >
> > Did you mean platform device here? Becase we don't want the gunayh-wdt
> > module to do anything other than registering the platform driver on
> > platforms other than qcom.
> >
>
> Yes, device, not driver.
>
> So in SCM driver (I think that's a better match than SMEM), do a:
> if (are_we_running_under_gunyah())
> platform_device_register(gunya-wdt);
>
> The Gunyah WDT _driver_ should based on that be autoloaded by the
> platform:gunyah-wdt alias.
Thanks for the clarification.
>
> > >
> > > > 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.
> > >
> >
> > Yes, you are right. This SMCC falls under ARM_SMCCC_OWNER_VENDOR_HYP
> > space, so it would behave differently on different hypervisors.
> >
> > Please let me know what you think about this **defensive** approach.
> >
> > - Move the Gunyah platform device registration to SCM driver.
> > - Checks to be done before registering the device
> > - Make ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID SMC [1] to verify that we are
> > running under gunyah
> > - check for the other wdt devices like kpss, sbsa in dT
> >
> > ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID SMC will not be supported by all
> > versions of Gunyah, but atleast it would confirm the definitive presence
> > of Gunyah.
> >
>
> Yes, this looks good.
>
Thanks, I think QCM SCM driver hosting this would be a good idea.
> I presume if we determine that Gunyah is present, and we haven't put
> sbsa wdt in place (e.g. during bringup) Gunyah and Gunyah WDT will
> handle the outcome gracefully...
>
Yes, we are told Gunyah support SMCC based WDT even if it emulates
SBSA. Most importantly, we have STATUS SMC in gunyah-wdt probe before
registering the watchdog device.
The following two patches which merged recently will make the above
implementation simpler. Providing them here for the reference material
for v5.
- arm_smccc_hypervisor_has_uuid() API addition from
https://lore.kernel.org/all/20250428210742.435282-2-romank@linux.microsoft.com/
Please note that recent commit make this API available for SMC conduit
as well.
- qcom_scm_qtee_init() example from
https://lore.kernel.org/all/20250911-qcom-tee-using-tee-ss-without-mem-obj-v12-2-17f07a942b8d@oss.qualcomm.com/
Thanks,
Pavan
Powered by blists - more mailing lists