From patchwork Mon Sep 14 16:58:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 53597 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 23C4622B17 for ; Mon, 14 Sep 2015 17:01:00 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf43994174wic.2 for ; Mon, 14 Sep 2015 10:00:59 -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 :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:cc:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=K0z59pSDq0GYqJy01rTq2pTXF2Ggthpx7yko9yCBIAI=; b=bDan3oDJ+mpcsdi7c1sTI5jI7PBtlcUfyPqoc+0nn5XcjzFSMmp3hvEOvCwEhKLwEA 0JtYqltXWAyCwUCivp4DuK4X9tnh4XyK30p87tUZYmOdbS4I2ePhDi9esFnLydKp1taO HaWiIHUxfefRspzg2zfSGh11rrv/F+G9f/QsGCTBvJuskl7pXKdefr52cqYTZYzDd0+Z S+REZ2qCMevWNjwl+ueR/FkGwzvhDPzoXEKIaB+qxciZhTX7Clx0vgg+up1JVgN5T3va +8OtOvaBspaICW1OdbKer0ZNXgjc0nGhW5TWH52Fp3v2HNGN1QFmaZHCmx8D6F+GarcH KssA== X-Gm-Message-State: ALoCoQnWcKMhnV1Wu41gHfQf6kLG2KonGIboxKlsDWs/qAdtavV7w0vV9VneoSpeltXl5EV0mzPI X-Received: by 10.112.198.33 with SMTP id iz1mr3291449lbc.8.1442250059407; Mon, 14 Sep 2015 10:00:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.232 with SMTP id 8ls609432lap.103.gmail; Mon, 14 Sep 2015 10:00:59 -0700 (PDT) X-Received: by 10.152.37.162 with SMTP id z2mr10660390laj.117.1442250059219; Mon, 14 Sep 2015 10:00:59 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id x8si10396150laa.64.2015.09.14.10.00.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 10:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbcjc2 with SMTP id jc2so70846496lbc.0 for ; Mon, 14 Sep 2015 10:00:59 -0700 (PDT) X-Received: by 10.152.170.225 with SMTP id ap1mr6457294lac.72.1442250059081; Mon, 14 Sep 2015 10:00:59 -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.59.35 with SMTP id w3csp1307232lbq; Mon, 14 Sep 2015 10:00:57 -0700 (PDT) X-Received: by 10.67.3.3 with SMTP id bs3mr36807796pad.121.1442250057399; Mon, 14 Sep 2015 10:00:57 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ku6si24732673pbc.79.2015.09.14.10.00.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Sep 2015 10:00:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) 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 1ZbX6b-0001Ni-KW; Mon, 14 Sep 2015 16:59:49 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZbX6Y-0001GF-3T for linux-arm-kernel@lists.infradead.org; Mon, 14 Sep 2015 16:59:47 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.139]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id t8EGwowo020536; Mon, 14 Sep 2015 17:58:50 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 195621AE331C; Mon, 14 Sep 2015 17:58:56 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm64: head.S: initialise mdcr_el2 in el2_setup Date: Mon, 14 Sep 2015 17:58:55 +0100 Message-Id: <1442249935-13277-1-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150914_095946_491058_9B18D2A3 X-CRM114-Status: UNSURE ( 8.54 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Marc Zyngier , Will Deacon , zhaoshenglong@huawei.com 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: will.deacon@arm.com 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.179 as permitted sender) smtp.mailfrom=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 When entering the kernel at EL2, we fail to initialise the MDCR_EL2 register which controls debug access and PMU capabilities at EL1. This patch ensures that the register is initialised so that all traps are disabled and all the PMU counters are available to the host. When a guest is scheduled, KVM takes care to configure trapping appropriately. Cc: Marc Zyngier Signed-off-by: Will Deacon Acked-by: Marc Zyngier --- arch/arm64/kernel/head.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index a055be6125cf..90d09eddd5b2 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -523,6 +523,11 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems msr hstr_el2, xzr // Disable CP15 traps to EL2 #endif + /* EL2 debug */ + mrs x0, pmcr_el0 // Disable debug access traps + ubfx x0, x0, #11, #5 // to EL2 and allow access to + msr mdcr_el2, x0 // all PMU counters from EL1 + /* Stage-2 translation */ msr vttbr_el2, xzr