diff mbox

[v6,2/7] ACPI: Make ACPI processor driver more extensible

Message ID CAJ5Y-eYwnaDzyL78CyJDmo35CFTNoQrYfEcO3VYnpaZkSVPdcw@mail.gmail.com
State New
Headers show

Commit Message

Ashwin Chaugule July 8, 2015, 8:05 p.m. UTC
On 8 July 2015 at 15:55, Rafael J. Wysocki <rafael@kernel.org> wrote:
> Hi Ashwin,
>
> On Wed, Jul 8, 2015 at 9:16 PM, Ashwin Chaugule
> <ashwin.chaugule@linaro.org> wrote:
>> Hi Rafael,
>>
>> On 8 July 2015 at 09:34, Rafael J. Wysocki <rafael@kernel.org> wrote:
>>> Hi Ashwin,
>>>
>>> On Wed, Jul 8, 2015 at 3:27 AM, Ashwin Chaugule
>>> <ashwin.chaugule@linaro.org> wrote:
>>>> On 7 July 2015 at 21:07, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>>>> On Monday, June 15, 2015 04:09:06 PM Ashwin Chaugule wrote:
>>>>>> The ACPI processor driver is currently tied too closely
>>>>>> to the ACPI C-states (CST), P-states (PSS) and other related
>>>>>> constructs for controlling CPU idle and CPU performance.
>>>>>>
>>>>>> The newer ACPI specification (v5.1 onwards) introduces
>>>>>> alternative methods to CST and PSS. These new mechanisms
>>>>>> are described within each ACPI Processor object and so they
>>>>>> need to be scanned whenever a new Processor object is detected.
>>>>>> This patch introduces two new Kconfig symbols to allow for
>>>>>> finer configurability among the various options for controlling
>>>>>> CPU idle and performance states. There is no change in functionality
>>>>>> and these options are defaulted to enabled to maintain previous
>>>>>> behaviour.
>>>>>>
>>>>>> The following patchwork introduces CPPC: A newer method of
>>>>>> controlling CPU performance. The OS is not expected to support CPPC
>>>>>> and PSS at runtime. So the kconfig option lets us make these two
>>>>>> mutually exclusive at compile time.
>>>>>>
>>>>>> Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
>>>>>> Reviewed-by: Al Stone <al.stone@linaro.org>
>>>>>> ---
>>>>>>  drivers/acpi/Kconfig            |  31 +++++++++--
>>>>>>  drivers/acpi/Makefile           |   7 ++-
>>>>>>  drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
>>>>>>  drivers/cpufreq/Kconfig         |   2 +-
>>>>>>  drivers/cpufreq/Kconfig.x86     |   2 +
>>>>>>  include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
>>>>>>  6 files changed, 176 insertions(+), 72 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>>>>>> index ab2cbb5..5942754 100644
>>>>>> --- a/drivers/acpi/Kconfig
>>>>>> +++ b/drivers/acpi/Kconfig
>>>>>> @@ -166,18 +166,39 @@ config ACPI_DOCK
>>>>>>         This driver supports ACPI-controlled docking stations and removable
>>>>>>         drive bays such as the IBM Ultrabay and the Dell Module Bay.
>>>>>>
>>>>>> -config ACPI_PROCESSOR
>>>>>> -     tristate "Processor"
>>>>>> -     select THERMAL
>>>>>> -     select CPU_IDLE
>>>>>> +config ACPI_CST
>>>>>> +     bool "ACPI C states (CST) driver"
>>>>>> +     depends on ACPI_PROCESSOR
>>>>>>       depends on X86 || IA64
>>>>>> +     select CPU_IDLE
>>>>>>       default y
>>>>>>       help
>>>>>>         This driver installs ACPI as the idle handler for Linux and uses
>>>>>>         ACPI C2 and C3 processor states to save power on systems that
>>>>>> -       support it.  It is required by several flavors of cpufreq
>>>>>> +       support it.
>>>>>> +
>>>>>> +config ACPI_PSS
>>>>>> +     bool "ACPI P States (PSS) driver"
>>>>>> +     depends on ACPI_PROCESSOR
>>>>>> +     depends on X86 || IA64
>>>>>> +     select THERMAL
>>>>>> +     default y
>>>>>> +     help
>>>>>> +       This driver implements ACPI methods for controlling CPU performance
>>>>>> +       using PSS methods as described in the ACPI spec. It also enables support
>>>>>> +       for ACPI based performance throttling (TSS) and ACPI based thermal
>>>>>> +       monitoring. It is required by several flavors of cpufreq
>>>>>>         performance-state drivers.
>>>>>
>>>>> For starters, I don't like these new Kconfig options.
>>>>>
>>>>> Isn't there a way to implement what you need without adding them?
>>>>
>>>> We need to use the ACPI Processor driver for CPPC without including
>>>> all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming
>>>> LPI work from Sudeep will also face the same issue. I considered the
>>>> alternative of adding a probe routine which matches
>>>> ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like
>>>> a better option. Do you have any other ideas?
>>>
>>> First of all, I don't see what _CST has to do with CPPC.
>>>
>>> Second, it looks like the problem is that x86 probably won't use CPPC,
>>> while arm64 probably won't use _PSS.
>>>
>>> That can be addressed by adding Kconfig options, but those options
>>> should not be user-selectable (because quite honestly users don't have
>>> to know what those things are and they don't care *and* things break
>>> if they make a wrong choice).  Instead, I'd make architecture Kconfigs
>>> select those options automatically.
>>>
>>
>> I've made changes locally. Basically s/ACPI_PSS/HAVE_ACPI_PSS/ and in
>> arch/x86/Kconfig; select HAVE_ACPI_PSS if ACPI. Similarly for CST.
>> Just wanted to check if there were any other comments before sending
>> out v7.
>
> Can you please just send the new version of the $subject patch alone for now?

Attached below. (hope that worked.)

>
> Also I'm still unsure what the connection between _CST and CPPC is.
>

There isnt. But I'm missing where I've implied the dependency?

Thanks,
Ashwin.

Comments

Ashwin Chaugule July 8, 2015, 8:28 p.m. UTC | #1
On 8 July 2015 at 16:05, Ashwin Chaugule <ashwin.chaugule@linaro.org> wrote:
> On 8 July 2015 at 15:55, Rafael J. Wysocki <rafael@kernel.org> wrote:
>> Hi Ashwin,
>>
>> On Wed, Jul 8, 2015 at 9:16 PM, Ashwin Chaugule
>> <ashwin.chaugule@linaro.org> wrote:
>>> Hi Rafael,
>>>
>>> On 8 July 2015 at 09:34, Rafael J. Wysocki <rafael@kernel.org> wrote:
>>>> Hi Ashwin,
>>>>
>>>> On Wed, Jul 8, 2015 at 3:27 AM, Ashwin Chaugule
>>>> <ashwin.chaugule@linaro.org> wrote:
>>>>> On 7 July 2015 at 21:07, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>>>>>> On Monday, June 15, 2015 04:09:06 PM Ashwin Chaugule wrote:
>>>>>>> The ACPI processor driver is currently tied too closely
>>>>>>> to the ACPI C-states (CST), P-states (PSS) and other related
>>>>>>> constructs for controlling CPU idle and CPU performance.
>>>>>>>
>>>>>>> The newer ACPI specification (v5.1 onwards) introduces
>>>>>>> alternative methods to CST and PSS. These new mechanisms
>>>>>>> are described within each ACPI Processor object and so they
>>>>>>> need to be scanned whenever a new Processor object is detected.
>>>>>>> This patch introduces two new Kconfig symbols to allow for
>>>>>>> finer configurability among the various options for controlling
>>>>>>> CPU idle and performance states. There is no change in functionality
>>>>>>> and these options are defaulted to enabled to maintain previous
>>>>>>> behaviour.
>>>>>>>
>>>>>>> The following patchwork introduces CPPC: A newer method of
>>>>>>> controlling CPU performance. The OS is not expected to support CPPC
>>>>>>> and PSS at runtime. So the kconfig option lets us make these two
>>>>>>> mutually exclusive at compile time.
>>>>>>>
>>>>>>> Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
>>>>>>> Reviewed-by: Al Stone <al.stone@linaro.org>
>>>>>>> ---
>>>>>>>  drivers/acpi/Kconfig            |  31 +++++++++--
>>>>>>>  drivers/acpi/Makefile           |   7 ++-
>>>>>>>  drivers/acpi/processor_driver.c |  86 ++++++++++++++++++----------
>>>>>>>  drivers/cpufreq/Kconfig         |   2 +-
>>>>>>>  drivers/cpufreq/Kconfig.x86     |   2 +
>>>>>>>  include/acpi/processor.h        | 120 ++++++++++++++++++++++++++++------------
>>>>>>>  6 files changed, 176 insertions(+), 72 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
>>>>>>> index ab2cbb5..5942754 100644
>>>>>>> --- a/drivers/acpi/Kconfig
>>>>>>> +++ b/drivers/acpi/Kconfig
>>>>>>> @@ -166,18 +166,39 @@ config ACPI_DOCK
>>>>>>>         This driver supports ACPI-controlled docking stations and removable
>>>>>>>         drive bays such as the IBM Ultrabay and the Dell Module Bay.
>>>>>>>
>>>>>>> -config ACPI_PROCESSOR
>>>>>>> -     tristate "Processor"
>>>>>>> -     select THERMAL
>>>>>>> -     select CPU_IDLE
>>>>>>> +config ACPI_CST
>>>>>>> +     bool "ACPI C states (CST) driver"
>>>>>>> +     depends on ACPI_PROCESSOR
>>>>>>>       depends on X86 || IA64
>>>>>>> +     select CPU_IDLE
>>>>>>>       default y
>>>>>>>       help
>>>>>>>         This driver installs ACPI as the idle handler for Linux and uses
>>>>>>>         ACPI C2 and C3 processor states to save power on systems that
>>>>>>> -       support it.  It is required by several flavors of cpufreq
>>>>>>> +       support it.
>>>>>>> +
>>>>>>> +config ACPI_PSS
>>>>>>> +     bool "ACPI P States (PSS) driver"
>>>>>>> +     depends on ACPI_PROCESSOR
>>>>>>> +     depends on X86 || IA64
>>>>>>> +     select THERMAL
>>>>>>> +     default y
>>>>>>> +     help
>>>>>>> +       This driver implements ACPI methods for controlling CPU performance
>>>>>>> +       using PSS methods as described in the ACPI spec. It also enables support
>>>>>>> +       for ACPI based performance throttling (TSS) and ACPI based thermal
>>>>>>> +       monitoring. It is required by several flavors of cpufreq
>>>>>>>         performance-state drivers.
>>>>>>
>>>>>> For starters, I don't like these new Kconfig options.
>>>>>>
>>>>>> Isn't there a way to implement what you need without adding them?
>>>>>
>>>>> We need to use the ACPI Processor driver for CPPC without including
>>>>> all its current dependencies. (i.e. PSS, TSS, CSS etc.). The upcoming
>>>>> LPI work from Sudeep will also face the same issue. I considered the
>>>>> alternative of adding a probe routine which matches
>>>>> ACPI_PROCESSOR_OBJECT/DEVICE_HID to each driver, but this seemed like
>>>>> a better option. Do you have any other ideas?
>>>>
>>>> First of all, I don't see what _CST has to do with CPPC.
>>>>
>>>> Second, it looks like the problem is that x86 probably won't use CPPC,
>>>> while arm64 probably won't use _PSS.
>>>>
>>>> That can be addressed by adding Kconfig options, but those options
>>>> should not be user-selectable (because quite honestly users don't have
>>>> to know what those things are and they don't care *and* things break
>>>> if they make a wrong choice).  Instead, I'd make architecture Kconfigs
>>>> select those options automatically.
>>>>
>>>
>>> I've made changes locally. Basically s/ACPI_PSS/HAVE_ACPI_PSS/ and in
>>> arch/x86/Kconfig; select HAVE_ACPI_PSS if ACPI. Similarly for CST.
>>> Just wanted to check if there were any other comments before sending
>>> out v7.
>>
>> Can you please just send the new version of the $subject patch alone for now?
>
> Attached below. (hope that worked.)
>
>>
>> Also I'm still unsure what the connection between _CST and CPPC is.
>>
>
> There isnt. But I'm missing where I've implied the dependency?

Perhaps the confusion is coming from the introduction of ACPI_CST in
this file. I could leave it as it is and just separate out the
ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST,
since we know the LPI stuff is coming up soon as a CST alternative
anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can
address that as part of his LPI patchset?

Thanks,
Ashwin.
Ashwin Chaugule July 8, 2015, 9:46 p.m. UTC | #2
On 8 July 2015 at 16:46, Rafael J. Wysocki <rafael@kernel.org> wrote:
> Hi Ashwin,

Hi,

> On Wed, Jul 8, 2015 at 10:28 PM, Ashwin Chaugule
> <ashwin.chaugule@linaro.org> wrote:
>> On 8 July 2015 at 16:05, Ashwin Chaugule <ashwin.chaugule@linaro.org> wrote:
>>> On 8 July 2015 at 15:55, Rafael J. Wysocki <rafael@kernel.org> wrote:
>>>> Hi Ashwin,
>>>>
>>>> On Wed, Jul 8, 2015 at 9:16 PM, Ashwin Chaugule
>>>> <ashwin.chaugule@linaro.org> wrote:
>>>>> Hi Rafael,
>>>>>
>
> [cut]
>
>>>>
>>>> Also I'm still unsure what the connection between _CST and CPPC is.
>>>>
>>>
>>> There isnt. But I'm missing where I've implied the dependency?
>>
>> Perhaps the confusion is coming from the introduction of ACPI_CST in
>> this file. I could leave it as it is and just separate out the
>> ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST,
>> since we know the LPI stuff is coming up soon as a CST alternative
>> anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can
>> address that as part of his LPI patchset?
>
> Yes, please.  That would be much less confusing.

Deja Vu. :)

When I let processor_driver and processor_idle compile on ARM64, I get
a bunch of errors because processor_idle.c contains a lot of X86
specific defines. That is why I'd created the ACPI_CST option which
we'd enable only on X86.

I'm not entirely sure what these enums and functions should default
to, or what they should be on ARM specifically. Given that on ARM64
we're likely to use LPI as against CST, it seems the original approach
is better. Thoughts?

------8<------

rivers/acpi/processor_idle.c: In function ‘disabled_by_idle_boot_param’:
drivers/acpi/processor_idle.c:73:9: error: ‘boot_option_idle_override’
undeclared (first use in this function)
  return boot_option_idle_override == IDLE_POLL ||
         ^
drivers/acpi/processor_idle.c:73:9: note: each undeclared identifier
is reported only once for each function it appears in
drivers/acpi/processor_idle.c:73:38: error: ‘IDLE_POLL’ undeclared
(first use in this function)
  return boot_option_idle_override == IDLE_POLL ||
                                      ^
drivers/acpi/processor_idle.c:74:32: error: ‘IDLE_HALT’ undeclared
(first use in this function)
   boot_option_idle_override == IDLE_HALT;
                                ^
drivers/acpi/processor_idle.c: In function ‘acpi_safe_halt’:
drivers/acpi/processor_idle.c:121:3: error: implicit declaration of
function ‘arch_safe_halt’ [-Werror=implicit-function-declaration]
   safe_halt();
   ^
drivers/acpi/processor_idle.c: In function ‘acpi_processor_get_power_info_cst’:
drivers/acpi/processor_idle.c:435:9: error:
‘boot_option_idle_override’ undeclared (first use in this function)
        (boot_option_idle_override == IDLE_NOMWAIT)) {
         ^
drivers/acpi/processor_idle.c:435:38: error: ‘IDLE_NOMWAIT’ undeclared
(first use in this function)
        (boot_option_idle_override == IDLE_NOMWAIT)) {
                                      ^
drivers/acpi/processor_idle.c: In function ‘acpi_idle_enter_bm’:
drivers/acpi/processor_idle.c:749:2: error: implicit declaration of
function ‘acpi_unlazy_tlb’ [-Werror=implicit-function-declaration]
  acpi_unlazy_tlb(smp_processor_id());
  ^
drivers/acpi/processor_idle.c: In function ‘acpi_processor_power_init’:
drivers/acpi/processor_idle.c:1072:3: error: implicit declaration of
function ‘acpi_processor_cstate_check’
[-Werror=implicit-function-declaration]
   max_cstate = acpi_processor_cstate_check(max_cstate);
   ^
drivers/acpi/processor_idle.c: In function ‘disabled_by_idle_boot_param’:
drivers/acpi/processor_idle.c:75:1: warning: control reaches end of
non-void function [-Wreturn-type]
 }
 ^
------8<------

Regards,
Ashwin.
Ashwin Chaugule July 8, 2015, 9:57 p.m. UTC | #3
On 8 July 2015 at 18:21, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Wednesday, July 08, 2015 05:46:45 PM Ashwin Chaugule wrote:
>> On 8 July 2015 at 16:46, Rafael J. Wysocki <rafael@kernel.org> wrote:
>> >>
>> >> Perhaps the confusion is coming from the introduction of ACPI_CST in
>> >> this file. I could leave it as it is and just separate out the
>> >> ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST,
>> >> since we know the LPI stuff is coming up soon as a CST alternative
>> >> anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can
>> >> address that as part of his LPI patchset?
>> >
>> > Yes, please.  That would be much less confusing.
>>
>> Deja Vu. :)
>>
>> When I let processor_driver and processor_idle compile on ARM64, I get
>> a bunch of errors because processor_idle.c contains a lot of X86
>> specific defines. That is why I'd created the ACPI_CST option which
>> we'd enable only on X86.
>>
>> I'm not entirely sure what these enums and functions should default
>> to, or what they should be on ARM specifically. Given that on ARM64
>> we're likely to use LPI as against CST, it seems the original approach
>> is better. Thoughts?
>
> Before we go anywhere deeper, have you checked what happens on ia64?

I dont have access, but I'm really not changing anything functionally.

Thanks,
Ashwin.
Ashwin Chaugule July 9, 2015, 12:25 p.m. UTC | #4
Hi Sudeep,


On 9 July 2015 at 05:06, Sudeep Holla <sudeep.holla@arm.com> wrote:
> Hi,
>
> On 08/07/15 21:28, Ashwin Chaugule wrote:
>>
>> On 8 July 2015 at 16:05, Ashwin Chaugule <ashwin.chaugule@linaro.org>
>> wrote:
>>>
>>> On 8 July 2015 at 15:55, Rafael J. Wysocki <rafael@kernel.org> wrote:
>> Perhaps the confusion is coming from the introduction of ACPI_CST in
>> this file. I could leave it as it is and just separate out the
>> ACPI_PSS bits. But I figured, while I'm at it, I'd introduce ACPI_CST,
>> since we know the LPI stuff is coming up soon as a CST alternative
>> anyway. So if you prefer, I can drop the CST bits and maybe Sudeep can
>> address that as part of his LPI patchset?
>>
>
> Correct, I will handle it as a prerequisite for introducing _LPI
> support. I had posted an RFC long back, will revive those patches and
> repost them soon.
>
> It's better to enable ACPI_PROCESSOR on ARM64 only after we have all
> these dependencies resolved. Until then we need to carry some patches
> locally for testing.

With Rafaels latest suggestion of adding ACPI_PROCESSOR_IDLE, we dont
need to wait until all dependencies are resolved to enable
acpi_processor on ARM64. CPPC patchwork has been up for review for
quite a long time and has been validated on hardware. There is no
reason for it to be blocked until LPI is upstream ready.

Regards,
Ashwin.
diff mbox

Patch

From cd48987a681d6f6fcbdfe4da4a7b456abf5daa05 Mon Sep 17 00:00:00 2001
From: Ashwin Chaugule <ashwin.chaugule@linaro.org>
Date: Fri, 22 May 2015 14:55:30 -0400
Subject: [PATCH 2/7] ACPI: Make ACPI processor driver more extensible

The ACPI processor driver is currently tied too closely
to the ACPI C-states (CST), P-states (PSS) and other related
constructs for controlling CPU idle and CPU performance.

The newer ACPI specification (v5.1 onwards) introduces
alternative methods to CST and PSS. These new mechanisms
are described within each ACPI Processor object and so they
need to be scanned whenever a new Processor object is detected.
This patch introduces two new Kconfig symbols to allow for
finer configurability among the various options for controlling
CPU idle and performance states. There is no change in functionality
and the options are auto-selected by the architecture Kconfig files.

The following patchwork introduces CPPC: A newer method of
controlling CPU performance. The OS is not expected to support CPPC
and PSS at runtime. So the kconfig options lets us make these two
mutually exclusive at compile time.

Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
---
 arch/x86/Kconfig                |   2 +
 drivers/acpi/Kconfig            |  31 ++++++++--
 drivers/acpi/Makefile           |   7 ++-
 drivers/acpi/processor_driver.c |  86 +++++++++++++++++++---------
 drivers/cpufreq/Kconfig         |   2 +-
 drivers/cpufreq/Kconfig.x86     |   2 +
 include/acpi/processor.h        | 122 +++++++++++++++++++++++++++++-----------
 7 files changed, 180 insertions(+), 72 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 226d569..a6a0740 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -143,6 +143,8 @@  config X86
 	select ACPI_LEGACY_TABLES_LOOKUP if ACPI
 	select X86_FEATURE_NAMES if PROC_FS
 	select SRCU
+	select HAVE_ACPI_CST if ACPI
+	select HAVE_ACPI_PSS if ACPI
 
 config INSTRUCTION_DECODER
 	def_bool y
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index ab2cbb5..7ebb673 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -166,18 +166,37 @@  config ACPI_DOCK
 	  This driver supports ACPI-controlled docking stations and removable
 	  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_PROCESSOR
-	tristate "Processor"
-	select THERMAL
-	select CPU_IDLE
+config HAVE_ACPI_CST
+	bool
+	depends on ACPI_PROCESSOR
 	depends on X86 || IA64
-	default y
+	select CPU_IDLE
 	help
 	  This driver installs ACPI as the idle handler for Linux and uses
 	  ACPI C2 and C3 processor states to save power on systems that
-	  support it.  It is required by several flavors of cpufreq
+	  support it.
+
+config HAVE_ACPI_PSS
+	bool
+	depends on ACPI_PROCESSOR
+	depends on X86 || IA64
+	select THERMAL
+	help
+	  This driver implements ACPI methods for controlling CPU performance
+	  using PSS methods as described in the ACPI spec. It also enables support
+	  for ACPI based performance throttling (TSS) and ACPI based thermal
+	  monitoring. It is required by several flavors of cpufreq
 	  performance-state drivers.
 
+config ACPI_PROCESSOR
+	tristate "Processor"
+	depends on X86 || IA64
+	default y
+	help
+	  This driver adds support for the ACPI Processor package. It is required
+	  by several flavors of cpufreq performance-state, thermal, throttling and
+	  idle drivers.
+
 	  To compile this driver as a module, choose M here:
 	  the module will be called processor.
 
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index 8a063e2..3726725 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -82,9 +82,10 @@  obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
 
 # processor has its own "processor." module_param namespace
-processor-y			:= processor_driver.o processor_throttling.o
-processor-y			+= processor_idle.o processor_thermal.o
-processor-$(CONFIG_CPU_FREQ)	+= processor_perflib.o
+processor-y			:= processor_driver.o
+processor-$(CONFIG_HAVE_ACPI_CST)	+= processor_idle.o
+processor-$(CONFIG_HAVE_ACPI_PSS)	+= processor_perflib.o	\
+	processor_throttling.o processor_thermal.o
 
 obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o
 
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index d9f7158..817fec5 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -163,34 +163,24 @@  static struct notifier_block __refdata acpi_cpu_notifier = {
 	    .notifier_call = acpi_cpu_soft_notify,
 };
 
-static int __acpi_processor_start(struct acpi_device *device)
+#ifdef CONFIG_HAVE_ACPI_PSS
+static int acpi_pss_perf_init(struct acpi_processor *pr,
+		struct acpi_device *device)
 {
-	struct acpi_processor *pr = acpi_driver_data(device);
-	acpi_status status;
 	int result = 0;
 
-	if (!pr)
-		return -ENODEV;
-
-	if (pr->flags.need_hotplug_init)
-		return 0;
-
-#ifdef CONFIG_CPU_FREQ
 	acpi_processor_ppc_has_changed(pr, 0);
-#endif
+
 	acpi_processor_get_throttling_info(pr);
 
 	if (pr->flags.throttling)
 		pr->flags.limit = 1;
 
-	if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
-		acpi_processor_power_init(pr);
-
 	pr->cdev = thermal_cooling_device_register("Processor", device,
 						   &processor_cooling_ops);
 	if (IS_ERR(pr->cdev)) {
 		result = PTR_ERR(pr->cdev);
-		goto err_power_exit;
+		return result;
 	}
 
 	dev_dbg(&device->dev, "registered as cooling_device%d\n",
@@ -204,6 +194,7 @@  static int __acpi_processor_start(struct acpi_device *device)
 			"Failed to create sysfs link 'thermal_cooling'\n");
 		goto err_thermal_unregister;
 	}
+
 	result = sysfs_create_link(&pr->cdev->device.kobj,
 				   &device->dev.kobj,
 				   "device");
@@ -213,17 +204,61 @@  static int __acpi_processor_start(struct acpi_device *device)
 		goto err_remove_sysfs_thermal;
 	}
 
-	status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
-					     acpi_processor_notify, device);
-	if (ACPI_SUCCESS(status))
-		return 0;
-
 	sysfs_remove_link(&pr->cdev->device.kobj, "device");
  err_remove_sysfs_thermal:
 	sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
  err_thermal_unregister:
 	thermal_cooling_device_unregister(pr->cdev);
- err_power_exit:
+
+	return result;
+}
+
+static void acpi_pss_perf_exit(struct acpi_processor *pr,
+		struct acpi_device *device)
+{
+	if (pr->cdev) {
+		sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
+		sysfs_remove_link(&pr->cdev->device.kobj, "device");
+		thermal_cooling_device_unregister(pr->cdev);
+		pr->cdev = NULL;
+	}
+}
+#else
+static inline int acpi_pss_perf_init(struct acpi_processor *pr,
+		struct acpi_device *device)
+{
+	return 0;
+}
+
+static inline void acpi_pss_perf_exit(struct acpi_processor *pr,
+		struct acpi_device *device) {}
+#endif /* CONFIG_HAVE_ACPI_PSS */
+
+static int __acpi_processor_start(struct acpi_device *device)
+{
+	struct acpi_processor *pr = acpi_driver_data(device);
+	acpi_status status;
+	int result = 0;
+
+	if (!pr)
+		return -ENODEV;
+
+	if (pr->flags.need_hotplug_init)
+		return 0;
+
+	if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
+		acpi_processor_power_init(pr);
+
+	result = acpi_pss_perf_init(pr, device);
+	if (result)
+		goto err_power_exit;
+
+	status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
+					     acpi_processor_notify, device);
+	if (ACPI_SUCCESS(status))
+		return 0;
+
+err_power_exit:
 	acpi_processor_power_exit(pr);
 	return result;
 }
@@ -252,15 +287,10 @@  static int acpi_processor_stop(struct device *dev)
 	pr = acpi_driver_data(device);
 	if (!pr)
 		return 0;
-
 	acpi_processor_power_exit(pr);
 
-	if (pr->cdev) {
-		sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
-		sysfs_remove_link(&pr->cdev->device.kobj, "device");
-		thermal_cooling_device_unregister(pr->cdev);
-		pr->cdev = NULL;
-	}
+	acpi_pss_perf_exit(pr, device);
+
 	return 0;
 }
 
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index 659879a..d07944c 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -223,7 +223,7 @@  endif
 if IA64
 config IA64_ACPI_CPUFREQ
 	tristate "ACPI Processor P-States driver"
-	depends on ACPI_PROCESSOR
+	depends on ACPI_PROCESSOR && HAVE_ACPI_PSS && HAVE_ACPI_CST
 	help
 	This driver adds a CPUFreq driver which utilizes the ACPI
 	Processor Performance States.
diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index c59bdcb..76dd454 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -18,6 +18,7 @@  config X86_INTEL_PSTATE
 config X86_PCC_CPUFREQ
 	tristate "Processor Clocking Control interface driver"
 	depends on ACPI && ACPI_PROCESSOR
+	depends on HAVE_ACPI_PSS && HAVE_ACPI_CST
 	help
 	  This driver adds support for the PCC interface.
 
@@ -32,6 +33,7 @@  config X86_PCC_CPUFREQ
 config X86_ACPI_CPUFREQ
 	tristate "ACPI Processor P-States driver"
 	depends on ACPI_PROCESSOR
+	depends on HAVE_ACPI_PSS && HAVE_ACPI_CST
 	help
 	  This driver adds a CPUFreq driver which utilizes the ACPI
 	  Processor Performance States.
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 4188a4d..71ecf65 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -222,16 +222,6 @@  struct acpi_processor_errata {
 	} piix4;
 };
 
-extern int acpi_processor_preregister_performance(struct
-						  acpi_processor_performance
-						  __percpu *performance);
-
-extern int acpi_processor_register_performance(struct acpi_processor_performance
-					       *performance, unsigned int cpu);
-extern void acpi_processor_unregister_performance(struct
-						  acpi_processor_performance
-						  *performance,
-						  unsigned int cpu);
 
 /* note: this locks both the calling module and the processor module
          if a _PPC object exists, rmmod is disallowed then */
@@ -267,28 +257,52 @@  static inline int acpi_processor_ffh_cstate_probe(unsigned int cpu,
 	return -1;
 }
 static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
-						   *cstate)
-{
-	return;
-}
+						   *cstate) {}
 #endif
 
 /* in processor_perflib.c */
 
-#ifdef CONFIG_CPU_FREQ
+#ifdef CONFIG_HAVE_ACPI_PSS
+extern int acpi_processor_preregister_performance(struct
+						  acpi_processor_performance
+						  __percpu *performance);
+
+extern int acpi_processor_register_performance(struct acpi_processor_performance
+					       *performance, unsigned int cpu);
+extern void acpi_processor_unregister_performance(struct
+						  acpi_processor_performance
+						  *performance,
+						  unsigned int cpu);
 void acpi_processor_ppc_init(void);
 void acpi_processor_ppc_exit(void);
 int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag);
 extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit);
 #else
-static inline void acpi_processor_ppc_init(void)
+static inline int acpi_processor_preregister_performance(struct
+		acpi_processor_performance
+		__percpu *performance)
 {
-	return;
+	return -ENODEV;
+
 }
-static inline void acpi_processor_ppc_exit(void)
+
+static inline int acpi_processor_register_performance(struct
+		acpi_processor_performance
+		*performance, unsigned int cpu)
 {
-	return;
+	return -ENODEV;
+
 }
+
+static inline void acpi_processor_unregister_performance(struct
+		acpi_processor_performance
+		*performance,
+		unsigned int cpu) {}
+
+static inline void acpi_processor_ppc_init(void) {}
+
+static inline void acpi_processor_ppc_exit(void) {}
+
 static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr,
 								int event_flag)
 {
@@ -302,12 +316,12 @@  static inline int acpi_processor_ppc_has_changed(struct acpi_processor *pr,
 	}
 	return 0;
 }
+
 static inline int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
 {
 	return -ENODEV;
 }
-
-#endif				/* CONFIG_CPU_FREQ */
+#endif				/* CONFIG_HAVE_ACPI_PSS */
 
 /* in processor_core.c */
 phys_cpuid_t acpi_get_phys_id(acpi_handle, int type, u32 acpi_id);
@@ -318,6 +332,7 @@  int acpi_get_cpuid(acpi_handle, int type, u32 acpi_id);
 void acpi_processor_set_pdc(acpi_handle handle);
 
 /* in processor_throttling.c */
+#ifdef CONFIG_HAVE_ACPI_PSS
 int acpi_processor_tstate_has_changed(struct acpi_processor *pr);
 int acpi_processor_get_throttling_info(struct acpi_processor *pr);
 extern int acpi_processor_set_throttling(struct acpi_processor *pr,
@@ -330,36 +345,75 @@  extern void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
 			unsigned long action);
 extern const struct file_operations acpi_processor_throttling_fops;
 extern void acpi_processor_throttling_init(void);
+#else
+static inline int acpi_processor_tstate_has_changed(struct acpi_processor *pr)
+{
+	return 0;
+}
+
+static inline int acpi_processor_get_throttling_info(struct acpi_processor *pr)
+{
+	return -ENODEV;
+}
+
+static inline int acpi_processor_set_throttling(struct acpi_processor *pr,
+					 int state, bool force)
+{
+	return -ENODEV;
+}
+
+static inline void acpi_processor_reevaluate_tstate(struct acpi_processor *pr,
+			unsigned long action) {}
+
+static inline void acpi_processor_throttling_init(void) {}
+#endif	/* CONFIG_HAVE_ACPI_PSS */
+
 /* in processor_idle.c */
+extern struct cpuidle_driver acpi_idle_driver;
+#ifdef CONFIG_HAVE_ACPI_CST
 int acpi_processor_power_init(struct acpi_processor *pr);
 int acpi_processor_power_exit(struct acpi_processor *pr);
 int acpi_processor_cst_has_changed(struct acpi_processor *pr);
 int acpi_processor_hotplug(struct acpi_processor *pr);
-extern struct cpuidle_driver acpi_idle_driver;
+#else
+static inline int acpi_processor_power_init(struct acpi_processor *pr)
+{
+	return -ENODEV;
+}
+
+static inline int acpi_processor_power_exit(struct acpi_processor *pr)
+{
+	return -ENODEV;
+}
+
+static inline int acpi_processor_cst_has_changed(struct acpi_processor *pr)
+{
+	return -ENODEV;
+}
 
-#ifdef CONFIG_PM_SLEEP
+static inline int acpi_processor_hotplug(struct acpi_processor *pr)
+{
+	return -ENODEV;
+}
+#endif	/* CONFIG_HAVE_ACPI_CST */
+
+#if defined(CONFIG_HAVE_ACPI_CST) & defined(CONFIG_PM_SLEEP)
 void acpi_processor_syscore_init(void);
 void acpi_processor_syscore_exit(void);
 #else
 static inline void acpi_processor_syscore_init(void) {}
 static inline void acpi_processor_syscore_exit(void) {}
-#endif
+#endif /* CONFIG_HAVE_ACPI_CST */
 
 /* in processor_thermal.c */
 int acpi_processor_get_limit_info(struct acpi_processor *pr);
+#ifdef CONFIG_HAVE_ACPI_PSS
 extern const struct thermal_cooling_device_ops processor_cooling_ops;
-#ifdef CONFIG_CPU_FREQ
 void acpi_thermal_cpufreq_init(void);
 void acpi_thermal_cpufreq_exit(void);
 #else
-static inline void acpi_thermal_cpufreq_init(void)
-{
-	return;
-}
-static inline void acpi_thermal_cpufreq_exit(void)
-{
-	return;
-}
-#endif
+static inline void acpi_thermal_cpufreq_init(void) {}
+static inline void acpi_thermal_cpufreq_exit(void) {}
+#endif	/* CONFIG_HAVE_ACPI_PSS */
 
 #endif
-- 
1.9.1