Message ID | 20250409065703.1461867-2-zhenglifeng1@huawei.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Add functions for getting and setting registers related to autonomous selection in cppc_acpi | expand |
On 4/9/2025 1:56 AM, Lifeng Zheng wrote: > In ACPI 6.5, s8.4.6.1 _CPC (Continuous Performance Control), whether each > of the per-cpu cpc_regs[] is mendatory or optional is defined. Since the mandatory > CPC_SUPPORTED() check is only for optional cpc field, another macro to > check if the field is optional is needed. > > Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> > Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com> > --- > drivers/acpi/cppc_acpi.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c > index f193e713825a..39f019e265da 100644 > --- a/drivers/acpi/cppc_acpi.c > +++ b/drivers/acpi/cppc_acpi.c > @@ -129,6 +129,20 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); > #define CPC_SUPPORTED(cpc) ((cpc)->type == ACPI_TYPE_INTEGER ? \ > !!(cpc)->cpc_entry.int_value : \ > !IS_NULL_REG(&(cpc)->cpc_entry.reg)) > + > +/* > + * Each bit indicates the optionality of the register in per-cpu > + * cpc_regs[] with the corresponding index. 0 means mandatory and 1 > + * means optional. > + */ > +#define REG_OPTIONAL (0x1FC7D0) > + > +/* > + * Use the index of the register in per-cpu cpc_regs[] to check if > + * it's an optional one. > + */ > +#define IS_OPTIONAL_CPC_REG(reg_idx) (REG_OPTIONAL & (1U << (reg_idx))) > + > /* > * Arbitrary Retries in case the remote processor is slow to respond > * to PCC commands. Keeping it high enough to cover emulators where
On 2025/4/10 2:53, Mario Limonciello wrote: > On 4/9/2025 1:56 AM, Lifeng Zheng wrote: >> In ACPI 6.5, s8.4.6.1 _CPC (Continuous Performance Control), whether each >> of the per-cpu cpc_regs[] is mendatory or optional is defined. Since the > mandatory Thanks! >> CPC_SUPPORTED() check is only for optional cpc field, another macro to >> check if the field is optional is needed. >> >> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com> >> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com> >> --- >> drivers/acpi/cppc_acpi.c | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c >> index f193e713825a..39f019e265da 100644 >> --- a/drivers/acpi/cppc_acpi.c >> +++ b/drivers/acpi/cppc_acpi.c >> @@ -129,6 +129,20 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); >> #define CPC_SUPPORTED(cpc) ((cpc)->type == ACPI_TYPE_INTEGER ? \ >> !!(cpc)->cpc_entry.int_value : \ >> !IS_NULL_REG(&(cpc)->cpc_entry.reg)) >> + >> +/* >> + * Each bit indicates the optionality of the register in per-cpu >> + * cpc_regs[] with the corresponding index. 0 means mandatory and 1 >> + * means optional. >> + */ >> +#define REG_OPTIONAL (0x1FC7D0) >> + >> +/* >> + * Use the index of the register in per-cpu cpc_regs[] to check if >> + * it's an optional one. >> + */ >> +#define IS_OPTIONAL_CPC_REG(reg_idx) (REG_OPTIONAL & (1U << (reg_idx))) >> + >> /* >> * Arbitrary Retries in case the remote processor is slow to respond >> * to PCC commands. Keeping it high enough to cover emulators where >
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index f193e713825a..39f019e265da 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -129,6 +129,20 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); #define CPC_SUPPORTED(cpc) ((cpc)->type == ACPI_TYPE_INTEGER ? \ !!(cpc)->cpc_entry.int_value : \ !IS_NULL_REG(&(cpc)->cpc_entry.reg)) + +/* + * Each bit indicates the optionality of the register in per-cpu + * cpc_regs[] with the corresponding index. 0 means mandatory and 1 + * means optional. + */ +#define REG_OPTIONAL (0x1FC7D0) + +/* + * Use the index of the register in per-cpu cpc_regs[] to check if + * it's an optional one. + */ +#define IS_OPTIONAL_CPC_REG(reg_idx) (REG_OPTIONAL & (1U << (reg_idx))) + /* * Arbitrary Retries in case the remote processor is slow to respond * to PCC commands. Keeping it high enough to cover emulators where