Commit efd9735b authored by Marc Zyngier's avatar Marc Zyngier Committed by chenxiang
Browse files

KVM: arm64: vgic-v3: Use the NMI attribute as part of the AP-list sorting

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I97WGU

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=arm64/nmi&id=71cca79830764714f5824c7e7f2ae8f2cf5c647e



----------------------------------------------------------------

Since we want NMIs to make it quicker into the LRs, add them to
the priority sorting.

Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Signed-off-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarcaijian <caijian11@h-partners.com>
parent c35e0950
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -252,6 +252,7 @@ static struct kvm_vcpu *vgic_target_oracle(struct vgic_irq *irq)
 *
 * Otherwise things should be sorted by the priority field and the GIC
 * hardware support will take care of preemption of priority groups etc.
 * NMI acts as a super-priority.
 *
 * Return negative if "a" sorts before "b", 0 to preserve order, and positive
 * to sort "b" before "a".
@@ -287,7 +288,12 @@ static int vgic_irq_cmp(void *priv, const struct list_head *a,
		goto out;
	}

	/* Both pending and enabled, sort by priority */
	/* Both pending and enabled, sort by NMI and then priority */
	if (irqa->nmi != irqb->nmi) {
		ret = (int)irqb->nmi - (int)irqa->nmi;
		goto out;
	}

	ret = irqa->priority - irqb->priority;
out:
	raw_spin_unlock(&irqb->irq_lock);