From: Hans de Goede <hdegoede@redhat.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>, markgross@kernel.org
Cc: platform-driver-x86@vger.kernel.org, Patil.Reddy@amd.com
Subject: Re: [PATCH v1 06/15] platform/x86/amd/pmf: Add heartbeat signal support
Date: Wed, 27 Jul 2022 21:53:12 +0200 [thread overview]
Message-ID: <191776ed-8d45-cd62-89f5-ff20e20b2b40@redhat.com> (raw)
In-Reply-To: <20220712145847.3438544-7-Shyam-sundar.S-k@amd.com>
Hi,
On 7/12/22 16:58, Shyam Sundar S K wrote:
> PMF driver can send periodic heartbeat signals to OEM BIOS. When BIOS does
> not receive the signal after a period of time, it can infer that AMDPMF
> has hung or failed to load.
>
> In this situation, BIOS can fallback to legacy operations. OEM can modify
> the time interval of the signal or completely disable signals through
> ACPI Method.
>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/platform/x86/amd/pmf/acpi.c | 42 +++++++++++++++++++++++++++--
> drivers/platform/x86/amd/pmf/core.c | 1 +
> drivers/platform/x86/amd/pmf/pmf.h | 10 +++++++
> 3 files changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c
> index fd5ab7a116f0..60ffc9ba4adc 100644
> --- a/drivers/platform/x86/amd/pmf/acpi.c
> +++ b/drivers/platform/x86/amd/pmf/acpi.c
> @@ -97,6 +97,7 @@ int is_apmf_func_supported(unsigned long index)
>
> static int apmf_get_system_params(struct apmf_if *ampf_if)
> {
> + struct apmf_notification_cfg *n = &f_if->notify_cfg;
> struct apmf_system_params params;
> union acpi_object *info;
> size_t size;
> @@ -120,11 +121,13 @@ static int apmf_get_system_params(struct apmf_if *ampf_if)
> memset(¶ms, 0, sizeof(params));
> memcpy(¶ms, info->buffer.pointer, size);
>
> - pr_debug("PMF: system params mask:0x%x flags:0x%x cmd_code:0x%x\n",
> + pr_debug("PMF: system params mask:0x%x flags:0x%x cmd_code:0x%x heartbeat:%d\n",
> params.valid_mask,
> params.flags,
> - params.command_code);
> + params.command_code,
> + params.heartbeat_int);
> params.flags = params.flags & params.valid_mask;
> + n->hb_interval = params.heartbeat_int;
>
> out:
> kfree(info);
> @@ -159,6 +162,26 @@ int apmf_get_static_slider_granular(struct apmf_if *ampf_if,
> return err;
> }
>
> +static void apmf_sbios_heartbeat_notify(struct work_struct *work)
> +{
> + struct amd_pmf_dev *dev = container_of(work, struct amd_pmf_dev, heart_beat.work);
> + struct apmf_notification_cfg *n = &dev->apmf_if->notify_cfg;
> + union acpi_object *info;
> + int err = 0;
> +
> + dev_dbg(dev->dev, "Sending heartbeat to SBIOS\n");
> + info = apmf_if_call(dev->apmf_if, APMF_FUNC_SBIOS_HEARTBEAT, NULL);
> + if (!info) {
> + err = -EIO;
> + goto out;
> + }
> +
> + schedule_delayed_work(&dev->heart_beat, msecs_to_jiffies(n->hb_interval * 1000));
> +
> +out:
> + kfree(info);
> +}
> +
> static acpi_handle apmf_if_probe_handle(void)
> {
> acpi_handle handle = NULL;
> @@ -179,8 +202,15 @@ static acpi_handle apmf_if_probe_handle(void)
> return handle;
> }
>
> +void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev)
> +{
> + if (pmf_dev->apmf_if->func.sbios_heartbeat)
> + cancel_delayed_work_sync(&pmf_dev->heart_beat);
> +}
> +
> int apmf_acpi_init(struct amd_pmf_dev *pmf_dev)
> {
> + struct apmf_notification_cfg *n;
> acpi_handle apmf_if_handle;
> struct apmf_if *apmf_if;
> int ret;
> @@ -202,6 +232,7 @@ int apmf_acpi_init(struct amd_pmf_dev *pmf_dev)
> goto out;
> }
> pmf_dev->apmf_if = apmf_if;
> + n = &apmf_if->notify_cfg;
>
> if (apmf_if->func.system_params) {
> ret = apmf_get_system_params(apmf_if);
> @@ -212,6 +243,13 @@ int apmf_acpi_init(struct amd_pmf_dev *pmf_dev)
> }
> }
>
> + if (n->hb_interval) {
> + apmf_if->func.sbios_heartbeat = true;
> + /* send heartbeats only if the interval is not zero */
> + INIT_DELAYED_WORK(&pmf_dev->heart_beat, apmf_sbios_heartbeat_notify);
> + schedule_delayed_work(&pmf_dev->heart_beat, 0);
> + }
> +
> out:
> return ret;
> }
> diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c
> index 3d2af6a8e5e4..ff26928e6a49 100644
> --- a/drivers/platform/x86/amd/pmf/core.c
> +++ b/drivers/platform/x86/amd/pmf/core.c
> @@ -289,6 +289,7 @@ static int amd_pmf_remove(struct platform_device *pdev)
>
> mutex_destroy(&dev->lock);
> amd_pmf_deinit_features(dev);
> + apmf_acpi_deinit(dev);
> amd_pmf_dbgfs_unregister(dev);
> kfree(dev->buf);
> return 0;
> diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h
> index 77021ef4bfde..504e1ae79706 100644
> --- a/drivers/platform/x86/amd/pmf/pmf.h
> +++ b/drivers/platform/x86/amd/pmf/pmf.h
> @@ -17,6 +17,7 @@
> /* APMF Functions */
> #define APMF_FUNC_VERIFY_INTERFACE 0
> #define APMF_FUNC_GET_SYS_PARAMS 1
> +#define APMF_FUNC_SBIOS_HEARTBEAT 4
> #define APMF_FUNC_STATIC_SLIDER_GRANULAR 9
>
> /* Message Definitions */
> @@ -43,12 +44,18 @@
> /* AMD PMF BIOS interfaces */
> struct apmf_if_functions {
> bool system_params;
> + bool sbios_heartbeat;
> bool static_slider_granular;
> };
>
> +struct apmf_notification_cfg {
> + int hb_interval; /* SBIOS heartbeat interval */
> +};
> +
> struct apmf_if {
> acpi_handle handle;
> struct apmf_if_functions func;
> + struct apmf_notification_cfg notify_cfg;
> };
>
> struct apmf_verify_interface {
> @@ -63,6 +70,7 @@ struct apmf_system_params {
> u32 valid_mask;
> u32 flags;
> u8 command_code;
> + u32 heartbeat_int;
> } __packed;
>
> enum amd_stt_skin_temp {
> @@ -101,6 +109,7 @@ struct amd_pmf_dev {
> struct apmf_if *apmf_if;
> enum platform_profile_option current_profile;
> struct platform_profile_handler pprof;
> + struct delayed_work heart_beat;
> struct mutex lock; /* protects the PMF interface */
> #if IS_ENABLED(CONFIG_DEBUG_FS)
> struct dentry *dbgfs_dir;
> @@ -130,6 +139,7 @@ struct amd_pmf_static_slider_granular {
>
> /* Core Layer */
> int apmf_acpi_init(struct amd_pmf_dev *pmf_dev);
> +void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev);
> int is_apmf_func_supported(unsigned long index);
> int amd_pmf_send_cmd(struct amd_pmf_dev *dev, u8 message, bool get, u32 arg, u32 *data);
> int amd_pmf_get_power_source(void);
next prev parent reply other threads:[~2022-07-27 19:53 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 14:58 [PATCH v1 00/15] platform/x86/amd/pmf: Introduce AMD PMF Driver Shyam Sundar S K
2022-07-12 14:58 ` [PATCH v1 01/15] ACPI: platform_profile: Add support for notification chains Shyam Sundar S K
2022-07-12 15:03 ` Limonciello, Mario
2022-07-27 13:24 ` Hans de Goede
2022-07-27 20:38 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 02/15] platform/x86/amd/pmf: Add support for PMF core layer Shyam Sundar S K
2022-07-27 13:57 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 03/15] platform/x86/amd/pmf: Add support for PMF APCI layer Shyam Sundar S K
2022-07-27 13:57 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 04/15] platform/x86/amd/pmf: Add support SPS PMF feature Shyam Sundar S K
2022-07-27 19:29 ` Hans de Goede
2022-07-27 20:26 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 05/15] platform/x86/amd/pmf: Add debugfs information Shyam Sundar S K
2022-07-27 19:50 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 06/15] platform/x86/amd/pmf: Add heartbeat signal support Shyam Sundar S K
2022-07-27 19:53 ` Hans de Goede [this message]
2022-07-12 14:58 ` [PATCH v1 07/15] platform/x86/amd/pmf: Add fan control support Shyam Sundar S K
2022-07-27 20:11 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 08/15] platform/x86/amd/pmf: Get performance metrics from PMFW Shyam Sundar S K
2022-07-27 20:36 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 09/15] platform/x86/amd/pmf: Add support for CnQF Shyam Sundar S K
2022-07-27 20:51 ` Hans de Goede
2022-07-27 21:00 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 10/15] platform/x86/amd/pmf: Add sysfs to toggle CnQF Shyam Sundar S K
2022-07-27 20:52 ` Hans de Goede
2022-07-27 21:12 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 11/15] Documentation/ABI/testing/sysfs-amd-pmf: Add ABI doc for AMD PMF Shyam Sundar S K
2022-07-27 20:52 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 12/15] platform/x86/amd/pmf: Add support for Auto mode feature Shyam Sundar S K
2022-07-27 21:22 ` Hans de Goede
2022-07-28 12:57 ` Shyam Sundar S K
2022-07-28 13:15 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 13/15] platform/x86/amd/pmf: Handle AMT and CQL events for Auto mode Shyam Sundar S K
2022-07-27 21:33 ` Hans de Goede
2022-07-27 21:44 ` Hans de Goede
2022-07-27 21:46 ` Hans de Goede
2022-07-27 23:52 ` Limonciello, Mario
2022-07-28 13:03 ` Hans de Goede
2022-07-28 13:43 ` Limonciello, Mario
2022-07-28 14:09 ` Hans de Goede
2022-07-28 14:38 ` Limonciello, Mario
2022-07-28 17:46 ` Hans de Goede
2022-07-28 18:06 ` Limonciello, Mario
2022-07-28 18:17 ` Hans de Goede
2022-07-28 21:01 ` Limonciello, Mario
2022-07-29 11:03 ` Hans de Goede
2022-07-29 15:43 ` Limonciello, Mario
2022-07-29 17:40 ` Shyam Sundar S K
2022-07-29 17:59 ` Hans de Goede
2022-08-01 10:29 ` Shyam Sundar S K
2022-08-01 11:08 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 14/15] platform/x86/amd/pmf: Force load driver on older supported platforms Shyam Sundar S K
2022-07-27 21:40 ` Hans de Goede
2022-07-12 14:58 ` [PATCH v1 15/15] MAINTAINERS: Add AMD PMF driver entry Shyam Sundar S K
2022-07-27 21:41 ` Hans de Goede
2022-07-28 17:44 ` Shyam Sundar S K
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=191776ed-8d45-cd62-89f5-ff20e20b2b40@redhat.com \
--to=hdegoede@redhat.com \
--cc=Patil.Reddy@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.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).