From patchwork Wed Mar 29 19:49:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Prakash, Prashanth" X-Patchwork-Id: 9652527 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 971E46034B for ; Wed, 29 Mar 2017 20:47:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8894F27CF3 for ; Wed, 29 Mar 2017 20:47:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D6402841D; Wed, 29 Mar 2017 20:47:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC9DA28334 for ; Wed, 29 Mar 2017 20:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932737AbdC2Tua (ORCPT ); Wed, 29 Mar 2017 15:50:30 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46780 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753160AbdC2TuU (ORCPT ); Wed, 29 Mar 2017 15:50:20 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 87CC960EA5; Wed, 29 Mar 2017 19:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1490817019; bh=LTNtP0UX0ZSNp2RtA6Vsx1LFeURkDG3DGB5Fr9ARk0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JGMA8RwGODt1NwYaJLjbhUEiFCTQJJzarQBMXxbXTnfEMM5KsdjtXKt/1ey4gjKko JlZjie8h7UoHaFutftaDKQ5EE06cM6x8k90Eq+qNk77yMVFEOAKnKtORbwMCzfX1d0 s+eKzH5TnrkrmDgzEpYuPFER0vp8omlmPQbEOUrI= Received: from pprakash-lnx.qualcomm.com (unknown [129.46.15.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: pprakash@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7F18A60DDB; Wed, 29 Mar 2017 19:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1490817019; bh=LTNtP0UX0ZSNp2RtA6Vsx1LFeURkDG3DGB5Fr9ARk0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JGMA8RwGODt1NwYaJLjbhUEiFCTQJJzarQBMXxbXTnfEMM5KsdjtXKt/1ey4gjKko JlZjie8h7UoHaFutftaDKQ5EE06cM6x8k90Eq+qNk77yMVFEOAKnKtORbwMCzfX1d0 s+eKzH5TnrkrmDgzEpYuPFER0vp8omlmPQbEOUrI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7F18A60DDB Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pprakash@codeaurora.org From: Prashanth Prakash To: linux-acpi@vger.kernel.org Cc: rjw@rjwysocki.net, hotran@apm.com, ahs3@redhat.com, Prashanth Prakash Subject: [PATCH V2 1/2] ACPI / CPPC: Read lowest non linear perf in cppc_get_perf_caps Date: Wed, 29 Mar 2017 13:49:59 -0600 Message-Id: <1490817000-13876-2-git-send-email-pprakash@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1490817000-13876-1-git-send-email-pprakash@codeaurora.org> References: <1490817000-13876-1-git-send-email-pprakash@codeaurora.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Read lowest non linear perf in cppc_get_perf_caps so that it can be exposed via sysfs to the usespace. Lowest non linear perf is the lowest performance level at which nonlinear power savings are achieved. Signed-off-by: Prashanth Prakash --- drivers/acpi/cppc_acpi.c | 19 +++++++++++-------- include/acpi/cppc_acpi.h | 1 + 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 3ca0729..f5f3c29 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -972,9 +972,9 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val) int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps) { struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum); - struct cpc_register_resource *highest_reg, *lowest_reg, *ref_perf, - *nom_perf; - u64 high, low, nom; + struct cpc_register_resource *highest_reg, *lowest_reg, + *lowest_non_linear_reg, *nominal_reg; + u64 high, low, nom, low_non_linear; int ret = 0, regs_in_pcc = 0; if (!cpc_desc) { @@ -984,12 +984,12 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps) highest_reg = &cpc_desc->cpc_regs[HIGHEST_PERF]; lowest_reg = &cpc_desc->cpc_regs[LOWEST_PERF]; - ref_perf = &cpc_desc->cpc_regs[REFERENCE_PERF]; - nom_perf = &cpc_desc->cpc_regs[NOMINAL_PERF]; + lowest_non_linear_reg = &cpc_desc->cpc_regs[LOW_NON_LINEAR_PERF]; + nominal_reg = &cpc_desc->cpc_regs[NOMINAL_PERF]; /* Are any of the regs PCC ?*/ if (CPC_IN_PCC(highest_reg) || CPC_IN_PCC(lowest_reg) || - CPC_IN_PCC(ref_perf) || CPC_IN_PCC(nom_perf)) { + CPC_IN_PCC(lowest_non_linear_reg) || CPC_IN_PCC(nominal_reg)) { regs_in_pcc = 1; down_write(&pcc_data.pcc_lock); /* Ring doorbell once to update PCC subspace */ @@ -1005,10 +1005,13 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps) cpc_read(cpunum, lowest_reg, &low); perf_caps->lowest_perf = low; - cpc_read(cpunum, nom_perf, &nom); + cpc_read(cpunum, nominal_reg, &nom); perf_caps->nominal_perf = nom; - if (!high || !low || !nom) + cpc_read(cpunum, lowest_non_linear_reg, &low_non_linear); + perf_caps->lowest_non_linear_perf = low_non_linear; + + if (!high || !low || !nom || !low_non_linear) ret = -EFAULT; out_err: diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 427a7c3..3f64660 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -103,6 +103,7 @@ struct cppc_perf_caps { u32 highest_perf; u32 nominal_perf; u32 lowest_perf; + u32 lowest_non_linear_perf; }; struct cppc_perf_ctrls {