From patchwork Tue Oct 24 11:40:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 829874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLrvn2YkTz9t2l for ; Tue, 24 Oct 2017 22:41:41 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OEjFHtk9"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLrvn1Cx8zDqmS for ; Tue, 24 Oct 2017 22:41:41 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OEjFHtk9"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::243; helo=mail-pf0-x243.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OEjFHtk9"; dkim-atps=neutral Received: from mail-pf0-x243.google.com (mail-pf0-x243.google.com [IPv6:2607:f8b0:400e:c00::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLrvJ4jzvzDqYv for ; Tue, 24 Oct 2017 22:41:16 +1100 (AEDT) Received: by mail-pf0-x243.google.com with SMTP id b79so19489480pfk.5 for ; Tue, 24 Oct 2017 04:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jik7hKhAqvXGjeNWqI4Jk7Hm/7mVmaaiGt+1nYOGXSI=; b=OEjFHtk9imedaF4Kcdw9Iyc8rTME5OcIUYCuXLNc5NMJTDfXZVN837Ffk2zPfsORiE 1swqes82HZeVR9RLhZsOvs02gA7NK/UJsfqvzcFfhRTKLseyenhtmaOd9mKkFp4VklNK V/q/SoFn4gE3XXeXPFT24o5vnHSA4l4nxu8hUja6o6EbnvEhI7W3s66Q5ovQjzYyNLAG j08nBfZEsw4hMVgS5hCdHwGEQFBNyBgXETSdUmAyTCuojbZU9KejVJ3ybPs6yNyvcTxF Pf5wRQlo/E03S+OkeIZWU1bESYG3pAzlQH7tjXgZWxrxR1wOyUaYF6wuWNdaTIbMyX/6 mVww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Jik7hKhAqvXGjeNWqI4Jk7Hm/7mVmaaiGt+1nYOGXSI=; b=KzjeA9NM913AognOxKN9p/9JbYPoJTO0/AJ9MC1uVvPawilaWbyZBsRoMqAlm97iF0 so3fReiM3XrnarrYWGlrcL9b5tW9INTfWgiAxiYFmMJ8T0dUFaVuNYSiipHJAQ4v7Pwv G7Gu3Dbps3PnhYkuvTOO02bZW7GchtEn2ffebuw0EPbjsp1uBjiP1s6m5Fqeuet3s4Yy KFmATdOQPSEiohEZSKRXWUzADdg/mR4AyAztAsNa0PoSOtInltcSEJG+0byaHxluO+CC Vr49bC7ncLxPt+ZZDguWksWccqAIxhd06wS0zCycuaZYKoiWtPsGWv4MFmtHTdnKpmjN ksBQ== X-Gm-Message-State: AMCzsaVYMSxuq5aXijBeY75/jOu+9RrlDKAA468wINkXSg6yT1JwqBnE FzV4hLHORTtpE1uPYefylYttdg== X-Google-Smtp-Source: ABhQp+SA7NY5ZP25AIyKN40Mj1X8tY2UvifRLKHgQSYYy+KQGnLdxkXFumRRPvSLkyudAwcEP5HBUA== X-Received: by 10.98.12.212 with SMTP id 81mr16450838pfm.88.1508845274414; Tue, 24 Oct 2017 04:41:14 -0700 (PDT) Received: from roar.au.ibm.com (59-102-69-156.tpgi.com.au. [59.102.69.156]) by smtp.gmail.com with ESMTPSA id q77sm286187pfd.84.2017.10.24.04.41.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 04:41:13 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Tue, 24 Oct 2017 21:40:59 +1000 Message-Id: <20171024114100.13714-2-npiggin@gmail.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171024114100.13714-1-npiggin@gmail.com> References: <20171024114100.13714-1-npiggin@gmail.com> Subject: [Skiboot] [PATCH 1/2] asm/head: initialize preferred DSCR value X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 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" POWER7/8 use DSCR=0. POWER9 preferred value has "stride-N" enabled. Signed-off-by: Nicholas Piggin --- asm/head.S | 22 +++++++++++++++++++--- include/processor.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/asm/head.S b/asm/head.S index d6b58be9..d82e4e5e 100644 --- a/asm/head.S +++ b/asm/head.S @@ -782,7 +782,7 @@ init_replicated_sprs: cmpwi cr0,%r3,PVR_TYPE_P8NVL beq 3f cmpwi cr0,%r3,PVR_TYPE_P9 - beq 3f + beq 4f /* Unsupported CPU type... what do we do ? */ b 9f @@ -792,14 +792,30 @@ init_replicated_sprs: mtspr SPR_LPCR, %r3 sync isync - b 9f + LOAD_IMM64(%r3,0x0) + mtspr SPR_DSCR,%r3 + b 9f + +3: /* P8, P8E */ + /* LPCR: sane value */ + LOAD_IMM64(%r3,0x0040000000000000) + mtspr SPR_LPCR, %r3 + sync + isync + LOAD_IMM64(%r3,0x0) + mtspr SPR_DSCR,%r3 + b 9f -3: /* P8, P8E, P9 */ +4: /* P9 */ /* LPCR: sane value */ LOAD_IMM64(%r3,0x0040000000000000) mtspr SPR_LPCR, %r3 sync isync + /* DSCR: Stride-N Stream Enable */ + LOAD_IMM64(%r3,0x0000000000000010) + mtspr SPR_DSCR,%r3 + 9: blr .global enter_nap diff --git a/include/processor.h b/include/processor.h index 1f18762a..77110d01 100644 --- a/include/processor.h +++ b/include/processor.h @@ -44,6 +44,7 @@ #define SPR_PIR_P7_MASK 0x03ff /* Mask of implemented bits */ /* SPR register definitions */ +#define SPR_DSCR 0x011 /* RW: Data stream control reg */ #define SPR_DSISR 0x012 /* RW: Data storage interrupt status reg */ #define SPR_DAR 0x013 /* RW: Data address reg */ #define SPR_DEC 0x016 /* RW: Decrement Register */ From patchwork Tue Oct 24 11:41:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 829875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yLrw16BMHz9t2l for ; Tue, 24 Oct 2017 22:41:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jT7iYAJk"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yLrw14GyCzDqln for ; Tue, 24 Oct 2017 22:41:53 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jT7iYAJk"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jT7iYAJk"; dkim-atps=neutral Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yLrvN2Qb9zDqYv for ; Tue, 24 Oct 2017 22:41:19 +1100 (AEDT) Received: by mail-pf0-x244.google.com with SMTP id n89so19460282pfk.11 for ; Tue, 24 Oct 2017 04:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OKe52rq/oBwh0atZ+W2nbXKZWDAaLp+iiwQk71v1LQU=; b=jT7iYAJktMlc3TC62+xlWLgtB2Kr12MKJvTPbiprVLawxKZUvWIJ8mtS/CsOYcZIBJ pgJPkx9K29IY/UvFPZPSjhUUX3qOvTTFsM+7OyVHTZJz20fXAYplw+wDeF59NxrKnFww 9NRgOLUpB9xuxdbUgbxU/IGAkn15JGXcWWZmb1giA+4EPMTdpulhUfjRaGqS0nPbxsY7 vZxPCYHtHFp+BDA776cSviWzAwIjnAmwaW2mS+x+G1pV2K0xcAtDbttIiQIFCAzI3Kye 7yhcVRekgBsYAAhSE9DmQa+Vzd96Wor9ZLLVoeiUTtuow6iCZG7KWBeaRG0I7APY7afp ypBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OKe52rq/oBwh0atZ+W2nbXKZWDAaLp+iiwQk71v1LQU=; b=Q7qyUo0VwbODId4xeyXY8/sKxXoEcaUrV3Is28k4oYYaC9muPpl6/pWFSn6mX4jqG6 I4QmpsWUd1gq8tg/KtzAEzYoBH32bUXH/X+ffFPE4MTysi0oWdXIOPxl6SZe+Di+c2GY inTQcO9iNL1JYfKDAZoZXEvb7IVDdkl52KGR7gGUXWESKxizlhu3P1SQ/UZmf6RotuY0 g0FHJI2gOJTrNA1TFJWP98zMepOqDTbWn3+GUAzKpjLZTd9RgGBT3MBZ7tA8Lq+e3Zvz 0YlwJn8QwgZrPefoXuGQXvBq1sLTWpLvCPGu75232Xwzp7JNFi7lAu0NM5BVlUXIvjZ0 b8rg== X-Gm-Message-State: AMCzsaUZlLOxhlR/kLH1utDbQRAv5vofEVMa/bGe0+fNE0dbSdORTLLG +rKN8/sfvcciQPgfHFZHhDXYpQ== X-Google-Smtp-Source: ABhQp+QJm1pOx3x67NrnJ6M4cggMA3blsOI9GmQSz43OeKP2+IPcoRbZRM1MuxVmRiBsNglRd6Tt0A== X-Received: by 10.84.241.129 with SMTP id b1mr13040123pll.103.1508845277518; Tue, 24 Oct 2017 04:41:17 -0700 (PDT) Received: from roar.au.ibm.com (59-102-69-156.tpgi.com.au. [59.102.69.156]) by smtp.gmail.com with ESMTPSA id q77sm286187pfd.84.2017.10.24.04.41.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 04:41:16 -0700 (PDT) From: Nicholas Piggin To: skiboot@lists.ozlabs.org Date: Tue, 24 Oct 2017 21:41:00 +1000 Message-Id: <20171024114100.13714-3-npiggin@gmail.com> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20171024114100.13714-1-npiggin@gmail.com> References: <20171024114100.13714-1-npiggin@gmail.com> Subject: [Skiboot] [PATCH 2/2] cpu: Unconditionally re-initialise SPRs in opal_reinit_cpus() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 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" opal_reinit_cpus should re-initialise SPRs to their boot state, because it should things according to the boot state. This solves the problem that the hypervisor may change SPRs before kexecing to a new kernel. Signed-off-by: Nicholas Piggin --- core/cpu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/cpu.c b/core/cpu.c index 27e0d6cf..02f6a613 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -1246,6 +1246,13 @@ void cpu_set_radix_mode(void) static void cpu_cleanup_one(void *param __unused) { + struct cpu_thread *cpu = this_cpu(); + + /* Bring SPRs back to boot state */ + if (cpu_is_thread0(cpu)) + init_shared_sprs(); + init_replicated_sprs(); + mtspr(SPR_AMR, 0); mtspr(SPR_IAMR, 0); }