Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6283955ybe; Wed, 18 Sep 2019 00:34:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlWdHbRQKPBdYjp7kfRFwJXC+F/eMTe2c4wMoz9FQACg25nqikw9MX10Q/dX35YGiMhe3W X-Received: by 2002:a17:906:128a:: with SMTP id k10mr8479372ejb.9.1568792056964; Wed, 18 Sep 2019 00:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568792056; cv=none; d=google.com; s=arc-20160816; b=dD3m2S+iHN/GeDGxRzM00MubvmMXz+iWwXwHkfB1qFzbARXpQZ2dRcU2KPWHhLjYGt lo4DJe/KluvECFY1+PrHQWdCZ9YNNJeaD0VBAs4/OQip2Ts8O6H31kASgn22EHl+T5UH ub4p7+JKANJOXt/qO33RtOjWQlC32lz2i4QmTBqwFtuit1/mNhUOpmuj20E4KgRr+iV3 +RELPu7vw6TbJhJ0dvIkrtIDbT3yt9joDaUFFZGcLUvu6m81aidP7haxhPTdsWXoYFvM x+edfITIUSUnhP1lfu6dkLGkowkk9LbDFGB36f+v3h9Z6V8JfZDR7BDAFZIkfUaumBL0 J57Q== 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=gmwzwNBmbgLQUoNO8iWqOoZD/2/k9hvbGKy++vc6twA=; b=HbswLHDEE70q+s5kRQi7VO8hZMbAZhwLU1xOcvb1oTVU0VvjQN85368jtkeZpHv/xh 5aIMwooymrWMBcDvND90wuuFYd8zK3Ke4SdZOaurEZCUZxzfT4kwRSB/BaTVwco+aN4I /rmoqnRkqXJBaCZwPPFbdsXeBJMsGgjgxrH6ZbmJvQkJ4+2rjAXx5QlPwYEHq4+vVxEK 7JU6QfSLUc/ABUX4ccWI3wtxu9Qn31t7GL43sW4m8eVJGhG3SOPS+OKkgdRaY/OfIPR7 SQrNnBgji3+ibieWCKTfQXBXpLGTYoCw+8Ph7kTdc0jSUyPC2OEUjLeAw5YVBQuPzvji C9Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="R36EQn4/"; 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 r2si2369499ejp.57.2019.09.18.00.33.52; Wed, 18 Sep 2019 00:34:16 -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="R36EQn4/"; 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 S1728511AbfIRD53 (ORCPT + 99 others); Tue, 17 Sep 2019 23:57:29 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:28242 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726138AbfIRD52 (ORCPT ); Tue, 17 Sep 2019 23:57:28 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46Y5lp1CYsz9txbD; Wed, 18 Sep 2019 05:57:26 +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=R36EQn4/; 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 J9iZYsVCWtsb; Wed, 18 Sep 2019 05:57:26 +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 46Y5lp09CTz9txbB; Wed, 18 Sep 2019 05:57:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1568779046; bh=gmwzwNBmbgLQUoNO8iWqOoZD/2/k9hvbGKy++vc6twA=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=R36EQn4/AGZQXQlLQMP4WDwtc5Mw2FT72VMVJQ20BapsxLfF/nJ4ZRyNfQWkNEaGV Ds1Y00urQRv1E5hu9ovs7CqySY3Scl1d9rd1nv/nPoLWT+zfuKojQXii/10yAHLUyw xA/252+jN1ORvAXOHJfbU9T41QlWUM9BS4LSzCXI= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id ABEBA8B7B4; Wed, 18 Sep 2019 05:57:26 +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 YpaIuwbc2CFQ; Wed, 18 Sep 2019 05:57:26 +0200 (CEST) Received: from pc16032vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6C82E8B7B0; Wed, 18 Sep 2019 05:57:26 +0200 (CEST) Received: by pc16032vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 2F33969881; Wed, 18 Sep 2019 03:57:26 +0000 (UTC) Message-Id: <6f9628f94976a659904863d6916db86405320872.1568778945.git.christophe.leroy@c-s.fr> In-Reply-To: <54e363e268a5b391ed69ca71ee01403d186d37a6.1568778945.git.christophe.leroy@c-s.fr> References: <54e363e268a5b391ed69ca71ee01403d186d37a6.1568778945.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v2 2/2] powerpc/irq: inline call_do_irq() and call_do_softirq() To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , segher@kernel.crashing.org, npiggin@gmail.com Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 18 Sep 2019 03:57:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org call_do_irq() and call_do_softirq() are quite similar on PPC32 and PPC64 and are simple enough to be worth inlining. Inlining them avoids an mflr/mtlr pair plus a save/reload on stack. This is inspired from S390 arch. Several other arches do more or less the same. The way sparc arch does seems odd thought. Signed-off-by: Christophe Leroy --- v2: no change. --- arch/powerpc/include/asm/irq.h | 2 -- arch/powerpc/kernel/irq.c | 26 ++++++++++++++++++++++++++ arch/powerpc/kernel/misc_32.S | 25 ------------------------- arch/powerpc/kernel/misc_64.S | 22 ---------------------- 4 files changed, 26 insertions(+), 49 deletions(-) diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index 70922661450e..86e8dbaecb7d 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h @@ -56,8 +56,6 @@ extern void *mcheckirq_ctx[NR_CPUS]; extern void *hardirq_ctx[NR_CPUS]; extern void *softirq_ctx[NR_CPUS]; -void call_do_softirq(void *sp); -void call_do_irq(struct pt_regs *regs, void *sp); extern void do_IRQ(struct pt_regs *regs); extern void __init init_IRQ(void); extern void __do_irq(struct pt_regs *regs); diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 04204be49577..b028c49f9635 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -642,6 +642,20 @@ void __do_irq(struct pt_regs *regs) irq_exit(); } +static inline void call_do_irq(struct pt_regs *regs, void *sp) +{ + register unsigned long r3 asm("r3") = (unsigned long)regs; + + asm volatile( + " "PPC_STLU" 1, %2(%1);\n" + " mr 1, %1;\n" + " bl %3;\n" + " "PPC_LL" 1, 0(1);\n" : "+r"(r3) : + "b"(sp), "i"(THREAD_SIZE - STACK_FRAME_OVERHEAD), "i"(__do_irq) : + "lr", "xer", "ctr", "memory", "cr0", "cr1", "cr5", "cr6", "cr7", + "r0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"); +} + void do_IRQ(struct pt_regs *regs) { struct pt_regs *old_regs = set_irq_regs(regs); @@ -686,6 +700,18 @@ void *mcheckirq_ctx[NR_CPUS] __read_mostly; void *softirq_ctx[NR_CPUS] __read_mostly; void *hardirq_ctx[NR_CPUS] __read_mostly; +static inline void call_do_softirq(const void *sp) +{ + asm volatile( + " "PPC_STLU" 1, %1(%0);\n" + " mr 1, %0;\n" + " bl %2;\n" + " "PPC_LL" 1, 0(1);\n" : : + "b"(sp), "i"(THREAD_SIZE - STACK_FRAME_OVERHEAD), "i"(__do_softirq) : + "lr", "xer", "ctr", "memory", "cr0", "cr1", "cr5", "cr6", "cr7", + "r0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"); +} + void do_softirq_own_stack(void) { void *irqsp = softirq_ctx[smp_processor_id()]; diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index a5422f7782b3..307307b57743 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S @@ -33,31 +33,6 @@ .text -_GLOBAL(call_do_softirq) - mflr r0 - stw r0,4(r1) - stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3) - mr r1,r3 - bl __do_softirq - lwz r1,0(r1) - lwz r0,4(r1) - mtlr r0 - blr - -/* - * void call_do_irq(struct pt_regs *regs, void *sp); - */ -_GLOBAL(call_do_irq) - mflr r0 - stw r0,4(r1) - stwu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r4) - mr r1,r4 - bl __do_irq - lwz r1,0(r1) - lwz r0,4(r1) - mtlr r0 - blr - /* * This returns the high 64 bits of the product of two 64-bit numbers. */ diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S index b55a7b4cb543..69fd714a5236 100644 --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -27,28 +27,6 @@ .text -_GLOBAL(call_do_softirq) - mflr r0 - std r0,16(r1) - stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r3) - mr r1,r3 - bl __do_softirq - ld r1,0(r1) - ld r0,16(r1) - mtlr r0 - blr - -_GLOBAL(call_do_irq) - mflr r0 - std r0,16(r1) - stdu r1,THREAD_SIZE-STACK_FRAME_OVERHEAD(r4) - mr r1,r4 - bl __do_irq - ld r1,0(r1) - ld r0,16(r1) - mtlr r0 - blr - .section ".toc","aw" PPC64_CACHES: .tc ppc64_caches[TC],ppc64_caches -- 2.13.3