From patchwork Fri Jul 28 14:10:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Morse X-Patchwork-Id: 9868903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DA34D6038F for ; Fri, 28 Jul 2017 14:14:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1D6A28815 for ; Fri, 28 Jul 2017 14:14:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C68E82889B; Fri, 28 Jul 2017 14:14:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C29528815 for ; Fri, 28 Jul 2017 14:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4WVWhe4WWm6PItJpr3Lcc8tF4mSv+PpDr/IywWPEDxQ=; b=F7PHrmRBIWRJmHZ2poC456PUSX /4kmGNyX168I8Ie55NHLTfPbkn+gCXRsnS8S+tKDR1AEp3+R5cG7dk7TIrnJ9ecsFC4g3k3dKrr21 vMWJaFA+d6wgkC+pCJk5Yz5VzC7gH2iXOwYHHC/XuOPi3SfhK78naQC9AMu0S6XXp5XPkcc7Fmg9k lJSieGV+rwhm5WKLWR6McK39G/UUc7OPp47j4GbVl1PXrAscdmc7vAvEFr0/aTvWfBz6ppHHjs55A nEtV1UDm3N04G5Yzc3y8qY+3t3XL3tvmb/9U6lO+iucIiy6cNhW6QHBotkGY2ARMfMTQ8D0LTGAXr ++OGbxuw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1db61Y-0000Hj-En; Fri, 28 Jul 2017 14:13:52 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1db603-0007pf-Ap for linux-arm-kernel@lists.infradead.org; Fri, 28 Jul 2017 14:12:21 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B3471650; Fri, 28 Jul 2017 07:11:49 -0700 (PDT) Received: from melchizedek.cambridge.arm.com (melchizedek.cambridge.arm.com [10.1.207.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C593B3F578; Fri, 28 Jul 2017 07:11:47 -0700 (PDT) From: James Morse To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 05/16] arm64: entry.S: move enable_step_tsk into kernel_exit Date: Fri, 28 Jul 2017 15:10:08 +0100 Message-Id: <20170728141019.9084-6-james.morse@arm.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170728141019.9084-1-james.morse@arm.com> References: <20170728141019.9084-1-james.morse@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170728_071219_569457_D4D62BFA X-CRM114-Status: UNSURE ( 8.21 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Xie XiuQi , Marc Zyngier , Catalin Marinas , Will Deacon , Wang Xiongfeng , kvmarm@lists.cs.columbia.edu, Christoffer Dall MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP enable_step_tsk may enable single-step, so needs to mask debug exceptions to prevent us from single-stepping kernel_exit. This should be the callers problem. Earlier cleanup (2a2830703a23) moved disable_step_tsk into kernel_entry. enable_step_tsk has two callers, both immediately before kernel_exit 0. Move the macro call into kernel_exit after local_mask_daif. enable_step_tsk is now only called with debug exceptions masked. This was the last user of disable_dbg, remove it. Signed-off-by: James Morse --- arch/arm64/include/asm/assembler.h | 9 +-------- arch/arm64/kernel/entry.S | 7 ++++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 896ddd9b21a6..f4dc435406ea 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -70,13 +70,6 @@ msr daif, \flags .endm -/* - * Enable and disable debug exceptions. - */ - .macro disable_dbg - msr daifset, #8 - .endm - .macro enable_dbg msr daifclr, #8 .endm @@ -90,9 +83,9 @@ 9990: .endm + /* call with debug exceptions masked */ .macro enable_step_tsk, flgs, tmp tbz \flgs, #TIF_SINGLESTEP, 9990f - disable_dbg mrs \tmp, mdscr_el1 orr \tmp, \tmp, #1 msr mdscr_el1, \tmp diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 491182f0abb5..0836b65d4c84 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -212,6 +212,10 @@ alternative_else_nop_endif .if \el == 0 ldr x23, [sp, #S_SP] // load return stack pointer msr sp_el0, x23 + + ldr x1, [tsk, #TSK_TI_FLAGS] + enable_step_tsk flgs=x1, tmp=x2 + #ifdef CONFIG_ARM64_ERRATUM_845719 alternative_if ARM64_WORKAROUND_845719 tbz x22, #4, 1f @@ -750,7 +754,6 @@ ret_fast_syscall: cbnz x2, ret_fast_syscall_trace and x2, x1, #_TIF_WORK_MASK cbnz x2, work_pending - enable_step_tsk x1, x2 kernel_exit 0 ret_fast_syscall_trace: enable_irq // enable interrupts @@ -765,7 +768,6 @@ work_pending: #ifdef CONFIG_TRACE_IRQFLAGS bl trace_hardirqs_on // enabled while in userspace #endif - ldr x1, [tsk, #TSK_TI_FLAGS] // re-check for single-step b finish_ret_to_user /* * "slow" syscall return path. @@ -776,7 +778,6 @@ ret_to_user: and x2, x1, #_TIF_WORK_MASK cbnz x2, work_pending finish_ret_to_user: - enable_step_tsk x1, x2 kernel_exit 0 ENDPROC(ret_to_user)