aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2009-11-19 06:31:01 -0500
committerDave Jones <davej@redhat.com>2009-11-24 13:33:34 -0500
commite2f74f355e9e2914483db10c05d70e69e0b7ae04 (patch)
treee17cae217151627c2c95aeeb2a43baf96d49ac91 /drivers/cpufreq
parentcf3289d0e701b2f59123bf653c12722a7e32aedb (diff)
[ACPI/CPUFREQ] Introduce bios_limit per cpu cpufreq sysfs interface
This interface is mainly intended (and implemented) for ACPI _PPC BIOS frequency limitations, but other cpufreq drivers can also use it for similar use-cases. Why is this needed: Currently it's not obvious why cpufreq got limited. People see cpufreq/scaling_max_freq reduced, but this could have happened by: - any userspace prog writing to scaling_max_freq - thermal limitations - hardware (_PPC in ACPI case) limitiations Therefore export bios_limit (in kHz) to: - Point the user that it's the BIOS (broken or intended) which limits frequency - Export it as a sysfs interface for userspace progs. While this was a rarely used feature on laptops, there will appear more and more server implemenations providing "Green IT" features like allowing the service processor to limit the frequency. People want to know about HW/BIOS frequency limitations. All ACPI P-state driven cpufreq drivers are covered with this patch: - powernow-k8 - powernow-k7 - acpi-cpufreq Tested with a patched DSDT which limits the first two cores (_PPC returns 1) via _PPC, exposed by bios_limit: # echo 2200000 >cpu2/cpufreq/scaling_max_freq # cat cpu*/cpufreq/scaling_max_freq 2600000 2600000 2200000 2200000 # #scaling_max_freq shows general user/thermal/BIOS limitations # cat cpu*/cpufreq/bios_limit 2600000 2600000 2800000 2800000 # #bios_limit only shows the HW/BIOS limitation CC: Pallipadi Venkatesh <venkatesh.pallipadi@intel.com> CC: Len Brown <lenb@kernel.org> CC: davej@codemonkey.org.uk CC: linux@dominikbrodowski.net Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5b9b1c8c4950..f20668c09ce0 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -647,6 +647,21 @@ static ssize_t show_scaling_setspeed(struct cpufreq_policy *policy, char *buf)
647 return policy->governor->show_setspeed(policy, buf); 647 return policy->governor->show_setspeed(policy, buf);
648} 648}
649 649
650/**
651 * show_scaling_driver - show the current cpufreq HW/BIOS limitation
652 */
653static ssize_t show_bios_limit(struct cpufreq_policy *policy, char *buf)
654{
655 unsigned int limit;
656 int ret;
657 if (cpufreq_driver->bios_limit) {
658 ret = cpufreq_driver->bios_limit(policy->cpu, &limit);
659 if (!ret)
660 return sprintf(buf, "%u\n", limit);
661 }
662 return sprintf(buf, "%u\n", policy->cpuinfo.max_freq);
663}
664
650#define define_one_ro(_name) \ 665#define define_one_ro(_name) \
651static struct freq_attr _name = \ 666static struct freq_attr _name = \
652__ATTR(_name, 0444, show_##_name, NULL) 667__ATTR(_name, 0444, show_##_name, NULL)
@@ -666,6 +681,7 @@ define_one_ro(cpuinfo_transition_latency);
666define_one_ro(scaling_available_governors); 681define_one_ro(scaling_available_governors);
667define_one_ro(scaling_driver); 682define_one_ro(scaling_driver);
668define_one_ro(scaling_cur_freq); 683define_one_ro(scaling_cur_freq);
684define_one_ro(bios_limit);
669define_one_ro(related_cpus); 685define_one_ro(related_cpus);
670define_one_ro(affected_cpus); 686define_one_ro(affected_cpus);
671define_one_rw(scaling_min_freq); 687define_one_rw(scaling_min_freq);
@@ -905,6 +921,11 @@ static int cpufreq_add_dev_interface(unsigned int cpu,
905 if (ret) 921 if (ret)
906 goto err_out_kobj_put; 922 goto err_out_kobj_put;
907 } 923 }
924 if (cpufreq_driver->bios_limit) {
925 ret = sysfs_create_file(&policy->kobj, &bios_limit.attr);
926 if (ret)
927 goto err_out_kobj_put;
928 }
908 929
909 spin_lock_irqsave(&cpufreq_driver_lock, flags); 930 spin_lock_irqsave(&cpufreq_driver_lock, flags);
910 for_each_cpu(j, policy->cpus) { 931 for_each_cpu(j, policy->cpus) {