Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4115659ybi; Mon, 3 Jun 2019 06:03:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJLaUas6Kh+8wvqG+Pr5B+ldtwSNUF86aJzx1KKldrBFAgDzboUCjvHQd+K8OLoK/TYqpC X-Received: by 2002:aa7:8203:: with SMTP id k3mr28164387pfi.124.1559566994275; Mon, 03 Jun 2019 06:03:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559566994; cv=none; d=google.com; s=arc-20160816; b=jZgRGlZ+yeDELfAfNe+Hub1qVTLy6bfP/emWiaWAllPVAlKuW26gjeVv2Cxw/6auSb 4CkGdC+IGwBIW74JCAU/7Z8dqdNkE1+iDuFtRZURpg81bxnP24I8kYFmBJxllAeucO13 eU1pS4pjGzC/ZBLjToPqvyuViInmKhg+0/Rm/NnYHjeRiELk20rQcG+zUiDHJsotr5cw DvYPfUVMSxfjTyvz/JWCxYrbw26zzo6ElN0PLlZM0mcDy7zgkagJSy19Cp9KOtIlDS2V Sb7cWUdDDKY/LzG7eaO7LLIUhjwjl0kmtShB9nCgSrUW72dadbgeyMAonfn2HevkhcVE 019Q== 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:message-id :dkim-signature; bh=sGfXk+kidH6pMSSQK1NVdRQ3mMjl4lldiD7dAX8TpPo=; b=sMutsDw5TTXRLB8ov5Viu18xqZDErCIGmBJ7Ik3cXqTs498qSw0RSx7Xuzpq2psEjs M7+HrtJb315vZsnlRZGt46sAnqWor1NQHSku5HywSYfu4d6Fqpr9igHAnNyk4lFW8cYo eXMTM6VMILNmL3qoCJTmuaf1pi9gNmZ7D34HrdpKr8/sCVYuynHu+d5ZKL3lrW0PjPCp b75nvdoSlyFB8jeCpF86Ftli9y1vSxqvX0k97aeMDPw0j+6j7zUhekdUHf8MvH7LrTNZ XBDq4iZRhCRskvuZUAK7I6se0CaUvHIGN4eTLxIWnlxJigE1J0ucj2rb26g0I7HvhbQi 7bJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=APkqGIzu; 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 d1si18594922pgg.412.2019.06.03.06.02.54; Mon, 03 Jun 2019 06:03:14 -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=@c-s.fr header.s=mail header.b=APkqGIzu; 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 S1727954AbfFCNAz (ORCPT + 99 others); Mon, 3 Jun 2019 09:00:55 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:37553 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727653AbfFCNAz (ORCPT ); Mon, 3 Jun 2019 09:00:55 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 45HZt74TlNz9v0wV; Mon, 3 Jun 2019 15:00:47 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=APkqGIzu; 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 moZU-hkmW74f; Mon, 3 Jun 2019 15:00:47 +0200 (CEST) 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 45HZt73Bshz9v0wS; Mon, 3 Jun 2019 15:00:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1559566847; bh=sGfXk+kidH6pMSSQK1NVdRQ3mMjl4lldiD7dAX8TpPo=; h=From:Subject:To:Cc:Date:From; b=APkqGIzuUzYD8oDm7EkOFnvEzJcNUeElo+G9IMjLsk6N/T8vMiEcMO52l3/qvxWxp JOfcMNC6RDOFRiyGY4dXJnkSy8RpGMh1nlei6+9H7MlB/nQz6iHgx/OfsEJewxT6Zf eCumgGla2x7RQR/TVGUjvg/f3ZPpK7wtXxNe1mxo= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6CD418B906; Mon, 3 Jun 2019 15:00:52 +0200 (CEST) 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 zuVuUvQGercw; Mon, 3 Jun 2019 15:00:52 +0200 (CEST) Received: from po16846vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 302FD8B905; Mon, 3 Jun 2019 15:00:52 +0200 (CEST) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 5BD30661E4; Mon, 3 Jun 2019 13:00:51 +0000 (UTC) Message-Id: <90d30adb0943a11ab127808c03229ba657478df4.1559566521.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] powerpc/32s: fix booting with CONFIG_PPC_EARLY_DEBUG_BOOTX To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mathieu Malaterre Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 3 Jun 2019 13:00:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When booting through OF, setup_disp_bat() does nothing because disp_BAT are not set. By change, it used to work because BOOTX buffer is mapped 1:1 at address 0x81000000 by the bootloader, and btext_setup_display() sets virt addr same as phys addr. But since commit 215b823707ce ("powerpc/32s: set up an early static hash table for KASAN."), a temporary page table overrides the bootloader mapping. This 0x81000000 is also problematic with the newly implemented Kernel Userspace Access Protection (KUAP) because it is within user address space. This patch fixes those issues by properly setting disp_BAT through a call to btext_prepare_BAT(), allowing setup_disp_bat() to properly setup BAT3 for early bootx screen buffer access. Reported-by: Mathieu Malaterre Fixes: 215b823707ce ("powerpc/32s: set up an early static hash table for KASAN.") Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/btext.h | 4 ++++ arch/powerpc/kernel/prom_init.c | 1 + arch/powerpc/kernel/prom_init_check.sh | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/btext.h b/arch/powerpc/include/asm/btext.h index 3ffad030393c..461b0f193864 100644 --- a/arch/powerpc/include/asm/btext.h +++ b/arch/powerpc/include/asm/btext.h @@ -13,7 +13,11 @@ extern void btext_update_display(unsigned long phys, int width, int height, int depth, int pitch); extern void btext_setup_display(int width, int height, int depth, int pitch, unsigned long address); +#ifdef CONFIG_PPC32 extern void btext_prepare_BAT(void); +#else +static inline void btext_prepare_BAT(void) { } +#endif extern void btext_map(void); extern void btext_unmap(void); diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 3555cad7bdde..ed446b7ea164 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -2336,6 +2336,7 @@ static void __init prom_check_displays(void) prom_printf("W=%d H=%d LB=%d addr=0x%x\n", width, height, pitch, addr); btext_setup_display(width, height, 8, pitch, addr); + btext_prepare_BAT(); } #endif /* CONFIG_PPC_EARLY_DEBUG_BOOTX */ } diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh index 518d416971c1..160bef0d553d 100644 --- a/arch/powerpc/kernel/prom_init_check.sh +++ b/arch/powerpc/kernel/prom_init_check.sh @@ -24,7 +24,7 @@ fi WHITELIST="add_reloc_offset __bss_start __bss_stop copy_and_flush _end enter_prom $MEM_FUNCS reloc_offset __secondary_hold __secondary_hold_acknowledge __secondary_hold_spinloop __start -logo_linux_clut224 +logo_linux_clut224 btext_prepare_BAT reloc_got2 kernstart_addr memstart_addr linux_banner _stext __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC." -- 2.13.3