diff mbox series

[v4,1/6] ACPI: CPPC: Add IS_OPTIONAL_CPC_REG macro

Message ID 20250113122104.3870673-2-zhenglifeng1@huawei.com (mailing list archive)
State Changes Requested, archived
Headers show
Series Support for autonomous selection in cppc_cpufreq | expand

Commit Message

Lifeng Zheng Jan. 13, 2025, 12:20 p.m. UTC
Add IS_OPTIONAL_CPC_REG macro to judge if a cpc_reg is an optional one.

Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
 drivers/acpi/cppc_acpi.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Rafael J. Wysocki Jan. 14, 2025, 1:27 p.m. UTC | #1
On Mon, Jan 13, 2025 at 1:21 PM Lifeng Zheng <zhenglifeng1@huawei.com> wrote:
>
> Add IS_OPTIONAL_CPC_REG macro to judge if a cpc_reg is an optional one.

This requires a bit more explanation, especially what's the purpose of
it (ie. the "why").

> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
> ---
>  drivers/acpi/cppc_acpi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index f193e713825a..6454b469338f 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -129,6 +129,12 @@ 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))
> +
> +/* These indicate optional of the per-cpu cpc_regs[]. */

Again, you need to say more here, like how this is supposed to work.

> +#define REG_OPTIONAL (0b111111100011111010000)

A hex literal would work too AFAICS.

> +
> +#define IS_OPTIONAL_CPC_REG(reg_idx) (REG_OPTIONAL & (1U << (reg_idx)))

You need to explain what reg_idx is.

> +
>  /*
>   * Arbitrary Retries in case the remote processor is slow to respond
>   * to PCC commands. Keeping it high enough to cover emulators where
> --
Lifeng Zheng Jan. 15, 2025, 7:52 a.m. UTC | #2
On 2025/1/14 21:27, Rafael J. Wysocki wrote:

> On Mon, Jan 13, 2025 at 1:21 PM Lifeng Zheng <zhenglifeng1@huawei.com> wrote:
>>
>> Add IS_OPTIONAL_CPC_REG macro to judge if a cpc_reg is an optional one.
> 
> This requires a bit more explanation, especially what's the purpose of
> it (ie. the "why").

Will add more explanation. Thanks.

> 
>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>> ---
>>  drivers/acpi/cppc_acpi.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
>> index f193e713825a..6454b469338f 100644
>> --- a/drivers/acpi/cppc_acpi.c
>> +++ b/drivers/acpi/cppc_acpi.c
>> @@ -129,6 +129,12 @@ 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))
>> +
>> +/* These indicate optional of the per-cpu cpc_regs[]. */
> 
> Again, you need to say more here, like how this is supposed to work.

Will add it. Thanks.

> 
>> +#define REG_OPTIONAL (0b111111100011111010000)
> 
> A hex literal would work too AFAICS.

Will change it. Thanks.

> 
>> +
>> +#define IS_OPTIONAL_CPC_REG(reg_idx) (REG_OPTIONAL & (1U << (reg_idx)))
> 
> You need to explain what reg_idx is.

Will add more annotations. Thanks.

> 
>> +
>>  /*
>>   * Arbitrary Retries in case the remote processor is slow to respond
>>   * to PCC commands. Keeping it high enough to cover emulators where
>> --
diff mbox series

Patch

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index f193e713825a..6454b469338f 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -129,6 +129,12 @@  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))
+
+/* These indicate optional of the per-cpu cpc_regs[]. */
+#define REG_OPTIONAL (0b111111100011111010000)
+
+#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