From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: KVM: vgic: simplify vgic_get_target_reg
Date: Tue, 18 Jun 2013 12:21:33 -0700 [thread overview]
Message-ID: <20130618192133.GA6213@lvm> (raw)
In-Reply-To: <1371550209-8123-1-git-send-email-marc.zyngier@arm.com>
On Tue, Jun 18, 2013 at 11:10:09AM +0100, Marc Zyngier wrote:
> 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>
> ---
> arch/arm/kvm/vgic.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
> index 17c5ac7..a2d478a 100644
> --- a/arch/arm/kvm/vgic.c
> +++ b/arch/arm/kvm/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
>
ack
prev parent reply other threads:[~2013-06-18 19:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 10:10 [PATCH] ARM: KVM: vgic: simplify vgic_get_target_reg Marc Zyngier
2013-06-18 19:21 ` Christoffer Dall [this message]
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=20130618192133.GA6213@lvm \
--to=christoffer.dall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).