Skip to content

Commit c9b51bb

Browse files
eaugerchazy
authored andcommitted
KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling the ITS
The spec says it is UNPREDICTABLE to enable the ITS if any of the following conditions are true: - GITS_CBASER.Valid == 0. - GITS_BASER<n>.Valid == 0, for any GITS_BASER<n> register where the Type field indicates Device. - GITS_BASER<n>.Valid == 0, for any GITS_BASER<n> register where the Type field indicates Interrupt Collection and GITS_TYPER.HCC == 0. In that case, let's keep the ITS disabled. Signed-off-by: Eric Auger <eric.auger@redhat.com> Reported-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
1 parent f31b98b commit c9b51bb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

virt/kvm/arm/vgic/vgic-its.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,16 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
14661466
{
14671467
mutex_lock(&its->cmd_lock);
14681468

1469+
/*
1470+
* It is UNPREDICTABLE to enable the ITS if any of the CBASER or
1471+
* device/collection BASER are invalid
1472+
*/
1473+
if (!its->enabled && (val & GITS_CTLR_ENABLE) &&
1474+
(!(its->baser_device_table & GITS_BASER_VALID) ||
1475+
!(its->baser_coll_table & GITS_BASER_VALID) ||
1476+
!(its->cbaser & GITS_CBASER_VALID)))
1477+
goto out;
1478+
14691479
its->enabled = !!(val & GITS_CTLR_ENABLE);
14701480

14711481
/*
@@ -1474,6 +1484,7 @@ static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its,
14741484
*/
14751485
vgic_its_process_commands(kvm, its);
14761486

1487+
out:
14771488
mutex_unlock(&its->cmd_lock);
14781489
}
14791490

0 commit comments

Comments
 (0)