From: Henning Schild <henning.schild@siemens.com>
To: <linux-kernel@vger.kernel.org>, <linux-leds@vger.kernel.org>,
<platform-driver-x86@vger.kernel.org>,
<linux-watchdog@vger.kernel.org>
Cc: Srikanth Krishnakar <skrishnakar@gmail.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
"Gerd Haeussler" <gerd.haeussler.ext@siemens.com>,
Guenter Roeck <linux@roeck-us.net>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
Mark Gross <mgross@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>, Pavel Machek <pavel@ucw.cz>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Michael Haener <michael.haener@siemens.com>
Subject: Re: [PATCH v2 4/4] platform/x86: pmc_atom: improve critclk_systems matching for Siemens PCs
Date: Mon, 15 Mar 2021 11:14:34 +0100 [thread overview]
Message-ID: <20210315111434.413137b5@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20210315095710.7140-5-henning.schild@siemens.com>
Am Mon, 15 Mar 2021 10:57:10 +0100
schrieb Henning Schild <henning.schild@siemens.com>:
> Siemens industrial PCs unfortunately can not always be properly
> identified the way we used to. An earlier commit introduced code that
> allows proper identification without looking at DMI strings that could
> differ based on product branding.
> Switch over to that proper way and revert commits that used to collect
> the machines based on unstable strings.
>
> Fixes: 648e921888ad ("clk: x86: Stop marking clocks as
> CLK_IS_CRITICAL") Fixes: e8796c6c69d1 ("platform/x86: pmc_atom: Add
> Siemens CONNECT ...") Fixes: f110d252ae79 ("platform/x86: pmc_atom:
> Add Siemens SIMATIC ...") Fixes: ad0d315b4d4e ("platform/x86:
> pmc_atom: Add Siemens SIMATIC ...") Tested-by: Michael Haener
> <michael.haener@siemens.com> Signed-off-by: Henning Schild
> <henning.schild@siemens.com> ---
> drivers/platform/x86/pmc_atom.c | 47
> +++++++++++++++++++-------------- 1 file changed, 27 insertions(+),
> 20 deletions(-)
>
> diff --git a/drivers/platform/x86/pmc_atom.c
> b/drivers/platform/x86/pmc_atom.c index ca684ed760d1..38542d547f29
> 100644 --- a/drivers/platform/x86/pmc_atom.c
> +++ b/drivers/platform/x86/pmc_atom.c
> @@ -13,6 +13,7 @@
> #include <linux/io.h>
> #include <linux/platform_data/x86/clk-pmc-atom.h>
> #include <linux/platform_data/x86/pmc_atom.h>
> +#include <linux/platform_data/x86/simatic-ipc.h>
> #include <linux/platform_device.h>
> #include <linux/pci.h>
> #include <linux/seq_file.h>
> @@ -362,6 +363,23 @@ static void pmc_dbgfs_register(struct pmc_dev
> *pmc) }
> #endif /* CONFIG_DEBUG_FS */
>
> +static bool pmc_clk_is_critical = true;
> +
> +static int siemens_clk_is_critical(const struct dmi_system_id *d)
> +{
> + u32 st_id;
> +
> + if (dmi_walk(simatic_ipc_find_dmi_entry_helper, &st_id))
> + goto out;
> +
> + if (st_id == SIMATIC_IPC_IPC227E || st_id ==
> SIMATIC_IPC_IPC277E)
> + return 1;
> +
> +out:
> + pmc_clk_is_critical = false;
> + return 1;
> +}
> +
> /*
> * Some systems need one or more of their pmc_plt_clks to be
> * marked as critical.
> @@ -424,24 +442,10 @@ static const struct dmi_system_id
> critclk_systems[] = { },
> },
> {
> - .ident = "SIMATIC IPC227E",
> - .matches = {
> - DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"),
> - DMI_MATCH(DMI_PRODUCT_VERSION, "6ES7647-8B"),
> - },
> - },
> - {
> - .ident = "SIMATIC IPC277E",
> - .matches = {
> - DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"),
> - DMI_MATCH(DMI_PRODUCT_VERSION, "6AV7882-0"),
> - },
> - },
> - {
> - .ident = "CONNECT X300",
> + .callback = siemens_clk_is_critical,
> + .ident = "SIEMENS AG",
> .matches = {
> DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"),
> - DMI_MATCH(DMI_PRODUCT_VERSION,
> "A5E45074588"), },
> },
>
> @@ -453,7 +457,7 @@ static int pmc_setup_clks(struct pci_dev *pdev,
> void __iomem *pmc_regmap, {
> struct platform_device *clkdev;
> struct pmc_clk_data *clk_data;
> - const struct dmi_system_id *d =
> dmi_first_match(critclk_systems);
> + const struct dmi_system_id *d;
>
> clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
> if (!clk_data)
> @@ -461,9 +465,12 @@ static int pmc_setup_clks(struct pci_dev *pdev,
> void __iomem *pmc_regmap,
> clk_data->base = pmc_regmap; /* offset is added by client */
> clk_data->clks = pmc_data->clks;
> - if (d) {
> - clk_data->critical = true;
> - pr_info("%s critclks quirk enabled\n", d->ident);
> + if (dmi_check_system(critclk_systems)) {
Had to switch to check_system to get the callback to work.
> + clk_data->critical = pmc_clk_is_critical;
> + if (clk_data->critical) {
> + d = dmi_first_match(critclk_systems);
> + pr_info("%s critclks quirk enabled\n",
> d->ident);
Now need a double match here just to print the ident. Not too happy
with that but proposing it like this to keep the ident printing.
I guess it could be improved by not printing the ident or having a
global variable and global callback to remember the ident to print
later. I would propose to not print the ident if the double-match does
not find traction.
Henning
> + }
> }
>
> clkdev = platform_device_register_data(&pdev->dev,
> "clk-pmc-atom",
next prev parent reply other threads:[~2021-03-15 10:15 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 9:57 [PATCH v2 0/4] add device drivers for Siemens Industrial PCs Henning Schild
2021-03-15 9:57 ` [PATCH v2 1/4] platform/x86: simatic-ipc: add main driver for Siemens devices Henning Schild
2021-03-15 10:31 ` Andy Shevchenko
2021-03-15 16:30 ` Henning Schild
2021-03-17 19:13 ` Henning Schild
2021-03-17 20:03 ` Hans de Goede
2021-03-18 11:30 ` Enrico Weigelt, metux IT consult
2021-03-18 11:45 ` Hans de Goede
2021-03-26 9:55 ` Henning Schild
2021-03-26 12:21 ` Hans de Goede
2021-03-15 9:57 ` [PATCH v2 2/4] leds: simatic-ipc-leds: add new driver for Siemens Industial PCs Henning Schild
2021-03-15 10:48 ` Andy Shevchenko
2021-03-15 11:19 ` Pavel Machek
2021-03-15 11:26 ` Andy Shevchenko
2021-03-15 12:40 ` Henning Schild
2021-03-18 11:38 ` Enrico Weigelt, metux IT consult
2021-03-27 9:46 ` Henning Schild
2021-04-01 16:20 ` Enrico Weigelt, metux IT consult
2021-03-27 9:56 ` Henning Schild
2021-03-18 10:27 ` Enrico Weigelt, metux IT consult
2021-03-18 12:40 ` Alexander Dahl
2021-03-23 17:45 ` Henning Schild
2021-03-26 16:33 ` Henning Schild
2021-03-18 10:25 ` Enrico Weigelt, metux IT consult
2021-03-27 11:16 ` Henning Schild
2021-03-27 11:41 ` Henning Schild
2021-03-15 9:57 ` [PATCH v2 3/4] watchdog: simatic-ipc-wdt: add new driver for Siemens Industrial PCs Henning Schild
2021-03-15 15:10 ` Guenter Roeck
2021-03-29 16:28 ` Henning Schild
2021-03-15 9:57 ` [PATCH v2 4/4] platform/x86: pmc_atom: improve critclk_systems matching for Siemens PCs Henning Schild
2021-03-15 10:14 ` Henning Schild [this message]
2021-03-15 10:19 ` Hans de Goede
2021-03-15 12:09 ` Henning Schild
2021-03-15 14:58 ` [PATCH] platform/x86: pmc_atom: use callback for all dmi quirk entries Henning Schild
2021-03-15 16:31 ` Hans de Goede
2021-03-15 17:00 ` Henning Schild
2021-03-15 18:01 ` Hans de Goede
2021-03-16 5:47 ` Henning Schild
2021-03-16 9:43 ` Hans de Goede
2021-03-15 13:25 ` [PATCH v2 4/4] platform/x86: pmc_atom: improve critclk_systems matching for Siemens PCs kernel test robot
2021-03-15 10:55 ` [PATCH v2 0/4] add device drivers for Siemens Industrial PCs Andy Shevchenko
2021-03-15 16:08 ` Henning Schild
2021-08-02 9:21 ` Henning Schild
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=20210315111434.413137b5@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=andy.shevchenko@gmail.com \
--cc=gerd.haeussler.ext@siemens.com \
--cc=hdegoede@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mgross@linux.intel.com \
--cc=michael.haener@siemens.com \
--cc=pavel@ucw.cz \
--cc=platform-driver-x86@vger.kernel.org \
--cc=skrishnakar@gmail.com \
--cc=wim@linux-watchdog.org \
/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;
as well as URLs for NNTP newsgroup(s).