public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: pbonzini@redhat.com, gleb@redhat.com
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Subject: [PATCH 1/4] ARM: KVM: vgic: simplify vgic_get_target_reg
Date: Thu, 29 Aug 2013 11:08:22 +0100	[thread overview]
Message-ID: <1377770905-9937-2-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1377770905-9937-1-git-send-email-marc.zyngier@arm.com>

vgic_get_target_reg is quite complicated, for no good reason.
Actually, it is fairly easy to write it in a much more efficient
way by using the target CPU array instead of the bitmap.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 virt/kvm/arm/vgic.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 17c5ac7..a2d478a 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -432,19 +432,13 @@ static bool handle_mmio_priority_reg(struct kvm_vcpu *vcpu,
 static u32 vgic_get_target_reg(struct kvm *kvm, int irq)
 {
 	struct vgic_dist *dist = &kvm->arch.vgic;
-	struct kvm_vcpu *vcpu;
-	int i, c;
-	unsigned long *bmap;
+	int i;
 	u32 val = 0;
 
 	irq -= VGIC_NR_PRIVATE_IRQS;
 
-	kvm_for_each_vcpu(c, vcpu, kvm) {
-		bmap = vgic_bitmap_get_shared_map(&dist->irq_spi_target[c]);
-		for (i = 0; i < GICD_IRQS_PER_ITARGETSR; i++)
-			if (test_bit(irq + i, bmap))
-				val |= 1 << (c + i * 8);
-	}
+	for (i = 0; i < GICD_IRQS_PER_ITARGETSR; i++)
+		val |= 1 << (dist->irq_spi_cpu[irq + i] + i * 8);
 
 	return val;
 }
-- 
1.8.2.3



  reply	other threads:[~2013-08-29 10:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29 10:08 [GIT PULL] ARM: KVM: VGIC fixes for 3.12 Marc Zyngier
2013-08-29 10:08 ` Marc Zyngier [this message]
2013-08-29 10:08 ` [PATCH 2/4] ARM: KVM: vgic: fix GICD_ICFGRn access Marc Zyngier
2013-08-29 20:28   ` Christoffer Dall
2013-08-29 10:08 ` [PATCH 3/4] ARM: KVM: Bugfix: vgic_bytemap_get_reg per cpu regs Marc Zyngier
2013-08-29 10:08 ` [PATCH 4/4] ARM: KVM: vgic: Bump VGIC_NR_IRQS to 256 Marc Zyngier
2013-08-30 13:08 ` [GIT PULL] ARM: KVM: VGIC fixes for 3.12 Gleb Natapov
2013-08-30 13:15   ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1377770905-9937-2-git-send-email-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox