Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1178516pxj; Fri, 4 Jun 2021 07:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVUDDQaq2Y9X16v9gJwGzjGIRuqWySVZqfjDa82KcRrmEWmGl9c1R0uyx16ZXBaVV5o1DU X-Received: by 2002:aa7:c844:: with SMTP id g4mr5142984edt.257.1622818612450; Fri, 04 Jun 2021 07:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622818612; cv=none; d=google.com; s=arc-20160816; b=SV4zzZYX6htFr7fJApeZvebb/pljwqnNQjEvPM3AuFWQ5tGzan6COQCqWj111gc82X ksuSc06pvUK4xPcaJr3Cm0mPDCIBG+PrWPvDPttA+tE4vrVyDi9evXQbid7W37FfcU8j qRxicy7uh20CF4hZ1410cr89hrqPvByJkAwK81tZsJFqnvdW7Fe/B8ouyu/sfi1M3mnu XOt8wEDIiZtnDjJyuJ0JOHCjcQCMtc+EsC3cXP4PQDw21wCfGsCQ4VioWvEnelrzEqzx 6oxa0uA2faS4Sf7Yitxca/y49WIm2vYy3CH/5nLioQiBfYPj/Z19KDbFVxQ/oGxPVovR 95yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=DV6kk//BVoaypvN/zKdSpDHTN+PVNxCvNTH9VFZhQ7A=; b=fGXbArRno0sfM2g8C2ZslBlnfWSaunZ+28YheM6foYCrQF980rw5bl1Fi4vw+ksIzT i372yGPakW+MJMg/d5cKMWwYss+dDvmYWLOterBqfYFAXorRiy0221J5XANT0m4ADTQG dgEjNnEZ7+DuvyhVRzFJuOvj1boqYpJXZ0IpcNTRpF3Bi+WHbT2WNeec9GFx3sTEinG3 /uzw5PEsG2GfRSVvskDhdMOIclaX3jjnKIjxo5hHjIFVYeU9E2qcloyMArH04kXv5zHP a9hRTVCFupBLXwoXsTDoSMET11bXjOo1MU5rkLGceThl+CZqufukBLs2JFa3jVgT208w Ya6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hc37si4007077ejc.354.2021.06.04.07.56.29; Fri, 04 Jun 2021 07:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbhFDO4G (ORCPT + 99 others); Fri, 4 Jun 2021 10:56:06 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:19683 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbhFDO4G (ORCPT ); Fri, 4 Jun 2021 10:56:06 -0400 Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4FxQlC3wR1zBCvy; Fri, 4 Jun 2021 16:54:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1F1mw8VolGXn; Fri, 4 Jun 2021 16:54:15 +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 4FxQlC32qmzBCvw; Fri, 4 Jun 2021 16:54:15 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 610808B8A9; Fri, 4 Jun 2021 16:54:15 +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 KMfNGPxWtXFD; Fri, 4 Jun 2021 16:54:15 +0200 (CEST) Received: from po15610vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 19A338B885; Fri, 4 Jun 2021 16:54:15 +0200 (CEST) Received: by po15610vm.idsi0.si.c-s.fr (Postfix, from userid 0) id E794C64BDB; Fri, 4 Jun 2021 14:54:14 +0000 (UTC) Message-Id: <552e27fa09394a6bc70585fcdfa237f99a5d1267.1622818435.git.christophe.leroy@csgroup.eu> In-Reply-To: <5ab3a517bc883a2fc905fb2cb5ee9344f37b2cfa.1622818435.git.christophe.leroy@csgroup.eu> References: <5ab3a517bc883a2fc905fb2cb5ee9344f37b2cfa.1622818435.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH 3/4] powerpc/32: Reduce code duplication of system call entry To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Fri, 4 Jun 2021 14:54:14 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org booke and non booke do pretty similar things in SYSCALL_ENTRY macro just before calling jumping to transfer_to_syscall(). Do them in transfer_to_syscall() instead. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/entry_32.S | 19 +++++++++++++++++++ arch/powerpc/kernel/head_32.h | 19 ------------------- arch/powerpc/kernel/head_booke.h | 18 ------------------ 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S index 9160285cb2f4..0f53f6d11865 100644 --- a/arch/powerpc/kernel/entry_32.S +++ b/arch/powerpc/kernel/entry_32.S @@ -32,6 +32,7 @@ #include #include #include +#include #include "head_32.h" @@ -74,6 +75,24 @@ _ASM_NOKPROBE_SYMBOL(prepare_transfer_to_handler) .globl transfer_to_syscall transfer_to_syscall: + stw r11, GPR1(r1) + stw r11, 0(r1) + mflr r12 + stw r12, _LINK(r1) +#if defined(CONFIG_BOOKE) || defined(CONFIG_40x) + rlwinm r9,r9,0,14,12 /* clear MSR_WE (necessary?) */ +#endif + lis r12,STACK_FRAME_REGS_MARKER@ha /* exception frame marker */ + SAVE_GPR(2, r1) + addi r12,r12,STACK_FRAME_REGS_MARKER@l + stw r9,_MSR(r1) + li r2, INTERRUPT_SYSCALL + stw r12,8(r1) + stw r2,_TRAP(r1) + SAVE_GPR(0, r1) + SAVE_4GPRS(3, r1) + SAVE_2GPRS(7, r1) + addi r2,r10,-THREAD SAVE_NVGPRS(r1) /* Calling convention has r9 = orig r0, r10 = regs */ diff --git a/arch/powerpc/kernel/head_32.h b/arch/powerpc/kernel/head_32.h index 7ca25eb9bc75..6b1ec9e3541b 100644 --- a/arch/powerpc/kernel/head_32.h +++ b/arch/powerpc/kernel/head_32.h @@ -155,29 +155,10 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt) addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE rfi 1: - stw r11,GPR1(r1) - stw r11,0(r1) - mr r11, r1 stw r12,_NIP(r1) - mflr r12 - stw r12, _LINK(r11) mfcr r12 rlwinm r12,r12,0,4,2 /* Clear SO bit in CR */ stw r12,_CCR(r1) -#ifdef CONFIG_40x - rlwinm r9,r9,0,14,12 /* clear MSR_WE (necessary?) */ -#endif - lis r12,STACK_FRAME_REGS_MARKER@ha /* exception frame marker */ - stw r2,GPR2(r11) - addi r12,r12,STACK_FRAME_REGS_MARKER@l - stw r9,_MSR(r11) - li r2, \trapno - stw r12,8(r11) - stw r2,_TRAP(r11) - SAVE_GPR(0, r11) - SAVE_4GPRS(3, r11) - SAVE_2GPRS(7, r11) - addi r2,r10,-THREAD b transfer_to_syscall /* jump to handler */ .endm diff --git a/arch/powerpc/kernel/head_booke.h b/arch/powerpc/kernel/head_booke.h index 4a2fad9f225e..10f31146b472 100644 --- a/arch/powerpc/kernel/head_booke.h +++ b/arch/powerpc/kernel/head_booke.h @@ -140,26 +140,8 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) rlwinm r12,r12,0,4,2 /* Clear SO bit in CR */ ALLOC_STACK_FRAME(r1, THREAD_SIZE - INT_FRAME_SIZE) stw r12, _CCR(r1) - mflr r12 - stw r12,_LINK(r1) mfspr r12,SPRN_SRR0 - stw r11, GPR1(r1) - stw r11, 0(r1) - mr r11, r1 stw r12,_NIP(r1) - rlwinm r9,r9,0,14,12 /* clear MSR_WE (necessary?) */ - lis r12, STACK_FRAME_REGS_MARKER@ha /* exception frame marker */ - stw r2,GPR2(r11) - addi r12, r12, STACK_FRAME_REGS_MARKER@l - stw r9,_MSR(r11) - li r2, \trapno - stw r12, 8(r11) - stw r2,_TRAP(r11) - SAVE_GPR(0, r11) - SAVE_4GPRS(3, r11) - SAVE_2GPRS(7, r11) - - addi r2,r10,-THREAD b transfer_to_syscall /* jump to handler */ .endm -- 2.25.0