All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL] KVM/ARM fixes for v4.4-rc6
@ 2015-12-18 13:00 ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-12-18 13:00 UTC (permalink / raw)
  To: Paolo Bonzini, Gleb Natapov
  Cc: Christoffer Dall, kvm, kvmarm, linux-arm-kernel

Hi Paolo,

We have a one line fix for the VGIC this time around, fixing a patch
that went in -rc2. Oh well. Hopefully this is the last one for v4.4.

Please pull!

Thanks,

	M.

The following changes since commit 0de58f852875a0f0dcfb120bb8433e4e73c7803b:

  ARM/arm64: KVM: correct PTE uncachedness check (2015-12-04 16:30:17 +0000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvm-arm-for-v4.4-rc6

for you to fetch changes up to fdec12c12ed4333afb49c9948c29fbd5fb52da97:

  KVM: arm/arm64: vgic: Fix kvm_vgic_map_is_active's dist check (2015-12-11 16:33:31 +0000)

----------------------------------------------------------------
KVM/ARM fixes for v4.4-rc6

- Fix for the active interrupt detection code, affecting
  the timer interrupt injection.

----------------------------------------------------------------
Christoffer Dall (1):
      KVM: arm/arm64: vgic: Fix kvm_vgic_map_is_active's dist check

 virt/kvm/arm/vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL] KVM/ARM fixes for v4.4-rc6
@ 2015-12-18 13:00 ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-12-18 13:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Paolo,

We have a one line fix for the VGIC this time around, fixing a patch
that went in -rc2. Oh well. Hopefully this is the last one for v4.4.

Please pull!

Thanks,

	M.

The following changes since commit 0de58f852875a0f0dcfb120bb8433e4e73c7803b:

  ARM/arm64: KVM: correct PTE uncachedness check (2015-12-04 16:30:17 +0000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git tags/kvm-arm-for-v4.4-rc6

for you to fetch changes up to fdec12c12ed4333afb49c9948c29fbd5fb52da97:

  KVM: arm/arm64: vgic: Fix kvm_vgic_map_is_active's dist check (2015-12-11 16:33:31 +0000)

----------------------------------------------------------------
KVM/ARM fixes for v4.4-rc6

- Fix for the active interrupt detection code, affecting
  the timer interrupt injection.

----------------------------------------------------------------
Christoffer Dall (1):
      KVM: arm/arm64: vgic: Fix kvm_vgic_map_is_active's dist check

 virt/kvm/arm/vgic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] KVM: arm/arm64: vgic-new: Try to insert multi-source SGIs at once
  2015-12-18 13:00 ` Marc Zyngier
@ 2015-12-18 13:00   ` Marc Zyngier
  -1 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-12-18 13:00 UTC (permalink / raw)
  To: Paolo Bonzini, Gleb Natapov
  Cc: Christoffer Dall, kvm, kvmarm, linux-arm-kernel

Improve handling of multi-source SGIs: instead of only inserting
one source per SGI per run, try to insert them all at once.

Hopefully this is a rare case.

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

diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index c6f04a1..052f917 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -371,15 +371,22 @@ static int compute_ap_list_depth(struct kvm_vcpu *vcpu)
 	struct vgic_irq *irq;
 	int count = 0;
 
-	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list)
-		count++;
-
+	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
+		spin_lock(&irq->irq_lock);
+		/* GICv2 SGIs can count for more than one... */
+		if (irq->intid < VGIC_NR_SGIS && irq->source)
+			count += hweight8(irq->source);
+		else
+			count++;
+		spin_unlock(&irq->irq_lock);
+	}
 	return count;
 }
 
 static void vgic_populate_lrs(struct kvm_vcpu *vcpu)
 {
 	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
+	u32 model = vcpu->kvm->arch.vgic.vgic_model;
 	struct vgic_irq *irq;
 	int count = 0;
 
@@ -390,8 +397,23 @@ static void vgic_populate_lrs(struct kvm_vcpu *vcpu)
 
 	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
 		spin_lock(&irq->irq_lock);
-		if (vgic_target_oracle(irq) == vcpu)
+
+		if (unlikely(vgic_target_oracle(irq) != vcpu))
+			goto next;
+
+		/*
+		 * If we get an SGI with multiple sources, try to get
+		 * them in all at once.
+		 */
+		if (model == KVM_DEV_TYPE_ARM_VGIC_V2 &&
+		    irq->intid < VGIC_NR_SGIS) {
+			while(irq->source && count < vcpu->arch.vgic_cpu.nr_lr)
+				vgic_populate_lr(vcpu, irq, count++);
+		} else {
 			vgic_populate_lr(vcpu, irq, count++);
+		}
+
+	next:
 		spin_unlock(&irq->irq_lock);
 
 		if (count == vcpu->arch.vgic_cpu.nr_lr)
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] KVM: arm/arm64: vgic-new: Try to insert multi-source SGIs at once
@ 2015-12-18 13:00   ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-12-18 13:00 UTC (permalink / raw)
  To: linux-arm-kernel

Improve handling of multi-source SGIs: instead of only inserting
one source per SGI per run, try to insert them all at once.

Hopefully this is a rare case.

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

diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c
index c6f04a1..052f917 100644
--- a/virt/kvm/arm/vgic/vgic.c
+++ b/virt/kvm/arm/vgic/vgic.c
@@ -371,15 +371,22 @@ static int compute_ap_list_depth(struct kvm_vcpu *vcpu)
 	struct vgic_irq *irq;
 	int count = 0;
 
-	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list)
-		count++;
-
+	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
+		spin_lock(&irq->irq_lock);
+		/* GICv2 SGIs can count for more than one... */
+		if (irq->intid < VGIC_NR_SGIS && irq->source)
+			count += hweight8(irq->source);
+		else
+			count++;
+		spin_unlock(&irq->irq_lock);
+	}
 	return count;
 }
 
 static void vgic_populate_lrs(struct kvm_vcpu *vcpu)
 {
 	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
+	u32 model = vcpu->kvm->arch.vgic.vgic_model;
 	struct vgic_irq *irq;
 	int count = 0;
 
@@ -390,8 +397,23 @@ static void vgic_populate_lrs(struct kvm_vcpu *vcpu)
 
 	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
 		spin_lock(&irq->irq_lock);
-		if (vgic_target_oracle(irq) == vcpu)
+
+		if (unlikely(vgic_target_oracle(irq) != vcpu))
+			goto next;
+
+		/*
+		 * If we get an SGI with multiple sources, try to get
+		 * them in all at once.
+		 */
+		if (model == KVM_DEV_TYPE_ARM_VGIC_V2 &&
+		    irq->intid < VGIC_NR_SGIS) {
+			while(irq->source && count < vcpu->arch.vgic_cpu.nr_lr)
+				vgic_populate_lr(vcpu, irq, count++);
+		} else {
 			vgic_populate_lr(vcpu, irq, count++);
+		}
+
+	next:
 		spin_unlock(&irq->irq_lock);
 
 		if (count == vcpu->arch.vgic_cpu.nr_lr)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL] KVM/ARM fixes for v4.4-rc6
  2015-12-18 13:00 ` Marc Zyngier
@ 2015-12-18 14:01   ` Marc Zyngier
  -1 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-12-18 14:01 UTC (permalink / raw)
  To: Paolo Bonzini, Gleb Natapov; +Cc: linux-arm-kernel, kvm, kvmarm


Idiot alert, sending the wrong patch...

On 18/12/15 13:00, Marc Zyngier wrote:
> Hi Paolo,
> 
> We have a one line fix for the VGIC this time around, fixing a patch
> that went in -rc2. Oh well. Hopefully this is the last one for v4.4.
> 
> Please pull!

Or don't, actually.

Sorry about the noise, the real one is coming in a minute, once I've
collected a couple of brain cells...

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL] KVM/ARM fixes for v4.4-rc6
@ 2015-12-18 14:01   ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-12-18 14:01 UTC (permalink / raw)
  To: linux-arm-kernel


Idiot alert, sending the wrong patch...

On 18/12/15 13:00, Marc Zyngier wrote:
> Hi Paolo,
> 
> We have a one line fix for the VGIC this time around, fixing a patch
> that went in -rc2. Oh well. Hopefully this is the last one for v4.4.
> 
> Please pull!

Or don't, actually.

Sorry about the noise, the real one is coming in a minute, once I've
collected a couple of brain cells...

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-18 14:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 13:00 [PULL] KVM/ARM fixes for v4.4-rc6 Marc Zyngier
2015-12-18 13:00 ` Marc Zyngier
2015-12-18 13:00 ` [PATCH] KVM: arm/arm64: vgic-new: Try to insert multi-source SGIs at once Marc Zyngier
2015-12-18 13:00   ` Marc Zyngier
2015-12-18 14:01 ` [PULL] KVM/ARM fixes for v4.4-rc6 Marc Zyngier
2015-12-18 14:01   ` Marc Zyngier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.