Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 8e29f32

Browse files
tangnianyaogregkh
authored andcommitted
irqchip/gic-v3-its: Fix VSYNC referencing an unmapped VPE on GIC v4.1
commit 80e9963 upstream. As per the GICv4.1 spec (Arm IHI 0069H, 5.3.19): "A VMAPP with {V, Alloc}=={0, x} is self-synchronizing, This means the ITS command queue does not show the command as consumed until all of its effects are completed." Furthermore, VSYNC is allowed to deliver an SError when referencing a non existent VPE. By these definitions, a VMAPP followed by a VSYNC is a bug, as the later references a VPE that has been unmapped by the former. Fix it by eliding the VSYNC in this scenario. Fixes: 64edfaa ("irqchip/gic-v4.1: Implement the v4.1 flavour of VMAPP") Signed-off-by: Nianyao Tang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Reviewed-by: Zenghui Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 20b5342 commit 8e29f32

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
786786
struct its_cmd_block *cmd,
787787
struct its_cmd_desc *desc)
788788
{
789+
struct its_vpe *vpe = valid_vpe(its, desc->its_vmapp_cmd.vpe);
789790
unsigned long vpt_addr, vconf_addr;
790791
u64 target;
791792
bool alloc;
@@ -798,6 +799,11 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
798799
if (is_v4_1(its)) {
799800
alloc = !atomic_dec_return(&desc->its_vmapp_cmd.vpe->vmapp_count);
800801
its_encode_alloc(cmd, alloc);
802+
/*
803+
* Unmapping a VPE is self-synchronizing on GICv4.1,
804+
* no need to issue a VSYNC.
805+
*/
806+
vpe = NULL;
801807
}
802808

803809
goto out;
@@ -832,7 +838,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
832838
out:
833839
its_fixup_cmd(cmd);
834840

835-
return valid_vpe(its, desc->its_vmapp_cmd.vpe);
841+
return vpe;
836842
}
837843

838844
static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,

0 commit comments

Comments
 (0)