From patchwork Fri Jun 14 03:07:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 166754 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1505646ilk; Thu, 13 Jun 2019 20:12:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRttCHMMCBlDA91aFdNiH1jEoFjyP2N56yFmsQp2XuHS+XsmJCB+XGN1Hs3bnaWr9bSWPH X-Received: by 2002:a17:902:be10:: with SMTP id r16mr28999706pls.294.1560481958034; Thu, 13 Jun 2019 20:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560481958; cv=none; d=google.com; s=arc-20160816; b=V4Kjgn8CvIlj9DGFzhlqbFiSXSTib6YfN/wUjGOarK+fCWuciKThz+UZhuo5HZJsnr yercgvaq/ZcwJM8/qe/xAnSLdlETk2/DbaXl4n+x2Wone6wz+TdPhSdR03oxKSc0mqQq 0uIMaUtL++26y9QbIW9CtuoOzNPZPwSi20DmDw1Y+ejsertVyWwFA2UvFT2tHAvfb6jL 8VWTN+mCMlZj6c2ifuWwGOTTK12eiGaXwis1ChZd9oGCTImKRf6mBxY4DjxzgJGk9M35 Yz5VbgXRKghwlqY82d+4KkB9LzaRj8BP+6wRuQYqKxDTdZydhcCTKEODZ5TJt8+o+/Z8 6sQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FJU6AKZYmaWbov8SdJbQnRPRbYy33d5KJviuZzujVLk=; b=jWtnovbkeMm8f8pe2OrJDo1YohtqIvntK7A1mSCFcsz68dXNZbql7yVrPUdZ0GMm6i 7+KWmHqYJgnLUe0jjs6y4mzFfoH0qmBXIatVnsQACxzE2oJe3Vx/n5nk//QpP4gZ/zkk rHu9ZVvi1mDDbbcBkSfKcWlxvzAapodKNZclxoJE4QeL28PillMFzTGVlr469A1GsPik h1Gazt1S1n3otzYbZoTIs62UctGNZynY7mCt18FQ5E5OeAJmFD2/eemjTqpR4ccHUIi4 4uyd7fwWAGHdHo7rIrG7NvDNHIUNia8mlnQ2wmWdMcze5IvQb7S9BcS6s+pbUSmRDEgE OCrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YrcvAeSG; 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 e8si1073936plb.420.2019.06.13.20.12.37; Thu, 13 Jun 2019 20:12:38 -0700 (PDT) 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=YrcvAeSG; 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 S1726455AbfFNDMh (ORCPT + 14 others); Thu, 13 Jun 2019 23:12:37 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37636 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbfFNDMh (ORCPT ); Thu, 13 Jun 2019 23:12:37 -0400 Received: by mail-pf1-f196.google.com with SMTP id 19so498174pfa.4 for ; Thu, 13 Jun 2019 20:12:36 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=FJU6AKZYmaWbov8SdJbQnRPRbYy33d5KJviuZzujVLk=; b=YrcvAeSGhO45tP17Rj0WtR5s4BK3jEYUh+NId6My01EnBc6fQOndzVVJcCKlZPE2sv AlQwDjj6xSPf9flbs2HG1+hEd661VSkzhWlQK/h3zMp5Pq7SG2Ow6UQ5P82Qte7XZyOh /p5/Y/dMH9ybqE6m4ws6cqKEaegYm6Xh7fC4jivkqpTJoB0hDGQP1aXo6RK6WNYGGCht 8MN6NHlgIhl3XzSqPXCCspLAQ/1Wjx+Yo7BEpV0L2NmIofv8gWJnupmYazoGkvEg3ShG 8oQDdplctgWkaKaUmIsAJVf8q/LWWoWRLO6JczPvHL4xVwrDGCfd1I2j4dhbi0Mlr99X WT4Q== 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:mime-version:content-transfer-encoding; bh=FJU6AKZYmaWbov8SdJbQnRPRbYy33d5KJviuZzujVLk=; b=bR0sDKUy9xKojC7sedsTYkkGqF5n2XJRUVXqTViYZD5cDfSyPl+23af6DGFx+elUeW dgUv93zSzzovL47JhQqvS7gdM6MoZ10Ng8Vxi4KK+Fv1pozuF9JpED4P33l1BnaTBtRg zW8gelwhMIoiYc3XLhuajjzAJUeNE2S/0G2yZGt+zyre6W+h4clHz7Kv8nXRjXEF2/ZD poizZ7zRRUBUDdh5psO5bCJl/WjsKBnZBAY4aRcOL517norOwQvJwcipi3UduREl6hMc qc2hFxz8eQj8UBb5bqFmc0tHQzZeyG2CBNVG+e1ZWKqkbpgwNJUNHh/T+sYotxssdVwd Eo+Q== X-Gm-Message-State: APjAAAU3uc+RWQ7MT8ZbGJHF5lN7Rc2CvVkVfnu77nIVO17CQMhNLI5J b5SsQyF25SJ8WBvMnpo7b2FY9g== X-Received: by 2002:a62:6143:: with SMTP id v64mr59569090pfb.42.1560481956440; Thu, 13 Jun 2019 20:12:36 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id 85sm1140276pgb.52.2019.06.13.20.12.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jun 2019 20:12:35 -0700 (PDT) From: Viresh Kumar To: linux-arm-kernel@lists.infradead.org, Julien Thierry Cc: Viresh Kumar , stable@vger.kernel.org, Catalin Marinas , Marc Zyngier , Mark Rutland , Will Deacon , Russell King , Vincent Guittot , mark.brown@arm.com Subject: [PATCH v4.4 16/45] arm64: Move post_ttbr_update_workaround to C code Date: Fri, 14 Jun 2019 08:37:59 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b In-Reply-To: References: MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier commit 95e3de3590e3f2358bb13f013911bc1bfa5d3f53 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: Catalin Marinas [ v4.4: Removed cpufeature.h, included alternative.h, dropped entry.S changes and adapted to drop alternative_if_not ] Signed-off-by: Viresh Kumar --- arch/arm64/include/asm/assembler.h | 18 ------------------ arch/arm64/mm/context.c | 10 ++++++++++ arch/arm64/mm/proc.S | 3 +-- 3 files changed, 11 insertions(+), 20 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 8ab46508e836..2b30363a3a89 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -23,7 +23,6 @@ #ifndef __ASM_ASSEMBLER_H #define __ASM_ASSEMBLER_H -#include #include #include #include @@ -283,21 +282,4 @@ lr .req x30 // link register .Ldone\@: .endm -/* - * Errata workaround post TTBR0_EL1 update. - */ - .macro post_ttbr0_update_workaround -#ifdef CONFIG_CAVIUM_ERRATUM_27456 -alternative_if_not ARM64_WORKAROUND_CAVIUM_27456 - ret - nop - nop - nop -alternative_else - ic iallu - dsb nsh - isb -#endif - .endm - #endif /* __ASM_ASSEMBLER_H */ diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index e87f53ff5f58..492d2968fa8f 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -185,6 +186,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) { int fld = cpuid_feature_extract_field(read_cpuid(ID_AA64MMFR0_EL1), 4); diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 4eb1084e203a..a70b712ca94a 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -139,8 +139,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) .section ".text.init", #alloc, #execinstr