From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Andre Przywara <andre.przywara@amd.com>
Cc: cpufreq@vger.kernel.org, Matthew Garrett <mjg@redhat.com>,
Andreas Herrmann <andreas.herrmann3@amd.com>,
Thomas Renninger <trenn@suse.de>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] acpi-cpufreq: Add compatibility for legacy AMD cpb sysfs knob
Date: Sun, 5 Aug 2012 23:29:36 +0200 [thread overview]
Message-ID: <201208052329.36556.rjw@sisk.pl> (raw)
In-Reply-To: <1343305724-2809-7-git-send-email-andre.przywara@amd.com>
On Thursday, July 26, 2012, Andre Przywara wrote:
> The powernow-k8 driver supported a sysfs knob called "cpb", which was
> instantiated per CPU, but actually acted globally for the whole
> system. To keep some compatibility with this feature, we re-introduce
> this behavior here, but:
> a) only enable it on AMD CPUs and
> b) protect it with a Kconfig switch
>
> I'd like to consider this feature obsolete. Lets keep it around for
> some kernel versions and then phase it out.
You're not keeing it, but moving it to a different driver. :-)
Why don't we ask the users who really really want it to use powernow-k8
instead?
Rafael
> Signed-off-by: Andre Przywara <andre.przywara@amd.com>
> ---
> drivers/cpufreq/Kconfig.x86 | 12 ++++++++++
> drivers/cpufreq/acpi-cpufreq.c | 46 ++++++++++++++++++++++++++++++++++++++-
> 2 files changed, 56 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
> index 78ff7ee..d2f2320 100644
> --- a/drivers/cpufreq/Kconfig.x86
> +++ b/drivers/cpufreq/Kconfig.x86
> @@ -32,6 +32,18 @@ config X86_ACPI_CPUFREQ
>
> If in doubt, say N.
>
> +config X86_ACPI_CPUFREQ_CPB
> + default y
> + bool "Legacy cpb sysfs knob support for AMD CPUs"
> + depends on X86_ACPI_CPUFREQ && CPU_SUP_AMD
> + help
> + The powernow-k8 driver used to provide a sysfs knob called "cpb"
> + to disable the Core Performance Boosting feature of AMD CPUs. This
> + file has now been superseeded by the more generic "boost" entry.
> +
> + By enabling this option the acpi_cpufreq driver provides the old
> + entry in addition to the new boost ones, for compatibility reasons.
> +
> config ELAN_CPUFREQ
> tristate "AMD Elan SC400 and SC410"
> select CPU_FREQ_TABLE
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index ca41aaa..1ba4cac 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -131,8 +131,7 @@ static void boost_set_msrs(bool enable, const struct cpumask *cpumask)
> wrmsr_on_cpus(cpumask, msr_addr, msrs);
> }
>
> -static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr,
> - const char *buf, size_t count)
> +static ssize_t _store_boost(const char *buf, size_t count)
> {
> int ret;
> unsigned long val = 0;
> @@ -159,6 +158,12 @@ static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr,
> return count;
> }
>
> +static ssize_t store_global_boost(struct kobject *kobj, struct attribute *attr,
> + const char *buf, size_t count)
> +{
> + return _store_boost(buf, count);
> +}
> +
> static ssize_t show_global_boost(struct kobject *kobj,
> struct attribute *attr, char *buf)
> {
> @@ -169,6 +174,21 @@ static struct global_attr global_boost = __ATTR(boost, 0644,
> show_global_boost,
> store_global_boost);
>
> +#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
> +static ssize_t store_cpb(struct cpufreq_policy *policy, const char *buf,
> + size_t count)
> +{
> + return _store_boost(buf, count);
> +}
> +
> +static ssize_t show_cpb(struct cpufreq_policy *policy, char *buf)
> +{
> + return sprintf(buf, "%u\n", boost_enabled);
> +}
> +
> +static struct freq_attr cpb = __ATTR(cpb, 0644, show_cpb, store_cpb);
> +#endif
> +
> static int check_est_cpu(unsigned int cpuid)
> {
> struct cpuinfo_x86 *cpu = &cpu_data(cpuid);
> @@ -887,6 +907,7 @@ static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
>
> static struct freq_attr *acpi_cpufreq_attr[] = {
> &cpufreq_freq_attr_scaling_available_freqs,
> + NULL, /* this is a placeholder for cpb, do not remove */
> NULL,
> };
>
> @@ -958,6 +979,27 @@ static int __init acpi_cpufreq_init(void)
> if (ret)
> return ret;
>
> +#ifdef CONFIG_X86_ACPI_CPUFREQ_CPB
> + /* this is a sysfs file with a strange name and an even stranger
> + * semantic - per CPU instantiation, but system global effect.
> + * Lets enable it only on AMD CPUs for compatibility reasons and
> + * only if configured. This is considered legacy code, which
> + * will probably be removed at some point in the future.
> + */
> + if (check_amd_hwpstate_cpu(0)) {
> + struct freq_attr **iter;
> +
> + pr_debug("adding sysfs entry for cpb\n");
> +
> + for (iter = acpi_cpufreq_attr; *iter != NULL; iter++)
> + ;
> +
> + /* make sure there is a terminator behind it */
> + if (iter[1] == NULL)
> + *iter = &cpb;
> + }
> +#endif
> +
> ret = cpufreq_register_driver(&acpi_cpufreq_driver);
> if (ret)
> free_acpi_perf_data();
>
next prev parent reply other threads:[~2012-08-05 21:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 12:28 [PATCH 0/8] acpi-cpufreq: Move modern AMD cpufreq support to acpi-cpufreq Andre Przywara
2012-07-26 12:28 ` [PATCH 1/8] acpi-cpufreq: Add support for modern AMD CPUs Andre Przywara
2012-07-26 12:28 ` [PATCH 2/8] acpi-cpufreq: Add quirk to disable _PSD usage on all " Andre Przywara
2012-07-26 12:28 ` [PATCH 3/8] cpufreq: Add compatibility hack to powernow-k8 Andre Przywara
2012-08-22 0:48 ` Thomas Renninger
2012-07-26 12:28 ` [PATCH 4/8] ACPI: Add fixups for AMD P-state figures Andre Przywara
2012-07-26 12:28 ` [PATCH 5/8] acpi-cpufreq: Add support for disabling dynamic overclocking Andre Przywara
2012-08-05 21:26 ` Rafael J. Wysocki
2012-07-26 12:28 ` [PATCH 6/8] acpi-cpufreq: Add compatibility for legacy AMD cpb sysfs knob Andre Przywara
2012-08-05 21:29 ` Rafael J. Wysocki [this message]
2012-07-26 12:28 ` [PATCH 7/8] cpufreq: Remove support for hardware P-state chips from powernow-k8 Andre Przywara
2012-08-05 21:33 ` Rafael J. Wysocki
2012-08-20 13:00 ` Andre Przywara
2012-08-20 20:49 ` Rafael J. Wysocki
2012-08-22 1:00 ` Thomas Renninger
2012-08-22 13:39 ` Andre Przywara
2012-08-22 14:34 ` Thomas Renninger
2012-07-26 12:28 ` [PATCH 8/8] Documentation: Add documentation for boost control switch Andre Przywara
2012-08-05 21:34 ` Rafael J. Wysocki
2012-07-26 14:01 ` [PATCH 0/8] acpi-cpufreq: Move modern AMD cpufreq support to acpi-cpufreq Thomas Renninger
2012-07-26 19:58 ` Rafael J. Wysocki
2012-08-05 21:20 ` Rafael J. Wysocki
2012-08-05 23:39 ` H. Peter Anvin
2012-08-06 8:20 ` Borislav Petkov
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=201208052329.36556.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=andre.przywara@amd.com \
--cc=andreas.herrmann3@amd.com \
--cc=cpufreq@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mjg@redhat.com \
--cc=trenn@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox