2023-08-11 09:58:29

by Simon Horman

[permalink] [raw]
Subject: Re: [PATCH V8 2/9] drivers core: add ACPI based WBRF mechanism introduced by AMD

On Thu, Aug 10, 2023 at 03:37:56PM +0800, Evan Quan wrote:
> AMD has introduced an ACPI based mechanism to support WBRF for some
> platforms with AMD dGPU + WLAN. This needs support from BIOS equipped
> with necessary AML implementations and dGPU firmwares.
>
> For those systems without the ACPI mechanism and developing solutions,
> user can use/fall-back the generic WBRF solution for diagnosing potential
> interference issues.
>
> And for the platform which does not equip with the necessary AMD ACPI
> implementations but with CONFIG_WBRF_AMD_ACPI built as 'y', it will
> fall back to generic WBRF solution if the `wbrf` is set as "on".
>
> Co-developed-by: Mario Limonciello <[email protected]>
> Signed-off-by: Mario Limonciello <[email protected]>
> Co-developed-by: Evan Quan <[email protected]>
> Signed-off-by: Evan Quan <[email protected]>

...

> diff --git a/drivers/acpi/amd_wbrf.c b/drivers/acpi/amd_wbrf.c

...

> +static bool check_acpi_wbrf(acpi_handle handle, u64 rev, u64 funcs)
> +{
> + int i;
> + u64 mask = 0;
> + union acpi_object *obj;
> +
> + if (funcs == 0)
> + return false;
> +
> + obj = acpi_evaluate_wbrf(handle, rev, 0);
> + if (!obj)
> + return false;
> +
> + if (obj->type != ACPI_TYPE_BUFFER)
> + return false;
> +
> + /*
> + * Bit vector providing supported functions information.
> + * Each bit marks support for one specific function of the WBRF method.
> + */
> + for (i = 0; i < obj->buffer.length && i < 8; i++)
> + mask |= (((u64)obj->buffer.pointer[i]) << (i * 8));
> +
> + ACPI_FREE(obj);
> +
> + if ((mask & BIT(WBRF_ENABLED)) &&
> + (mask & funcs) == funcs)

Hi Evan,

a minor nit from my side: the indentation of the line above seems odd.

if ((mask & BIT(WBRF_ENABLED)) &&
(mask & funcs) == funcs)

> + return true;
> +
> + return false;
> +}

...


2023-08-14 08:10:51

by Evan Quan

[permalink] [raw]
Subject: RE: [PATCH V8 2/9] drivers core: add ACPI based WBRF mechanism introduced by AMD

[AMD Official Use Only - General]



> -----Original Message-----
> From: Simon Horman <[email protected]>
> Sent: Friday, August 11, 2023 5:38 PM
> To: Quan, Evan <[email protected]>
> Cc: [email protected]; [email protected]; Deucher, Alexander
> <[email protected]>; Koenig, Christian
> <[email protected]>; Pan, Xinhui <[email protected]>;
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Limonciello, Mario <[email protected]>;
> [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> Lazar, Lijo <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; linux-
> [email protected]; [email protected]; amd-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]
> Subject: Re: [PATCH V8 2/9] drivers core: add ACPI based WBRF mechanism
> introduced by AMD
>
> On Thu, Aug 10, 2023 at 03:37:56PM +0800, Evan Quan wrote:
> > AMD has introduced an ACPI based mechanism to support WBRF for some
> > platforms with AMD dGPU + WLAN. This needs support from BIOS equipped
> > with necessary AML implementations and dGPU firmwares.
> >
> > For those systems without the ACPI mechanism and developing solutions,
> > user can use/fall-back the generic WBRF solution for diagnosing potential
> > interference issues.
> >
> > And for the platform which does not equip with the necessary AMD ACPI
> > implementations but with CONFIG_WBRF_AMD_ACPI built as 'y', it will
> > fall back to generic WBRF solution if the `wbrf` is set as "on".
> >
> > Co-developed-by: Mario Limonciello <[email protected]>
> > Signed-off-by: Mario Limonciello <[email protected]>
> > Co-developed-by: Evan Quan <[email protected]>
> > Signed-off-by: Evan Quan <[email protected]>
>
> ...
>
> > diff --git a/drivers/acpi/amd_wbrf.c b/drivers/acpi/amd_wbrf.c
>
> ...
>
> > +static bool check_acpi_wbrf(acpi_handle handle, u64 rev, u64 funcs)
> > +{
> > + int i;
> > + u64 mask = 0;
> > + union acpi_object *obj;
> > +
> > + if (funcs == 0)
> > + return false;
> > +
> > + obj = acpi_evaluate_wbrf(handle, rev, 0);
> > + if (!obj)
> > + return false;
> > +
> > + if (obj->type != ACPI_TYPE_BUFFER)
> > + return false;
> > +
> > + /*
> > + * Bit vector providing supported functions information.
> > + * Each bit marks support for one specific function of the WBRF
> method.
> > + */
> > + for (i = 0; i < obj->buffer.length && i < 8; i++)
> > + mask |= (((u64)obj->buffer.pointer[i]) << (i * 8));
> > +
> > + ACPI_FREE(obj);
> > +
> > + if ((mask & BIT(WBRF_ENABLED)) &&
> > + (mask & funcs) == funcs)
>
> Hi Evan,
>
> a minor nit from my side: the indentation of the line above seems odd.
Thanks. Will update this.

Evan
>
> if ((mask & BIT(WBRF_ENABLED)) &&
> (mask & funcs) == funcs)
>
> > + return true;
> > +
> > + return false;
> > +}
>
> ...