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: 129563 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3355945lja; Mon, 26 Feb 2018 00:22:07 -0800 (PST) X-Google-Smtp-Source: AG47ELvxdaMQTTgIQngO9WY7Xqagf1mtPva8zZjKk+kIGMffw+5WoDv8vt8hO5gBHBZL3uuyC2wM X-Received: by 10.98.65.72 with SMTP id o69mr7762030pfa.97.1519633327830; Mon, 26 Feb 2018 00:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519633327; cv=none; d=google.com; s=arc-20160816; b=nAYL39sGmWp5yc02Om7ymrveLvR8nvGVXatxWReZO5hxj5bHlE3Twv22XPoaU6aZSl Di9E12sddAOkJysEdaaRQeYQdk+oE1YmRLvIxeJQG/nt9ELm8BzlypCt3Gq9HH5aPhmm drGG/8oDlMDXj+Kp9JmgDtMBgXQcqpRWNkaHHSA90AtOPE+a+2lAqxZxv9ODA8L93A4D wupK8HIXpSlzqVy9SX7hvXY/M4/SXHyA+XgTKbz4nDbikyMfoUSezrys/txJt4nvY0t/ k8/FBGV1cX3WVCwJOfrK3o6Wx84iTCcf4Ptujm5A1BON7+nJrFrT5AE7z1ZFTUrChec+ HOUA== 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=1Y8BanaJo1dWq0GIhEtFd/7ONzz9WFIJLPbGyXUfe10=; b=CYOMUfOW9cVSz4Bi3RNAYutgxIz7pmqPT9+XdqlNmzfqA4/cUwEovjF9fIYW+SrQRU 7m40wpKUptxNZUqZDKlSsvp86oEX002XP3GqRq2+rgz5ZhYD+34U9LW3jytWpRDAwTMN lMCklYuDeKIfxBd0WArls4MdNYd0omzeIjAL6VgXCICv2Fu5ljHNjkHNfvdngDwaBQx4 P9TAovnD+xIMAPEMDspxZ6G6jevxExkeN0amC2XRF2PeUxYhePgIiU0oNFwaMhD7qnJ8 UQRdpeG45GX8H+L21NjSuT7MiOeNYDOtZfgrfzhGlMJzN8kc9OM28LOlpMyRggCvVtEU YGsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d1w8YmAm; 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 o2si1022986pfg.286.2018.02.26.00.22.07; Mon, 26 Feb 2018 00:22:07 -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=d1w8YmAm; 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 S1752250AbeBZIWG (ORCPT + 10 others); Mon, 26 Feb 2018 03:22:06 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:46754 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752354AbeBZIV7 (ORCPT ); Mon, 26 Feb 2018 03:21:59 -0500 Received: by mail-pf0-f195.google.com with SMTP id z10so1880523pfh.13 for ; Mon, 26 Feb 2018 00:21:58 -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=Yapdj4R506LyGqSOeZtRd9r7qS5iAG3ftCQ9DePSay8ohdNn7+AYFuI8xaK9xbslte i4QkEtNGnRhclHGci52O755uUAY/fZRnu3rhHOCz95ERbLTttlE2GVht+8ne3/HzRPQc GBU3MhaBtJIkDu9fsKk8+PbR5YtsdSpcF1vsn8N5tI7DcLS9Y4KQRRntCi2OiQNZpT4r HwWxZuGMP/ifpdGimo9NmXa/i8Dil2GbDYgWxlqSnsL46KsKO/4n+MrV7yZ0OJrhVbho aeHUBl49xf02CBHo7lEHPLsE2+qpvRAaFizJ9uAHxnngVPrVue5brHO1Kghm3MjQcDQv kgSQ== X-Gm-Message-State: APf1xPCJlNkykNBCZaqkg5nh4xSGrPJmV1LA+0MO+7UpXEAiSMf62kXU JYytdsJiFNxjad3gNNxOaco2Sg== 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) Cc: James Morse , Kees Cook 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> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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(-) -- 2.7.4 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)