From: Mario Limonciello <mario.limonciello@amd.com>
To: Evan Quan <evan.quan@amd.com>,
rafael@kernel.org, lenb@kernel.org, Alexander.Deucher@amd.com,
Christian.Koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com,
daniel@ffwll.ch, kvalo@kernel.org, nbd@nbd.name,
lorenzo@kernel.org, ryder.lee@mediatek.com,
shayne.chen@mediatek.com, sean.wang@mediatek.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
Lijo.Lazar@amd.com
Cc: linux-acpi@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH V3 5/7] drm/amd/pm: add flood detection for wbrf events
Date: Sun, 18 Jun 2023 21:22:58 -0500 [thread overview]
Message-ID: <83f35ea2-935e-3026-908e-74a5147b22f8@amd.com> (raw)
In-Reply-To: <20230616065757.1054422-6-evan.quan@amd.com>
On 6/16/23 01:57, Evan Quan wrote:
> To protect PMFW from being overloaded.
>
> Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 28 ++++++++++++++++---
> drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 7 +++++
> 2 files changed, 31 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index 89f876cc60e6..2619e310ef54 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -1272,6 +1272,22 @@ static void smu_wbrf_event_handler(struct amdgpu_device *adev)
> {
> struct smu_context *smu = adev->powerplay.pp_handle;
>
> + schedule_delayed_work(&smu->wbrf_delayed_work,
> + msecs_to_jiffies(SMU_WBRF_EVENT_HANDLING_PACE));
> +}
> +
> +/**
> + * smu_wbrf_delayed_work_handler - callback on delayed work timer expired
> + *
> + * @work: struct work_struct pointer
> + *
> + * Flood is over and driver will consume the latest exclusion ranges.
> + */
> +static void smu_wbrf_delayed_work_handler(struct work_struct *work)
> +{
> + struct smu_context *smu =
> + container_of(work, struct smu_context, wbrf_delayed_work.work);
> +
> smu_wbrf_handle_exclusion_ranges(smu);
> }
>
> @@ -1311,6 +1327,9 @@ static int smu_wbrf_init(struct smu_context *smu)
> if (!smu->wbrf_supported)
> return 0;
>
> + INIT_DELAYED_WORK(&smu->wbrf_delayed_work,
> + smu_wbrf_delayed_work_handler);
> +
> ret = amdgpu_acpi_register_wbrf_notify_handler(adev,
> smu_wbrf_event_handler);
> if (ret)
> @@ -1321,11 +1340,10 @@ static int smu_wbrf_init(struct smu_context *smu)
> * before our driver loaded. To make sure our driver
> * is awared of those exclusion ranges.
> */
> - ret = smu_wbrf_handle_exclusion_ranges(smu);
> - if (ret)
> - dev_err(adev->dev, "Failed to handle wbrf exclusion ranges\n");
> + schedule_delayed_work(&smu->wbrf_delayed_work,
> + msecs_to_jiffies(SMU_WBRF_EVENT_HANDLING_PACE));
>
> - return ret;
> + return 0;
> }
>
> /**
> @@ -1343,6 +1361,8 @@ static void smu_wbrf_fini(struct smu_context *smu)
> return;
>
> amdgpu_acpi_unregister_wbrf_notify_handler(adev);
> +
> + cancel_delayed_work_sync(&smu->wbrf_delayed_work);
> }
>
> static int smu_smc_hw_setup(struct smu_context *smu)
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> index ff0af3da0be2..aa63cc43d41c 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
> @@ -478,6 +478,12 @@ struct stb_context {
>
> #define WORKLOAD_POLICY_MAX 7
>
> +/*
> + * Configure wbrf event handling pace as there can be only one
> + * event processed every SMU_WBRF_EVENT_HANDLING_PACE ms.
> + */
> +#define SMU_WBRF_EVENT_HANDLING_PACE 10
> +
> struct smu_context
> {
> struct amdgpu_device *adev;
> @@ -576,6 +582,7 @@ struct smu_context
>
> /* data structures for wbrf feature support */
> bool wbrf_supported;
> + struct delayed_work wbrf_delayed_work;
> };
>
> struct i2c_adapter;
next prev parent reply other threads:[~2023-06-19 2:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 6:57 [PATCH V3 0/7] Support Wifi RFI interference mitigation feature Evan Quan
2023-06-16 6:57 ` [PATCH V3 1/7] drivers/acpi: Add support for Wifi band RF mitigations Evan Quan
2023-06-19 2:04 ` Mario Limonciello
2023-06-21 1:26 ` Quan, Evan
2023-06-16 6:57 ` [PATCH V3 2/7] wifi: mac80211: Add support for ACPI WBRF Evan Quan
2023-06-19 2:17 ` Mario Limonciello
2023-06-19 8:24 ` Johannes Berg
2023-06-21 1:04 ` Quan, Evan
2023-06-21 1:24 ` Quan, Evan
2023-06-16 6:57 ` [PATCH V3 3/7] drm/amd/pm: update driver_if and ppsmc headers for coming wbrf feature Evan Quan
2023-06-19 2:18 ` Mario Limonciello
2023-06-16 6:57 ` [PATCH V3 4/7] drm/amd/pm: setup the framework to support Wifi RFI mitigation feature Evan Quan
2023-06-19 2:22 ` Mario Limonciello
2023-06-19 14:54 ` Lazar, Lijo
2023-06-21 0:34 ` Quan, Evan
2023-06-16 6:57 ` [PATCH V3 5/7] drm/amd/pm: add flood detection for wbrf events Evan Quan
2023-06-19 2:22 ` Mario Limonciello [this message]
2023-06-16 6:57 ` [PATCH V3 6/7] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.0 Evan Quan
2023-06-19 2:26 ` Mario Limonciello
2023-06-16 6:57 ` [PATCH V3 7/7] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7 Evan Quan
2023-06-19 2:27 ` Mario Limonciello
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=83f35ea2-935e-3026-908e-74a5147b22f8@amd.com \
--to=mario.limonciello@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Lijo.Lazar@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=evan.quan@amd.com \
--cc=kvalo@kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=rafael@kernel.org \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.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;
as well as URLs for NNTP newsgroup(s).