xen/arm: gic: Read unconditionally the source from the LRs
authorJulien Grall <julien.grall@arm.com>
Wed, 21 Mar 2018 03:34:35 +0000 (03:34 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 21 Mar 2018 16:33:10 +0000 (09:33 -0700)
commitbde2870e7da1896b36d5117d307a8ac2f07ae276
tree788ef0131cbe05baafd37214520813c40f9ede28
parent393a0e78ade8119545aa2b201e0d839c591ed683
xen/arm: gic: Read unconditionally the source from the LRs

Commit 5cb00d1 "ARM: GIC: extend LR read/write functions to cover EOI
and source" extended gic_lr to cover the source. The new field was only
set for SGIs interrupt in the read function. However, the write function
is writing the field unconditionally for virtual interrupt.

This means that if the caller was combining the 2 functions (e.g to
update the LR), the source need to be set to 0 by the caller.
Unfortunately, gic_update_one_lr is not zeroing the structure before
reading the LRs. This will lead to trigger the assert randomly.

Instead of zeroing the structure in gic_update_one_lr, make sure that
the source is written unconditionally on read. This is also simplifying
the code to avoid an if statement in the read path.

Lastly, properly update the comments in write_lr that was mistakenly
speaking about the read lr path.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
xen/arch/arm/gic-v2.c
xen/arch/arm/gic-v3.c