Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7420081yba; Thu, 2 May 2019 09:30:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSwiYHtToIpOMYUpidT+0hvb4q5feJrwswzkHsuUwQH8Df6u8sDpYzMDlNjAnuulx+GFg+ X-Received: by 2002:a17:902:2924:: with SMTP id g33mr4741985plb.26.1556814644745; Thu, 02 May 2019 09:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556814644; cv=none; d=google.com; s=arc-20160816; b=H6WnTQ23hg0dD38LJH0s/EDDeI8iC+YntI/ABsnijIoJggjmXGm1vPFll5fE9h9jf7 xsmqNuwBaBYYH1m4ZEqihEAI9lQXcV2C1/XrSxbuYc4u295VlylnMs7KFIH5XL5fmhQ/ 6P1EzVAy4E8IS9zagOW7Epny23SErhkI2X+eve45wrkzRksH7kz7uxJSnLZSoHP/yLTs /EN/6RYjs9JwfDlarmJCCnOi8sk7j5+cQWuKd3IcQPkV081U2x/HpZAltxc+cQbY45H5 8u8Fe7fqfZu0N+UI/YQIobhvlXGusOrZlvt2+GjEetWUFVrFomhLWO8gEbQq6mG8W8AP 7kUA== 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=iX8N4X4/3jjKfRo8rxN9aW8cVxuV4eTVr3P4dhOrlOU=; b=qP3V9gSci2WSAW0pusRqkDHkYxMDkuD/QtZ9PG9dOAyuPmHejrEnjBJvOEqaFA9NYi b0KEm5gOEoVmxABPTOjrxwflVe0PvQs/JOVYyAle56XDknHKpJtAyN/trR1TWWmmYH34 DTPr4HurpMu3hSdZPCR19Qa1juqKZI0YKOeJ7LEsn7X5zYHtDuTLxkOD2hQunT3ORAak 7i2Tj+Fnv08ptdsTw0cQuuJauqZk0kJsgdcw+lv+mZG9NCCr53K8r97GURioJ4aCUKbr XSsB9ms5u2f1k3SqJV61Fb1/H1bp5c+dl0r2vZjjK//ytTnNBdvLPQYwak6JuyNfg3WR jCkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=VoBsxNlz; 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 a9si43824374pfc.46.2019.05.02.09.30.28; Thu, 02 May 2019 09:30:44 -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=VoBsxNlz; 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 S1726549AbfEBQ1c (ORCPT + 99 others); Thu, 2 May 2019 12:27:32 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:4767 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726283AbfEBQ1c (ORCPT ); Thu, 2 May 2019 12:27:32 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44w0zN6BMBz9tycl; Thu, 2 May 2019 18:27:28 +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=VoBsxNlz; 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 Lfd0sENGpsVg; Thu, 2 May 2019 18:27:28 +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 44w0zN576Xz9tyck; Thu, 2 May 2019 18:27:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1556814448; bh=iX8N4X4/3jjKfRo8rxN9aW8cVxuV4eTVr3P4dhOrlOU=; h=From:Subject:To:Cc:Date:From; b=VoBsxNlzz9eC6YVtElAtODt4EuGF5A3Xq6mQaiwLsl56b6KkjMOecvheqzJ/GC0aF BUmTl5UaUoIB47hO4ofSSa/aXhZYPSAnLLMdhlKvuV7Ri6z2LaidCFbpW6AtCkw/Y2 +DsVVlfUjIAeA+SqajX45OWMxytPUHvbXq5DUAhE= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 604178B8FE; Thu, 2 May 2019 18:27:30 +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 KPo6y13lIc8o; Thu, 2 May 2019 18:27:30 +0200 (CEST) Received: from po16846vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3C2778B899; Thu, 2 May 2019 18:27:30 +0200 (CEST) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id E0BE6672AF; Thu, 2 May 2019 16:27:29 +0000 (UTC) Message-Id: <298f344bdb21ab566271f5d18c6782ed20f072b7.1556814003.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v2 1/3] powerpc: Move PPC_HA() PPC_HI() and PPC_LO() to ppc-opcode.h To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 2 May 2019 16:27:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PPC_HA() PPC_HI() and PPC_LO() macros are nice macros. Move them from module64.c to ppc-opcode.h in order to use them in other places. Signed-off-by: Christophe Leroy --- v2: no change arch/powerpc/include/asm/ppc-opcode.h | 7 +++++++ arch/powerpc/kernel/module_64.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 23f7ed796f38..c5ff44400d4d 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h @@ -412,6 +412,13 @@ #define __PPC_SPR(r) ((((r) & 0x1f) << 16) | ((((r) >> 5) & 0x1f) << 11)) #define __PPC_RC21 (0x1 << 10) +/* Both low and high 16 bits are added as SIGNED additions, so if low + 16 bits has high bit set, high 16 bits must be adjusted. These + macros do that (stolen from binutils). */ +#define PPC_LO(v) ((v) & 0xffff) +#define PPC_HI(v) (((v) >> 16) & 0xffff) +#define PPC_HA(v) PPC_HI ((v) + 0x8000) + /* * Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a * larx with EH set as an illegal instruction. diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c index 8661eea78503..c2e1b06253b8 100644 --- a/arch/powerpc/kernel/module_64.c +++ b/arch/powerpc/kernel/module_64.c @@ -400,13 +400,6 @@ static inline unsigned long my_r2(const Elf64_Shdr *sechdrs, struct module *me) return (sechdrs[me->arch.toc_section].sh_addr & ~0xfful) + 0x8000; } -/* Both low and high 16 bits are added as SIGNED additions, so if low - 16 bits has high bit set, high 16 bits must be adjusted. These - macros do that (stolen from binutils). */ -#define PPC_LO(v) ((v) & 0xffff) -#define PPC_HI(v) (((v) >> 16) & 0xffff) -#define PPC_HA(v) PPC_HI ((v) + 0x8000) - /* Patch stub to reference function and correct r2 value. */ static inline int create_stub(const Elf64_Shdr *sechdrs, struct ppc64_stub_entry *entry, -- 2.13.3