irqchip/gic-v3-its: Only emit SYNC if targetting a valid collection
authorMarc Zyngier <[email protected]>
Fri, 22 Jun 2018 09:52:52 +0000 (10:52 +0100)
committerThomas Gleixner <[email protected]>
Fri, 22 Jun 2018 12:22:01 +0000 (14:22 +0200)
commit83559b47cdc4d396fc1187a13b527d01b55e0fe6
tree334c14cf25e94f001202cda8c3a6de3651b90ff5
parentc1797b11a09c8323c92b074fd48b89a936c991d0
irqchip/gic-v3-its: Only emit SYNC if targetting a valid collection

It is possible, under obscure circumstances, to convince the ITS driver to
emit a SYNC operation that targets a collection that is not bound to any
redistributor (and the target_address field is zero) because the
corresponding CPU has not been seen yet (the system has been booted with
max_cpus="something small").

If the ITS is using the linear CPU number as the target, this is not a big
deal, as we just end-up issuing a SYNC to CPU0. But if the ITS requires the
physical address of the redistributor (with GITS_TYPER.PTA==1), we end-up
asking the ITS to write to the physical address zero, which is not exactly
a good idea (there has been report of the ITS locking up). This should of
course never happen, but hey, this is SW...

In order to avoid the above disaster, let's track which collections have
been actually initialized, and let's not generate a SYNC if the collection
hasn't been properly bound to a redistributor.  Take this opportunity to
spit our a warning, in the hope that someone may report the issue if it
arrises again.

Reported-by: Yang Yingliang <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Jason Cooper <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: Sumit Garg <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
drivers/irqchip/irq-gic-v3-its.c