From patchwork Thu Apr 30 09:24:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 47801 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A247B2121F for ; Thu, 30 Apr 2015 09:34:11 +0000 (UTC) Received: by laat2 with SMTP id t2sf13848876laa.2 for ; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=N4mg6riDrHZ7mLYEj/efUSXDHgROSM6AfCT5e57yQp0=; b=k22Q1QrdCbgIuHzTQdZJSeBBRaL4VCHXuWlg8YpXhnTNCVbZgO64NYxew6OS7i1P/i nm52siM4RjL4rUExrRNUjGt2fAfx4KRGgSTQjWf4Aar7tJtapxbtlqDvfC3we9biGhYJ xFGwaY0Rl3jLi383vVGc77Lb7Xrl8athhait4bQ4aF6FUEYoqLiWRwaZkFptVGF2spPI YjxRxMo79VC2qsV+jWU1d+TOgCvLNmflDYF3Bob1LEoGf/9pw/1pX68V92cjK+tjlcM1 BwRXU9a/+0LsL2ZBjJw5n1vL6xGq48gC3dS3fOBu24lUnghpc+PEr+jGQGs5VotN7n+C e9Gw== X-Gm-Message-State: ALoCoQlmjKdAqVDCxu31LEk0ZaGIvPpAJ/u5tBGX1j97zkLklWXbOMQR9+o1GB9a4WtbPsIOPDib X-Received: by 10.112.93.203 with SMTP id cw11mr2026375lbb.0.1430386450656; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.164 with SMTP id cz4ls367464lac.3.gmail; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) X-Received: by 10.112.35.230 with SMTP id l6mr2838551lbj.5.1430386450546; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id o4si1330106laj.143.2015.04.30.02.34.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Apr 2015 02:34:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbqq2 with SMTP id qq2so39913415lbb.3 for ; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) X-Received: by 10.152.2.227 with SMTP id 3mr2952907lax.73.1430386450457; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp2998945lbt; Thu, 30 Apr 2015 02:34:10 -0700 (PDT) X-Received: by 10.66.189.105 with SMTP id gh9mr6380002pac.41.1430385973281; Thu, 30 Apr 2015 02:26:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nf2si2640288pbc.149.2015.04.30.02.26.12; Thu, 30 Apr 2015 02:26:13 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750995AbbD3JZz (ORCPT + 2 others); Thu, 30 Apr 2015 05:25:55 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:53096 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751505AbbD3JZS (ORCPT ); Thu, 30 Apr 2015 05:25:18 -0400 Received: from ku by ip4-83-240-18-248.cust.nbox.cz with local (Exim 4.85) (envelope-from ) id 1YnkiW-0005Oj-Af; Thu, 30 Apr 2015 11:25:12 +0200 From: Jiri Slaby To: stable@vger.kernel.org Cc: Pranavkumar Sawargaonkar , Anup Patel , Christoffer Dall , Shannon Zhao , Jiri Slaby Subject: [patch added to the 3.12 stable tree] ARM/ARM64: KVM: Nuke Hyp-mode tlbs before enabling MMU Date: Thu, 30 Apr 2015 11:24:52 +0200 Message-Id: <1430385911-20480-44-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430385911-20480-1-git-send-email-jslaby@suse.cz> References: <1430385911-20480-1-git-send-email-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Pranavkumar Sawargaonkar This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit f6edbbf36da3a27b298b66c7955fc84e1dcca305 upstream. X-Gene u-boot runs in EL2 mode with MMU enabled hence we might have stale EL2 tlb enteris when we enable EL2 MMU on each host CPU. This can happen on any ARM/ARM64 board running bootloader in Hyp-mode (or EL2-mode) with MMU enabled. This patch ensures that we flush all Hyp-mode (or EL2-mode) TLBs on each host CPU before enabling Hyp-mode (or EL2-mode) MMU. Cc: Tested-by: Mark Rutland Reviewed-by: Marc Zyngier Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel Signed-off-by: Christoffer Dall Signed-off-by: Shannon Zhao Signed-off-by: Jiri Slaby --- arch/arm/kvm/init.S | 4 ++++ arch/arm64/kvm/hyp-init.S | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/kvm/init.S b/arch/arm/kvm/init.S index 1b9844d369cc..ee4f7447a1d3 100644 --- a/arch/arm/kvm/init.S +++ b/arch/arm/kvm/init.S @@ -98,6 +98,10 @@ __do_hyp_init: mrc p15, 0, r0, c10, c2, 1 mcr p15, 4, r0, c10, c2, 1 + @ Invalidate the stale TLBs from Bootloader + mcr p15, 4, r0, c8, c7, 0 @ TLBIALLH + dsb ish + @ Set the HSCTLR to: @ - ARM/THUMB exceptions: Kernel config (Thumb-2 kernel) @ - Endianness: Kernel config diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index ba84e6705e20..e9c87e5402c7 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S @@ -74,6 +74,10 @@ __do_hyp_init: msr mair_el2, x4 isb + /* Invalidate the stale TLBs from Bootloader */ + tlbi alle2 + dsb sy + mov x4, #SCTLR_EL2_FLAGS msr sctlr_el2, x4 isb