From patchwork Mon Jan 9 06:24:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9504027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8097660757 for ; Mon, 9 Jan 2017 06:38:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 714B1280DE for ; Mon, 9 Jan 2017 06:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65F002811C; Mon, 9 Jan 2017 06:38:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E251A280DE for ; Mon, 9 Jan 2017 06:38:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163753AbdAIGgf (ORCPT ); Mon, 9 Jan 2017 01:36:35 -0500 Received: from outprodmail02.cc.columbia.edu ([128.59.72.51]:51998 "EHLO outprodmail02.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939615AbdAIG0A (ORCPT ); Mon, 9 Jan 2017 01:26:00 -0500 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail02.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Od07005146 for ; Mon, 9 Jan 2017 01:25:59 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id 537C284 for ; Mon, 9 Jan 2017 01:25:59 -0500 (EST) Received: from sendprodmail04.cc.columbia.edu (sendprodmail04.cc.columbia.edu [128.59.72.16]) by hazelnut (Postfix) with ESMTP id 3B97A84 for ; Mon, 9 Jan 2017 01:25:59 -0500 (EST) Received: from mail-qk0-f199.google.com (mail-qk0-f199.google.com [209.85.220.199]) by sendprodmail04.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Px1a004924 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:25:59 -0500 Received: by mail-qk0-f199.google.com with SMTP id x64so109015504qkb.5 for ; Sun, 08 Jan 2017 22:25:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fqZch1u3aONP/+4lUVeo7g1fyxDeEV+8wy2L+wTgjqI=; b=IeHFMpVnqpfRomvymN66GDXgFb/g9sA1oMMR+jnYSgspgAf9x4xNE9h6ZA6MBkqIFq PDtp7Gs36smytVbT01qeIvmb45W68c6y0QxqmWZ6KsoCLnVQ+EVaFqLoUWG1jvSymhQF FMuuyf6Brvum58GTdeB01rpkC1CZ1Zc+MqZmKUsPizy6n5way5SsBXHmFxxQ4IgsJquz DGJ1zl3nUs2L+JA7uI3+MaPHH3m8yXqiOOsDwlOJASps/226r+2roNYnxGNaczvaSROb G9pl7uxAuKBbEL6TvO7u7NgxK9V5S46ktjKmNpdZb3vchUTG/eWuvVCFQ75NPb7WuXrw VNzw== X-Gm-Message-State: AIkVDXIOvWX4Kou4LUXDEG+T6euzsJH+vlXAeEb7ycDXqSzk2wCgePbYsRxE4OuzmVsfqi1u6UlAgJ7eiA2nmghos6bbRVj8u60/3gSnuuV46Mpca1zAUqADQcVWxrj57RXWiwesrLTQnMY= X-Received: by 10.200.56.76 with SMTP id r12mr77475924qtb.2.1483943158901; Sun, 08 Jan 2017 22:25:58 -0800 (PST) X-Received: by 10.200.56.76 with SMTP id r12mr77475898qtb.2.1483943158752; Sun, 08 Jan 2017 22:25:58 -0800 (PST) Received: from jintack.cs.columbia.edu ([2001:18d8:ffff:16:21a:4aff:feaa:f900]) by smtp.gmail.com with ESMTPSA id h3sm8623257qtc.6.2017.01.08.22.25.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 22:25:57 -0800 (PST) From: Jintack Lim To: christoffer.dall@linaro.org, marc.zyngier@arm.com, pbonzini@redhat.com, rkrcmar@redhat.com, linux@armlinux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, vladimir.murzin@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, james.morse@arm.com, lorenzo.pieralisi@arm.com, kevin.brodsky@arm.com, wcohen@redhat.com, shankerd@codeaurora.org, geoff@infradead.org, andre.przywara@arm.com, eric.auger@redhat.com, anna-maria@linutronix.de, shihwei@cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: jintack@cs.columbia.edu Subject: [RFC 20/55] KVM: arm64: Forward CPACR_EL1 traps to the guest hypervisor Date: Mon, 9 Jan 2017 01:24:16 -0500 Message-Id: <1483943091-1364-21-git-send-email-jintack@cs.columbia.edu> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu> References: <1483943091-1364-1-git-send-email-jintack@cs.columbia.edu> X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.78 on 128.59.72.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Forward CPACR_EL1 traps to the guest hypervisor if it has configured the virtual CPTR_EL2 to do so. Signed-off-by: Jintack Lim --- arch/arm64/kvm/sys_regs.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 321ecbc..e66f40d 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -951,6 +951,11 @@ static bool access_cpacr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, const struct sys_reg_desc *r) { + /* Forward this trap to the guest hypervisor if it expects */ + if (!vcpu_mode_el2(vcpu) && + (vcpu_el2_reg(vcpu, CPTR_EL2) & CPTR_EL2_TCPAC)) + return kvm_inject_nested_sync(vcpu, kvm_vcpu_get_hsr(vcpu)); + access_rw(p, &vcpu_sys_reg(vcpu, r->reg)); return true; }