From patchwork Tue Feb 13 15:08:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 872910 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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 3zgmb00h20z9t3F for ; Wed, 14 Feb 2018 02:26:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SjRYZaJe"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zgmZz6ghRzF0bF for ; Wed, 14 Feb 2018 02:26:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="SjRYZaJe"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::241; helo=mail-pg0-x241.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="SjRYZaJe"; dkim-atps=neutral Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (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 3zgmCH4kjhzF1PT for ; Wed, 14 Feb 2018 02:08:59 +1100 (AEDT) Received: by mail-pg0-x241.google.com with SMTP id a11so28416pgu.13 for ; Tue, 13 Feb 2018 07:08:59 -0800 (PST) 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=H1Co9oIpLGuFX4rJn1vTWFopLZ2ufsAgTzFk6IVsr/c=; b=SjRYZaJeMVMysQ/U0+7Ul3UOxquxU7rR//YrZHtzyr6ZFRE6451eawRF24SewpYEzA /wxNEQFhisTl8HMioi18dz9D+1NLzpUh/Je3fgqEhCI8Cd4YYtdkc05y2cRdkDKqMV94 ZIuQ+kc6ISX2F0C69yF19t8bW+4oTUvvJ7HJqzI5u23Q+f5aHjI0yJ50xBU+bex6bQx8 339JNSmcCs7VIqNXxwbn4Qn1vXAiJ34tTM4hyJCoqxL/zLBhF5gj4Y3npC9CGmKLM9Bg yRy2YRX0VFba3jPrFzJFLjRRCi4XFJwDxtec7C1HBA0tDkF4GIY7tkZX7v0o0k/GFrl4 egqA== 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=H1Co9oIpLGuFX4rJn1vTWFopLZ2ufsAgTzFk6IVsr/c=; b=uEGFVTUsJ1RhQ9pWjwQBB1sY5zV5NnMIRUJZagPn2Cwc+TLPlAytfbbcfHF4cJZiU3 CVUKZiUV8Q+DboWpXmPJGCQuTINrPOk4QxETwiPYzN78j8MZX0xBG6ErrF3w8vrplRfo pHiv2mc0L1ACb8IKYUEmfrg8q+QWxkm9Ps5AQeHmf96QjVVJALsHSMoeeepzurWniMIJ Ml3usOBB8ertgvzkdV7F9JjFgfDMlUfyAniqTebYRgB2AS3SePnEyRYf5VFjNON0TWFI fVI4BfMpBhUiiOeLm5lkswfxEX/kt47BRMxile311+NuTS1GEiCkswMWmAAUdFvVFaxc jWhw== X-Gm-Message-State: APf1xPBss7XnoqM8FqJeQ5JjzcsMRazm/RptwRL3h+aPbGdN58uTqGrJ KFtg1YDqWwj34h0xxuEQnNGvoA== X-Google-Smtp-Source: AH8x226Qhd8pdz4Fe02dKver2yVRq0iM/UYIH+8BpCLeXovcB6Tpc90zsqktpaS4Xb7AbYq266e6IQ== X-Received: by 10.98.108.133 with SMTP id h127mr1572461pfc.50.1518534537751; Tue, 13 Feb 2018 07:08:57 -0800 (PST) Received: from roar.local0.net ([202.7.219.42]) by smtp.gmail.com with ESMTPSA id f123sm24720533pgc.55.2018.02.13.07.08.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 07:08:56 -0800 (PST) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 07/14] powerpc/64: move default SPR recording Date: Wed, 14 Feb 2018 01:08:17 +1000 Message-Id: <20180213150824.27689-8-npiggin@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180213150824.27689-1-npiggin@gmail.com> References: <20180213150824.27689-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Move this into the early setup code, and don't iterate over CPU masks. We don't want to call into sysfs so early from setup, and a future patch won't initialize CPU masks by the time this is called. --- arch/powerpc/kernel/paca.c | 3 +++ arch/powerpc/kernel/setup.h | 9 +++------ arch/powerpc/kernel/setup_64.c | 8 ++++++++ arch/powerpc/kernel/sysfs.c | 18 +++++++----------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index 2699f9009286..e560072f122b 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c @@ -133,6 +133,9 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu) new_paca->kexec_state = KEXEC_STATE_NONE; new_paca->__current = &init_task; new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL; +#ifdef CONFIG_PPC64 + new_paca->dscr_default = spr_default_dscr; +#endif #ifdef CONFIG_PPC_BOOK3S_64 new_paca->slb_shadow_ptr = NULL; #endif diff --git a/arch/powerpc/kernel/setup.h b/arch/powerpc/kernel/setup.h index 3fc11e30308f..d144df54ad40 100644 --- a/arch/powerpc/kernel/setup.h +++ b/arch/powerpc/kernel/setup.h @@ -45,14 +45,11 @@ void emergency_stack_init(void); static inline void emergency_stack_init(void) { }; #endif -#ifdef CONFIG_PPC64 -void record_spr_defaults(void); -#else -static inline void record_spr_defaults(void) { }; -#endif - #ifdef CONFIG_PPC64 u64 ppc64_bolted_size(void); + +/* Default SPR values from firmware/kexec */ +extern unsigned long spr_default_dscr; #endif /* diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 3ce12af4906f..dde34d35d1e7 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -254,6 +254,14 @@ static void cpu_ready_for_interrupts(void) get_paca()->kernel_msr = MSR_KERNEL; } +unsigned long spr_default_dscr = 0; + +void __init record_spr_defaults(void) +{ + if (early_cpu_has_feature(CPU_FTR_DSCR)) + spr_default_dscr = mfspr(SPRN_DSCR); +} + /* * Early initialization entry point. This is called by head.S * with MMU translation disabled. We rely on the "feature" of diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 1f9d94dac3a6..ab4eb61fe659 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -588,21 +588,17 @@ static DEVICE_ATTR(dscr_default, 0600, static void sysfs_create_dscr_default(void) { - int err = 0; - if (cpu_has_feature(CPU_FTR_DSCR)) - err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); -} - -void __init record_spr_defaults(void) -{ - int cpu; - if (cpu_has_feature(CPU_FTR_DSCR)) { - dscr_default = mfspr(SPRN_DSCR); - for (cpu = 0; cpu < nr_cpu_ids; cpu++) + int err = 0; + int cpu; + + for_each_possible_cpu(cpu) paca_ptrs[cpu]->dscr_default = dscr_default; + + err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); } } + #endif /* CONFIG_PPC64 */ #ifdef HAS_PPC_PMC_PA6T