From patchwork Thu Mar 20 11:53:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 26699 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 68F23202E0 for ; Thu, 20 Mar 2014 13:27:13 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf3441267oac.7 for ; Thu, 20 Mar 2014 06:27:13 -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 :in-reply-to:references: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=3bYdXUpyQc1VNNC1no61PhW0GnIlVPkUXs6QI8FT4SQ=; b=HWMJMnPtYLG2MuyBXVHUfZz7A+aqUfdAvFylC+uXIzgu9WfmiblOh288L8iqS8PpwD Lt+eSx76WJngtkgboXKWUDSURz7G7CPIEX46Hyqhg9OzsczUImvPB+KCgFZc+I0RI5fu KNpkfaFm0oaRkGxy2BIZz/rFy/o1XJLGxtPQ9MYhfXdZmYxJmrmInktrfFSgN7LFqzV2 u1/REbURACSA5ipSv7MNeMtVjd50OadZM11N4YMPUFu1zj7vhabLSJzYxoq8L0N6dCuh 7muoELClbb8JxjrUF2AEGPgxkwLarzro2+z0C75Ew1T6al2PyqrGvOf81Bp2PKvvrH4S ZfDw== X-Gm-Message-State: ALoCoQkbv6IUg00tX027Zm/G5ho7anjAV6ntonjUKb/m3qPz5dHGVcrfSsZ3KStITFi0lXceGb/b X-Received: by 10.182.34.169 with SMTP id a9mr3464672obj.49.1395322032978; Thu, 20 Mar 2014 06:27:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.10 with SMTP id i10ls222387qgf.62.gmail; Thu, 20 Mar 2014 06:27:12 -0700 (PDT) X-Received: by 10.52.9.167 with SMTP id a7mr46836vdb.88.1395322032881; Thu, 20 Mar 2014 06:27:12 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id i1si425586vcl.6.2014.03.20.06.27.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 06:27:12 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lh14so911203vcb.6 for ; Thu, 20 Mar 2014 06:27:12 -0700 (PDT) X-Received: by 10.58.207.74 with SMTP id lu10mr33347954vec.15.1395322032795; Thu, 20 Mar 2014 06:27:12 -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.220.78.9 with SMTP id i9csp387925vck; Thu, 20 Mar 2014 06:27:12 -0700 (PDT) X-Received: by 10.180.182.199 with SMTP id eg7mr3048537wic.13.1395322031573; Thu, 20 Mar 2014 06:27:11 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id t1si1372289wjt.90.2014.03.20.06.27.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Mar 2014 06:27:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQbaq-00008y-V1; Thu, 20 Mar 2014 11:57:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQbZw-0005vA-Il; Thu, 20 Mar 2014 11:56:08 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQbXt-0005f9-23 for linux-arm-kernel@lists.infradead.org; Thu, 20 Mar 2014 11:54:11 +0000 Received: from e102391-lin.cambridge.arm.com (e102391-lin.cambridge.arm.com [10.1.209.166]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 389CA1401D2; Thu, 20 Mar 2014 06:53:24 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 17/19] arm64: KVM: move hcr_el2 setting into vgic-v2-switch.S Date: Thu, 20 Mar 2014 11:53:04 +0000 Message-Id: <1395316386-12617-18-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1395316386-12617-1-git-send-email-marc.zyngier@arm.com> References: <1395316386-12617-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140320_075401_220188_DE08273A X-CRM114-Status: UNSURE ( 7.88 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -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] Cc: Catalin Marinas , Will Deacon , Christoffer Dall X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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 GICv3 requires the hcr_el2 switch to be tightly coupled with some of the interrupt controller's register switch. In order to have similar code paths, start moving the hcr_el2 manipulation code to the GICv2 switch code. Acked-by: Catalin Marinas Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp.S | 7 ------- arch/arm64/kvm/vgic-v2-switch.S | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S index aed72d0..92b9120 100644 --- a/arch/arm64/kvm/hyp.S +++ b/arch/arm64/kvm/hyp.S @@ -335,11 +335,6 @@ .endm .macro activate_traps - ldr x2, [x0, #VCPU_IRQ_LINES] - ldr x1, [x0, #VCPU_HCR_EL2] - orr x2, x2, x1 - msr hcr_el2, x2 - ldr x2, =(CPTR_EL2_TTA) msr cptr_el2, x2 @@ -353,8 +348,6 @@ .endm .macro deactivate_traps - mov x2, #HCR_RW - msr hcr_el2, x2 msr cptr_el2, xzr msr hstr_el2, xzr diff --git a/arch/arm64/kvm/vgic-v2-switch.S b/arch/arm64/kvm/vgic-v2-switch.S index c5dc777..d36cd7a 100644 --- a/arch/arm64/kvm/vgic-v2-switch.S +++ b/arch/arm64/kvm/vgic-v2-switch.S @@ -85,6 +85,9 @@ CPU_BE( rev w5, w5 ) sub w4, w4, #1 cbnz w4, 1b 2: + mov x2, #HCR_RW + msr hcr_el2, x2 + isb .endm /* @@ -92,6 +95,11 @@ CPU_BE( rev w5, w5 ) * x0: Register pointing to VCPU struct */ .macro restore_vgic_v2_state + ldr x2, [x0, #VCPU_IRQ_LINES] + ldr x1, [x0, #VCPU_HCR_EL2] + orr x2, x2, x1 + msr hcr_el2, x2 + /* Get VGIC VCTRL base into x2 */ ldr x2, [x0, #VCPU_KVM] kern_hyp_va x2