All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Brandewie <dirk.brandewie@gmail.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Adrian Huang <adrian.huang@hp.com>
Cc: viresh.kumar@linaro.org, linux-pm@vger.kernel.org,
	linda.knippers@hp.com, adrianhuang0701@gmail.com
Subject: Re: [PATCH v3] cpufreq: intel_pstate: skip the driver if ACPI has power mgmt option
Date: Thu, 31 Oct 2013 15:23:24 -0700	[thread overview]
Message-ID: <5272D85C.3030306@gmail.com> (raw)
In-Reply-To: <2937960.e8vxuRXoUT@vostro.rjw.lan>

On 10/31/2013 03:29 PM, Rafael J. Wysocki wrote:
> On Thursday, October 31, 2013 11:24:05 PM Adrian Huang wrote:
>> Do not load the Intel pstate driver if the platform firmware
>> (ACPI BIOS) supports the power management alternatives.
>> The ACPI BIOS indicates that the OS control mode can be used
>> if the _PSS (Performance Supported States) is defined in ACPI
>> table. For the OS control mode, the Intel pstate driver will be
>> loaded.
>>
>> Signed-off-by: Adrian Huang <adrian.huang@hp.com>
>
> Do I assume correctly that this has been tested on the affected hardware?
>
> Dirk, any objections?

As long as you are comfortable with the ACPI related logic for matching
the entry in the hw_vendor_info vendor_info[] I have no objections.

One question though can this be disabled via the HP BIOS if the
customer does not want to use the firmware power management?

--Dirk
>
>> ---
>> Changes from v2:
>>   - Remove unnecessary assignments and parentheses (Thanks to Rafael)
>>
>> Changes from v1:
>>   - Minimize indentation levels (Thanks to Rafael)
>>   - Re-define some local variables (Thanks to by Rafael)
>>   - Return -ENODEV if platform FW has power management modes (Thanks to by Dirk)
>>
>>   drivers/cpufreq/intel_pstate.c | 70 ++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 70 insertions(+)
>>
>> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
>> index eb3fdc7..9ec1d6c 100644
>> --- a/drivers/cpufreq/intel_pstate.c
>> +++ b/drivers/cpufreq/intel_pstate.c
>> @@ -26,6 +26,8 @@
>>   #include <linux/fs.h>
>>   #include <linux/debugfs.h>
>>   #include <trace/events/power.h>
>> +#include <linux/acpi.h>
>> +#include <acpi/processor.h>
>>
>>   #include <asm/div64.h>
>>   #include <asm/msr.h>
>> @@ -129,6 +131,18 @@ static struct perf_limits limits = {
>>   	.max_sysfs_pct = 100,
>>   };
>>
>> +struct hw_vendor_info {
>> +	u16  valid;
>> +	char oem_id[ACPI_OEM_ID_SIZE];
>> +	char oem_table_id[ACPI_OEM_TABLE_ID_SIZE];
>> +};
>> +
>> +/* Hardware vendor-specific info that has its own power management modes */
>> +static struct hw_vendor_info vendor_info[] = {
>> +	{1, "HP    ", "ProLiant"},
>> +	{0, "", ""},
>> +};
>> +
>>   static inline void pid_reset(struct _pid *pid, int setpoint, int busy,
>>   			int deadband, int integral) {
>>   	pid->setpoint = setpoint;
>> @@ -698,6 +712,55 @@ static int intel_pstate_msrs_not_valid(void)
>>
>>   	return 0;
>>   }
>> +
>> +static bool intel_pstate_no_acpi_pss(void)
>> +{
>> +	int i;
>> +
>> +	for_each_possible_cpu(i) {
>> +		acpi_status status;
>> +		union acpi_object *pss;
>> +		struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
>> +		struct acpi_processor *pr = per_cpu(processors, i);
>> +
>> +		if (!pr)
>> +			continue;
>> +
>> +		status = acpi_evaluate_object(pr->handle, "_PSS",
>> +					      NULL, &buffer);
>> +		if (ACPI_FAILURE(status))
>> +			continue;
>> +
>> +		pss = buffer.pointer;
>> +		if (pss && pss->type == ACPI_TYPE_PACKAGE) {
>> +			kfree(pss);
>> +			return false;
>> +		}
>> +
>> +		kfree(pss);
>> +	}
>> +
>> +	return true;
>> +}
>> +
>> +static bool intel_pstate_platform_pwr_mgmt_exists(void)
>> +{
>> +	struct acpi_table_header hdr;
>> +	struct hw_vendor_info *v_info;
>> +
>> +	if (ACPI_FAILURE(acpi_get_table_header(ACPI_SIG_FADT, 0, &hdr)))
>> +		return false;
>> +
>> +	for (v_info = vendor_info; v_info->valid; v_info++) {
>> +		if (!strncmp(hdr.oem_id, v_info->oem_id, ACPI_OEM_ID_SIZE)
>> +		    && !strncmp(hdr.oem_table_id, v_info->oem_table_id, ACPI_OEM_TABLE_ID_SIZE)
>> +		    && intel_pstate_no_acpi_pss())
>> +			return true;
>> +	}
>> +
>> +	return false;
>> +}
>> +
>>   static int __init intel_pstate_init(void)
>>   {
>>   	int cpu, rc = 0;
>> @@ -706,6 +769,13 @@ static int __init intel_pstate_init(void)
>>   	if (no_load)
>>   		return -ENODEV;
>>
>> +	/*
>> +	 * The Intel pstate driver will be ignored if the platform
>> +	 * firmware has its own power management modes.
>> +	 */
>> +	if (!acpi_disabled && intel_pstate_platform_pwr_mgmt_exists())
>> +		return -ENODEV;
>> +
>>   	id = x86_match_cpu(intel_pstate_cpu_ids);
>>   	if (!id)
>>   		return -ENODEV;
>>


  reply	other threads:[~2013-10-31 22:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-31 15:24 [PATCH v3] cpufreq: intel_pstate: skip the driver if ACPI has power mgmt option Adrian Huang
2013-10-31 22:29 ` Rafael J. Wysocki
2013-10-31 22:23   ` Dirk Brandewie [this message]
2013-10-31 22:47     ` Rafael J. Wysocki
2013-10-31 22:37       ` Dirk Brandewie
2013-11-01  1:53       ` Adrian Huang
     [not found]       ` <CAHKZfL2_ahVjaPCiMa14uHFNuwOKnPhAUr-Vn3QcqDHod_f8vg@mail.gmail.com>
2013-11-02 12:58         ` Rafael J. Wysocki
2013-11-06  6:25           ` Linda Knippers

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=5272D85C.3030306@gmail.com \
    --to=dirk.brandewie@gmail.com \
    --cc=adrian.huang@hp.com \
    --cc=adrianhuang0701@gmail.com \
    --cc=linda.knippers@hp.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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.