xen/arm: gic: Relax barrier when sending an SGI
authorJulien Grall <julien.grall@arm.com>
Tue, 23 Oct 2018 14:25:13 +0000 (15:25 +0100)
committerJulien Grall <julien.grall@arm.com>
Mon, 12 Nov 2018 12:18:53 +0000 (12:18 +0000)
commit3b439f636ee9a9588203cf0aa0edfa18ccdc60b9
treef5096d352bb4ede7be9cbf36fa93ec59948eb824
parent9d5cedefbaafd5b66f74edecea2d569332a41c95
xen/arm: gic: Relax barrier when sending an SGI

When sending an SGI to another CPU, we require a barrier to ensure that
any pending stores to normal memory are made visible to the recipient
before the interrupt arrives.

For GICv2, rather than using dsb(sy) before writel_gicd, we can instead
use dsb(ishst), since we just need to ensure that any pending normal
writes are visible within the inner-shareable domain before we poke the
GIC.

With this observation, we can then further weaken the barrier to a
dmb(ishst), since other CPUs in the inner-shareable domain must observe
the write to the distributor before the SGI is generated.

A DMB instruction can be used to ensure the relative order of only
memory accesses before and after the barrier. Since writes to system
registers are not memory operations, barrier DMB is not sufficient for
observalibility of memory accesses that occur before ICC_SGI1R_EL1
(GICv3).

For GICv3, a DSB instruction ensures that no instructions that appear in
program order after the DSB instruction, can execute until the DSB
instruction has completed.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andrii Anisov <andrii_anisov@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/gic-v2.c
xen/arch/arm/gic-v3.c
xen/arch/arm/gic.c