Skip to content

Commit a84a07f

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
irqchip/gic-v4: Make sure a VPE is locked when VMAPP is issued
In order to make sure that vpe->col_idx is correctly sampled when a VMAPP command is issued, the vpe_lock must be held for the VPE. This is now possible since the introduction of the per-VM vmapp_lock, which can be taken before vpe_lock in the correct locking order. Signed-off-by: Marc Zyngier <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Nianyao Tang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f0eb154 commit a84a07f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,9 @@ static void its_map_vm(struct its_node *its, struct its_vm *vm)
18101810
for (i = 0; i < vm->nr_vpes; i++) {
18111811
struct its_vpe *vpe = vm->vpes[i];
18121812

1813-
its_send_vmapp(its, vpe, true);
1813+
scoped_guard(raw_spinlock, &vpe->vpe_lock)
1814+
its_send_vmapp(its, vpe, true);
1815+
18141816
its_send_vinvall(its, vpe);
18151817
}
18161818
}
@@ -1827,8 +1829,10 @@ static void its_unmap_vm(struct its_node *its, struct its_vm *vm)
18271829
if (!--vm->vlpi_count[its->list_nr]) {
18281830
int i;
18291831

1830-
for (i = 0; i < vm->nr_vpes; i++)
1832+
for (i = 0; i < vm->nr_vpes; i++) {
1833+
guard(raw_spinlock)(&vm->vpes[i]->vpe_lock);
18311834
its_send_vmapp(its, vm->vpes[i], false);
1835+
}
18321836
}
18331837
}
18341838

0 commit comments

Comments
 (0)