Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3496576ybl; Sun, 12 Jan 2020 19:46:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzvTJfK3rAZQm5MUa+y1AAM0P00+ch30DW5d0FsuNX38Cqaz3oSXHAsgNGUG50Z3zpXklK7 X-Received: by 2002:aca:530e:: with SMTP id h14mr10856182oib.105.1578887184599; Sun, 12 Jan 2020 19:46:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578887184; cv=none; d=google.com; s=arc-20160816; b=XmrhlF7o4Ba5p8NnhOvrobDE2XO8sBU3ZErSXoDigN4DobMNhxQXTPuy1ErhR0NSIS QlgQ7oTj4IHVtn4F4GRkug6ZpQ4SwCgv5+639rw3DIc8CGiT7ZRixtGe7EQNmcU7svxQ SmngOXJtaKBbEt5bAHgE9IYnOfg9bd5YK9xJ3jnMjuIv1oSNP37dlWPoTO3CtyDpoHqp Ye0puTbAoREcsecO/qKWv61cHa2Hb8cHirTm/5/7JeUS0kK3KHWsc5teuSYwBrM7UJi0 WW6Y4SDefJfxWLTZYmF9tinjtrr4sSXNRsEecqkhNR1+1aF2IM5aXlqFPnNqRXe6h9ht 9/uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:to:from; bh=EPZzryiK2bwxeR83SrwGerk+EOxMi85zAGgI/QCi5WY=; b=gmV2TOucxzdFMicTW1khD+n/DgcSLNQgeUdy9i+bAArqKfQ12i8jHwuhrX5EQzXtu+ mGyIPLb341y58FFOyMXUp4K13In+gn225QtkxK7MDn+7mIdm/9IFPM0CkNbWfTjTfuAT 8H3bJDTYDhPZaK6scK419gUs5TYr4S3bVfSQw+c2a4D964wSIwNNhEKiI06s7A/bTfut RYEZ5FUYw7q05X33NgqYwYmgFcyy30W3ezDXGL+HyVNEDzAMaD/B0Z9oxJUrpy7ofuHk J3IsQEYlvVvBTCtBl3w5ACf4gyEFlZhDy96VT6cJanpqEWiMkHxLl3UF6rKWT1RkIBnR HvQA== 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 b1si5224655oiy.9.2020.01.12.19.46.12; Sun, 12 Jan 2020 19:46:24 -0800 (PST) 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 S2387435AbgAMDpT (ORCPT + 99 others); Sun, 12 Jan 2020 22:45:19 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:20402 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387400AbgAMDpT (ORCPT ); Sun, 12 Jan 2020 22:45:19 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00D3gilx041857 for ; Sun, 12 Jan 2020 22:45:18 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xfvaxp1g7-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 12 Jan 2020 22:45:17 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Jan 2020 03:45:15 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Mon, 13 Jan 2020 03:45:13 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00D3jCaL53280818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 03:45:12 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A0D042041; Mon, 13 Jan 2020 03:45:12 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 75FE14203F; Mon, 13 Jan 2020 03:45:10 +0000 (GMT) Received: from pratiks-thinkpad.in.ibm.com (unknown [9.124.31.88]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 13 Jan 2020 03:45:10 +0000 (GMT) From: Pratik Rajesh Sampat To: linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org, mpe@ellerman.id.au, svaidy@linux.ibm.com, ego@linux.vnet.ibm.com, linuxram@us.ibm.com, psampat@linux.ibm.com, pratik.sampat@in.ibm.com, pratik.r.sampat@gmail.com Subject: [RESEND PATCH v2 0/3] Introduce Self-Save API for deep stop states Date: Mon, 13 Jan 2020 09:15:06 +0530 X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 20011303-0008-0000-0000-00000348CE40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20011303-0009-0000-0000-00004A691C00 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-12_11:2020-01-10,2020-01-12 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=927 phishscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 spamscore=0 mlxscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-2001130028 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RESEND Changes: 1. Updated OPAL API numbering for consistency Skiboot patches: https://patchwork.ozlabs.org/patch/1221011/ RFC v1 patches: https://lkml.org/lkml/2019/12/4/193 Changelog RFC v1 --> v2 1. Optimized preference bitmask 2. Addressed comments from Ram Pai Currently the stop-API supports a mechanism called as self-restore which allows us to restore the values of certain SPRs on wakeup from a deep-stop state to a desired value. To use this, the Kernel makes an OPAL call passing the PIR of the CPU, the SPR number and the value to which the SPR should be restored when that CPU wakes up from a deep stop state. Recently, a new feature, named self-save has been enabled in the stop-api, which is an alternative mechanism to do the same, except that self-save will save the current content of the SPR before entering a deep stop state and also restore the content back on waking up from a deep stop state. This patch series aims at introducing and leveraging the self-save feature in the kernel. Now, as the kernel has a choice to prefer one mode over the other and there can be registers in both the save/restore SPR list which are sent from the device tree, a new interface has been defined for the seamless handing of the modes for each SPR. A list of preferred SPRs are maintained in the kernel which contains two properties: 1. supported_mode: Helps in identifying if it strictly supports self save or restore or both. Initialized using the information from device tree. 2. preferred_mode: Calls out what mode is preferred for each SPR. It could be strictly self save or restore, or it can also determine the preference of mode over the other if both are present by encapsulating the other in bitmask from LSB to MSB. Initialized statically. Below is a table to show the Scenario::Consequence when the self save and self restore modes are available or disabled in different combinations as perceived from the device tree thus giving complete backwards compatibly regardless of an older firmware running a newer kernel or vise-versa. Support for self save or self-restore is embedded in the device tree, along with the set of registers it supports. SR = Self restore; SS = Self save .-----------------------------------.----------------------------------------. | Scenario | Consequence | :-----------------------------------+----------------------------------------: | Legacy Firmware. No SS or SR node | Self restore is called for all | | | supported SPRs | :-----------------------------------+----------------------------------------: | SR: !active SS: !active | Deep stop states disabled | :-----------------------------------+----------------------------------------: | SR: active SS: !active | Self restore is called for all | | | supported SPRs | :-----------------------------------+----------------------------------------: | SR: active SS: active | Goes through the preferences for each | | | SPR and executes of the modes | | | accordingly. Currently, Self restore is| | | called for all the SPRs except PSSCR | | | which is self saved | :-----------------------------------+----------------------------------------: | SR: active(only HID0) SS: active | Self save called for all supported | | | registers expect HID0 (as HID0 cannot | | | be self saved currently) | :-----------------------------------+----------------------------------------: | SR: !active SS: active | currently will disable deep states as | | | HID0 is needed to be self restored and | | | cannot be self saved | '-----------------------------------'----------------------------------------' Pratik Rajesh Sampat (3): powerpc/powernv: Interface to define support and preference for a SPR powerpc/powernv: Introduce Self save support powerpc/powernv: Parse device tree, population of SPR support arch/powerpc/include/asm/opal-api.h | 3 +- arch/powerpc/include/asm/opal.h | 1 + arch/powerpc/platforms/powernv/idle.c | 433 ++++++++++++++++++--- arch/powerpc/platforms/powernv/opal-call.c | 1 + 4 files changed, 381 insertions(+), 57 deletions(-) -- 2.24.1