Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp76832yba; Fri, 5 Apr 2019 02:18:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUdFw6VOBdvHjiCkPVblYb5SHR+YkrzwL/JPwYSgQg6mhrrvF9bd2d1w7ELZM9OWg/9NPZ X-Received: by 2002:a63:1659:: with SMTP id 25mr10500843pgw.275.1554455924342; Fri, 05 Apr 2019 02:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554455924; cv=none; d=google.com; s=arc-20160816; b=gkAzQLVGtBk2vxEnaV+9M2zfYX0YGCJMPswhBbIj7xD8UcDGvA05r3PjYDJEW7GvWG Ccn47KWnaJpykQrYfmq1OhD3qKnNYVLAPdcGQRzQn3qAz8Reuwp9oPnvKCt5zQll25bT iLE8xMWK3lIoha86lmnYmpkburppNOJnIMXy+tlfWt4gX35iztF2q8QUtaJ0UCMiubx+ QY1C9AVDBoHASnkZeEklZEr0wva9mZakYxjm1nJvAaMLn5AarSKRGkJLcOF9wNHU4JfX xOl2370EOrpg0c3TDSh36TgpkpJJJ2bE6dHjRtfbRdgzI9W7RmtmHNb/qITyK0sc6RPa waAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=We0o3LdwRfU7dBE9DpASRUJthoKWzOX986GbPIFN0Ew=; b=W2mxoHcd/Jy0wiVhuIipylvVrGSYLXtXVMRbbiS04qFPELcGK12vHrGMg97z5N71zR LqiBQWomZtl2XLbkJCKigf1c6UuOoME91IzEZj0lv7kLJfIb8xF43rmzQ7/MoJDSHBud URwKZBXn2sAFnmzyKbVwICDT/QTNIeY09XwUj/DCZY8B/ENECwOEN2iXjHzy2cJgq6If CpH25OnUbd8cNHX51iHHUNVd4wXQacWf/M35wFAP3dT8uJu4yJEvN/uazKj7IdhIr2Nq EVI3aY7S0+4L8ZF9mcV2i4MZ/weRvM3PGRocMX9OIgoSRR1RsjYYIxjmdK9Ue62dXH1m jkKQ== 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 r23si15832802pgv.471.2019.04.05.02.18.29; Fri, 05 Apr 2019 02:18:44 -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 S1730554AbfDEJRU (ORCPT + 99 others); Fri, 5 Apr 2019 05:17:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60682 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730537AbfDEJRT (ORCPT ); Fri, 5 Apr 2019 05:17:19 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x359BM0R026882 for ; Fri, 5 Apr 2019 05:17:18 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rp2mvw6x6-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 05 Apr 2019 05:17:18 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Apr 2019 10:17:16 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 5 Apr 2019 10:17:14 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x359HDh959375746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 Apr 2019 09:17:13 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98C6B5204E; Fri, 5 Apr 2019 09:17:13 +0000 (GMT) Received: from boston16h.aus.stglabs.ibm.com (unknown [9.3.23.78]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5A53D52050; Fri, 5 Apr 2019 09:17:12 +0000 (GMT) From: Abhishek Goel To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-pm@vger.kernel.org Cc: rjw@rjwysocki.net, daniel.lezcano@linaro.org, mpe@ellerman.id.au, ego@linux.vnet.ibm.com, Abhishek Goel Subject: [PATCH v2 2/2] cpuidle : Add auto-promotion flag to cpuidle flags Date: Fri, 5 Apr 2019 04:16:47 -0500 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190405091647.4169-1-huntbag@linux.vnet.ibm.com> References: <20190405091647.4169-1-huntbag@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19040509-0020-0000-0000-0000032C9111 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040509-0021-0000-0000-0000217EA863 Message-Id: <20190405091647.4169-3-huntbag@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-05_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=786 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904050068 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch sets up flags for the state which needs to be auto-promoted. On POWERNV system, only lite states need to be autopromoted. We identify lite states by those which do not lose user context. That information has been used to set the flag for lite states. Signed-off-by: Abhishek Goel --- arch/powerpc/include/asm/opal-api.h | 1 + drivers/cpuidle/Kconfig | 4 ++++ drivers/cpuidle/cpuidle-powernv.c | 13 +++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 870fb7b23..735dec731 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -226,6 +226,7 @@ */ #define OPAL_PM_TIMEBASE_STOP 0x00000002 +#define OPAL_PM_LOSE_USER_CONTEXT 0x00001000 #define OPAL_PM_LOSE_HYP_CONTEXT 0x00002000 #define OPAL_PM_LOSE_FULL_CONTEXT 0x00004000 #define OPAL_PM_NAP_ENABLED 0x00010000 diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index 8caccbbd7..9b8e9b96a 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -35,6 +35,10 @@ config CPU_IDLE_GOV_TEO config DT_IDLE_STATES bool +config CPU_IDLE_AUTO_PROMOTION + bool + default y if PPC_POWERNV + menu "ARM CPU Idle Drivers" depends on ARM || ARM64 source "drivers/cpuidle/Kconfig.arm" diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c index 84b1ebe21..0dd767270 100644 --- a/drivers/cpuidle/cpuidle-powernv.c +++ b/drivers/cpuidle/cpuidle-powernv.c @@ -299,6 +299,7 @@ static int powernv_add_idle_states(void) for (i = 0; i < dt_idle_states; i++) { unsigned int exit_latency, target_residency; bool stops_timebase = false; + bool lose_user_context = false; struct pnv_idle_states_t *state = &pnv_idle_states[i]; /* @@ -324,6 +325,9 @@ static int powernv_add_idle_states(void) if (has_stop_states && !(state->valid)) continue; + if (state->flags & OPAL_PM_LOSE_USER_CONTEXT) + lose_user_context = true; + if (state->flags & OPAL_PM_TIMEBASE_STOP) stops_timebase = true; @@ -332,12 +336,17 @@ static int powernv_add_idle_states(void) add_powernv_state(nr_idle_states, "Nap", CPUIDLE_FLAG_NONE, nap_loop, target_residency, exit_latency, 0, 0); + } else if (has_stop_states && !lose_user_context) { + add_powernv_state(nr_idle_states, state->name, + CPUIDLE_FLAG_AUTO_PROMOTION, + stop_loop, target_residency, + exit_latency, state->psscr_val, + state->psscr_mask); } else if (has_stop_states && !stops_timebase) { add_powernv_state(nr_idle_states, state->name, CPUIDLE_FLAG_NONE, stop_loop, target_residency, exit_latency, - state->psscr_val, - state->psscr_mask); + state->psscr_val, state->psscr_mask); } /* -- 2.17.1