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: 4646761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 593449F36A for ; Wed, 30 Jul 2014 09:49:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 939D620149 for ; Wed, 30 Jul 2014 09:49:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4C2820138 for ; Wed, 30 Jul 2014 09:49:16 +0000 (UTC) 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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+aLB61xdbBzK1CNt/GHev7S5jE7PgS6q+aQJSc4YgRs=; b=RGPWefj03IheF+LqNVvu6hINLn8zDo8GUQ7xagwIcyWk6HODbU+xB7iVyv+EGELo9w e9qFadteMNgLOe0Tf3pGIiIauctv1fcRDHhYFjBmUh8Ph7z3h2NjTMW/oQbDZ9Kf3DTO HkRiYmYGUBHEwV0wR7W3TzfRGt3aIlkcBCFktsiejhLFamZ5782cep9kr8NcFqWdV5kP lp2Gq8kdecCmYYi7p6PPpeGE1T5+Q7qGmdqaZgbzok3KoWTJ/i7NKTPwiac9bxi8eGOH tGE79eu7wIeb9iIhH4lFYjJpYI5/rUk4asDB4aP8MVtd/aMbDaG552qslXCrn64tEIhQ wQiw== X-Gm-Message-State: ALoCoQnXT3LsV0pFhQ9p7NylfSqgWMH9/MHNptRhPLiKoEx0OlrjS9Y3tZq7CI8lnr2qY7ddetpx 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 (-) 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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