Skip to contentSkip to conversation

irqchip/gic-v4.1: Wait for completion of redistributor's INVALL operation

PATCH Applied Zenghui Yu 3 participants 3 messages Mar 2, 2020 – Mar 29, 2020

Subsystems (3)
lore
Share & tools
lore

Zenghui Yu

author reviewer
#0 lore raw

PATCH 1/1 irqchip/gic-v4.1: Wait for completion of redistributor's INVALL operation

In GICv4.1, we emulate a guest-issued INVALL command by a direct write to GICR_INVALLR. Before we finish the emulation and go back to guest, let's make sure the physical invalidate operation is actually completed and no stale data will be left in redistributor. Per the specification, this can be achieved by polling the GICR_SYNCR.Busy bit (to zero).

---
 drivers/irqchip/irq-gic-v3-its.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +2 -0
index 83b1186ffcad..fc8c2970cee4 100644
@@ -3784,6 +3784,8 @@ static void its_vpe_4_1_invall(struct its_vpe *vpe)
 	/* Target the redistributor this vPE is currently known on */
 	rdbase = per_cpu_ptr(gic_rdists->rdist, vpe->col_idx)->rd_base;
 	gic_write_lpir(val, rdbase + GICR_INVALLR);
+
+	wait_for_syncr(rdbase);
 }
 
 static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
Signature · 1 line
2.19.1
maintainer
#1 lore raw
Quoted 24 lines · Zenghui Yu

In GICv4.1, we emulate a guest-issued INVALL command by a direct write to GICR_INVALLR. Before we finish the emulation and go back to guest, let's make sure the physical invalidate operation is actually completed and no stale data will be left in redistributor. Per the specification, this can be achieved by polling the GICR_SYNCR.Busy bit (to zero).

---
 drivers/irqchip/irq-gic-v3-its.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +2 -0
index 83b1186ffcad..fc8c2970cee4 100644
@@ -3784,6 +3784,8 @@ static void its_vpe_4_1_invall(struct its_vpe 
 *vpe)
 	/* Target the redistributor this vPE is currently known on */
 	rdbase = per_cpu_ptr(gic_rdists->rdist, vpe->col_idx)->rd_base;
 	gic_write_lpir(val, rdbase + GICR_INVALLR);
+
+	wait_for_syncr(rdbase);
 }
 
Quoted 2 lines

static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void
*vcpu_info)

Yup, well spotted. I'll add that to the series.

Thanks,

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...
merge bot Applied
#2 lore raw
In reply to Zenghui Yu
The following commit has been merged into the irq/core branch of tip:

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     b978c25f6ee7d4c79cbe918eed684e53887ec001
Gitweb:        https://git.kernel.org/tip/b978c25f6ee7d4c79cbe918eed684e53887ec001
Author:        Zenghui Yu <[email protected]>
AuthorDate:    Wed, 04 Mar 2020 20:33:11 
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Fri, 20 Mar 2020 17:48:09 

irqchip/gic-v4.1: Wait for completion of redistributor's INVALL operation

In GICv4.1, we emulate a guest-issued INVALL command by a direct write to GICR_INVALLR. Before we finish the emulation and go back to guest, let's make sure the physical invalidate operation is actually completed and no stale data will be left in redistributor. Per the specification, this can be achieved by polling the GICR_SYNCR.Busy bit (to zero).

---
 drivers/irqchip/irq-gic-v3-its.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +2 -0
index 1af7139..c843702 100644
@@ -3827,6 +3827,8 @@ static void its_vpe_4_1_invall(struct its_vpe *vpe)
 	/* Target the redistributor this vPE is currently known on */
 	rdbase = per_cpu_ptr(gic_rdists->rdist, vpe->col_idx)->rd_base;
 	gic_write_lpir(val, rdbase + GICR_INVALLR);
+
+	wait_for_syncr(rdbase);
 }
 
 static int its_vpe_4_1_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)