mbox series

[v14,0/9] Enable Wifi RFI interference mitigation feature support

Message ID 20231129091348.3972539-1-Jun.Ma2@amd.com
Headers show
Series Enable Wifi RFI interference mitigation feature support | expand

Message

Ma Jun Nov. 29, 2023, 9:13 a.m. UTC
Due to electrical and mechanical constraints in certain platform designs there
may be likely interference of relatively high-powered harmonics of the (G-)DDR
memory clocks with local radio module frequency bands used by Wifi 6/6e/7. To
mitigate possible RFI interference we introuduced WBRF(Wifi Band RFI mitigation Feature).
Producers can advertise the frequencies in use and consumers can use this information
to avoid using these frequencies for sensitive features.

The whole patch set is based on Linux 6.7.0-rc1. With some brief introductions
as below:
Patch1:      Document about WBRF
Patch2:      Core functionality setup for WBRF feature support
Patch3 - 4:  Bring WBRF support to wifi subsystem.
Patch5 - 9:  Bring WBRF support to AMD graphics driver.

Evan Quan (6):
  cfg80211: expose nl80211_chan_width_to_mhz for wide sharing
  wifi: mac80211: Add support for WBRF features
  drm/amd/pm: update driver_if and ppsmc headers for coming wbrf feature
  drm/amd/pm: setup the framework to support Wifi RFI mitigation feature
  drm/amd/pm: add flood detection for wbrf events
  drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7

Ma Jun (3):
  Documentation/driver-api: Add document about WBRF mechanism
  platform/x86/amd: Add support for AMD ACPI based Wifi band RFI
    mitigation feature
  drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.0

 Documentation/driver-api/wbrf.rst             |  78 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           |   2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  17 +
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 208 +++++++++++
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  42 +++
 .../inc/pmfw_if/smu13_driver_if_v13_0_0.h     |   3 +-
 .../inc/pmfw_if/smu13_driver_if_v13_0_7.h     |   3 +-
 .../pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h  |   5 +-
 .../pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h  |   3 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |   3 +-
 drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h  |   4 +
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c    |  48 +++
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c  |  22 ++
 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c  |  13 +
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |   3 +
 drivers/platform/x86/amd/Kconfig              |  15 +
 drivers/platform/x86/amd/Makefile             |   1 +
 drivers/platform/x86/amd/wbrf.c               | 337 ++++++++++++++++++
 include/linux/acpi_amd_wbrf.h                 |  94 +++++
 include/net/cfg80211.h                        |   9 +
 net/mac80211/Makefile                         |   2 +
 net/mac80211/chan.c                           |   9 +
 net/mac80211/ieee80211_i.h                    |   7 +
 net/mac80211/main.c                           |   2 +
 net/mac80211/wbrf.c                           |  95 +++++
 net/wireless/chan.c                           |   3 +-
 26 files changed, 1020 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/driver-api/wbrf.rst
 create mode 100644 drivers/platform/x86/amd/wbrf.c
 create mode 100644 include/linux/acpi_amd_wbrf.h
 create mode 100644 net/mac80211/wbrf.c

Comments

Mario Limonciello Nov. 29, 2023, 5:21 p.m. UTC | #1
On 11/29/2023 03:13, Ma Jun wrote:
> Add documentation about AMD's Wifi band RFI mitigation (WBRF) mechanism
> explaining the theory and how it is used.
> 
> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

> 
> --
> v14:
> - Fix the format issue (IIpo Jarvinen)
> ---
>   Documentation/driver-api/wbrf.rst | 78 +++++++++++++++++++++++++++++++
>   1 file changed, 78 insertions(+)
>   create mode 100644 Documentation/driver-api/wbrf.rst
> 
> diff --git a/Documentation/driver-api/wbrf.rst b/Documentation/driver-api/wbrf.rst
> new file mode 100644
> index 000000000000..12793bb1abce
> --- /dev/null
> +++ b/Documentation/driver-api/wbrf.rst
> @@ -0,0 +1,78 @@
> +.. SPDX-License-Identifier: GPL-2.0-or-later
> +
> +=================================
> +WBRF - Wifi Band RFI Mitigations
> +=================================
> +
> +Due to electrical and mechanical constraints in certain platform designs
> +there may be likely interference of relatively high-powered harmonics of
> +the GPU memory clocks with local radio module frequency bands used by
> +certain Wifi bands.
> +
> +To mitigate possible RFI interference producers can advertise the
> +frequencies in use and consumers can use this information to avoid using
> +these frequencies for sensitive features.
> +
> +When a platform is known to have this issue with any contained devices,
> +the platform designer will advertise the availability of this feature via
> +ACPI devices with a device specific method (_DSM).
> +* Producers with this _DSM will be able to advertise the frequencies in use.
> +* Consumers with this _DSM will be able to register for notifications of
> +frequencies in use.
> +
> +Some general terms
> +==================
> +
> +Producer: such component who can produce high-powered radio frequency
> +Consumer: such component who can adjust its in-use frequency in
> +           response to the radio frequencies of other components to
> +           mitigate the possible RFI.
> +
> +To make the mechanism function, those producers should notify active use
> +of their particular frequencies so that other consumers can make relative
> +internal adjustments as necessary to avoid this resonance.
> +
> +ACPI interface
> +==============
> +
> +Although initially used by for wifi + dGPU use cases, the ACPI interface
> +can be scaled to any type of device that a platform designer discovers
> +can cause interference.
> +
> +The GUID used for the _DSM is 7B7656CF-DC3D-4C1C-83E9-66E721DE3070.
> +
> +3 functions are available in this _DSM:
> +
> +* 0: discover # of functions available
> +* 1: record RF bands in use
> +* 2: retrieve RF bands in use
> +
> +Driver programming interface
> +============================
> +
> +.. kernel-doc:: drivers/platform/x86/amd/wbrf.c
> +
> +Sample Usage
> +=============
> +
> +The expected flow for the producers:
> +1. During probe, call `acpi_amd_wbrf_supported_producer` to check if WBRF
> +   can be enabled for the device.
> +2. On using some frequency band, call `acpi_amd_wbrf_add_remove` with 'add'
> +   param to get other consumers properly notified.
> +3. Or on stopping using some frequency band, call
> +   `acpi_amd_wbrf_add_remove` with 'remove' param to get other consumers notified.
> +
> +The expected flow for the consumers:
> +1. During probe, call `acpi_amd_wbrf_supported_consumer` to check if WBRF
> +   can be enabled for the device.
> +2. Call `amd_wbrf_register_notifier` to register for notification
> +   of frequency band change(add or remove) from other producers.
> +3. Call the `amd_wbrf_retrieve_freq_band` initally to retrieve
> +   current active frequency bands considering some producers may broadcast
> +   such information before the consumer is up.
> +4. On receiving a notification for frequency band change, run
> +   `amd_wbrf_retrieve_freq_band` again to retrieve the latest
> +   active frequency bands.
> +5. During driver cleanup, call `amd_wbrf_unregister_notifier` to
> +   unregister the notifier.
Mario Limonciello Nov. 29, 2023, 5:26 p.m. UTC | #2
On 11/29/2023 03:13, Ma Jun wrote:
> From: Evan Quan <quanliangl@hotmail.com>
> 
> The newly added WBRF feature needs this interface for channel
> width calculation.
> 
> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
> Signed-off-by: Evan Quan <quanliangl@hotmail.com>

I think the order should be the other way around for these SoB as 
"you're signing off on Evan's work".

Otherwise LGTM.

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> 
> --
> v8->v9:
>    - correct typo(Mhz -> MHz) (Johnson)
> v13:
>   - Fix the format issue (IIpo Jarvinen)
> ---
>   include/net/cfg80211.h | 9 +++++++++
>   net/wireless/chan.c    | 3 ++-
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
> index b137a33a1b68..08f0d7184167 100644
> --- a/include/net/cfg80211.h
> +++ b/include/net/cfg80211.h
> @@ -976,6 +976,15 @@ const struct cfg80211_chan_def *
>   cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
>   			    const struct cfg80211_chan_def *chandef2);
>   
> +/**
> + * nl80211_chan_width_to_mhz - get the channel width in MHz
> + * @chan_width: the channel width from &enum nl80211_chan_width
> + *
> + * Return: channel width in MHz if the chan_width from &enum nl80211_chan_width
> + * is valid. -1 otherwise.
> + */
> +int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);
> +
>   /**
>    * cfg80211_chandef_valid - check if a channel definition is valid
>    * @chandef: the channel definition to check
> diff --git a/net/wireless/chan.c b/net/wireless/chan.c
> index 2d21e423abdb..dfb4893421d7 100644
> --- a/net/wireless/chan.c
> +++ b/net/wireless/chan.c
> @@ -141,7 +141,7 @@ static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef)
>   	return true;
>   }
>   
> -static int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width)
> +int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width)
>   {
>   	int mhz;
>   
> @@ -190,6 +190,7 @@ static int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width)
>   	}
>   	return mhz;
>   }
> +EXPORT_SYMBOL(nl80211_chan_width_to_mhz);
>   
>   static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)
>   {