From patchwork Mon Jan 9 06:24:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jintack Lim X-Patchwork-Id: 9503997 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 5B58C60757 for ; Mon, 9 Jan 2017 06:36:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BB1727FA8 for ; Mon, 9 Jan 2017 06:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 401BC2811C; Mon, 9 Jan 2017 06:36:10 +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=unavailable 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 BC31527FA8 for ; Mon, 9 Jan 2017 06:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034077AbdAIGeq (ORCPT ); Mon, 9 Jan 2017 01:34:46 -0500 Received: from outprodmail01.cc.columbia.edu ([128.59.72.39]:38360 "EHLO outprodmail01.cc.columbia.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S939732AbdAIG0N (ORCPT ); Mon, 9 Jan 2017 01:26:13 -0500 Received: from hazelnut (hazelnut.cc.columbia.edu [128.59.213.250]) by outprodmail01.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Q9ME018083 for ; Mon, 9 Jan 2017 01:26:10 -0500 Received: from hazelnut (localhost.localdomain [127.0.0.1]) by hazelnut (Postfix) with ESMTP id EAAE088 for ; Mon, 9 Jan 2017 01:26:09 -0500 (EST) Received: from sendprodmail01.cc.columbia.edu (sendprodmail01.cc.columbia.edu [128.59.72.13]) by hazelnut (Postfix) with ESMTP id C7CCA89 for ; Mon, 9 Jan 2017 01:26:09 -0500 (EST) Received: from mail-qt0-f197.google.com (mail-qt0-f197.google.com [209.85.216.197]) by sendprodmail01.cc.columbia.edu (8.14.4/8.14.4) with ESMTP id v096Q9ju041204 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 9 Jan 2017 01:26:09 -0500 Received: by mail-qt0-f197.google.com with SMTP id x49so82677268qtc.7 for ; Sun, 08 Jan 2017 22:26:09 -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=The4RozNkwYQlAt8v+nJiqGvfzUtO8Qcu8mXahH5/PA=; b=ZD6H3IHB8DgV8TuP5omP0/MWbtZA4WbxXX1AaunsXpfIAvEbKdRrs0MUxFCqUrVULG 1KaraI/mJbTe9V97xHYVlmFSHqXz8z/9+436rMReWHNKPAMfeZyAMqXo86tObUIk+Cc1 tpuF3KCb0Sf3FZUOjvKF2G06mnmvZlsaaD1m7xVBi3merAzG+iapBVveW4A2ntKzIESB NLmrfkCu3ccmBMiHBtfrERRydQs65rSo43iSPIJmKziTPhjHhxCeK3gwamQj6TGwSsOT tVfi3+h18EfyoXjQDIJu0M52uUrDtXXNEHB5dM5umxEaozADN6XkDb+MwtStmKv6XLnz Gnjg== X-Gm-Message-State: AIkVDXKAtXrZuWCr9ORBlqFf4+D5NBLguCSt8Ag5mZ3z1HwjOK07tod/W0xQ71as83aDXSTaSJ9emRr0E7ow9XaqcoV1Mg3JQvygMzOZCFizcXNsAzVx5WYPv71Ma6aNQnFIioi6QW4NoPM= X-Received: by 10.55.46.132 with SMTP id u126mr86528861qkh.67.1483943169418; Sun, 08 Jan 2017 22:26:09 -0800 (PST) X-Received: by 10.55.46.132 with SMTP id u126mr86528838qkh.67.1483943169292; Sun, 08 Jan 2017 22:26:09 -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.26.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jan 2017 22:26:08 -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 29/55] KVM: arm/arm64: Set up the prepared vgic state Date: Mon, 9 Jan 2017 01:24:25 -0500 Message-Id: <1483943091-1364-30-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.13 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since vgic state is properly prepared and is pointed by hw_v2_cpu_if, let's use it to manipulate vgic. Signed-off-by: Jintack Lim --- virt/kvm/arm/hyp/vgic-v2-sr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/virt/kvm/arm/hyp/vgic-v2-sr.c b/virt/kvm/arm/hyp/vgic-v2-sr.c index c8aeb7b..5d4898f 100644 --- a/virt/kvm/arm/hyp/vgic-v2-sr.c +++ b/virt/kvm/arm/hyp/vgic-v2-sr.c @@ -22,10 +22,15 @@ #include #include +static __hyp_text struct vgic_v2_cpu_if *__hyp_get_cpu_if(struct kvm_vcpu *vcpu) +{ + return kern_hyp_va(vcpu->arch.vgic_cpu.hw_v2_cpu_if); +} + static void __hyp_text save_maint_int_state(struct kvm_vcpu *vcpu, void __iomem *base) { - struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; + struct vgic_v2_cpu_if *cpu_if = __hyp_get_cpu_if(vcpu); int nr_lr = (kern_hyp_va(&kvm_vgic_global_state))->nr_lr; u32 eisr0, eisr1; int i; @@ -67,7 +72,7 @@ static void __hyp_text save_maint_int_state(struct kvm_vcpu *vcpu, static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base) { - struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; + struct vgic_v2_cpu_if *cpu_if = __hyp_get_cpu_if(vcpu); int nr_lr = (kern_hyp_va(&kvm_vgic_global_state))->nr_lr; u32 elrsr0, elrsr1; @@ -86,7 +91,7 @@ static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base) static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base) { - struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; + struct vgic_v2_cpu_if *cpu_if = __hyp_get_cpu_if(vcpu); int nr_lr = (kern_hyp_va(&kvm_vgic_global_state))->nr_lr; int i; @@ -107,7 +112,7 @@ static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base) void __hyp_text __vgic_v2_save_state(struct kvm_vcpu *vcpu) { struct kvm *kvm = kern_hyp_va(vcpu->kvm); - struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; + struct vgic_v2_cpu_if *cpu_if = __hyp_get_cpu_if(vcpu); struct vgic_dist *vgic = &kvm->arch.vgic; void __iomem *base = kern_hyp_va(vgic->vctrl_base); @@ -138,7 +143,7 @@ void __hyp_text __vgic_v2_save_state(struct kvm_vcpu *vcpu) void __hyp_text __vgic_v2_restore_state(struct kvm_vcpu *vcpu) { struct kvm *kvm = kern_hyp_va(vcpu->kvm); - struct vgic_v2_cpu_if *cpu_if = &vcpu->arch.vgic_cpu.vgic_v2; + struct vgic_v2_cpu_if *cpu_if = __hyp_get_cpu_if(vcpu); struct vgic_dist *vgic = &kvm->arch.vgic; void __iomem *base = kern_hyp_va(vgic->vctrl_base); int nr_lr = (kern_hyp_va(&kvm_vgic_global_state))->nr_lr;