Received: by 10.223.185.116 with SMTP id b49csp7394059wrg; Thu, 1 Mar 2018 05:00:18 -0800 (PST) X-Google-Smtp-Source: AG47ELvJ82m7mk83F5HAQmZTWbHW2qaT0Pi5LgB2VrYj5F5PNwsjyAnohdR9edhOt5/9tbiO3TEN X-Received: by 10.98.202.138 with SMTP id y10mr1862831pfk.184.1519909218284; Thu, 01 Mar 2018 05:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519909218; cv=none; d=google.com; s=arc-20160816; b=VIgFJgD4GNNGmOQ9ZrXYbA9zKIFu1R+A3ugSjqHcoWem/SOfqjeDjRuy4jJY1c0YoL CA2ItKyfMg6SUZiPbzNRM620JYwXefy06ot9zVrXmKoYJNCE+/vgidzjKbirsV7H/HY6 8vJpO6m7BWkPmhTYSQjqUrV08MnTpyc1lOpjHXeIoN3EOPeXgAJD9CEu9Mom3ny93AFg Z9rxlRQG4yhGop338o82rwRm91YALO+XidqElY9ECvLVQORKx8nVE/kyfXLlFYgi6UyQ v80JXiW65zoiLoRkvLv/y+4Evw+JyoiG7fRs6PzwjH30RKWKd08u4zyi2KguUwT5M1X2 xZYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BzSs6B5O9af3dF01m9Oi65XG3SRNuoRk/WR0mJQYa1U=; b=k4mYgAlfR9IE8wCcn8F7adyk6CmXm+uKpsW8pJs4ZfVV2KS/9UKHS2iNMtmh/9ErcX FJyxiEe3nUFHQXqxjP26N0aK6QmX+RVSlp5Fs6qFxgyH2sgixBN0JRZQ6oMuluGbMVe7 JTC7K1izH3KMg2Sf8le8o9/YZN3pjCxuhBbz1XcklKzMVSXsQgwgk8FAGytW2Dnwsgyg Pi6brNaIJ0XTtvXmRHRMoscszrXO77lOPhgioMAgeJBsiglZEcaseSfiZ7Y/1bgyPn1k cC2IDmra0fjYNzJVFFQK7vnEWqsjRQ284mXNTH78UOk7MrLX9ebrITweFyYMPufSqQpc /x6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G9Xpb+GJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r59-v6si3073603plb.69.2018.03.01.05.00.02; Thu, 01 Mar 2018 05:00:18 -0800 (PST) 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=@linaro.org header.s=google header.b=G9Xpb+GJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030739AbeCAM6f (ORCPT + 99 others); Thu, 1 Mar 2018 07:58:35 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:45742 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030586AbeCAM6d (ORCPT ); Thu, 1 Mar 2018 07:58:33 -0500 Received: by mail-pg0-f65.google.com with SMTP id i133so2261657pgc.12 for ; Thu, 01 Mar 2018 04:58:32 -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=WQy95Y27gKDCK3Lr5sCxULqZ0wYZlZ3jV0DlMAKZCJ32LRr209+KwMkkYSemy8oPls 4kjDyCmtxo+nwd75CjaiYemsOgN5Ou7DTuawpy7wdOnE5gT/rofSK+yf1WIYo6AJonIv 63HKMLIs2ztJfMQ7SxipTrum1vSlEfAfHJuJY/hwr5x3c8LBoM6H/J00KtxZuLcutewi ER289X315QobOvebzc8/d4s756ibn9RBa0OE/O4k10c+XO+MvmcqlXy6cms43u9awfBs q7ozZr6n6TLlnyQn1evqAl2U+/zGgpTDjp2fAk7/CkwC5vvkDM5nlTAtsp5mzlUQ1QwH FmgQ== X-Gm-Message-State: APf1xPCaYpwnziPeCdGpgrZG4kQgxWsC97qt8Vn8L/DTDP2TPgPd+Eay MWRqHffM3aJ31aS1bow8nV/zAg== 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 Cc: Alex Shi 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" -- 2.7.4