From patchwork Thu Mar 1 12:53:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 10251279 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 0B692604D4 for ; Thu, 1 Mar 2018 13:05:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 882AE26E54 for ; Thu, 1 Mar 2018 13:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C82A28D3F; Thu, 1 Mar 2018 13:05:50 +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 719BD26E54 for ; Thu, 1 Mar 2018 13:05:49 +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=wn2GHOzBoHTqol4+YYmaZ+ZgcZhCg+VphqGczK9u++k=; b=j47Z1WnrTC7k1xNynjAlY1kNP/ C4S9OfcxPf2p5GQJzKcSdH+nVMcdSDVfjpYX17JDBxAI512qWOVaGP59ILZTsbttvFiqceM2PBj7N DVAI9d9nEnG+N8GLLMC9j9C5G6Veq0F3o+HolMndjxTXZ2cNAQbibqZSLOQWjvIA622mSMtN2SntD SWy5dQKp/yP//8FmB2LSpeMVG/MDIRc3OP9zDIUHIYOTmaSGXjnIQFtSCXe6Hg8bKctR9h0xxwdIo 3Qm/WroC5q5+pJ3nA8H59or/1xUfkeLZdFQjANKxvufUBlrgWNM6iiSwh52iKwUsU7XuFrITvt1J7 +VUIHTUw==; 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 1erNtz-0000L7-Jf; Thu, 01 Mar 2018 13:05:39 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erNnH-0002hh-9l for linux-arm-kernel@lists.infradead.org; Thu, 01 Mar 2018 13:00:14 +0000 Received: by mail-pg0-x243.google.com with SMTP id y8so2270925pgr.9 for ; Thu, 01 Mar 2018 04:58:33 -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=BzSs6B5O9af3dF01m9Oi65XG3SRNuoRk/WR0mJQYa1U=; b=G9Xpb+GJcL9lVx3quP0hfR+df8EkUpZtQt/11xoqRvj77zPlhOphQMjfwsL81SMdoL ol0I6k250RFvdTCTTg6fxCdL/o1nCw9LEYTP02A4kDcZW5WPplxGxohdFwxU8/jo+uvO zWaAq5QEGWV/x2t8RM1KdUbiVNM8rXcR1fChw= 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=BzSs6B5O9af3dF01m9Oi65XG3SRNuoRk/WR0mJQYa1U=; b=H1v7gmcUfRbpYM9u9yqcZuO7B0yHBZiPReHxCJnQzVVTtNzcIHpzr5LCkSGorq3cRE jTHepBNPQce2AMVeg4JjX10QB3BaHNpD8BTruygXNH24UuRsmBv5NoVcQrog5vXzaAgx j6dHTlhO54PFDEecMxTZfSXNJgEPYKQeeoSjMHBhyn/pGDv1ANISheE5R97aLJ/GQ7m5 Fd7jojxnRCJThR51s9U9kBIhrmAiPwC5spdDWxlgVNmUImq3YflnChjfygvC6ysJdCxl h1A6yHu4FQu4PUnevJS+pyJ7yxokdBUQsSqA8QHOEm5HCU7HQV71Zs7voWvEQLtNf0pp Y9Hw== X-Gm-Message-State: APf1xPAHykrbhj65znUoWVJsr9L7X3Q0BSJdCK/0OwRLKz1n6RnojtES PeGXoU6ZTzfBvXwss9ApRgUPmQ== X-Google-Smtp-Source: AG47ELsSaHpLouGpAiK9eWqrim4cDZZDopX6aelhZ+aZklaZr9ZC4iYpduQn9xnN61fTwMcklfdgAg== X-Received: by 10.101.85.71 with SMTP id t7mr1484811pgr.386.1519909112559; Thu, 01 Mar 2018 04:58:32 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id x4sm2289655pfb.46.2018.03.01.04.57.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 04:58:32 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 22/45] arm64: Move post_ttbr_update_workaround to C code Date: Thu, 1 Mar 2018 20:53:59 +0800 Message-Id: <1519908862-11425-23-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> References: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180301_045844_091762_79080706 X-CRM114-Status: GOOD ( 11.28 ) 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: Alex Shi 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: Marc Zyngier commit 95e3de3590e3 upstream. We will soon need to invoke a CPU-specific function pointer after changing page tables, so move post_ttbr_update_workaround out into C code to make this possible. Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Alex Shi --- arch/arm64/mm/context.c | 9 +++++++++ arch/arm64/mm/proc.S | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index efcf1f7..32eeabe91 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -224,6 +224,15 @@ void check_and_switch_context(struct mm_struct *mm, unsigned int cpu) cpu_switch_mm(mm->pgd, mm); } +/* Errata workaround post TTBRx_EL1 update. */ +asmlinkage void post_ttbr_update_workaround(void) +{ + asm(ALTERNATIVE("nop; nop; nop", + "ic iallu; dsb nsh; isb", + ARM64_WORKAROUND_CAVIUM_27456, + CONFIG_CAVIUM_ERRATUM_27456)); +} + static int asids_init(void) { asid_bits = get_cpu_asid_bits(); diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index c2adb0c..cca061a 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -136,8 +136,7 @@ ENTRY(cpu_do_switch_mm) bfi x0, x1, #48, #16 // set the ASID msr ttbr0_el1, x0 // set TTBR0 isb - post_ttbr0_update_workaround - ret + b post_ttbr_update_workaround // Back to C code... ENDPROC(cpu_do_switch_mm) .pushsection ".idmap.text", "ax"