Re: [PATCH v3 08/21] cpufreq: amd: add acpi cppc function as the backend for legacy processors

From: Huang Rui
Date: Mon Nov 01 2021 - 05:03:14 EST


On Fri, Oct 29, 2021 at 10:20:09PM +0800, Limonciello, Mario wrote:
> On 10/29/2021 08:02, Huang Rui wrote:
> > In some old Zen based processors, they are using the shared memory that
> > exposed from ACPI SBIOS.
>
> I don't think this is only "old" processors. I think there are "new"
> processors that just don't happen to implement the MSR too.
>

Yes, I will correct the description.

> >
> > Signed-off-by: Jinzhou Su <Jinzhou.Su@xxxxxxx>
> > Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
> > ---
> > drivers/cpufreq/amd-pstate.c | 58 ++++++++++++++++++++++++++++++++----
> > 1 file changed, 53 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> > index 55ff03f85608..d399938d6d85 100644
> > --- a/drivers/cpufreq/amd-pstate.c
> > +++ b/drivers/cpufreq/amd-pstate.c
> > @@ -73,6 +73,19 @@ static inline int pstate_enable(bool enable)
> > return wrmsrl_safe(MSR_AMD_CPPC_ENABLE, enable ? 1 : 0);
> > }
> >
> > +static int cppc_enable(bool enable)
> > +{
> > + int cpu, ret = 0;
> > +
> > + for_each_online_cpu(cpu) {
>
> I wonder if this should also be changed to present CPU instead of
> offline CPU. Otherwise could this turn into a situation that the user
> starts with some CPU's offlined and enables them later but this doesn't
> end up applying to the CPUs that were started offlined and changed?
>

Yes, make sense. It is actually similiar with previous acpi_cpc_valid fix
patch. I will update it in V4.

Thanks,
Ray