Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3321721imm; Mon, 4 Jun 2018 01:18:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI7BA7VJoRsEmjzYVL9fQt+sCvG7eW+pb+I3I5MeKwZ1v1ZNFkfIcqbwh/7f6GLpDBKL7Ue X-Received: by 2002:a17:902:8c81:: with SMTP id t1-v6mr20618297plo.310.1528100332545; Mon, 04 Jun 2018 01:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528100332; cv=none; d=google.com; s=arc-20160816; b=zlbBMNI59bZjHK5f0S/0yd3s3EsuSdUGb6hfTHtQitscIyxuMFGLM9TM8ZbvGyEzpu KmwCqQbIRQ9ljwIjX+rQ0gWLojIKBPO8cbc28WPNztD6mfPSfrU9bkU+4PkCHDpHh0m/ ip5NnUhY8/9DHG73pzLveyLmctrEOVFrC2fafTN1LE9J+AtelEZCWkmv8gmhPDn7zlQu UhddbnXhD6Rx2n8JxzvV77CoqtiDOZg4P7h7lcFz2pMP/+wPwF9nLl44ScA1a9SguPEH MtGtl+q6RRiwX6JY7xo76P16KN2yhzz2xzCPwekAsm0JgOARmZ8nL0+32ON7oLVOk4vC KNag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SD5YtsuohNr4IB0xwNDNpS45dyuwZiZTtIRNgo4bKDI=; b=Rq34gKvRvjmmDvMjO+3e7B7zghP0DyyfUs3u+I9l5eNIMr5Wjzma0/zy5v6MuV0qI6 Oeuhn+7ADy/6tJjYQELt6xpgJYfG4UUaMt0p/cwsMYyzgxWASAMVgARsdSbQb95r3FKL 88xl1pcnuMM9YXq/4A7009mneK/sSyaLQidxqbSGr4hiYK+QyAo+n407ki1SKZW0LaJJ 5bWn/luFONeDSVTGRyT8KEQ1A0GWJQDTKFJwWXJVbQf77/RE7v5AMA7vvXE34uQijWYF JmE0sG0ecighd5S8J+hE9Rz49kYarPcEkhOor4wFx/VDzc5rAH5L4hoG4GbXQ23KHG3b /jUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si128294plr.332.2018.06.04.01.18.37; Mon, 04 Jun 2018 01:18:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752034AbeFDISM (ORCPT + 99 others); Mon, 4 Jun 2018 04:18:12 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52254 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751854AbeFDISK (ORCPT ); Mon, 4 Jun 2018 04:18:10 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w548DoEh015441 for ; Mon, 4 Jun 2018 04:18:09 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jd032mb7h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Jun 2018 04:18:09 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Jun 2018 09:18:08 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Jun 2018 09:18:04 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w548I3ow32243816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Jun 2018 08:18:03 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 368654C046; Mon, 4 Jun 2018 09:09:27 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6FCF34C04A; Mon, 4 Jun 2018 09:09:25 +0100 (BST) Received: from fir03.in.ibm.com (unknown [9.124.102.72]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 4 Jun 2018 09:09:25 +0100 (BST) From: Abhishek Goel To: rjw@rjwysocki.net, daniel.lezcano@linaro.org, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: stewart@linux.vnet.ibm.com, Abhishek Goel Subject: [PATCH v2] cpuidle/powernv : Add Description for cpuidle state Date: Mon, 4 Jun 2018 13:47:58 +0530 X-Mailer: git-send-email 2.14.1 X-TM-AS-GCONF: 00 x-cbid: 18060408-0016-0000-0000-000001D76A03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060408-0017-0000-0000-00003229F89B Message-Id: <20180604081758.104201-1-huntbag@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-04_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806040103 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Names of cpuidle states were being used for description of states in POWER as no descriptions were added in device tree. This patch reads description for idle states which have been added in device tree. The description for idle states in case of POWER can be printed using "cpupower monitor -l" or "cpupower idle-info". Signed-off-by: Abhishek Goel --- The skiboot patch which adds description for idle states in device tree can be found here: https://patchwork.ozlabs.org/patch/924879/ drivers/cpuidle/cpuidle-powernv.c | 19 +++++++++++++++---- include/linux/cpuidle.h | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index 1a8234e706bc..08d8b0953a14 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -133,7 +133,7 @@ static int stop_loop(struct cpuidle_device *dev, static struct cpuidle_state powernv_states[CPUIDLE_STATE_MAX] = { { /* Snooze */ .name = "snooze", - .desc = "snooze", + .desc = "idle polling state", .exit_latency = 0, .target_residency = 0, .enter = snooze_loop }, @@ -206,6 +206,7 @@ static int powernv_cpuidle_driver_init(void) } static inline void add_powernv_state(int index, const char *name, + const char *desc, unsigned int flags, int (*idle_fn)(struct cpuidle_device *, struct cpuidle_driver *, @@ -215,7 +216,7 @@ static inline void add_powernv_state(int index, const char *name, u64 psscr_val, u64 psscr_mask) { strlcpy(powernv_states[index].name, name, CPUIDLE_NAME_LEN); - strlcpy(powernv_states[index].desc, name, CPUIDLE_NAME_LEN); + strlcpy(powernv_states[index].desc, desc, CPUIDLE_DESC_LEN); powernv_states[index].flags = flags; powernv_states[index].target_residency = target_residency; powernv_states[index].exit_latency = exit_latency; @@ -250,6 +251,7 @@ static int powernv_add_idle_states(void) u64 psscr_val[CPUIDLE_STATE_MAX]; u64 psscr_mask[CPUIDLE_STATE_MAX]; const char *names[CPUIDLE_STATE_MAX]; + const char *descs[CPUIDLE_STATE_MAX]; u32 has_stop_states = 0; int i, rc; u32 supported_flags = pnv_get_supported_cpuidle_states(); @@ -311,6 +313,13 @@ static int powernv_add_idle_states(void) pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-names in DT\n"); goto out; } + if (of_property_read_string_array(power_mgt, + "ibm,cpu-idle-state-descs", descs, dt_idle_states) < 0) { + of_property_read_string_array(power_mgt, + "ibm,cpu-idle-state-names", descs, dt_idle_states); + pr_warn("cpuidle-powernv: missing ibm,cpu-idle-state-descs in DT\n" + "Name will be used for description\n"); + } /* * If the idle states use stop instruction, probe for psscr values @@ -414,10 +423,11 @@ static int powernv_add_idle_states(void) target_residency = 100; /* Add NAP state */ add_powernv_state(nr_idle_states, "Nap", + "stop processor execution", CPUIDLE_FLAG_NONE, nap_loop, target_residency, exit_latency, 0, 0); } else if (has_stop_states && !stops_timebase) { - add_powernv_state(nr_idle_states, names[i], + add_powernv_state(nr_idle_states, names[i], descs[i], CPUIDLE_FLAG_NONE, stop_loop, target_residency, exit_latency, psscr_val[i], psscr_mask[i]); @@ -434,11 +444,12 @@ static int powernv_add_idle_states(void) target_residency = 300000; /* Add FASTSLEEP state */ add_powernv_state(nr_idle_states, "FastSleep", + "Core and L2 clock gating", CPUIDLE_FLAG_TIMER_STOP, fastsleep_loop, target_residency, exit_latency, 0, 0); } else if (has_stop_states && stops_timebase) { - add_powernv_state(nr_idle_states, names[i], + add_powernv_state(nr_idle_states, names[i], descs[i], CPUIDLE_FLAG_TIMER_STOP, stop_loop, target_residency, exit_latency, psscr_val[i], psscr_mask[i]); diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 1eefabf1621f..5094755cb132 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -17,7 +17,7 @@ #define CPUIDLE_STATE_MAX 10 #define CPUIDLE_NAME_LEN 16 -#define CPUIDLE_DESC_LEN 32 +#define CPUIDLE_DESC_LEN 60 struct module; -- 2.14.1