Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1631258imj; Fri, 8 Feb 2019 04:54:37 -0800 (PST) X-Google-Smtp-Source: AHgI3IbYwNNEg5+wP6LE7MrimtDJtlV4jq8QHH0FMf9rwFJ9LFA7n684Moe0eqJFdJdQt0+ap5+L X-Received: by 2002:a63:2507:: with SMTP id l7mr4808231pgl.22.1549630477655; Fri, 08 Feb 2019 04:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549630477; cv=none; d=google.com; s=arc-20160816; b=vnZfwUma3UBd34t7Y3cgOXARSSaUs7jUEluUXk5EWGxVNANXI1rMwjacWJDB/RdzQ9 MamZW6MGS/rENOAE3MRzI94xmYW/Tx5S2K7z02q6humD452H/pzvxZhu99G85e41u3ml 0FhA9dvzYz70wglW7x7QInrRjPNF2ehGaYJqG7kIdpNh28Mn/22SbC7TyRVILF70ku42 GtFigxKeqBVSXAdb6OCxFFFhnL+/zndlOap/hK4d+9tHg1f9/+r8guTwEi4Im9nK6z/s dH86K5bNiFB4vJzOWhBh8oNGI6cULq4TAYBVgeGxo+ajoJdVZdw0J+ESjtTP9VOSxCU2 9Nog== 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=v39Yv2nCAjGALaP9WAqaQxXxMbLYvvHMp4UEgCBdEzI=; b=IJamfBq/Lds8YCPXuFqS7uu3Vhs7TyNYD8TwUb4jd9/1oEb9nuGzhaO6oRrLU0KHfK hJdvnkPbtSnEWpxo5NLlu7JQ5eNwGEGgUSKd00812JS5h+P5Rd6ki41SQmG+EZX28DSw RwcSV/861Dv14S/nGNcUFJ7gQKfe1VVRzAB5t9HqsM9CQ6nSzIUuYCpBwNT9QD3+a8DY lClixFnDoaecGfct3cqsz30u1VgjWDVtDgqtMPFTaG8yKV6KAAw3yg/LTE5kCOWBn/q0 lakjLS2pBv+fLQCwD7bdCYBK5e16yC3pCmoILA+rvFvI5P2bIXUW7t22jKltGXfisbBZ lw0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=eWeKl4UQ; 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 n2si2074326pgr.67.2019.02.08.04.54.22; Fri, 08 Feb 2019 04:54:37 -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=eWeKl4UQ; 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 S1727651AbfBHMxm (ORCPT + 99 others); Fri, 8 Feb 2019 07:53:42 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:63368 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbfBHMwY (ORCPT ); Fri, 8 Feb 2019 07:52:24 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43ww7V1qJSz9v0dN; Fri, 8 Feb 2019 13:52:22 +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=eWeKl4UQ; 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 zCn_h22xBjln; Fri, 8 Feb 2019 13:52: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 43ww7V0pS0z9v0dJ; Fri, 8 Feb 2019 13:52:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1549630342; bh=v39Yv2nCAjGALaP9WAqaQxXxMbLYvvHMp4UEgCBdEzI=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=eWeKl4UQrEvU76ujptCMLEiIBPhdhGi0ThFgUKgVkPI8I/qwcSkutkCVmG38i1nAl yt1a1wR0wUJrp8oP+33/9KdHmv3aYyLP/uHglq/K2C6xANN1NjrFTNByvMZI1yvZkJ bnjiYpR3JXEjDqobF7Hyuuw8DGhL39oOVKDAPbEA= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 28CDD8B8D9; Fri, 8 Feb 2019 13:52:23 +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 dLzLGRLd2gVy; Fri, 8 Feb 2019 13:52:23 +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 092C58B756; Fri, 8 Feb 2019 13:52:23 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id F3B4D653E8; Fri, 8 Feb 2019 12:52:22 +0000 (UTC) Message-Id: <1946d8ed86a92a9a6827ec260d0d9c99e0d88184.1549630193.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 03/16] 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, 8 Feb 2019 12:52:22 +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 a5e2d5585dcb..b489aebdc5c5 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