Re: [PATCH v5 1/2] firmware: qcom: scm: Register gunyah watchdog device
From: Dmitry Baryshkov
Date: Tue Nov 11 2025 - 17:36:50 EST
On Tue, Nov 11, 2025 at 10:31:10PM +0530, Pavan Kondeti wrote:
> On Tue, Nov 11, 2025 at 10:38:27AM -0600, Bjorn Andersson wrote:
> > On Tue, Nov 11, 2025 at 10:51:43AM +0530, Pavan Kondeti wrote:
> > > On Mon, Nov 10, 2025 at 09:43:53AM +0530, Pavan Kondeti wrote:
> > > > On Sat, Nov 08, 2025 at 07:26:46PM +0200, Dmitry Baryshkov wrote:
> > > > > > +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;
> > > > > > + bool of_wdt_available;
> > > > > > + int i;
> > > > > > + uuid_t gunyah_uuid = UUID_INIT(0xc1d58fcd, 0xa453, 0x5fdb, 0x92, 0x65,
> > > > >
> > > > > static const?
> > > > >
> > > > > > + 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 (!arm_smccc_hypervisor_has_uuid(&gunyah_uuid))
> > > > > > + return;
> > > > >
> > > > > This rquires 'select HAVE_ARM_SMCCC_DISCOVERY'
> > > > >
> > > >
> > > > Probably `depends on HAVE_ARM_SMCCC_DISCOVERY` is correct here.
> > > >
> > >
> > > Dmitry / Bjorn,
> > >
> > > We are debating on this internally on how to resolve this dependency
> > >
> > > - QCOM_SCM depends on HAVE_ARM_SMCCC_DISCOVERY which means restricting
> > > QCOM_SCM compilation than what it is today.
> >
> > What does that imply? What is the actual impact? (Do I need to go read
> > the dependency tree myself?)
>
> Actually, I misunderstood how QCOM_SCM driver is enabled. It is being
> selected by other drivers which needs functionality provided by QCOM_SCM
> driver. So adding HAVE_ARM_SMCCC_DISCOVERY dependency does not make much
> sense. Sorry, I should have done my homework properly. I was carried
> away with `select` vs `depends on` approach.
>
> >
> > >
> > > - Adding #ifdefry around arm_smccc_hypervisor_has_uuid usage in qcom scm driver
> > >
> > > - Adding stub for `arm_smccc_hypervisor_has_uuid()` which is not done
> > > for any of the functions defined in drivers/firmware/smccc/smccc.c
> > >
> > > We are trending towards the first option above. Please let us know if
> > > you think otherwise.
> >
> > What is this trend driven by? Is it coin toss or is there a reason? My
> > gut feeling is trending towards one of the latter two options...
>
> Thanks, we are going with #ifdefry around the new code that is added by
> this patch.
It's preferred to use if(IS_ENABLED()) rather than #ifdef.
>
> >
> > But you're effectively asking us to go research these three options,
> > determine the pros/cons and then tell you what we think, at which point I
> > presume you will tell us what you think about each option.
> >
> > It would be better if you made a suggestion and told us why you think
> > this is the best choice - then we can either agree with your reasoning,
> > or choose to ask more questions or do some research.
> >
>
> Understood. I will keep this in mind while presenting choices from now
> onwards.
--
With best wishes
Dmitry