Re: [PATCH 5/6] acpi/cppc: Add support for optional CPPC registers

From: Rafael J. Wysocki
Date: Fri Mar 29 2019 - 19:04:18 EST


On Friday, March 29, 2019 9:18:04 PM CET Ghannam, Yazen wrote:
> > -----Original Message-----
> > From: linux-acpi-owner@xxxxxxxxxxxxxxx <linux-acpi-owner@xxxxxxxxxxxxxxx> On Behalf Of Pandruvada, Srinivas
> > Sent: Wednesday, March 27, 2019 10:48 AM
> > To: linux-kernel@xxxxxxxxxxxxxxx; devel@xxxxxxxxxx; Natarajan, Janakarajan <Janakarajan.Natarajan@xxxxxxx>; linux-
> > acpi@xxxxxxxxxxxxxxx; linux-pm@xxxxxxxxxxxxxxx
> > Cc: Ghannam, Yazen <Yazen.Ghannam@xxxxxxx>; lenb@xxxxxxxxxx; viresh.kumar@xxxxxxxxxx; Moore, Robert
> > <robert.moore@xxxxxxxxx>; Schmauss, Erik <erik.schmauss@xxxxxxxxx>; rjw@xxxxxxxxxxxxx
> > Subject: Re: [PATCH 5/6] acpi/cppc: Add support for optional CPPC registers
> >
> > On Fri, 2019-03-22 at 20:26 +0000, Natarajan, Janakarajan wrote:
> > > From: Yazen Ghannam <Yazen.Ghannam@xxxxxxx>
> > >
> > > Newer AMD processors support a subset of the optional CPPC registers.
> > > Create show, store and helper routines for supported CPPC registers.
> > >
> > > Signed-off-by: Yazen Ghannam <Yazen.Ghannam@xxxxxxx>
> > > [ carved out into a patch, cleaned up, productized ]
> > > Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@xxxxxxx>
> > >
> >
> > [..]
> >
> > > + /* desired_perf is the only mandatory value in perf_ctrls */
> > > + if (cpc_read(cpu, desired_reg, &desired))
> > > + ret = -EFAULT;
> > > +
> > > + if (CPC_SUPPORTED(max_reg) && cpc_read(cpu, max_reg, &max))
> > > + ret = -EFAULT;
> > > +
> > We should create and use different macro other than CPPC_SUPPORTED.
> > CPC_SUPPORTED doesn't validate the correctness of object type for a
> > field. For example "Maximum Performance Register" can only be buffer
> > not integer. In this way invalid field definitions can be ignored.
> >
>
> So create something like "CPPC_SUPPORTED_BUFFER" for buffer-only registers?
>
> And then buffer/integer registers will continue to use "CPPC_SUPPORTED".
>
> These seem to be the only two cases at this time. Is this okay?

Yes, something like that.

Thanks,
Rafael