All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Limonciello, Mario" <mario.limonciello@amd.com>
To: Huang Rui <ray.huang@amd.com>, "Yuan, Perry" <Perry.Yuan@amd.com>
Cc: "rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
	"viresh.kumar@linaro.org" <viresh.kumar@linaro.org>,
	"Sharma, Deepak" <Deepak.Sharma@amd.com>,
	"Karny, Wyes" <Wyes.Karny@amd.com>,
	"Shenoy, Gautham Ranjal" <gautham.shenoy@amd.com>,
	"Li, Sun peng (Leo)" <Sunpeng.Li@amd.com>,
	"Huang, Shimmer" <Shimmer.Huang@amd.com>,
	"Du, Xiaojian" <Xiaojian.Du@amd.com>,
	"Meng, Li (Jassmine)" <Li.Meng@amd.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server
Date: Tue, 20 Jun 2023 09:56:18 -0500	[thread overview]
Message-ID: <45a43152-fdf1-5f1e-1a46-0d9798c4090b@amd.com> (raw)
In-Reply-To: <ZJG8w8le9AyRWKzO@amd.com>


On 6/20/2023 9:50 AM, Huang Rui wrote:
> On Thu, Jun 15, 2023 at 02:32:00PM +0800, Yuan, Perry wrote:
>> From: Mario Limonciello <mario.limonciello@amd.com>
>>
>> This symbol will be used by intel-pstate and amd-pstate for making
>> decisions based on what the FADT indicates the system pm profile is.
>>
>> Suggested-by: Gautham Ranjal Shenoy <gautham.shenoy@amd.com>
>> Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
>> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
>> ---
>>   drivers/acpi/cppc_acpi.c | 34 ++++++++++++++++++++++++++++++++++
>>   include/acpi/actbl.h     |  3 ++-
>>   include/acpi/processor.h | 10 ++++++++++
>>   3 files changed, 46 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
>> index 7ff269a78c20..d8827eae3ba4 100644
>> --- a/drivers/acpi/cppc_acpi.c
>> +++ b/drivers/acpi/cppc_acpi.c
>> @@ -941,6 +941,40 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)
>>   }
>>   EXPORT_SYMBOL_GPL(acpi_cppc_processor_exit);
>>   
>> +
>> +/**
>> + * acpi_pm_profile_server() - Check if the system is a server.
>> + *
>> + * Return: true for server profiles, false for anything else
>> + */
>> +bool acpi_pm_profile_server(void)
>> +{
>> +	switch (acpi_gbl_FADT.preferred_profile) {
>> +	case PM_ENTERPRISE_SERVER:
>> +	case PM_SOHO_SERVER:
>> +	case PM_PERFORMANCE_SERVER:
>> +		return true;
>> +	}
>> +	return false;
>> +}
>> +EXPORT_SYMBOL_GPL(acpi_pm_profile_server);
>> +
>> +/**
>> + * acpi_pm_profile_undefined() - Check if the system is an undefined pm profile.
>> + *
>> + * Return: true for undefined profiles, false for anything else
>> + */
>> +bool acpi_pm_profile_undefined(void)
>> +{
>> +	if (acpi_gbl_FADT.preferred_profile == PM_UNSPECIFIED)
>> +		return true;
>> +	if (acpi_gbl_FADT.preferred_profile >= NR_PM_PROFILES)
>> +		return true;
> May I know the acpi_gbl_FADT.preferred_profile value of powerful desktop
> such as threadripper or AM4/AM5 socket types of processors?

I have a Threadripper for my workstation, and it's:

[02Dh 0045   1]                   PM Profile : 01 [Desktop]

> I am thinking whether we can use this way to differentiate powerful desktop
> and mobile platforms.

On a Rembrandt laptop it's:

[02Dh 0045   1]                   PM Profile : 02 [Mobile]

Given Raphael's comments about intel-pstate preferring not to
match "SOHO server" as a server, I am planning to move these functions
into amd-pstate directly and drop patch 4.
> Thanks,
> Ray
>
>> +	return false;
>> +}
>> +EXPORT_SYMBOL_GPL(acpi_pm_profile_undefined);
>> +
>> +
>>   /**
>>    * cpc_read_ffh() - Read FFH register
>>    * @cpunum:	CPU number to read
>> diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
>> index e5dfb6f4de52..451f6276da49 100644
>> --- a/include/acpi/actbl.h
>> +++ b/include/acpi/actbl.h
>> @@ -307,7 +307,8 @@ enum acpi_preferred_pm_profiles {
>>   	PM_SOHO_SERVER = 5,
>>   	PM_APPLIANCE_PC = 6,
>>   	PM_PERFORMANCE_SERVER = 7,
>> -	PM_TABLET = 8
>> +	PM_TABLET = 8,
>> +	NR_PM_PROFILES = 9
>>   };
>>   
>>   /* Values for sleep_status and sleep_control registers (V5+ FADT) */
>> diff --git a/include/acpi/processor.h b/include/acpi/processor.h
>> index 94181fe9780a..05a45ebddaea 100644
>> --- a/include/acpi/processor.h
>> +++ b/include/acpi/processor.h
>> @@ -360,6 +360,8 @@ int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
>>   #ifdef CONFIG_ACPI_CPPC_LIB
>>   extern int acpi_cppc_processor_probe(struct acpi_processor *pr);
>>   extern void acpi_cppc_processor_exit(struct acpi_processor *pr);
>> +extern bool acpi_pm_profile_server(void);
>> +extern bool acpi_pm_profile_undefined(void);
>>   #else
>>   static inline int acpi_cppc_processor_probe(struct acpi_processor *pr)
>>   {
>> @@ -369,6 +371,14 @@ static inline void acpi_cppc_processor_exit(struct acpi_processor *pr)
>>   {
>>   	return;
>>   }
>> +static inline bool acpi_pm_profile_server(void)
>> +{
>> +	return false;
>> +}
>> +static inline bool acpi_pm_profile_undefined(void)
>> +{
>> +	return true;
>> +}
>>   #endif	/* CONFIG_ACPI_CPPC_LIB */
>>   
>>   /* in processor_pdc.c */
>> -- 
>> 2.34.1
>>

      reply	other threads:[~2023-06-20 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15  6:32 [PATCH v2 1/4] ACPI: CPPC: Add a symbol to check if the preferred profile is a server Perry Yuan
2023-06-20 14:50 ` Huang Rui
2023-06-20 14:56   ` Limonciello, Mario [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45a43152-fdf1-5f1e-1a46-0d9798c4090b@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Deepak.Sharma@amd.com \
    --cc=Li.Meng@amd.com \
    --cc=Perry.Yuan@amd.com \
    --cc=Shimmer.Huang@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=Wyes.Karny@amd.com \
    --cc=Xiaojian.Du@amd.com \
    --cc=gautham.shenoy@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=ray.huang@amd.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.