From patchwork Wed Mar 19 15:45:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dirk.brandewie@gmail.com X-Patchwork-Id: 3859761 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1E1CFBF540 for ; Wed, 19 Mar 2014 18:18:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C02520122 for ; Wed, 19 Mar 2014 18:18:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D4D820123 for ; Wed, 19 Mar 2014 18:18:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965585AbaCSPqo (ORCPT ); Wed, 19 Mar 2014 11:46:44 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:44940 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965160AbaCSPqH (ORCPT ); Wed, 19 Mar 2014 11:46:07 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so9023803pab.8 for ; Wed, 19 Mar 2014 08:46:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o2KKyFBLE4zIcV39HjELboOjeMwVyrnJiLm3JMPDljg=; b=SGKsgYUbibAu4wfcrMSfm3OIZ51R3Ms9tsXzH0z2j49yQfFrWU373r9hO2euxIhHvl NwV3JxlDulfHInJD9v/D3SCpXEGTRd5Q0Nfg6Q8kd0X89g2zfCHcDm/ABHJnlN7vsdM+ GLSbxwnMcjdniUoyOuTdHnHBbbr8u03vezwcDsW3bXTUCEuuUeCeKxce/298VQt549nU LXZdn7uewbm48NeNM6AtahxMJxXjP9YHsar9t4+esnO2ejxbChOA96+hOk7+RbNjNnax 7dlayrLUci6sviCHPG8wvlvXkR/UyE/YEOOYRw1MQ860zm7CudwhrxvhWoRe3PdWA52G Kr8w== X-Received: by 10.66.190.138 with SMTP id gq10mr3863266pac.108.1395243967346; Wed, 19 Mar 2014 08:46:07 -0700 (PDT) Received: from echolake.localdomain (static-50-43-42-35.bvtn.or.frontiernet.net. [50.43.42.35]) by mx.google.com with ESMTPSA id x9sm63433275pbu.1.2014.03.19.08.46.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Mar 2014 08:46:05 -0700 (PDT) From: dirk.brandewie@gmail.com To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, patrick.marlier@gmail.com, viresh.kumar@linaro.org, srivatsa.bhat@linux.vnet.ibm.com, dirk.brandewie@gmail.com, Dirk Brandewie Subject: [PATCH 1/2] cpufreq: Add stop callback to cpufreq_driver interface Date: Wed, 19 Mar 2014 08:45:53 -0700 Message-Id: <1395243954-28262-2-git-send-email-dirk.j.brandewie@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1395243954-28262-1-git-send-email-dirk.j.brandewie@intel.com> References: <1395243954-28262-1-git-send-email-dirk.j.brandewie@intel.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dirk Brandewie This callback allows the driver to do clean up before the CPU is completely down and its state cannot be modified. This is used by the intel_pstate driver to reduce the requested P state prior to the core going away. This is required because the requested P state of the offline core is used to select the package P state. This effectively sets the floor package P state to the requested P state on the offline core. Signed-off-by: Dirk Brandewie --- Documentation/cpu-freq/cpu-drivers.txt | 8 +++++++- drivers/cpufreq/cpufreq.c | 3 ++- include/linux/cpufreq.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt index 8b1a445..79def80 100644 --- a/Documentation/cpu-freq/cpu-drivers.txt +++ b/Documentation/cpu-freq/cpu-drivers.txt @@ -61,7 +61,13 @@ target_index - See below on the differences. And optionally -cpufreq_driver.exit - A pointer to a per-CPU cleanup function. +cpufreq_driver.exit - A pointer to a per-CPU cleanup + function called during CPU_POST_DEAD + phase of cpu hotplug process. + +cpufreq_driver.stop - A pointer to a per-CPU stop function + called during CPU_DOWN_PREPARE phase of + cpu hotplug process. cpufreq_driver.resume - A pointer to a per-CPU resume function which is called with interrupts disabled diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index cf485d9..bb20292 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1336,7 +1336,8 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, __func__, new_cpu, cpu); } } - } + } else if (cpufreq_driver->stop && cpufreq_driver->setpolicy) + cpufreq_driver->stop(policy); return 0; } diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4d89e0e..ff8db19 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -224,6 +224,7 @@ struct cpufreq_driver { int (*bios_limit) (int cpu, unsigned int *limit); int (*exit) (struct cpufreq_policy *policy); + int (*stop) (struct cpufreq_policy *policy); int (*suspend) (struct cpufreq_policy *policy); int (*resume) (struct cpufreq_policy *policy); struct freq_attr **attr;