From patchwork Mon Feb 26 08:19:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 10241445 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 9968F602DC for ; Mon, 26 Feb 2018 08:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 710A429D6E for ; Mon, 26 Feb 2018 08:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6ED7129D5E; Mon, 26 Feb 2018 08:24:47 +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 autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 B73E229D8A for ; Mon, 26 Feb 2018 08:24:38 +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=Yz9iBkk8n25b485U7PLPXzvWrytz4hopeLVAqsjG+vY=; b=bNVQBhKn8AC7YZomE8wl7lSroF 3jeqAW1ZEPqZ472J6Y+DwJW9c8OuqYWcrP9BOJtdXbgB/PTo6BodoKQjOfidywlZc/QVTX30AnHzf mqcLOguypwrCeIbXsFRl3LZM2dmgMJ1YP6LIcjAUujhw4jZ7bmqoUs/5KE6LRZt0BC+ZTAK7rUSml s3qd2u2D8r4/cN4ZVh8hBebayW1IUxvdDY/Pi7Ytkp3uQJpiXrKGFyKim3NHu1MFRvclxkJY0mvUj Dm7TrL+Dpwr+0qheCbTiUcHWuk5SYPBQlSjUX4B/JRlUjp/LO/1rRlGfLq9Q7AA9IoSGdHcNYdOWW 7wpDIssg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eqE5G-0002Gf-TK; Mon, 26 Feb 2018 08:24:30 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eqE2z-0000Vu-Ld for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2018 08:22:12 +0000 Received: by mail-pf0-x243.google.com with SMTP id j24so6215740pff.12 for ; Mon, 26 Feb 2018 00:21:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1Y8BanaJo1dWq0GIhEtFd/7ONzz9WFIJLPbGyXUfe10=; b=d1w8YmAmizyCUP7HKtkENUc3d3YvSxAw5AtnW6Afct7gea/L3eJM4pEQAf8/ARNI+V TN675bGaucTxnQTM82msEVVXFeVeVqeLu59ELxwAHdIlszH9UM5bYAU38oobUs575BDj xJKuXCfeHowqYhanam1zRPPesyj9gRdIGWMJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1Y8BanaJo1dWq0GIhEtFd/7ONzz9WFIJLPbGyXUfe10=; b=dv07pf5pAvNi2I6rAjHfyLJ094HhVwZFJcMhMljOf6joKeeCkc7zMfL7sI+/5XXCai gFrAwczxxTy+YRPbjwnBc0+kcZPcA8URKNP9DuXb92z3T2TazNKFq5+FRKEzqPul8NYk q5yaum7d9YxM5PDcsKbc1S7Q/XL7M8MiuH62IP3wyt2GdFNOkFL0/fo4IrTS05xlvytG Vrm0q3QEGnFt10ELVHcmgtnnB91Hy1XRfIlWaIvG7c0tBbSLYd6KnoSdf61qQaFHbOwO H9QPq/CSfVzd3tkSI+h1rN6M8d3eJBIbXJVYISBMVJ6BaPavptFuC6YPu7kUg+BcjBaW JK8A== X-Gm-Message-State: APf1xPDs+f7mm+2n0qi554dXqySsjHytcC4/VycS3HOGQkqPp2fscO9s s1D5/9MfHEV19J00xk+NHQj3JA== X-Google-Smtp-Source: AH8x227f4Hawo51XZ+vo1Kl/+tJlOz3vC3XcLHXJmcOrgK3H7OGj5ajydxmKlCqqDgShE9SkvNC5bQ== X-Received: by 10.98.204.69 with SMTP id a66mr9820419pfg.33.1519633318597; Mon, 26 Feb 2018 00:21:58 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id o86sm1422706pfi.87.2018.02.26.00.21.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 00:21:58 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org (moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 07/52] arm64: Factor out TTBR0_EL1 post-update workaround into a specific asm macro Date: Mon, 26 Feb 2018 16:19:41 +0800 Message-Id: <1519633227-29832-8-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> References: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180226_002209_947607_705C1353 X-CRM114-Status: GOOD ( 12.03 ) 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: James Morse , Kees Cook 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 From: Catalin Marinas commit f33bcf03e6 upstream This patch takes the errata workaround code out of cpu_do_switch_mm into a dedicated post_ttbr0_update_workaround macro which will be reused in a subsequent patch. Cc: Will Deacon Cc: James Morse Cc: Kees Cook Reviewed-by: Mark Rutland Signed-off-by: Catalin Marinas Signed-off-by: Alex Shi --- arch/arm64/include/asm/assembler.h | 13 +++++++++++++ arch/arm64/mm/proc.S | 6 +----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 8760300..ab3a179 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -420,4 +420,17 @@ alternative_endif movk \reg, :abs_g0_nc:\val .endm +/* + * Errata workaround post TTBR0_EL1 update. + */ + .macro post_ttbr0_update_workaround +#ifdef CONFIG_CAVIUM_ERRATUM_27456 +alternative_if ARM64_WORKAROUND_CAVIUM_27456 + ic iallu + dsb nsh + isb +alternative_else_nop_endif +#endif + .endm + #endif /* __ASM_ASSEMBLER_H */ diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 352c73b..c2adb0c 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -136,11 +136,7 @@ ENTRY(cpu_do_switch_mm) bfi x0, x1, #48, #16 // set the ASID msr ttbr0_el1, x0 // set TTBR0 isb -alternative_if ARM64_WORKAROUND_CAVIUM_27456 - ic iallu - dsb nsh - isb -alternative_else_nop_endif + post_ttbr0_update_workaround ret ENDPROC(cpu_do_switch_mm)