Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp228199ybl; Wed, 4 Dec 2019 01:34:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwtdsE+SJR4U2k4XJQy6WHvU49qcW7iZHlbYVp9wo7sL0H0ioyCjcwV/YnFK9sMJgcIdpYQ X-Received: by 2002:a54:488d:: with SMTP id r13mr1667554oic.115.1575452068657; Wed, 04 Dec 2019 01:34:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575452068; cv=none; d=google.com; s=arc-20160816; b=DhOY5MSS+pQa9v3P0mnSBHb6wwXb1tvbl+hvX5g4c5VMBT6s7hV+RjjAV/4J5siRPi /mxNvWFbT+NJsTeaes/Ud3UoHxGMQKuDyVA18Hj1vdYd/BJiapL8fYQBOieUAmys+CPv saZsXZN21MJ71w9ydUhu8I1qTLqyer+It4fkIKrULeETRKcqmuXA6XcO4VhHNLsLSbN+ hiuYD/RGOp2JjlDYuzrG1iKO8oVemH5Tnsn+aB4aumPAH98Bnwh5bPJjEiINr+/UjpPz RjAlTHcUbVcsvOHfLdrbi+i1QXn6T6b8SunJTxTW8FlHsHCxImWZ9V9c3oHgqmxKPeDN i6yQ== 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=wxf2jv1osgo77IpgjDRMKJm6EBwpHqggCdMFR+OltAA=; b=h2YifX9u1ftzB91Bsl1LM6Y0RGoMBx3uSaILdaE4Uf0Cfpnap56CwpxHinGGDQQtVX bLb4fLB9MSKgkq4ensjctVHNXdEYuIj1Gd1hqS7qUOgnxyyuSPW/5+XHu7PHkhWSGap1 hzYcPqsBdgOPgx5T0/CNm9b8QuO2qO3lE1m6dGeQ59Vl9TMTUdiRs/qMQjMXTNaRUUmi l55kn6k32yvf8SSAJQBqjlYg+uZBpUsIKrFraC9Xo2NM15ZbLygRJqn9GH4GSzM1TIg9 rjZZ59zpHJO3ogEmcHiN8GGk4i5xmOeUJfJXjxpuIMM3xyFZUxVjupTtQbinAOn7peHl C20w== 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 o13si2830251otp.27.2019.12.04.01.34.15; Wed, 04 Dec 2019 01:34:28 -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 S1727454AbfLDJdG (ORCPT + 99 others); Wed, 4 Dec 2019 04:33:06 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:65036 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725971AbfLDJdF (ORCPT ); Wed, 4 Dec 2019 04:33:05 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xB49WUjt014396 for ; Wed, 4 Dec 2019 04:33:05 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2wn3pevqxb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 04 Dec 2019 04:33:04 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Dec 2019 09:33:02 -0000 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) Wed, 4 Dec 2019 09:33:00 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xB49WxST39845900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Dec 2019 09:32:59 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DF0DA405C; Wed, 4 Dec 2019 09:32:59 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED247A405B; Wed, 4 Dec 2019 09:32:56 +0000 (GMT) Received: from pratiks-thinkpad.ibmuc.com (unknown [9.85.83.83]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Dec 2019 09:32:56 +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 Subject: [RFC 0/3] Integrate Support for self-save and determine Date: Wed, 4 Dec 2019 15:02:52 +0530 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19120409-0020-0000-0000-0000039397CA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19120409-0021-0000-0000-000021EABE17 Message-Id: <20191204093255.11849-1-psampat@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-04_02:2019-12-04,2019-12-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 mlxscore=0 adultscore=0 impostorscore=0 suspectscore=0 bulkscore=1 lowpriorityscore=1 spamscore=0 clxscore=1011 mlxlogscore=661 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912040073 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. 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. 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 | 431 ++++++++++++++++++--- arch/powerpc/platforms/powernv/opal-call.c | 1 + 4 files changed, 379 insertions(+), 57 deletions(-) -- 2.21.0