Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp420766img; Fri, 22 Mar 2019 00:34:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHi2XJBSOH0IY0NJkrarJr4UOJONh+v4VBPuTiOlDPkS75m/D1dVWA0tWCkL5VnapOCVe2 X-Received: by 2002:a62:f94b:: with SMTP id g11mr7729141pfm.199.1553240094842; Fri, 22 Mar 2019 00:34:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553240094; cv=none; d=google.com; s=arc-20160816; b=WbRh1R1uFQK7PqeXKVvMJCAZpBcap2yph4CqZAKEONjUbfWtfPoLJkaQ/M4VMUJEoS /5pZR9fkBXscT3nX9TOu6PGvoVSNLWwO0AzuL+ZioY7sF/Y8oEi10RSwM0da+EX65i/w jputDJXJj0IB4+m3OJgODQe1NXmmM03WbKnk06k5fuCE67JCp+EVN+0ytr4m5eNX5vet hNZ2fCFmOWz2XjqlDcq4L4LdFnAPJiVgV6rXVsRm61DxdQfZ8jNj2s4P79C2sMU85Ywi IsnT8KLrgcGp1cU2WJjktfC4qkhzLlJwoNcFgJRi/Odv0gd5cVLtB/FN4qjNpVEP5uK5 5RNg== 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=yS39e5XhjXCC8jg14orCm9Zg9RmnInJo140Azdic74I=; b=TAZciXKe1lLKPf2Bb20lFmIzUh2vilgWTtQvWNO1bKZxlyWipyM0RBgqsFeqgE9y3o dZ8vd0Bnufnj9GDloLniISYU4wKRHko7l0NmDqPfYvqnHRbMWfuXnTz4JfLGI99vNgtl UKhV9BY2x5ju5Sct0yBzQe0PxGIwNsd5Y1xtLWJTb4zBa3YTHOphVhfRK+U6vGjOZH+y lLfOk/eAcbh621xt5pbEXTlgF+DpU08iHzY9yJ1P+tnUACzmDhd3+u+uG3zrP6Kp1Mob Hng2o9xWYbnEJRqvG85XxZ805tovN1SMPVzAR7/D8IX0CQKpf1iGCyVJ4jyBMbAw1z+V EZ6g== 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 n7si6335034plk.85.2019.03.22.00.34.39; Fri, 22 Mar 2019 00:34:54 -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 S1727594AbfCVHbz (ORCPT + 99 others); Fri, 22 Mar 2019 03:31:55 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:56742 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726047AbfCVHbz (ORCPT ); Fri, 22 Mar 2019 03:31:55 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2M7OF2M077434 for ; Fri, 22 Mar 2019 03:31:53 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2rctuxsd5r-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 22 Mar 2019 03:31:53 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Mar 2019 07:31:45 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 22 Mar 2019 07:31:43 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2M7VmKt39256268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Mar 2019 07:31:49 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D244311C05E; Fri, 22 Mar 2019 07:31:48 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B5BE811C04A; Fri, 22 Mar 2019 07:31:47 +0000 (GMT) Received: from boston16h.aus.stglabs.ibm.com (unknown [9.3.23.78]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 22 Mar 2019 07:31:47 +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, Abhishek Goel Subject: [PATCH 2/2] cpuidle : Add auto-promotion flag to cpuidle flags Date: Fri, 22 Mar 2019 02:29:42 -0500 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190322072942.8038-1-huntbag@linux.vnet.ibm.com> References: <20190322072942.8038-1-huntbag@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19032207-0008-0000-0000-000002D03BE3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19032207-0009-0000-0000-0000223C5AD7 Message-Id: <20190322072942.8038-3-huntbag@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-22_05:,, 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=797 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903220057 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. For powernv systems, lite states do not even 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 7e48eb5bf..0ece62684 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -26,6 +26,10 @@ config CPU_IDLE_GOV_MENU 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..e351f5f9c 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