From patchwork Thu Mar 1 12:53:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 130187 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2760952edc; Thu, 1 Mar 2018 04:56:14 -0800 (PST) X-Google-Smtp-Source: AG47ELtFuZ7I2x4cJOW9Otm3JMiqErPSYA+UeODD2sVx8tJHGu7+EWgA/Kykp2J2Td+WnQ8T+a8t X-Received: by 2002:a17:902:7a2:: with SMTP id 31-v6mr1840843plj.313.1519908974188; Thu, 01 Mar 2018 04:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519908974; cv=none; d=google.com; s=arc-20160816; b=Oi1vhBdonVmPytTTtavOzbMlVXvEWnpHUcIvAZ+8iTgLiPfVqtj1mxWJQwpCqzzJJv Yl2WjqHuV7AldbLzmE2H65qN4VrK0zywpcx+GU7uGzctvK6WkVXdcf60XjqzvoEgu4Fq gxNL1KH2uyidcBYHot+ActM0Ls0B7ij5dRUEIZQgXgKoyjz5KnYFxfPQWUBpBYJWz7LY gtZ0hWI+V1JdsCYEP1ANm50LlyYK+sWk3ULYqo59Wt1+7G5IpSdAZ2tfRNmxBs7XnWZ8 kjWQdbfVCBXb0Eg+rLp3+1iAB58FfSUeCtSVIjyQRydx0m1CpCM5zAtbLmwnwlhzzcBW SIqA== 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=UQNdQlwQnuN07IWkGHfmuoXA792OsiDxxN9eYWJI2NC5VN5J730nBKZLegSF+ACUEs ozVBnF2I0tS+KUD93kC3nVxnDfJZWZLPt5dxsKKOteDOImBgqHea+BpLT4Eu+iRSg33C Vfk3y01qkWdVMe1/IxqjZ+b4CeCCuCkCpicnIpxfZyk5YQxWi1A9RWXG+3I2kYKO0wZq JIXBf09vokHIZBlux4MoCh2kPYB9O5cdDuKgxPkfpEdmznNugX01CDLyk7l+2ZQ+c0c7 ID3Srg0Joul1yTgsNEdxwN/ilCoIceSyzYBGvC8hFinXgRtTVKZiPoTObRqstpOSZaw2 CN2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iJNPwsm5; 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 z60-v6si3059575plh.306.2018.03.01.04.56.13; Thu, 01 Mar 2018 04:56:14 -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=iJNPwsm5; 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 S1030694AbeCAM4K (ORCPT + 28 others); Thu, 1 Mar 2018 07:56:10 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:36076 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030568AbeCAM4G (ORCPT ); Thu, 1 Mar 2018 07:56:06 -0500 Received: by mail-pl0-f66.google.com with SMTP id 61-v6so3593445plf.3 for ; Thu, 01 Mar 2018 04:56:06 -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=iJNPwsm5RYUN+7lvaEDqUyfARuBi++8KzenaenRDM7kaPMoFj481PAc6dhCteFwK1L LU561UBY1VHvfo3+VaVqVaKXGlrVVw8WVdDaVa2Gx4aCyiKQRq2yBmzA61CLX53af0Kv I5SiiqUZ+PUsF05KOXZQtAvslfxP4UGh7o+lM= 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=OP/mbRQkjideO+3QjirgoIBpRy1sEeS8dcbGgjAMb5P30HATMV4C8ein3UaKREetcs uplQoWrFfThn1Ci3vPlpyg72ocAU470P5AyNPFoOxCLpvOGOI5LywXb1EdgtlU/rcUMa suOko61TkftDjK8B/HZ/MP4TVLu7ACft7w9JJl20GjIZZ5IMsfdalEVdn5UqikWoUL/k 6+VkTYT3QI9+PtYdU79lx5FWfho2UCeVYtd77Vhtnk+bl0yl6Wv8TQlGpdJG5+Wb4iHu 7MScsaWPd6NFgXG6ikdO+GHrv5ymx4LVdwN/8lP27y0Hl0Vt4MYnsAqsmgVYf0dwt++w GWpg== X-Gm-Message-State: APf1xPAfdeaqUOJp3fvkWXhLua3Uu/nXoU8TInGmW95tEljuxk650swU yTYFkrMYpVZJg6RT6eMcDjWBew== X-Received: by 2002:a17:902:b690:: with SMTP id c16-v6mr1888625pls.264.1519908966243; Thu, 01 Mar 2018 04:56:06 -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.55.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 04:56:05 -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: James Morse , Kees Cook , Alex Shi Subject: [PATCH 07/45] arm64: Factor out TTBR0_EL1 post-update workaround into a specific asm macro Date: Thu, 1 Mar 2018 20:53:44 +0800 Message-Id: <1519908862-11425-8-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: 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)