[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6VvgSO8XNBbP4Xw@amd.com>
Date: Fri, 23 Dec 2022 17:06:09 +0800
From: Huang Rui <ray.huang@....com>
To: "Yuan, Perry" <Perry.Yuan@....com>
Cc: "rafael.j.wysocki@...el.com" <rafael.j.wysocki@...el.com>,
"Limonciello, Mario" <Mario.Limonciello@....com>,
"viresh.kumar@...aro.org" <viresh.kumar@...aro.org>,
"Sharma, Deepak" <Deepak.Sharma@....com>,
"Fontenot, Nathan" <Nathan.Fontenot@....com>,
"Deucher, Alexander" <Alexander.Deucher@....com>,
"Huang, Shimmer" <Shimmer.Huang@....com>,
"Du, Xiaojian" <Xiaojian.Du@....com>,
"Meng, Li (Jassmine)" <Li.Meng@....com>,
"Karny, Wyes" <Wyes.Karny@....com>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v8 01/13] ACPI: CPPC: Add AMD pstate energy performance
preference cppc control
On Fri, Dec 23, 2022 at 11:19:57AM +0800, Yuan, Perry wrote:
> [AMD Official Use Only - General]
>
>
>
> > -----Original Message-----
> > From: Huang, Ray <Ray.Huang@....com>
> > Sent: Friday, December 23, 2022 10:16 AM
> > To: Yuan, Perry <Perry.Yuan@....com>
> > Cc: rafael.j.wysocki@...el.com; Limonciello, Mario
> > <Mario.Limonciello@....com>; viresh.kumar@...aro.org; Sharma, Deepak
> > <Deepak.Sharma@....com>; Fontenot, Nathan
> > <Nathan.Fontenot@....com>; Deucher, Alexander
> > <Alexander.Deucher@....com>; Huang, Shimmer
> > <Shimmer.Huang@....com>; Du, Xiaojian <Xiaojian.Du@....com>; Meng,
> > Li (Jassmine) <Li.Meng@....com>; Karny, Wyes <Wyes.Karny@....com>;
> > linux-pm@...r.kernel.org; linux-kernel@...r.kernel.org
> > Subject: Re: [PATCH v8 01/13] ACPI: CPPC: Add AMD pstate energy
> > performance preference cppc control
> >
> > On Mon, Dec 19, 2022 at 02:40:30PM +0800, Yuan, Perry wrote:
> > > From: Perry Yuan <Perry.Yuan@....com>
> > >
> > > Add support for setting and querying EPP preferences to the generic
> > > CPPC driver. This enables downstream drivers such as amd-pstate to
> > > discover and use these values
> > >
> > > Downstream drivers that want to use the new symbols cppc_get_epp_caps
> > > and cppc_set_epp_perf for querying and setting EPP preferences will
> > > need to call cppc_set_epp_perf to enable the EPP function firstly.
> > >
> > > Signed-off-by: Perry Yuan <Perry.Yuan@....com>
> > > ---
> > > drivers/acpi/cppc_acpi.c | 76
> > > +++++++++++++++++++++++++++++++++++++---
> > > include/acpi/cppc_acpi.h | 12 +++++++
> > > 2 files changed, 83 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index
> > > 093675b1a1ff..81081eb899ea 100644
> > > --- a/drivers/acpi/cppc_acpi.c
> > > +++ b/drivers/acpi/cppc_acpi.c
> > > @@ -1093,6 +1093,9 @@ static int cppc_get_perf(int cpunum, enum
> > > cppc_regs reg_idx, u64 *perf) {
> > > struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum);
> > > struct cpc_register_resource *reg;
> > > + int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpunum);
> > > + struct cppc_pcc_data *pcc_ss_data = NULL;
> > > + int ret = -EINVAL;
> > >
> > > if (!cpc_desc) {
> > > pr_debug("No CPC descriptor for CPU:%d\n", cpunum); @@
> > -1102,10
> > > +1105,6 @@ static int cppc_get_perf(int cpunum, enum cppc_regs reg_idx,
> > u64 *perf)
> > > reg = &cpc_desc->cpc_regs[reg_idx];
> > >
> > > if (CPC_IN_PCC(reg)) {
> > > - int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpunum);
> > > - struct cppc_pcc_data *pcc_ss_data = NULL;
> > > - int ret = 0;
> > > -
> >
> > Do you have any specific reason to move this piece out of if-condition?
>
> Move the declaration ahead of the If conditions like other functions did.
> It looks more reasonable and no functions impact.
>
If one platform doesn't have any CPC registers, it even won't need define
these variables like pcc_ss_id, pcc_ss_data, and it will save more time.
Thanks,
Ray
Powered by blists - more mailing lists