Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4162429ybc; Tue, 26 Nov 2019 04:56:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyVWB+AxpAoVR2RO0qsAqvbLG7aZ3IORnIJojTKR5yJcvEHzPj4JWulFHEig2X3U0F+eVlW X-Received: by 2002:a50:f40c:: with SMTP id r12mr24607498edm.16.1574772991244; Tue, 26 Nov 2019 04:56:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574772991; cv=none; d=google.com; s=arc-20160816; b=pz+ETvXkGiCM9Ar7wuki0em2PO2JmUNMQsuza4yvja+bDZfGZ5u42KAW0jQ5fh1Wrd 6pAQ5v191S1nxj49DDgYoEo2twCZmYRVgZnFrEMKpmeG/XR1n7CehZsPzEuo7MRA8f1w ncT9eL4+mDViCCt7f3it0+xlrdHc1x2vj2O6fdsDKRgAnRblrFnlBI22QtFC2ad3og5g WgQHGsmWcNlALbA888QRhJ26c72uBgp8m7NmykNXaNU877u19SkY2ccsXAIa1+EGJAxK D0Upya7NTrnW5ekTpxOMsGkUAeH0TiO4AXEJmCyW3vs/BtJpky2nBYuUlinOrKQvCcfa yhUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=Ar/ct3NNaf+HbYSsxVtRX3VS8CK/4uc5aDhVdyMVjyE=; b=g5WF9iLGDG05j6yle506rq9qC74F9itAhzijxlhhMTjrkZPsHS9GBk3pwn5NfL8gJk ZMoSjlL4xBswZJbut/SGePbk5U6tBO++7w4D83fwoz0eq9OEWqBRljwFl+OjmHD9jTXf NabRrvulkOyfVaKrwhk/4LGLc10nJ7D4ITuzvUnsAdXeBn4C3QoLoclqebH8/WHkhoz7 0ENy/CXhvRMlUWpPnP9SCLXy5iHc168eNZKQkOkeWNRFVy9aupjGwM0tmMmC2oqKKpsq 7ZsQBlbFBpUbYi3hkVhcshPTG1q4cyRh/LqGUEOXuPv3rM1ZBaYMDmKUQrGK2ggjd+Ro HLnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=rnM9a3rf; 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 b29si8209145ede.118.2019.11.26.04.56.07; Tue, 26 Nov 2019 04:56:31 -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; dkim=pass header.i=@c-s.fr header.s=mail header.b=rnM9a3rf; 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 S1728549AbfKZMg2 (ORCPT + 99 others); Tue, 26 Nov 2019 07:36:28 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:25835 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728482AbfKZMgT (ORCPT ); Tue, 26 Nov 2019 07:36:19 -0500 Received: from localhost (mailhub1-ext [192.168.12.233]) by localhost (Postfix) with ESMTP id 47Mk0c49Qsz9v0GD; Tue, 26 Nov 2019 13:36:16 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=rnM9a3rf; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id z2fMyooi37to; Tue, 26 Nov 2019 13:36:16 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 47Mk0c37FSz9v0G3; Tue, 26 Nov 2019 13:36:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1574771776; bh=Ar/ct3NNaf+HbYSsxVtRX3VS8CK/4uc5aDhVdyMVjyE=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=rnM9a3rfcPFiw9feHnbKJR/auwCb44b4MXYypNITwv/SRJa0tmV3N1+SF4p9Cgrsq 8mkODkEu1Mdze10d6W3bJuvW9RO5pIzkPNZe+Luwazyv/anIAqBJ+fIaVZi7Af7aN5 5cEy/0/fLhL4GYpDAMTIgxZBIp4+6d7N7e5Wf6UY= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A5E2E8B7FC; Tue, 26 Nov 2019 13:36:17 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id GSuhxnYpgQ1m; Tue, 26 Nov 2019 13:36:17 +0100 (CET) Received: from po16098vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 695328B771; Tue, 26 Nov 2019 13:36:17 +0100 (CET) Received: by po16098vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 3C0BF6B76A; Tue, 26 Nov 2019 12:36:17 +0000 (UTC) Message-Id: <97f35764b76f8abcaec8eb83f034367b02c13cc5.1574771541.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v4 13/16] powerpc/8xx: Enable CONFIG_VMAP_STACK To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org Date: Tue, 26 Nov 2019 12:36:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch enables CONFIG_VMAP_STACK. For that, a few changes are done in head_8xx.S. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 34 ++++++++++++++++++++++++++++------ arch/powerpc/platforms/Kconfig.cputype | 1 + 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 225e242ce1c5..fc6d4d10e298 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -127,7 +127,7 @@ instruction_counter: /* Machine check */ . = 0x200 MachineCheck: - EXCEPTION_PROLOG + EXCEPTION_PROLOG dar save_dar_dsisr_on_stack r4, r5, r11 li r6, RPN_PATTERN mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */ @@ -140,7 +140,7 @@ MachineCheck: /* Alignment exception */ . = 0x600 Alignment: - EXCEPTION_PROLOG + EXCEPTION_PROLOG dar save_dar_dsisr_on_stack r4, r5, r11 li r6, RPN_PATTERN mtspr SPRN_DAR, r6 /* Tag DAR, to be used in DTLB Error */ @@ -457,20 +457,26 @@ InstructionTLBError: */ . = 0x1400 DataTLBError: - EXCEPTION_PROLOG_0 + EXCEPTION_PROLOG_0 dar mfspr r11, SPRN_DAR cmpwi cr1, r11, RPN_PATTERN beq- cr1, FixupDAR /* must be a buggy dcbX, icbi insn. */ DARFixed:/* Return from dcbx instruction bug workaround */ +#ifdef CONFIG_VMAP_STACK + li r11, RPN_PATTERN + mtspr SPRN_DAR, r11 /* Tag DAR, to be used in DTLB Error */ +#endif EXCEPTION_PROLOG_1 - EXCEPTION_PROLOG_2 + EXCEPTION_PROLOG_2 dar get_and_save_dar_dsisr_on_stack r4, r5, r11 andis. r10,r5,DSISR_NOHPTE@h beq+ .Ldtlbie tlbie r4 .Ldtlbie: +#ifndef CONFIG_VMAP_STACK li r10,RPN_PATTERN mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */ +#endif /* 0x300 is DataAccess exception, needed by bad_page_fault() */ EXC_XFER_LITE(0x300, handle_page_fault) @@ -492,16 +498,20 @@ DARFixed:/* Return from dcbx instruction bug workaround */ */ do_databreakpoint: EXCEPTION_PROLOG_1 - EXCEPTION_PROLOG_2 + EXCEPTION_PROLOG_2 dar addi r3,r1,STACK_FRAME_OVERHEAD mfspr r4,SPRN_BAR stw r4,_DAR(r11) +#ifdef CONFIG_VMAP_STACK + lwz r5,_DSISR(r11) +#else mfspr r5,SPRN_DSISR +#endif EXC_XFER_STD(0x1c00, do_break) . = 0x1c00 DataBreakpoint: - EXCEPTION_PROLOG_0 + EXCEPTION_PROLOG_0 dar mfspr r11, SPRN_SRR0 cmplwi cr1, r11, (.Ldtlbie - PAGE_OFFSET)@l cmplwi cr7, r11, (.Litlbie - PAGE_OFFSET)@l @@ -530,6 +540,11 @@ InstructionBreakpoint: EXCEPTION(0x1e00, Trap_1e, unknown_exception, EXC_XFER_STD) EXCEPTION(0x1f00, Trap_1f, unknown_exception, EXC_XFER_STD) +#ifdef CONFIG_VMAP_STACK +stack_ovf_trampoline: + b stack_ovf +#endif + . = 0x2000 /* This is the procedure to calculate the data EA for buggy dcbx,dcbi instructions @@ -650,7 +665,14 @@ FixupDAR:/* Entry point for dcbx workaround. */ 152: mfdar r11 mtctr r11 /* restore ctr reg from DAR */ +#ifdef CONFIG_VMAP_STACK + mfspr r11, SPRN_SPRG_THREAD + stw r10, DAR(r11) + mfspr r10, SPRN_DSISR + stw r10, DSISR(r11) +#else mtdar r10 /* save fault EA to DAR */ +#endif mfspr r10,SPRN_M_TW b DARFixed /* Go back to normal TLB handling */ diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 1e352c2eea7a..f0583251e9a3 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -49,6 +49,7 @@ config PPC_8xx select PPC_HAVE_KUEP select PPC_HAVE_KUAP select PPC_MM_SLICES if HUGETLB_PAGE + select HAVE_ARCH_VMAP_STACK config 40x bool "AMCC 40x" -- 2.13.3