From patchwork Wed Jul 30 09:46:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 34506 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 34B2920DCC for ; Wed, 30 Jul 2014 09:48:41 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf2871049obc.0 for ; Wed, 30 Jul 2014 02:48:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=23+oDfCVMjWQRLFlsvyCeD8xIMIhukbpZvZ0VBnnJ+s=; b=KAqW//JegeHUaWAqMw5T/it72WIq5uDHRmxkeP9KT7wY6YNq68E8wdp0WYD08gK1i7 bEXJGglMV8bACkC9/vQbnK138UlFZuxTC/sJXTEjn0aroOTTSEKK5cQiMmgKCiAutmbE bkThgrq/OZ38RsSrTRijngfQC48DjdNuR9xcWK9GhR0EfUVgLkDVQlMzzIMDLEvoSCIF Jj1T/mBHlVdR+AGlvHiq/Xvj0gQGU2qxGG+dGfWBjp3PE59PAiv4f8qBi/7bEJd6JjfT vWulRQnyvgGlluhDp9gPuRjgKtHylP8zbsnaG22aHX1VodMK44L7JzxMaiL+0/i6TKXG IoYA== X-Gm-Message-State: ALoCoQm23QAgs7llpMdiYwgIMSpDR5W2/WCnkIUviNWabUxuvi4VgMab7LACK7e6nCgAF2hiZpn0 X-Received: by 10.50.66.236 with SMTP id i12mr16093661igt.5.1406713720759; Wed, 30 Jul 2014 02:48:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.119 with SMTP id d110ls457046qgf.47.gmail; Wed, 30 Jul 2014 02:48:40 -0700 (PDT) X-Received: by 10.220.172.8 with SMTP id j8mr2823141vcz.32.1406713720633; Wed, 30 Jul 2014 02:48:40 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id lg9si1173828vdb.3.2014.07.30.02.48.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 02:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so1372579vcb.14 for ; Wed, 30 Jul 2014 02:48:40 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr391013vdj.95.1406713720554; Wed, 30 Jul 2014 02:48:40 -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.221.37.5 with SMTP id tc5csp14139vcb; Wed, 30 Jul 2014 02:48:40 -0700 (PDT) X-Received: by 10.66.233.170 with SMTP id tx10mr3308938pac.68.1406713719763; Wed, 30 Jul 2014 02:48:39 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id su7si1753137pbc.251.2014.07.30.02.48.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jul 2014 02:48:39 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XCQU0-0003F6-Gf; Wed, 30 Jul 2014 09:47:40 +0000 Received: from mail-pd0-f182.google.com ([209.85.192.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XCQTs-00036s-1H for linux-arm-kernel@lists.infradead.org; Wed, 30 Jul 2014 09:47:37 +0000 Received: by mail-pd0-f182.google.com with SMTP id fp1so1193088pdb.27 for ; Wed, 30 Jul 2014 02:47:10 -0700 (PDT) X-Received: by 10.67.1.195 with SMTP id bi3mr3262612pad.74.1406713630670; Wed, 30 Jul 2014 02:47:10 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id yo9sm6225192pac.25.2014.07.30.02.47.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 02:47:10 -0700 (PDT) From: Pranavkumar Sawargaonkar To: kvmarm@lists.cs.columbia.edu Subject: [PATCH] ARM64: KVM: Nuke EL2 mode tlbs before enabling MMU for EL2 Date: Wed, 30 Jul 2014 15:16:47 +0530 Message-Id: <1406713607-27150-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140730_024732_089231_C4CE09E9 X-CRM114-Status: UNSURE ( 8.88 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.4 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.192.182 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.192.182 listed in wl.mailspike.net] Cc: Anup Patel , marc.zyngier@arm.com, patches@apm.org, christoffer.dall@linaro.org, linux-arm-kernel@lists.infradead.org, Pranavkumar Sawargaonkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@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.220.169 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 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 ARM64 board running bootloader in EL2 with MMU enabled. This patch ensures that we flush all EL2 TLBs on each host CPU before enabling EL2 MMU. This is very similar to what we do for EL1 TLBs before enabling EL1 MMU. (Refer __cpu_setup() of arch/arm64/mm/proc.S) Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- arch/arm64/kvm/hyp-init.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S index d968796..c319116 100644 --- a/arch/arm64/kvm/hyp-init.S +++ b/arch/arm64/kvm/hyp-init.S @@ -80,6 +80,10 @@ __do_hyp_init: msr mair_el2, x4 isb + /* Invalidate the stale TLBs from Bootloader */ + tlbi alle2 + dsb sy + mrs x4, sctlr_el2 and x4, x4, #SCTLR_EL2_EE // preserve endianness of EL2 ldr x5, =SCTLR_EL2_FLAGS