All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
@ 2022-06-27 16:58 Mario Limonciello
  2022-06-27 17:26 ` Yuan, Perry
  2022-06-29 18:41 ` Rafael J. Wysocki
  0 siblings, 2 replies; 6+ messages in thread
From: Mario Limonciello @ 2022-06-27 16:58 UTC (permalink / raw)
  To: mario.limonciello, Rafael J. Wysocki, Len Brown, Pierre Gondois,
	Sudeep Holla
  Cc: Perry Yuan, linux-acpi, linux-kernel

commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and
when CPPC_LIB is supported") added support for claiming to
support CPPC in _OSC on non-Intel platforms.

This unfortunately caused a regression on a vartiety of AMD
platforms in the field because a number of AMD platforms don't set
the `_OSC` bit 5 or 6 to indicate CPPC or CPPC v2 support.

As these AMD platforms already claim CPPC support via `X86_FEATURE_CPPC`,
use this enable this feature rather than requiring the `_OSC`.

Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is supported")
Reported-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/acpi/cppc_acpi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 903528f7e187..5463e6309b9a 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -629,6 +629,15 @@ static bool is_cppc_supported(int revision, int num_ent)
 		return false;
 	}
 
+	if (osc_sb_cppc_not_supported) {
+		pr_debug("Firmware missing _OSC support\n");
+#ifdef CONFIG_X86
+		return boot_cpu_has(X86_FEATURE_CPPC);
+#else
+		return false;
+#endif
+	}
+
 	return true;
 }
 
@@ -684,9 +693,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
 	acpi_status status;
 	int ret = -ENODATA;
 
-	if (osc_sb_cppc_not_supported)
-		return -ENODEV;
-
 	/* Parse the ACPI _CPC table for this CPU. */
 	status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
 			ACPI_TYPE_PACKAGE);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
  2022-06-27 16:58 [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported Mario Limonciello
@ 2022-06-27 17:26 ` Yuan, Perry
  2022-06-29 18:41 ` Rafael J. Wysocki
  1 sibling, 0 replies; 6+ messages in thread
From: Yuan, Perry @ 2022-06-27 17:26 UTC (permalink / raw)
  To: Limonciello, Mario, Rafael J. Wysocki, Len Brown, Pierre Gondois,
	Sudeep Holla
  Cc: linux-acpi, linux-kernel

[AMD Official Use Only - General]

Hi Rafael:

> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@amd.com>
> Sent: Tuesday, June 28, 2022 12:59 AM
> To: Limonciello, Mario <Mario.Limonciello@amd.com>; Rafael J. Wysocki
> <rafael@kernel.org>; Len Brown <lenb@kernel.org>; Pierre Gondois
> <pierre.gondois@arm.com>; Sudeep Holla <sudeep.holla@arm.com>
> Cc: Yuan, Perry <Perry.Yuan@amd.com>; linux-acpi@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is
> supported
> 
> commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and when
> CPPC_LIB is supported") added support for claiming to support CPPC in _OSC
> on non-Intel platforms.
> 
> This unfortunately caused a regression on a vartiety of AMD platforms in the
> field because a number of AMD platforms don't set the `_OSC` bit 5 or 6 to
> indicate CPPC or CPPC v2 support.
> 
> As these AMD platforms already claim CPPC support via
> `X86_FEATURE_CPPC`, use this enable this feature rather than requiring the
> `_OSC`.
> 
> Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is
> supported")
> Reported-by: Perry Yuan <perry.yuan@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/acpi/cppc_acpi.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index
> 903528f7e187..5463e6309b9a 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -629,6 +629,15 @@ static bool is_cppc_supported(int revision, int
> num_ent)
>  		return false;
>  	}
> 
> +	if (osc_sb_cppc_not_supported) {
> +		pr_debug("Firmware missing _OSC support\n"); #ifdef
> CONFIG_X86
> +		return boot_cpu_has(X86_FEATURE_CPPC); #else
> +		return false;
> +#endif
> +	}
> +
>  	return true;
>  }
> 

I align with Mario to use his patch to fix the amd pstate driver loading failure issue.
AMD CPUID include the cppc flag to mark the CPPC valid  if the _OSC dose not have the CPPC support info added.

Tested-by: Perry Yuan <perry.yuan@amd.com>


> @@ -684,9 +693,6 @@ int acpi_cppc_processor_probe(struct
> acpi_processor *pr)
>  	acpi_status status;
>  	int ret = -ENODATA;
> 
> -	if (osc_sb_cppc_not_supported)
> -		return -ENODEV;
> -
>  	/* Parse the ACPI _CPC table for this CPU. */
>  	status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
>  			ACPI_TYPE_PACKAGE);
> --
> 2.34.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
  2022-06-27 16:58 [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported Mario Limonciello
  2022-06-27 17:26 ` Yuan, Perry
@ 2022-06-29 18:41 ` Rafael J. Wysocki
  2022-06-29 18:48   ` Limonciello, Mario
  1 sibling, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-06-29 18:41 UTC (permalink / raw)
  To: Mario Limonciello
  Cc: Rafael J. Wysocki, Len Brown, Pierre Gondois, Sudeep Holla,
	Perry Yuan, ACPI Devel Maling List, Linux Kernel Mailing List

On Mon, Jun 27, 2022 at 6:58 PM Mario Limonciello
<mario.limonciello@amd.com> wrote:
>
> commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and
> when CPPC_LIB is supported") added support for claiming to
> support CPPC in _OSC on non-Intel platforms.
>
> This unfortunately caused a regression on a vartiety of AMD
> platforms in the field because a number of AMD platforms don't set
> the `_OSC` bit 5 or 6 to indicate CPPC or CPPC v2 support.
>
> As these AMD platforms already claim CPPC support via `X86_FEATURE_CPPC`,
> use this enable this feature rather than requiring the `_OSC`.
>
> Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is supported")
> Reported-by: Perry Yuan <perry.yuan@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>  drivers/acpi/cppc_acpi.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 903528f7e187..5463e6309b9a 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -629,6 +629,15 @@ static bool is_cppc_supported(int revision, int num_ent)
>                 return false;
>         }
>
> +       if (osc_sb_cppc_not_supported) {
> +               pr_debug("Firmware missing _OSC support\n");
> +#ifdef CONFIG_X86
> +               return boot_cpu_has(X86_FEATURE_CPPC);
> +#else
> +               return false;
> +#endif

What about doing

if (osc_sb_cppc_not_supported) {
        pr_debug("Firmware missing _OSC support\n");
        return IS_ENABLED(CONFIG_X86) && boot_cpu_has(X86_FEATURE_CPPC);
}

instead for the sake of reducing #ifdeffery?

Also, this is somewhat risky, because even if the given processor has
X86_FEATURE_CPPC set, the platform may still not want to expose CPPC
through ACPI.  How's that going to work after this change?


> +       }
> +
>         return true;
>  }
>
> @@ -684,9 +693,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
>         acpi_status status;
>         int ret = -ENODATA;
>
> -       if (osc_sb_cppc_not_supported)
> -               return -ENODEV;
> -
>         /* Parse the ACPI _CPC table for this CPU. */
>         status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
>                         ACPI_TYPE_PACKAGE);
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
  2022-06-29 18:41 ` Rafael J. Wysocki
@ 2022-06-29 18:48   ` Limonciello, Mario
  2022-06-29 19:09     ` Rafael J. Wysocki
  0 siblings, 1 reply; 6+ messages in thread
From: Limonciello, Mario @ 2022-06-29 18:48 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Pierre Gondois, Sudeep Holla, Yuan, Perry,
	ACPI Devel Maling List, Linux Kernel Mailing List

[Public]



> -----Original Message-----
> From: Rafael J. Wysocki <rafael@kernel.org>
> Sent: Wednesday, June 29, 2022 13:42
> To: Limonciello, Mario <Mario.Limonciello@amd.com>
> Cc: Rafael J. Wysocki <rafael@kernel.org>; Len Brown <lenb@kernel.org>;
> Pierre Gondois <pierre.gondois@arm.com>; Sudeep Holla
> <sudeep.holla@arm.com>; Yuan, Perry <Perry.Yuan@amd.com>; ACPI Devel
> Maling List <linux-acpi@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is
> supported
> 
> On Mon, Jun 27, 2022 at 6:58 PM Mario Limonciello
> <mario.limonciello@amd.com> wrote:
> >
> > commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and
> > when CPPC_LIB is supported") added support for claiming to
> > support CPPC in _OSC on non-Intel platforms.
> >
> > This unfortunately caused a regression on a vartiety of AMD
> > platforms in the field because a number of AMD platforms don't set
> > the `_OSC` bit 5 or 6 to indicate CPPC or CPPC v2 support.
> >
> > As these AMD platforms already claim CPPC support via `X86_FEATURE_CPPC`,
> > use this enable this feature rather than requiring the `_OSC`.
> >
> > Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is
> supported")
> > Reported-by: Perry Yuan <perry.yuan@amd.com>
> > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> > ---
> >  drivers/acpi/cppc_acpi.c | 12 +++++++++---
> >  1 file changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> > index 903528f7e187..5463e6309b9a 100644
> > --- a/drivers/acpi/cppc_acpi.c
> > +++ b/drivers/acpi/cppc_acpi.c
> > @@ -629,6 +629,15 @@ static bool is_cppc_supported(int revision, int
> num_ent)
> >                 return false;
> >         }
> >
> > +       if (osc_sb_cppc_not_supported) {
> > +               pr_debug("Firmware missing _OSC support\n");
> > +#ifdef CONFIG_X86
> > +               return boot_cpu_has(X86_FEATURE_CPPC);
> > +#else
> > +               return false;
> > +#endif
> 
> What about doing
> 
> if (osc_sb_cppc_not_supported) {
>         pr_debug("Firmware missing _OSC support\n");
>         return IS_ENABLED(CONFIG_X86) && boot_cpu_has(X86_FEATURE_CPPC);
> }
> 
> instead for the sake of reducing #ifdeffery?

I don't think that would compile on non-X86.  X86_FEATURE_CPPC comes as part of
arch/x86/include/asm/cpufeatures.h, which I wouldn't expect is included on !x86.

> 
> Also, this is somewhat risky, because even if the given processor has
> X86_FEATURE_CPPC set, the platform may still not want to expose CPPC
> through ACPI.  How's that going to work after this change?
> 

Well actually doing that through _OSC wouldn't have worked before 72f2ecb7ece7 either.
If desirable - a platform could avoid populating _CPC objects in ACPI tables in this case.

I do know of OEM platforms that the underlying APU supports CPPC but the OEM doesn't
populate _CPC.  Presumably for this exact reason.

> 
> > +       }
> > +
> >         return true;
> >  }
> >
> > @@ -684,9 +693,6 @@ int acpi_cppc_processor_probe(struct acpi_processor
> *pr)
> >         acpi_status status;
> >         int ret = -ENODATA;
> >
> > -       if (osc_sb_cppc_not_supported)
> > -               return -ENODEV;
> > -
> >         /* Parse the ACPI _CPC table for this CPU. */
> >         status = acpi_evaluate_object_typed(handle, "_CPC", NULL, &output,
> >                         ACPI_TYPE_PACKAGE);
> > --
> > 2.34.1
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
  2022-06-29 18:48   ` Limonciello, Mario
@ 2022-06-29 19:09     ` Rafael J. Wysocki
  2022-06-29 19:38       ` Limonciello, Mario
  0 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2022-06-29 19:09 UTC (permalink / raw)
  To: Limonciello, Mario
  Cc: Rafael J. Wysocki, Len Brown, Pierre Gondois, Sudeep Holla, Yuan,
	Perry, ACPI Devel Maling List, Linux Kernel Mailing List

On Wed, Jun 29, 2022 at 8:49 PM Limonciello, Mario
<Mario.Limonciello@amd.com> wrote:
>
> [Public]
>
>
>
> > -----Original Message-----
> > From: Rafael J. Wysocki <rafael@kernel.org>
> > Sent: Wednesday, June 29, 2022 13:42
> > To: Limonciello, Mario <Mario.Limonciello@amd.com>
> > Cc: Rafael J. Wysocki <rafael@kernel.org>; Len Brown <lenb@kernel.org>;
> > Pierre Gondois <pierre.gondois@arm.com>; Sudeep Holla
> > <sudeep.holla@arm.com>; Yuan, Perry <Perry.Yuan@amd.com>; ACPI Devel
> > Maling List <linux-acpi@vger.kernel.org>; Linux Kernel Mailing List <linux-
> > kernel@vger.kernel.org>
> > Subject: Re: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is
> > supported
> >
> > On Mon, Jun 27, 2022 at 6:58 PM Mario Limonciello
> > <mario.limonciello@amd.com> wrote:
> > >
> > > commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and
> > > when CPPC_LIB is supported") added support for claiming to
> > > support CPPC in _OSC on non-Intel platforms.
> > >
> > > This unfortunately caused a regression on a vartiety of AMD
> > > platforms in the field because a number of AMD platforms don't set
> > > the `_OSC` bit 5 or 6 to indicate CPPC or CPPC v2 support.
> > >
> > > As these AMD platforms already claim CPPC support via `X86_FEATURE_CPPC`,
> > > use this enable this feature rather than requiring the `_OSC`.
> > >
> > > Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is
> > supported")
> > > Reported-by: Perry Yuan <perry.yuan@amd.com>
> > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> > > ---
> > >  drivers/acpi/cppc_acpi.c | 12 +++++++++---
> > >  1 file changed, 9 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> > > index 903528f7e187..5463e6309b9a 100644
> > > --- a/drivers/acpi/cppc_acpi.c
> > > +++ b/drivers/acpi/cppc_acpi.c
> > > @@ -629,6 +629,15 @@ static bool is_cppc_supported(int revision, int
> > num_ent)
> > >                 return false;
> > >         }
> > >
> > > +       if (osc_sb_cppc_not_supported) {
> > > +               pr_debug("Firmware missing _OSC support\n");
> > > +#ifdef CONFIG_X86
> > > +               return boot_cpu_has(X86_FEATURE_CPPC);
> > > +#else
> > > +               return false;
> > > +#endif
> >
> > What about doing
> >
> > if (osc_sb_cppc_not_supported) {
> >         pr_debug("Firmware missing _OSC support\n");
> >         return IS_ENABLED(CONFIG_X86) && boot_cpu_has(X86_FEATURE_CPPC);
> > }
> >
> > instead for the sake of reducing #ifdeffery?
>
> I don't think that would compile on non-X86.  X86_FEATURE_CPPC comes as part of
> arch/x86/include/asm/cpufeatures.h, which I wouldn't expect is included on !x86.

Good point.

Something like this would still look better though IMO:

if (!osc_sb_cppc_not_supported)
        return true;

#ifdef CONFIG_X86
        return boot_cpu_has(X86_FEATURE_CPPC);
#else
        return false;
#endif
}


>
> >
> > Also, this is somewhat risky, because even if the given processor has
> > X86_FEATURE_CPPC set, the platform may still not want to expose CPPC
> > through ACPI.  How's that going to work after this change?
> >
>
> Well actually doing that through _OSC wouldn't have worked before 72f2ecb7ece7 either.
> If desirable - a platform could avoid populating _CPC objects in ACPI tables in this case.
>
> I do know of OEM platforms that the underlying APU supports CPPC but the OEM doesn't
> populate _CPC.  Presumably for this exact reason.

That is an option, but there is no requirement that _CPC must not be
populated when CPPC is not supported.

_OSC is the proper mechanism for negotiating CPPC support.

Still, if you know for a fact that on AMD systems X86_FEATURE_CPPC
always means that CPPC is supported, I can live with an extra vendor
check in the code above.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported
  2022-06-29 19:09     ` Rafael J. Wysocki
@ 2022-06-29 19:38       ` Limonciello, Mario
  0 siblings, 0 replies; 6+ messages in thread
From: Limonciello, Mario @ 2022-06-29 19:38 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Pierre Gondois, Sudeep Holla, Yuan, Perry,
	ACPI Devel Maling List, Linux Kernel Mailing List

[AMD Official Use Only - General]



> -----Original Message-----
> From: Rafael J. Wysocki <rafael@kernel.org>
> Sent: Wednesday, June 29, 2022 14:09
> To: Limonciello, Mario <Mario.Limonciello@amd.com>
> Cc: Rafael J. Wysocki <rafael@kernel.org>; Len Brown <lenb@kernel.org>;
> Pierre Gondois <pierre.gondois@arm.com>; Sudeep Holla
> <sudeep.holla@arm.com>; Yuan, Perry <Perry.Yuan@amd.com>; ACPI Devel
> Maling List <linux-acpi@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is
> supported
> 
> On Wed, Jun 29, 2022 at 8:49 PM Limonciello, Mario
> <Mario.Limonciello@amd.com> wrote:
> >
> > [Public]
> >
> >
> >
> > > -----Original Message-----
> > > From: Rafael J. Wysocki <rafael@kernel.org>
> > > Sent: Wednesday, June 29, 2022 13:42
> > > To: Limonciello, Mario <Mario.Limonciello@amd.com>
> > > Cc: Rafael J. Wysocki <rafael@kernel.org>; Len Brown <lenb@kernel.org>;
> > > Pierre Gondois <pierre.gondois@arm.com>; Sudeep Holla
> > > <sudeep.holla@arm.com>; Yuan, Perry <Perry.Yuan@amd.com>; ACPI Devel
> > > Maling List <linux-acpi@vger.kernel.org>; Linux Kernel Mailing List <linux-
> > > kernel@vger.kernel.org>
> > > Subject: Re: [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC
> is
> > > supported
> > >
> > > On Mon, Jun 27, 2022 at 6:58 PM Mario Limonciello
> > > <mario.limonciello@amd.com> wrote:
> > > >
> > > > commit 72f2ecb7ece7 ("ACPI: bus: Set CPPC _OSC bits for all and
> > > > when CPPC_LIB is supported") added support for claiming to
> > > > support CPPC in _OSC on non-Intel platforms.
> > > >
> > > > This unfortunately caused a regression on a vartiety of AMD
> > > > platforms in the field because a number of AMD platforms don't set
> > > > the `_OSC` bit 5 or 6 to indicate CPPC or CPPC v2 support.
> > > >
> > > > As these AMD platforms already claim CPPC support via
> `X86_FEATURE_CPPC`,
> > > > use this enable this feature rather than requiring the `_OSC`.
> > > >
> > > > Fixes: 72f2ecb7ece7 ("Set CPPC _OSC bits for all and when CPPC_LIB is
> > > supported")
> > > > Reported-by: Perry Yuan <perry.yuan@amd.com>
> > > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> > > > ---
> > > >  drivers/acpi/cppc_acpi.c | 12 +++++++++---
> > > >  1 file changed, 9 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> > > > index 903528f7e187..5463e6309b9a 100644
> > > > --- a/drivers/acpi/cppc_acpi.c
> > > > +++ b/drivers/acpi/cppc_acpi.c
> > > > @@ -629,6 +629,15 @@ static bool is_cppc_supported(int revision, int
> > > num_ent)
> > > >                 return false;
> > > >         }
> > > >
> > > > +       if (osc_sb_cppc_not_supported) {
> > > > +               pr_debug("Firmware missing _OSC support\n");
> > > > +#ifdef CONFIG_X86
> > > > +               return boot_cpu_has(X86_FEATURE_CPPC);
> > > > +#else
> > > > +               return false;
> > > > +#endif
> > >
> > > What about doing
> > >
> > > if (osc_sb_cppc_not_supported) {
> > >         pr_debug("Firmware missing _OSC support\n");
> > >         return IS_ENABLED(CONFIG_X86) &&
> boot_cpu_has(X86_FEATURE_CPPC);
> > > }
> > >
> > > instead for the sake of reducing #ifdeffery?
> >
> > I don't think that would compile on non-X86.  X86_FEATURE_CPPC comes as
> part of
> > arch/x86/include/asm/cpufeatures.h, which I wouldn't expect is included on
> !x86.
> 
> Good point.
> 
> Something like this would still look better though IMO:
> 
> if (!osc_sb_cppc_not_supported)
>         return true;
> 
> #ifdef CONFIG_X86
>         return boot_cpu_has(X86_FEATURE_CPPC);
> #else
>         return false;
> #endif
> }
> 

Thanks, I'll respin it with something similar to that.

> 
> >
> > >
> > > Also, this is somewhat risky, because even if the given processor has
> > > X86_FEATURE_CPPC set, the platform may still not want to expose CPPC
> > > through ACPI.  How's that going to work after this change?
> > >
> >
> > Well actually doing that through _OSC wouldn't have worked before
> 72f2ecb7ece7 either.
> > If desirable - a platform could avoid populating _CPC objects in ACPI tables in
> this case.
> >
> > I do know of OEM platforms that the underlying APU supports CPPC but the
> OEM doesn't
> > populate _CPC.  Presumably for this exact reason.
> 
> That is an option, but there is no requirement that _CPC must not be
> populated when CPPC is not supported.
> 
> _OSC is the proper mechanism for negotiating CPPC support.
> 

Right; I agree this should have been the proper mechanism.  I'll talk to
our internal BIOS team to double check reference BIOS is populated
with this correctly for programs going forward too.

> Still, if you know for a fact that on AMD systems X86_FEATURE_CPPC
> always means that CPPC is supported, I can live with an extra vendor
> check in the code above.

Thanks.  The definition of that CPUID 8000_0008 EBX bit 27 used
to populate X86_FEATURE_CPPC indicates whether the CPU/APU
supports the dedicated MSR.  There are also technically designs that can
work in shared memory mode that I think the only way to "safely" discover
will be via the _OSC.  If this same regression from 72f2ecb7ece7 crops up
on those we might need to look at changing the amd-pstate module parameter
override that enables it for shared memory into a general kernel command line
override for users to use.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-29 19:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 16:58 [PATCH] ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported Mario Limonciello
2022-06-27 17:26 ` Yuan, Perry
2022-06-29 18:41 ` Rafael J. Wysocki
2022-06-29 18:48   ` Limonciello, Mario
2022-06-29 19:09     ` Rafael J. Wysocki
2022-06-29 19:38       ` Limonciello, Mario

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.