Skip to content

Commit 205e065

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
irqchip/gic-v3-its: Only emit VSYNC if targetting a valid collection
Similarily to the SYNC operation, it must be verified that the VPE targetted by a VLPI is backed by a valid collection in the GIC driver data structures. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Jason Cooper <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Yang Yingliang <[email protected]> Cc: Sumit Garg <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 83559b4 commit 205e065

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,14 @@ static struct its_collection *valid_col(struct its_collection *col)
190190
return col;
191191
}
192192

193+
static struct its_vpe *valid_vpe(struct its_node *its, struct its_vpe *vpe)
194+
{
195+
if (valid_col(its->collections + vpe->col_idx))
196+
return vpe;
197+
198+
return NULL;
199+
}
200+
193201
/*
194202
* ITS command descriptors - parameters to be encoded in a command
195203
* block.
@@ -562,7 +570,7 @@ static struct its_vpe *its_build_vinvall_cmd(struct its_node *its,
562570

563571
its_fixup_cmd(cmd);
564572

565-
return desc->its_vinvall_cmd.vpe;
573+
return valid_vpe(its, desc->its_vinvall_cmd.vpe);
566574
}
567575

568576
static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
@@ -584,7 +592,7 @@ static struct its_vpe *its_build_vmapp_cmd(struct its_node *its,
584592

585593
its_fixup_cmd(cmd);
586594

587-
return desc->its_vmapp_cmd.vpe;
595+
return valid_vpe(its, desc->its_vmapp_cmd.vpe);
588596
}
589597

590598
static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,
@@ -607,7 +615,7 @@ static struct its_vpe *its_build_vmapti_cmd(struct its_node *its,
607615

608616
its_fixup_cmd(cmd);
609617

610-
return desc->its_vmapti_cmd.vpe;
618+
return valid_vpe(its, desc->its_vmapti_cmd.vpe);
611619
}
612620

613621
static struct its_vpe *its_build_vmovi_cmd(struct its_node *its,
@@ -630,7 +638,7 @@ static struct its_vpe *its_build_vmovi_cmd(struct its_node *its,
630638

631639
its_fixup_cmd(cmd);
632640

633-
return desc->its_vmovi_cmd.vpe;
641+
return valid_vpe(its, desc->its_vmovi_cmd.vpe);
634642
}
635643

636644
static struct its_vpe *its_build_vmovp_cmd(struct its_node *its,
@@ -648,7 +656,7 @@ static struct its_vpe *its_build_vmovp_cmd(struct its_node *its,
648656

649657
its_fixup_cmd(cmd);
650658

651-
return desc->its_vmovp_cmd.vpe;
659+
return valid_vpe(its, desc->its_vmovp_cmd.vpe);
652660
}
653661

654662
static u64 its_cmd_ptr_to_offset(struct its_node *its,

0 commit comments

Comments
 (0)