Skip to content

Commit 9bdd8b1

Browse files
author
Marc Zyngier
committed
irqchip/gic-v3-its: Properly handle command queue wrapping
wait_for_range_completion() is nicely busted when handling wrapping of the command queue, leading to an early exit instead of waiting for the command to have been executed. Fortunately, the impact is pretty minor, as it only impair the detection of an ITS that doesn't make any forward progress for a whole second. And an ITS should *never* lock up. Reported-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 319ec8b commit 9bdd8b1

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
@@ -453,7 +453,13 @@ static void its_wait_for_range_completion(struct its_node *its,
453453

454454
while (1) {
455455
rd_idx = readl_relaxed(its->base + GITS_CREADR);
456-
if (rd_idx >= to_idx || rd_idx < from_idx)
456+
457+
/* Direct case */
458+
if (from_idx < to_idx && rd_idx >= to_idx)
459+
break;
460+
461+
/* Wrapped case */
462+
if (from_idx >= to_idx && rd_idx >= to_idx && rd_idx < from_idx)
457463
break;
458464

459465
count--;

0 commit comments

Comments
 (0)