From patchwork Thu Mar 20 11:52:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 26686 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C7BDD20143 for ; Thu, 20 Mar 2014 11:57:45 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wo20sf2938766obc.2 for ; Thu, 20 Mar 2014 04:57:45 -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=p2jItCRVbf4anyJOKIBrhBdEry8Z9Jw1/ctVsrS202w=; b=EuxZ2uZhPOg/EpWVgfhtONR6ImhKOVRRTm6/Nl5WvetMo+5dSYKeNOQ63vEj2MB+sr ccfRSDhcUzDt4JmwhIIjsLyYOsb08o92nTRvamyN8PzSl9tRSjuLqO05jvLrPbISamWR L7hA5U/4gAfGFvbwhkOZuYLwy8kJEWY93/8ZnC4yAbr82Uk7bTcgnPDdmXslA5ukpYpF Hjb65ZijrRLrRzNY6DbJf0MDmsf/wHNElVx5jjmQzjnxZe6pbIF5KxXDbxt7P9e2WmIs EWbFhc/jj7AIrwQzoTnb3qeXgeTQnkjxMHcLpjO8VoImvSgICyHFr+GJ8611jTG2r1zr +KMw== X-Gm-Message-State: ALoCoQnUoP6/HN28f0njks9RHVV6wP+bMxz9J1oScN20NF+fuN2T16myMzgwsSmUrM2RS8ZQ5/nJ X-Received: by 10.43.158.9 with SMTP id ls9mr15966773icc.18.1395316665407; Thu, 20 Mar 2014 04:57:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.10 with SMTP id i10ls195743qgf.62.gmail; Thu, 20 Mar 2014 04:57:45 -0700 (PDT) X-Received: by 10.220.12.140 with SMTP id x12mr23443749vcx.19.1395316665267; Thu, 20 Mar 2014 04:57:45 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id tc10si354768vcb.215.2014.03.20.04.57.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Mar 2014 04:57:45 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so787903veb.11 for ; Thu, 20 Mar 2014 04:57:45 -0700 (PDT) X-Received: by 10.220.162.196 with SMTP id w4mr2767vcx.58.1395316665174; Thu, 20 Mar 2014 04:57:45 -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 i9csp381943vck; Thu, 20 Mar 2014 04:57:44 -0700 (PDT) X-Received: by 10.180.205.130 with SMTP id lg2mr2413318wic.59.1395316664283; Thu, 20 Mar 2014 04:57:44 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id hi2si1143821wjc.149.2014.03.20.04.57.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Mar 2014 04:57:44 -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 1WQbZG-0007YH-VI; Thu, 20 Mar 2014 11:55:28 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WQbYe-0005pF-Fc; Thu, 20 Mar 2014 11:54:48 +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 1WQbXl-0005fA-SO for linux-arm-kernel@lists.infradead.org; Thu, 20 Mar 2014 11:53:55 +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 49E601401C9; Thu, 20 Mar 2014 06:53:15 -0500 (CDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Subject: [PATCH v2 08/19] KVM: ARM: vgic: abstract EISR bitmap access Date: Thu, 20 Mar 2014 11:52:55 +0000 Message-Id: <1395316386-12617-9-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_075354_051123_BD68E967 X-CRM114-Status: GOOD ( 10.07 ) 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.128.180 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 Move the GICH_EISR access to its own function. Acked-by: Catalin Marinas Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 1 + virt/kvm/arm/vgic.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h index e82e3bb..7928909 100644 --- a/include/kvm/arm_vgic.h +++ b/include/kvm/arm_vgic.h @@ -85,6 +85,7 @@ struct vgic_ops { struct vgic_lr (*get_lr)(const struct kvm_vcpu *, int); void (*set_lr)(struct kvm_vcpu *, int, struct vgic_lr); u64 (*get_elrsr)(const struct kvm_vcpu *vcpu); + u64 (*get_eisr)(const struct kvm_vcpu *vcpu); }; struct vgic_dist { diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index 04206a8..896359f 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c @@ -1028,10 +1028,17 @@ static u64 vgic_v2_get_elrsr(const struct kvm_vcpu *vcpu) return *(u64 *)elrsr; } +static u64 vgic_v2_get_eisr(const struct kvm_vcpu *vcpu) +{ + const u32 *eisr = vcpu->arch.vgic_cpu.vgic_v2.vgic_eisr; + return *(u64 *)eisr; +} + static const struct vgic_ops vgic_ops = { .get_lr = vgic_v2_get_lr, .set_lr = vgic_v2_set_lr, .get_elrsr = vgic_v2_get_elrsr, + .get_eisr = vgic_v2_get_eisr, }; static inline struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr) @@ -1050,6 +1057,11 @@ static inline u64 vgic_get_elrsr(struct kvm_vcpu *vcpu) return vgic_ops.get_elrsr(vcpu); } +static inline u64 vgic_get_eisr(struct kvm_vcpu *vcpu) +{ + return vgic_ops.get_eisr(vcpu); +} + static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu) { struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; @@ -1256,9 +1268,11 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) * Some level interrupts have been EOIed. Clear their * active bit. */ + u64 eisr = vgic_get_eisr(vcpu); + unsigned long *eisr_ptr = (unsigned long *)&eisr; int lr; - for_each_set_bit(lr, (unsigned long *)vgic_cpu->vgic_v2.vgic_eisr, + for_each_set_bit(lr, eisr_ptr, vgic_cpu->nr_lr) { vgic_cpu->nr_lr) { struct vgic_lr vlr = vgic_get_lr(vcpu, lr);