From patchwork Fri Nov 29 14:14:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 21895 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0337A23FC4 for ; Fri, 29 Nov 2013 14:14:25 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id id10sf21502989vcb.4 for ; Fri, 29 Nov 2013 06:14:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=HiWgTvUUSNL0v/uDGeXOrZbow8hMtsVpkqkWK2YoZiQ=; b=XWWfNzYaWzRpR3kkw3fcoxHCY3bLDKtWYvB4rwNbGNeuEbnsDKljTz0Z4zYZdXGfLm Cnh4HCKCyGs2Zjh03UXjfHaEhGhhN6RJNwtdc/pj7AfFpXuKmSS3r6hkdJMZWtAknqpB UhmscIjiebrE1NbjrtqrADVdzxyHUjiKFP8pGAwklzNbZbCQ95Gozs2TeaYstK6clMJO AzCgJdBX2Olbiz2EGlt52G4ShD9MhOOpNBe8QG8fz6r2dzpBUHVwdoAv3LCOdQ5kEcJ9 JBCGBrjaUt0kO8My7WgdzqZAnVOKEYkI2dkwWmof1xpN6bND7zqmDCK183dVqiCGTtMX ssDw== X-Gm-Message-State: ALoCoQnc8dvekWjeVQqhxT0h7klUcT0/3QbtpKE2yjrR9JSpvo3gvV4xWqyN93RFMgnT3SHXzQ0r X-Received: by 10.236.209.134 with SMTP id s6mr21652190yho.40.1385734465072; Fri, 29 Nov 2013 06:14:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.174 with SMTP id 14ls1366014qef.5.gmail; Fri, 29 Nov 2013 06:14:24 -0800 (PST) X-Received: by 10.58.169.49 with SMTP id ab17mr13941vec.82.1385734464912; Fri, 29 Nov 2013 06:14:24 -0800 (PST) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id v5si24928359ves.42.2013.11.29.06.14.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 06:14:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.48; Received: by mail-vb0-f48.google.com with SMTP id x16so6619253vbf.21 for ; Fri, 29 Nov 2013 06:14:24 -0800 (PST) X-Received: by 10.52.249.97 with SMTP id yt1mr56295vdc.73.1385734464703; Fri, 29 Nov 2013 06:14:24 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp95358vcz; Fri, 29 Nov 2013 06:14:24 -0800 (PST) X-Received: by 10.68.218.165 with SMTP id ph5mr16500903pbc.11.1385734463482; Fri, 29 Nov 2013 06:14:23 -0800 (PST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id sg3si39956005pbb.163.2013.11.29.06.14.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 06:14:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id p10so13744854pdj.26 for ; Fri, 29 Nov 2013 06:14:23 -0800 (PST) X-Received: by 10.68.193.233 with SMTP id hr9mr16671674pbc.26.1385734462766; Fri, 29 Nov 2013 06:14:22 -0800 (PST) Received: from localhost ([122.167.133.207]) by mx.google.com with ESMTPSA id yg3sm116123696pab.16.2013.11.29.06.14.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 29 Nov 2013 06:14:22 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, nm@ti.com, ceh@ti.com, Viresh Kumar Subject: [PATCH V4 1/2] cpufreq: Mark x86 drivers with CPUFREQ_SKIP_INITIAL_FREQ_CHECK flag Date: Fri, 29 Nov 2013 19:44:14 +0530 Message-Id: <0875dc1b263f39081232c560fc72c15cd42dfc6f.1385734305.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On some systems we can't really say what frequency we're running at the moment and so for these we shouldn't check if we are running at a frequency present in frequency table. For now mark all x86 drivers with this flag: CPUFREQ_SKIP_INITIAL_FREQ_CHECK. This patch also defines this macro. It will be used in cpufreq.c in the next patch. Signed-off-by: Viresh Kumar --- V3->V4: - Reversed the order of patches - Moved definition of CPUFREQ_SKIP_INITIAL_FREQ_CHECK to patch 1/2 instead of 2/2. drivers/cpufreq/acpi-cpufreq.c | 1 + drivers/cpufreq/cpufreq-nforce2.c | 1 + drivers/cpufreq/e_powersaver.c | 1 + drivers/cpufreq/elanfreq.c | 1 + drivers/cpufreq/gx-suspmod.c | 1 + drivers/cpufreq/ia64-acpi-cpufreq.c | 1 + drivers/cpufreq/intel_pstate.c | 2 +- drivers/cpufreq/longhaul.c | 1 + drivers/cpufreq/longrun.c | 2 +- drivers/cpufreq/p4-clockmod.c | 1 + drivers/cpufreq/pcc-cpufreq.c | 2 +- drivers/cpufreq/powernow-k6.c | 1 + drivers/cpufreq/powernow-k7.c | 1 + drivers/cpufreq/powernow-k8.c | 3 ++- drivers/cpufreq/sc520_freq.c | 1 + drivers/cpufreq/speedstep-centrino.c | 1 + drivers/cpufreq/speedstep-ich.c | 1 + drivers/cpufreq/speedstep-smi.c | 1 + include/linux/cpufreq.h | 9 +++++++++ 19 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index caf41eb..b8e4f79 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -903,6 +903,7 @@ static struct freq_attr *acpi_cpufreq_attr[] = { }; static struct cpufreq_driver acpi_cpufreq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = acpi_cpufreq_target, .bios_limit = acpi_processor_get_bios_limit, diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c index a05b876..b3222f6 100644 --- a/drivers/cpufreq/cpufreq-nforce2.c +++ b/drivers/cpufreq/cpufreq-nforce2.c @@ -370,6 +370,7 @@ static int nforce2_cpu_exit(struct cpufreq_policy *policy) } static struct cpufreq_driver nforce2_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .name = "nforce2", .verify = nforce2_verify, .target = nforce2_target, diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c index 9012b8b..0826bda 100644 --- a/drivers/cpufreq/e_powersaver.c +++ b/drivers/cpufreq/e_powersaver.c @@ -389,6 +389,7 @@ static int eps_cpu_exit(struct cpufreq_policy *policy) } static struct cpufreq_driver eps_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = eps_target, .init = eps_cpu_init, diff --git a/drivers/cpufreq/elanfreq.c b/drivers/cpufreq/elanfreq.c index de08acf..426d14d 100644 --- a/drivers/cpufreq/elanfreq.c +++ b/drivers/cpufreq/elanfreq.c @@ -194,6 +194,7 @@ __setup("elanfreq=", elanfreq_setup); static struct cpufreq_driver elanfreq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .get = elanfreq_get_cpu_frequency, .verify = cpufreq_generic_frequency_table_verify, .target_index = elanfreq_target, diff --git a/drivers/cpufreq/gx-suspmod.c b/drivers/cpufreq/gx-suspmod.c index d83e826..7bfad48 100644 --- a/drivers/cpufreq/gx-suspmod.c +++ b/drivers/cpufreq/gx-suspmod.c @@ -438,6 +438,7 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy) * MediaGX/Geode GX initialize cpufreq driver */ static struct cpufreq_driver gx_suspmod_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .get = gx_get_cpuspeed, .verify = cpufreq_gx_verify, .target = cpufreq_gx_target, diff --git a/drivers/cpufreq/ia64-acpi-cpufreq.c b/drivers/cpufreq/ia64-acpi-cpufreq.c index 53c6ac6..907bf9a 100644 --- a/drivers/cpufreq/ia64-acpi-cpufreq.c +++ b/drivers/cpufreq/ia64-acpi-cpufreq.c @@ -344,6 +344,7 @@ acpi_cpufreq_cpu_exit ( static struct cpufreq_driver acpi_cpufreq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = acpi_cpufreq_target, .get = acpi_cpufreq_get, diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 5f1cbae..6c8f5d3 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -725,7 +725,7 @@ static int intel_pstate_cpu_init(struct cpufreq_policy *policy) } static struct cpufreq_driver intel_pstate_driver = { - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = intel_pstate_verify_policy, .setpolicy = intel_pstate_set_policy, .get = intel_pstate_get, diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index 45bafdd..16c0a37 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c @@ -909,6 +909,7 @@ static int longhaul_cpu_init(struct cpufreq_policy *policy) } static struct cpufreq_driver longhaul_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = longhaul_target, .get = longhaul_get, diff --git a/drivers/cpufreq/longrun.c b/drivers/cpufreq/longrun.c index 074971b..b67d341 100644 --- a/drivers/cpufreq/longrun.c +++ b/drivers/cpufreq/longrun.c @@ -278,7 +278,7 @@ static int longrun_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver longrun_driver = { - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = longrun_verify_policy, .setpolicy = longrun_set_policy, .get = longrun_get, diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c index 3d1cba9..92b7e2b 100644 --- a/drivers/cpufreq/p4-clockmod.c +++ b/drivers/cpufreq/p4-clockmod.c @@ -234,6 +234,7 @@ static unsigned int cpufreq_p4_get(unsigned int cpu) } static struct cpufreq_driver p4clockmod_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = cpufreq_p4_target, .init = cpufreq_p4_cpu_init, diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index e2b4f40..eafe4ca 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c @@ -571,7 +571,7 @@ static int pcc_cpufreq_cpu_exit(struct cpufreq_policy *policy) } static struct cpufreq_driver pcc_cpufreq_driver = { - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .get = pcc_get_freq, .verify = pcc_cpufreq_verify, .target = pcc_cpufreq_target, diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 643e795..fe60021 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c @@ -150,6 +150,7 @@ static unsigned int powernow_k6_get(unsigned int cpu) } static struct cpufreq_driver powernow_k6_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = powernow_k6_target, .init = powernow_k6_cpu_init, diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index 946708a..4e67abc 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c @@ -679,6 +679,7 @@ static int powernow_cpu_exit(struct cpufreq_policy *policy) } static struct cpufreq_driver powernow_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = powernow_target, .get = powernow_get, diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 0023c7d..ffe89ba 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -1204,7 +1204,8 @@ out: } static struct cpufreq_driver cpufreq_amd64_driver = { - .flags = CPUFREQ_ASYNC_NOTIFICATION, + .flags = CPUFREQ_ASYNC_NOTIFICATION | + CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .verify = cpufreq_generic_frequency_table_verify, .target_index = powernowk8_target, .bios_limit = acpi_processor_get_bios_limit, diff --git a/drivers/cpufreq/sc520_freq.c b/drivers/cpufreq/sc520_freq.c index 6adb354..d6a1cf6 100644 --- a/drivers/cpufreq/sc520_freq.c +++ b/drivers/cpufreq/sc520_freq.c @@ -89,6 +89,7 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver sc520_freq_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .get = sc520_freq_get_cpu_frequency, .verify = cpufreq_generic_frequency_table_verify, .target_index = sc520_freq_target, diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c index 4e1daca..887fd43 100644 --- a/drivers/cpufreq/speedstep-centrino.c +++ b/drivers/cpufreq/speedstep-centrino.c @@ -505,6 +505,7 @@ out: } static struct cpufreq_driver centrino_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .name = "centrino", /* should be speedstep-centrino, but there's a 16 char limit */ .init = centrino_cpu_init, diff --git a/drivers/cpufreq/speedstep-ich.c b/drivers/cpufreq/speedstep-ich.c index 7639b2b..67596e7 100644 --- a/drivers/cpufreq/speedstep-ich.c +++ b/drivers/cpufreq/speedstep-ich.c @@ -307,6 +307,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) static struct cpufreq_driver speedstep_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .name = "speedstep-ich", .verify = cpufreq_generic_frequency_table_verify, .target_index = speedstep_target, diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c index 0f5326d..4f23289 100644 --- a/drivers/cpufreq/speedstep-smi.c +++ b/drivers/cpufreq/speedstep-smi.c @@ -308,6 +308,7 @@ static int speedstep_resume(struct cpufreq_policy *policy) } static struct cpufreq_driver speedstep_driver = { + .flags = CPUFREQ_SKIP_INITIAL_FREQ_CHECK, .name = "speedstep-smi", .verify = cpufreq_generic_frequency_table_verify, .target_index = speedstep_target, diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index ee5fe9d..13b8802 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -252,6 +252,15 @@ struct cpufreq_driver { */ #define CPUFREQ_ASYNC_NOTIFICATION (1 << 4) +/* + * Set by drivers which don't want cpufreq core to check if CPU is running at a + * frequency present in freq-table exposed by the driver. For other drivers if + * CPU is found running at an out of table freq, we will try to set it to a freq + * from the table. And if that fails, we will stop further boot process by + * issuing a BUG_ON(). + */ +#define CPUFREQ_SKIP_INITIAL_FREQ_CHECK (1 << 5) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);