[PATCH v2] KVM: arm/arm64: GICv4: Do not perform a map to a mapped vLPI

Kunkun Jiang jiangkunkun at huawei.com
Sun Nov 19 02:49:41 PST 2023


Before performing a map, let's check whether the vLPI has been
mapped. This corresponds to checking whether a vLPI is valid
before unmap it.

Fixes: 196b136498b3 ("KVM: arm/arm64: GICv4: Wire mapping/unmapping of VLPIs in VFIO irq bypass")
Signed-off-by: Kunkun Jiang <jiangkunkun at huawei.com>
---
 arch/arm64/kvm/vgic/vgic-v4.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c
index 339a55194b2c..fb60bbb94460 100644
--- a/arch/arm64/kvm/vgic/vgic-v4.c
+++ b/arch/arm64/kvm/vgic/vgic-v4.c
@@ -436,6 +436,11 @@ int kvm_vgic_v4_set_forwarding(struct kvm *kvm, int virq,
 	if (ret)
 		goto out;
 
+	if (irq->hw) {
+		ret = 0;
+		goto out;
+	}
+
 	/*
 	 * Emit the mapping request. If it fails, the ITS probably
 	 * isn't v4 compatible, so let's silently bail out. Holding
-- 
2.33.0




More information about the linux-arm-kernel mailing list