Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1706848ybb; Fri, 29 Mar 2019 09:39:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJQV3lKINWcHWtU7nX9BRv8zwMLFPYalT2ZdZpYlobx2sG//BzvBQJT2/3AERfUsc5+AG8 X-Received: by 2002:a65:4108:: with SMTP id w8mr46590774pgp.236.1553877565610; Fri, 29 Mar 2019 09:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553877565; cv=none; d=google.com; s=arc-20160816; b=JJqWk5vJBAakcGLlZFDZkz+OO8RvLWrNY8XY3l8tZE1vlALWLp6txSQVqnsHPCzOQ1 0lzInpnyVSalZWndTN/gqXkjjUFfN9bmAiDs8wgglr1E6KIJ3E+mvTOLPwpqTgghczRC 9qltBKSegGOIkkhCLxTtO1LFKYWVbdFLoeer5e6GxdSOj9kgvMscAHoftk3Ime7NtgE7 aDUIQzhZ5MSea6mQqHjeBBFLKONEr+Ecb/QhrVN7aNHfXXxx6syPDCXZ8kXuPxgq1QIc CpJ1xkXALg6glbqEVZOuKY/jnYSl5Ly8m8SvZVNXnGVSqewr3cVHHJEEBFE4bVN6RA93 JEEw== 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=hTNSuBn6Dy3y0CN5HWy0crjeHC0u7sE4/2hVEVesrEE=; b=fVMcDAkdz23mkQPDHG5SdOufZPmMH3UBYC1ZOct3sPXBblnw4VDvY7CdeV8CbN2w/3 L/Nb9b84hO29b62BJ+LdmHwD7mPOQwH2lKpTHZ0RYGFaSWnfAmKUFJ5MfOnKhtd1G9Hl JnDIZU0u5cHh4VU98rs8wtrhlrBc0PT5cvrhgwtOfEYLKSndjk4K69gPT5S7vB2SmQ74 c2yx7dmD84Ix5biCsbNkQHFm+YPE9iaDpk+WEARnGsaCNvnLsTJ3ebu2W8nFjTMbynNN 9TIFPfpeSRN4i6v5BsVZ2w7z+FlazWF0gAgH7LLv2oRTckOKK8rc444q1uKTuRIq7Ilc nx/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=OnZO5l53; 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 a12si2157292pls.209.2019.03.29.09.39.09; Fri, 29 Mar 2019 09:39:25 -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=OnZO5l53; 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 S1729829AbfC2Qia (ORCPT + 99 others); Fri, 29 Mar 2019 12:38:30 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:40067 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728977AbfC2Qi0 (ORCPT ); Fri, 29 Mar 2019 12:38:26 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44W6qg0H9Yz9tyQS; Fri, 29 Mar 2019 17:38:23 +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=OnZO5l53; 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 yHX1CSOzbpRX; Fri, 29 Mar 2019 17:38:22 +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 44W6qf6Jv1z9tyQP; Fri, 29 Mar 2019 17:38:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1553877502; bh=hTNSuBn6Dy3y0CN5HWy0crjeHC0u7sE4/2hVEVesrEE=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=OnZO5l539RyilHcRtPIg2NNG0XE6szvddP1rFYlNJLGgGkc+zoGnm59tUP53eaftv iX2eu8BD/djOhF9p1Mj8QP4nRPU02ciAhZcwc6gABLbLIcocEXz8R9qzSXusHa4elc hhi3QqQKEKr5yUr/PhlmZb6a+N5kckGOyMgX89v8= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 78D618B93D; Fri, 29 Mar 2019 17:38:24 +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 jBSYhZW5DH1P; Fri, 29 Mar 2019 17:38:24 +0100 (CET) Received: from po16846vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 626FA8B938; Fri, 29 Mar 2019 17:38:24 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 58FD76FC56; Fri, 29 Mar 2019 16:38:24 +0000 (UTC) Message-Id: <81f3e0cee2dad12320f4cb01f5e8c60d0c22bccb.1553877076.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 02/17] powerpc/32: move LOAD_MSR_KERNEL() into head_32.h and use it To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 29 Mar 2019 16:38:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As preparation for using head_32.h for head_40x.S, move LOAD_MSR_KERNEL() there and use it to load r10 with MSR_KERNEL value. In the mean time, this patch modifies it so that it takes into account the size of the passed value to determine if 'li' can be used or if 'lis/ori' is needed instead of using the size of MSR_KERNEL. This is done by using gas macro. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/entry_32.S | 9 +-------- arch/powerpc/kernel/head_32.h | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index b61cfd29c76f..0ebbd23b68a9 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -37,14 +37,7 @@ #include #include -/* - * MSR_KERNEL is > 0x10000 on 4xx/Book-E since it include MSR_CE. - */ -#if MSR_KERNEL >= 0x10000 -#define LOAD_MSR_KERNEL(r, x) lis r,(x)@h; ori r,r,(x)@l -#else -#define LOAD_MSR_KERNEL(r, x) li r,(x) -#endif +#include "head_32.h" /* * Align to 4k in order to ensure that all functions modyfing srr0/srr1 diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/kernel/head_32.h index 7456e2a45acc..cf3d00844597 100644 --- a/arch/powerpc/kernel/head_32.h +++ b/arch/powerpc/kernel/head_32.h @@ -5,6 +5,19 @@ #include /* for STACK_FRAME_REGS_MARKER */ /* + * MSR_KERNEL is > 0x8000 on 4xx/Book-E since it include MSR_CE. + */ +.macro __LOAD_MSR_KERNEL r, x +.if \x >= 0x8000 + lis \r, (\x)@h + ori \r, \r, (\x)@l +.else + li \r, (\x) +.endif +.endm +#define LOAD_MSR_KERNEL(r, x) __LOAD_MSR_KERNEL r, x + +/* * Exception entry code. This code runs with address translation * turned off, i.e. using physical addresses. * We assume sprg3 has the physical address of the current @@ -89,7 +102,7 @@ #define EXC_XFER_TEMPLATE(n, hdlr, trap, copyee, tfer, ret) \ li r10,trap; \ stw r10,_TRAP(r11); \ - li r10,MSR_KERNEL; \ + LOAD_MSR_KERNEL(r10, MSR_KERNEL); \ copyee(r10, r9); \ bl tfer; \ i##n: \ -- 2.13.3