]> git.baikalelectronics.ru Git - kernel.git/commit
irqchip/gic-v3-its: Ensure nr_ites >= nr_lpis
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 6 Mar 2018 15:51:32 +0000 (15:51 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Sun, 11 Mar 2018 13:27:06 +0000 (13:27 +0000)
commit9f0347c3517af02a80f2e24479f60ba5bce05703
tree046f2135d6c3583976493228abf28c2f1801558d
parenta535981368239ef983080f1a16c6b0286778d3b8
irqchip/gic-v3-its: Ensure nr_ites >= nr_lpis

When struct its_device instances are created, the nr_ites member
will be set to a power of 2 that equals or exceeds the requested
number of MSIs passed to the msi_prepare() callback. At the same
time, the LPI map is allocated to be some multiple of 32 in size,
where the allocated size may be less than the requested size
depending on whether a contiguous range of sufficient size is
available in the global LPI bitmap.

This may result in the situation where the nr_ites < nr_lpis, and
since nr_ites is what we program into the hardware when we map the
device, the additional LPIs will be non-functional.

For bog standard hardware, this does not really matter. However,
in cases where ITS device IDs are shared between different PCIe
devices, we may end up allocating these additional LPIs without
taking into account that they don't actually work.

So let's make nr_ites at least 32. This ensures that all allocated
LPIs are 'live', and that its_alloc_device_irq() will fail when
attempts are made to allocate MSIs beyond what was allocated in
the first place.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
[maz: updated comment]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic-v3-its.c