From patchwork Fri Nov 21 17:21:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 41331 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E128D23C27 for ; Fri, 21 Nov 2014 17:26:03 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf3642855wid.3 for ; Fri, 21 Nov 2014 09:26:03 -0800 (PST) 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 :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=QJVZxmY4kiu21TNrBKwWt2AIR8ts0yKTAN1TRX4rrxc=; b=FNcmXWpz2osgMC1toUkDt3SyoWwtKDvcq4dFVaAnaGMW5tPM5DvEyq+PuTf6VQAjPt kXpyQdJ4IicjmPCCYJBwsylQ/tmWeeCIsRsAsIG07Zbw3Io4veK/yzvrHTz3hOIlX/Bo 8l90yZmF2nO3wG5U2yXiqGp9nNM8WtLlHxE9pNicYB03hCCbDBhfjCkMx5xGsbaw2oVa Cgj62CmjVM0VJmUnBCcqAjVP3+83gYX1LKCU6PoB0Swn3yQqzMOvZn6j32w1DgXpdcJf 8Wf0LOY5krwmU53q7qAuvTDSVOc8YuI7zyFRlrwJXSV2PhXDfu/kdF3GpJlKokNijSuA Wszg== X-Gm-Message-State: ALoCoQmO6NRpFCYPadcq+Ix/2Ov5lnoN/X72e3y4cecww27OTzKxGw+zAbVeNIYXuKOo8d0llCLb X-Received: by 10.194.178.163 with SMTP id cz3mr1940079wjc.1.1416590762866; Fri, 21 Nov 2014 09:26:02 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.42.137 with SMTP id o9ls190921lal.17.gmail; Fri, 21 Nov 2014 09:26:02 -0800 (PST) X-Received: by 10.152.87.67 with SMTP id v3mr5294668laz.97.1416590762687; Fri, 21 Nov 2014 09:26:02 -0800 (PST) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id ap1si6584625lac.54.2014.11.21.09.26.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 09:26:02 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id l4so4374519lbv.40 for ; Fri, 21 Nov 2014 09:26:02 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr6351259laz.27.1416590762586; Fri, 21 Nov 2014 09:26:02 -0800 (PST) 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.184.201 with SMTP id ew9csp131620lbc; Fri, 21 Nov 2014 09:26:01 -0800 (PST) X-Received: by 10.68.197.41 with SMTP id ir9mr9385983pbc.116.1416590760992; Fri, 21 Nov 2014 09:26:00 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [198.137.202.9]) by mx.google.com with ESMTPS id mv8si9841139pdb.96.2014.11.21.09.26.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Nov 2014 09:26:00 -0800 (PST) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=198.137.202.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 1Xrrty-0004sJ-F5; Fri, 21 Nov 2014 17:21:46 +0000 Received: from foss-mx-na.foss.arm.com ([217.140.108.86]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xrrtt-0004dH-HR for linux-arm-kernel@lists.infradead.org; Fri, 21 Nov 2014 17:21:41 +0000 Received: from foss-smtp-na-1.foss.arm.com (unknown [10.80.61.8]) by foss-mx-na.foss.arm.com (Postfix) with ESMTP id AF9B3220; Fri, 21 Nov 2014 11:21:15 -0600 (CST) Received: from collaborate-mta1.arm.com (highbank-bc01-b06.austin.arm.com [10.112.81.134]) by foss-smtp-na-1.foss.arm.com (Postfix) with ESMTP id 121CD6045D; Fri, 21 Nov 2014 11:21:13 -0600 (CST) Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.209.28]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 9F8C413F8F5; Fri, 21 Nov 2014 11:21:11 -0600 (CST) From: Marc Zyngier To: Paolo Bonzini Subject: [PATCH 2/3] arm64: KVM: Handle traps of ICC_SRE_EL1 as RAZ/WI Date: Fri, 21 Nov 2014 17:21:06 +0000 Message-Id: <1416590467-6044-3-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1416590467-6044-1-git-send-email-marc.zyngier@arm.com> References: <1416590467-6044-1-git-send-email-marc.zyngier@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141121_092141_591206_A4F3C884 X-CRM114-Status: GOOD ( 10.42 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.0 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 Cc: Mark Rutland , kvm@vger.kernel.org, Ard Biesheuvel , Gleb Natapov , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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: marc.zyngier@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.181 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 From: Christoffer Dall When running on a system with a GICv3, we currenly don't allow the guest to access the system register interface of the GICv3. We do this by clearing the ICC_SRE_EL2.Enable, which causes all guest accesses to ICC_SRE_EL1 to trap to EL2 and causes all guest accesses to other ICC_ registers to cause an undefined exception in the guest. However, we currently don't handle the trap of guest accesses to ICC_SRE_EL1 and will spill out a warning. The trap just needs to handle the access as RAZ/WI, and a guest that tries to prod this register and set ICC_SRE_EL1.SRE=1, must read back the value (which Linux already does) to see if it succeeded, and will thus observe that ICC_SRE_EL1.SRE was not set. Add the simple trap handler in the sorted table of the system registers. Signed-off-by: Christoffer Dall [ardb: added cp15 handling] Signed-off-by: Ard Biesheuvel Signed-off-by: Marc Zyngier --- arch/arm64/kvm/sys_regs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 4cc3b71..3d7c2df 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -424,6 +424,11 @@ static const struct sys_reg_desc sys_reg_descs[] = { /* VBAR_EL1 */ { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b0000), Op2(0b000), NULL, reset_val, VBAR_EL1, 0 }, + + /* ICC_SRE_EL1 */ + { Op0(0b11), Op1(0b000), CRn(0b1100), CRm(0b1100), Op2(0b101), + trap_raz_wi }, + /* CONTEXTIDR_EL1 */ { Op0(0b11), Op1(0b000), CRn(0b1101), CRm(0b0000), Op2(0b001), access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 }, @@ -690,6 +695,10 @@ static const struct sys_reg_desc cp15_regs[] = { { Op1( 0), CRn(10), CRm( 2), Op2( 1), access_vm_reg, NULL, c10_NMRR }, { Op1( 0), CRn(10), CRm( 3), Op2( 0), access_vm_reg, NULL, c10_AMAIR0 }, { Op1( 0), CRn(10), CRm( 3), Op2( 1), access_vm_reg, NULL, c10_AMAIR1 }, + + /* ICC_SRE */ + { Op1( 0), CRn(12), CRm(12), Op2( 5), trap_raz_wi }, + { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, };