Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp650259img; Fri, 22 Mar 2019 05:56:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzi3L3bNKcY4Gw9sJo3Z4S4naVY4dG2CvDr9c3ZBndAUi14+84AH1TFjOxuH6VreXjfB38H X-Received: by 2002:a62:5c87:: with SMTP id q129mr8768747pfb.180.1553259411552; Fri, 22 Mar 2019 05:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553259411; cv=none; d=google.com; s=arc-20160816; b=M/sbRRr9oonHVMFT0qJ8OIiFFNYzUSCoCOUDcDdEp6Xb7axUXfbl5Z1QqIIOhw52bA 2FRI89i9WbyJ7aUJcfiRoOUGPUudUXIV0Okpu57OMvUDlshm51QxTfueAhUbAPDp8B/0 uYurHRUpV6ozQcPhlMHh6R5dhFWJG8pVRNY4Bi/8HjO8UFV53/HnWyb+ykwvqYB6+OqX zEPNewcW4E25Z5jR9yY68fN3ksV6M2WB9KBVi2VD6F1jMjuG0diLX/aupa3PzuKPKFwT cFpYED6Eilv62lzSgYTYkrn/ZFEXfnm7sp441pI8HhOVf9ML5aBxCYE4YKlZi15mibMe 3N4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h9xZmerN3VsFez5gjgfmqPmuglFAHLDGdq4N7gwC5d0=; b=LlQTHfr3OBMgw0aEXSYTaHsKQsujW0oy0+S8/dv9QuoWsvY3+bTOhvYdhxgBwT1lT8 YdyEhiYlKVZyU0NXa4CBW61DpYFtkwbu1krSF0wvxskpuqnc5ewHioFJwAO/WPYRsXj1 TcxobKYne6qJ3ep5rzRfruO5m70qmUMWJ5eey+7FUen6T8zk9Rx4wmY7WlbGu4sO5cf4 GYOxfKnkHLNKgY4SKmVtPvm8fd+ZbbhHaag71ncCduPQcmSZVeCiviGnvUvPcfNZxt5V gBjcEOiUCOvj7zSQOwXm53DlhkMjHPzJsboEPwqq2Dhu7UzqzghBCDU7OHvztaq2Fg2+ oKwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x5uIgH0e; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si6524624plt.12.2019.03.22.05.56.33; Fri, 22 Mar 2019 05:56:51 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=x5uIgH0e; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732696AbfCVLuv (ORCPT + 99 others); Fri, 22 Mar 2019 07:50:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:54588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732676AbfCVLuq (ORCPT ); Fri, 22 Mar 2019 07:50:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0FFD22082C; Fri, 22 Mar 2019 11:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553255445; bh=WXLmifJiRhfuFN8FXmqsTfunqsEOECXfNNN2sjebvmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5uIgH0eBG3iGC2yOJ5LK5FDaGqWuWSIYYSsDzLBr2THxG+H0YNntUx/vZ84VCkfe LvHgm1nbaJddXmI5DD3daiTw0j6iMgoWc072GgnpRhq+HLrw47KnKBAD1nmept+htG fuaEnJM4/SuZwxsgJ+BsvRBnLqN5Vb+wBRlPSVgM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Schwidefsky Subject: [PATCH 4.14 093/183] s390/setup: fix early warning messages Date: Fri, 22 Mar 2019 12:15:21 +0100 Message-Id: <20190322111248.454011621@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111241.819468003@linuxfoundation.org> References: <20190322111241.819468003@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Schwidefsky commit 8727638426b0aea59d7f904ad8ddf483f9234f88 upstream. The setup_lowcore() function creates a new prefix page for the boot CPU. The PSW mask for the system_call, external interrupt, i/o interrupt and the program check handler have the DAT bit set in this new prefix page. At the time setup_lowcore is called the system still runs without virtual address translation, the paging_init() function creates the kernel page table and loads the CR13 with the kernel ASCE. Any code between setup_lowcore() and the end of paging_init() that has a BUG or WARN statement will create a program check that can not be handled correctly as there is no kernel page table yet. To allow early WARN statements initially setup the lowcore with DAT off and set the DAT bit only after paging_init() has completed. Cc: stable@vger.kernel.org Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/setup.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -300,7 +300,7 @@ early_param("vmalloc", parse_vmalloc); void *restart_stack __section(.data); -static void __init setup_lowcore(void) +static void __init setup_lowcore_dat_off(void) { struct lowcore *lc; @@ -311,19 +311,16 @@ static void __init setup_lowcore(void) lc = memblock_virt_alloc_low(sizeof(*lc), sizeof(*lc)); lc->restart_psw.mask = PSW_KERNEL_BITS; lc->restart_psw.addr = (unsigned long) restart_int_handler; - lc->external_new_psw.mask = PSW_KERNEL_BITS | - PSW_MASK_DAT | PSW_MASK_MCHECK; + lc->external_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK; lc->external_new_psw.addr = (unsigned long) ext_int_handler; lc->svc_new_psw.mask = PSW_KERNEL_BITS | - PSW_MASK_DAT | PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; + PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK; lc->svc_new_psw.addr = (unsigned long) system_call; - lc->program_new_psw.mask = PSW_KERNEL_BITS | - PSW_MASK_DAT | PSW_MASK_MCHECK; + lc->program_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK; lc->program_new_psw.addr = (unsigned long) pgm_check_handler; lc->mcck_new_psw.mask = PSW_KERNEL_BITS; lc->mcck_new_psw.addr = (unsigned long) mcck_int_handler; - lc->io_new_psw.mask = PSW_KERNEL_BITS | - PSW_MASK_DAT | PSW_MASK_MCHECK; + lc->io_new_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK; lc->io_new_psw.addr = (unsigned long) io_int_handler; lc->clock_comparator = clock_comparator_max; lc->kernel_stack = ((unsigned long) &init_thread_union) @@ -391,6 +388,17 @@ static void __init setup_lowcore(void) lowcore_ptr[0] = lc; } +static void __init setup_lowcore_dat_on(void) +{ + struct lowcore *lc; + + lc = lowcore_ptr[0]; + lc->external_new_psw.mask |= PSW_MASK_DAT; + lc->svc_new_psw.mask |= PSW_MASK_DAT; + lc->program_new_psw.mask |= PSW_MASK_DAT; + lc->io_new_psw.mask |= PSW_MASK_DAT; +} + static struct resource code_resource = { .name = "Kernel code", .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, @@ -948,7 +956,7 @@ void __init setup_arch(char **cmdline_p) #endif setup_resources(); - setup_lowcore(); + setup_lowcore_dat_off(); smp_fill_possible_mask(); cpu_detect_mhz_feature(); cpu_init(); @@ -961,6 +969,12 @@ void __init setup_arch(char **cmdline_p) */ paging_init(); + /* + * After paging_init created the kernel page table, the new PSWs + * in lowcore can now run with DAT enabled. + */ + setup_lowcore_dat_on(); + /* Setup default console */ conmode_default(); set_preferred_console();