From patchwork Fri May 11 09:06:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 911862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40j43z1ghTz9s16 for ; Fri, 11 May 2018 19:07:27 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40j43z0P81zF2Fk for ; Fri, 11 May 2018 19:07:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=permerror (mailfrom) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=benh@kernel.crashing.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40j43t4KwtzF2Dp for ; Fri, 11 May 2018 19:07:22 +1000 (AEST) Received: from pasglop.au.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w4B970o9000984; Fri, 11 May 2018 04:07:01 -0500 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Fri, 11 May 2018 19:06:58 +1000 Message-Id: <20180511090659.13305-1-benh@kernel.crashing.org> X-Mailer: git-send-email 2.17.0 Subject: [Skiboot] [PATCH 1/2] cpu: Use STOP1 on POWER9 for idle/sleep inside OPAL X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The current code requests STOP3, which means it gets STOP2 in practice. STOP2 has proven to occasionally be unreliable depending on FW version and chip revision, it also requires a functional CME, so instead, let's use STOP1. The difference is rather minimum for something that is only used a few seconds during boot. Signed-off-by: Benjamin Herrenschmidt --- core/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/cpu.c b/core/cpu.c index 3e5e5922..a603e11f 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -409,14 +409,14 @@ static void cpu_idle_p9(enum cpu_wake_cause wake_on) if (sreset_enabled) { /* stop with EC=1 (sreset) and ESL=1 (enable thread switch). */ - /* PSSCR SD=0 ESL=1 EC=1 PSSL=0 TR=3 MTL=0 RL=3 */ + /* PSSCR SD=0 ESL=1 EC=1 PSSL=0 TR=3 MTL=0 RL=1 */ psscr = PPC_BIT(42) | PPC_BIT(43) | - PPC_BITMASK(54, 55) | PPC_BITMASK(62,63); + PPC_BITMASK(54, 55) | PPC_BIT(63); enter_p9_pm_state(psscr); } else { /* stop with EC=0 (resumes) which does not require sreset. */ - /* PSSCR SD=0 ESL=0 EC=0 PSSL=0 TR=3 MTL=0 RL=3 */ - psscr = PPC_BITMASK(54, 55) | PPC_BITMASK(62,63); + /* PSSCR SD=0 ESL=0 EC=0 PSSL=0 TR=3 MTL=0 RL=1 */ + psscr = PPC_BITMASK(54, 55) | PPC_BIT(63); enter_p9_pm_lite_state(psscr); } From patchwork Fri May 11 09:06:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 911863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40j44L0LZ4z9s15 for ; Fri, 11 May 2018 19:07:46 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40j44K6HJXzF2FM for ; Fri, 11 May 2018 19:07:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=permerror (mailfrom) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=benh@kernel.crashing.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40j43y49pVzF2Dp for ; Fri, 11 May 2018 19:07:26 +1000 (AEST) Received: from pasglop.au.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w4B970oA000984; Fri, 11 May 2018 04:07:03 -0500 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Fri, 11 May 2018 19:06:59 +1000 Message-Id: <20180511090659.13305-2-benh@kernel.crashing.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180511090659.13305-1-benh@kernel.crashing.org> References: <20180511090659.13305-1-benh@kernel.crashing.org> Subject: [Skiboot] [PATCH 2/2] cpu: Cleanup clearing of doorbells on P9 X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We currently do a rather pointless msgclr prior to setting in_sleep/in_idle (with no ordering guarantee which isn't great). We also do the final msgsync/msgclr after setting in_sleep/in_idle back to false which while probably ok, isn't that great, we should do msgsync first thing when waking up. Finally, do p9_dbell_receive() before skip_sleep. So take out the first msgclr, swap the final p9_dbell_receive() and add a sync() for good measure and match what p8 does. Signed-off-by: Benjamin Herrenschmidt --- core/cpu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/cpu.c b/core/cpu.c index a603e11f..2ea329ed 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -375,8 +375,6 @@ static void cpu_idle_p9(enum cpu_wake_cause wake_on) return; } - msgclr(); /* flush pending messages */ - /* Synchronize with wakers */ if (wake_on == cpu_wake_on_job) { /* Mark ourselves in idle so other CPUs know to send an IPI */ @@ -420,11 +418,14 @@ static void cpu_idle_p9(enum cpu_wake_cause wake_on) enter_p9_pm_lite_state(psscr); } -skip_sleep: + /* Clear doorbell */ + p9_dbell_receive(); + + skip_sleep: /* Restore */ + sync(); cpu->in_idle = false; cpu->in_sleep = false; - p9_dbell_receive(); } static void cpu_idle_pm(enum cpu_wake_cause wake_on)