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: 130201 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2762983edc; Thu, 1 Mar 2018 04:58:36 -0800 (PST) X-Google-Smtp-Source: AG47ELvI2LF9pX38TXCL0ehSDsVHGQ4Mkw0TjtTKekBNpcLXfhnFno+MQ60D++y/nI3mAwKEdVrp X-Received: by 10.98.35.68 with SMTP id j65mr1855018pfj.5.1519909116298; Thu, 01 Mar 2018 04:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519909116; cv=none; d=google.com; s=arc-20160816; b=twsI/L6iEBszTdGNJHyjR4pv+aSSiBQwSXKjFoxLKqpwY21obxAVP3hU/V9hO6QZI8 WWSj6QUc8Py7K4nSUcAmRgOw2n3brcpOBqRdCDP6h2cD6qkbddFj8JSVzaX2lvx1rgVb 9+zczzjL1mNc8C0pZYW6FabK9Acuog8SFL1Dbcno1RNsfZPoSZimGIiFQru2uIABsTTL DLTy8mbhfWgvaNV24vwVdqFDXLCxHDhIDd/qLz4jJNfFeHjDr2EfydqrgWvrbOr6oSBn 5V6hFm/RNSB/Yall2cYkjOtp7U+D8sk1o4C/a5Aj+qK7sjk5unC4CKcTJQgPMNuQSzRX hdYg== 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=Tc4Mz0EcXLIuUmBlwAaxCZTMXybrCLNpmx1IIdNZD87jk/jzTXlnJhaXrLYytVooqB JnjmXwEY+N5XFEyWsC//kDVpKoZlii54V4Vx3hbyo7qVw7sc9ZmWeBt2lj80n+AYEJQp 9lfMrrP7snI1tW7Etv8wFUqJwwoPGmGgeLhVygT8fJC4CohCNyPymsYi23DCvrsPv1Zx EeQ20cgxLYNZiUteW4CeBtqKaUY5/fVwEQyBZKz0w+MiFfoXiR/6m5pPrBX70bXMPBtN 3C+kxBpM3gpB0uuEDvDF7x5exiS2PKIi0Z/FgWx1u3n9jiWHkocjalTRaA6RyfcH56Hu 7WEA== 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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 w62si2442652pgd.573.2018.03.01.04.58.36; Thu, 01 Mar 2018 04:58:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 S1030643AbeCAM6f (ORCPT + 10 others); Thu, 1 Mar 2018 07:58:35 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:44110 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030613AbeCAM6d (ORCPT ); Thu, 1 Mar 2018 07:58:33 -0500 Received: by mail-pg0-f66.google.com with SMTP id l4so2266304pgp.11 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=ICSQfMfSg7LNWm7HMau4oJ3+O8WzNuQW7yrHYgXtAxkjhu4NNZz9BpW9r2BAfstpn7 KPk2yzTG30+gTGO9vWZ2R2QN0oG7i38YbtfuMAB1ffXpxo9GcD7Bs/9fKhhaYaOsamG2 7kaW3UxH+Xy24bSBRfSEZC3JfIkkq84AX1piw2l9cY1Y+I9X7cvbem5GPextjdIK5iZh TJkx9wNcDeKkRETyKu96GRFCA6FZWqHiG6HFJhydXK1ixsiM0qOTpgz/MAyapeIH6u10 iHvvinEr1ycWjIkF0oZOc3qAICHXEeHauqxpARG7Vb2tgQ10bKrWzc4attwePPx7fUEy 1RbQ== X-Gm-Message-State: APf1xPB0NhmtL+5S/zJSGyy91rbpbBurMIGIctBUMV+CzlLfeWVvhwcF pawqYI/AyUiC/6bhM2iOAOQhdA== 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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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(-) -- 2.7.4 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"