From: Guenter Roeck <linux@roeck-us.net>
To: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Scott Cheloha <cheloha@linux.ibm.com>,
linux-watchdog@vger.kernel.org, bjking@linux.ibm.com,
nathanl@linux.ibm.com, aik@ozlabs.ru, npiggin@gmail.com,
vaishnavi@linux.ibm.com, wvoigt@us.ibm.com
Subject: Re: [RFC v1 2/2] watchdog: pseries-wdt: initial support for PAPR virtual watchdog timers
Date: Wed, 13 Apr 2022 20:48:28 -0700 [thread overview]
Message-ID: <20220414034828.GA2497623@roeck-us.net> (raw)
In-Reply-To: <YleS6B3bFA0J1/b+@google.com>
On Thu, Apr 14, 2022 at 11:20:08AM +0800, Tzung-Bi Shih wrote:
> On Wed, Apr 13, 2022 at 11:51:04AM -0500, Scott Cheloha wrote:
> > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > index c4e82a8d863f..f3e6db5bed74 100644
> > --- a/drivers/watchdog/Kconfig
> > +++ b/drivers/watchdog/Kconfig
> > @@ -1941,6 +1941,14 @@ config WATCHDOG_RTAS
> > To compile this driver as a module, choose M here. The module
> > will be called wdrtas.
> >
> > +config PSERIES_WDT
> > + tristate "POWER Architecture Platform Watchdog Timer"
> > + depends on PPC_PSERIES
> > + select WATCHDOG_CORE
> > + help
> > + Driver for virtual watchdog timers provided by PAPR
> > + hypervisors (e.g. pHyp, KVM).
> > +
>
> To maintain alphabetical order, the option should be prior to WATCHDOG_RTAS.
>
> > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> > index f7da867e8782..3ae1f7d9f1ec 100644
> > --- a/drivers/watchdog/Makefile
> > +++ b/drivers/watchdog/Makefile
> > @@ -185,6 +185,7 @@ obj-$(CONFIG_MEN_A21_WDT) += mena21_wdt.o
> >
> > # PPC64 Architecture
> > obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
> > +obj-$(CONFIG_PSERIES_WDT) += pseries-wdt.o
>
> Same here.
>
> > diff --git a/drivers/watchdog/pseries-wdt.c b/drivers/watchdog/pseries-wdt.c
> > new file mode 100644
> > index 000000000000..0d22ddf12a7f
> > --- /dev/null
> > +++ b/drivers/watchdog/pseries-wdt.c
> > @@ -0,0 +1,337 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later */
> > +
> > +#define DRV_NAME "pseries-wdt"
> > +#define pr_fmt(fmt) DRV_NAME ": " fmt
>
> `pr_fmt` is unused.
>
That is just a neat trick to get subsequent pr_xxx to print the driver name
as prefix.
>
> > +static int __init pseries_wdt_init_module(void)
> > +{
> > + unsigned long ret[PLPAR_HCALL_BUFSIZE] = { 0 };
> > + unsigned long cap;
> > + long rc;
> > + int err;
> > +
> > + rc = plpar_hcall(H_WATCHDOG, ret, PSERIES_WDTF_OP_QUERY);
> > + if (rc != H_SUCCESS) {
> > + if (rc == H_FUNCTION) {
> > + pr_info("hypervisor does not support H_WATCHDOG");
> > + return -ENODEV;
> > + }
> > + pr_err("H_WATCHDOG: %ld: capability query failed", rc);
> > + return -EIO;
The init function should not print any messages. Loading the driver on
a platform not supporting it should have no effect and print no messages.
> > + }
> > + cap = ret[0];
> > + min_timeout = roundup(PSERIES_WDTQ_MIN_TIMEOUT(cap), 1000) / 1000;
> > + pr_info("hypervisor supports %lu timer(s), %lums minimum timeout",
> > + PSERIES_WDTQ_MAX_NUMBER(cap), PSERIES_WDTQ_MIN_TIMEOUT(cap));
>
> Could these bits be in pseries_wdt_probe()?
Yes. Also, if values have to be passed to the driver, the init code should
pass it as platform data. There should be no static variables to pass
values to the probe function.
Thanks,
Guenter
next prev parent reply other threads:[~2022-04-14 3:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-13 16:51 [RFC v1 0/2] Add driver for PAPR watchdog timers Scott Cheloha
2022-04-13 16:51 ` [RFC v1 1/2] powerpc/pseries: hvcall.h: add definitions for H_WATCHDOG hypercall Scott Cheloha
2022-04-13 16:51 ` [RFC v1 2/2] watchdog: pseries-wdt: initial support for PAPR virtual watchdog timers Scott Cheloha
2022-04-14 3:20 ` Tzung-Bi Shih
2022-04-14 3:48 ` Guenter Roeck [this message]
2022-04-14 2:23 ` [RFC v1 0/2] Add driver for PAPR " Guenter Roeck
2022-04-14 12:39 ` Nathan Lynch
2022-04-19 8:49 ` Alexey Kardashevskiy
2022-04-19 13:55 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220414034828.GA2497623@roeck-us.net \
--to=linux@roeck-us.net \
--cc=aik@ozlabs.ru \
--cc=bjking@linux.ibm.com \
--cc=cheloha@linux.ibm.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=nathanl@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=tzungbi@kernel.org \
--cc=vaishnavi@linux.ibm.com \
--cc=wvoigt@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox