]> asedeno.scripts.mit.edu Git - linux.git/commit
irqchip/gic-v3-its: Refactor LPI allocator
authorMarc Zyngier <marc.zyngier@arm.com>
Sun, 27 May 2018 15:14:15 +0000 (16:14 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Mon, 16 Jul 2018 13:22:19 +0000 (14:22 +0100)
commit880cb3cddd164128522146d1c087fbd1811ed0cc
treec9c7e86419af439fe180bab9da21d917ab4d2e15
parent9d3cce1e8b8561fed5f383d22a4d6949db4eadbe
irqchip/gic-v3-its: Refactor LPI allocator

Our current LPI allocator relies on a bitmap, each bit representing
a chunk of 32 LPIs, meaning that each device gets allocated LPIs
in multiple of 32. It served us well so far, but new use cases now
require much more finer grain allocations, down the the individual
LPI.

Given the size of the IntID space (up to 32bit), it isn't practical
to continue using a bitmap, so let's use a different data structure
altogether.

We switch to a list, where each element represent a contiguous range
of LPIs. On allocation, we simply grab the first group big enough to
satisfy the allocation, and substract what we need from it. If the
group becomes empty, we just remove it. On freeing interrupts, we
insert a new group of interrupt in the list, sort it and fuse the
adjacent groups.

This makes freeing interrupt much more expensive than allocating
them (an unusual behaviour), but that's fine as long as we consider
that freeing interrupts is an extremely rare event.

We still allocate interrupts in blocks of 32 for the time being,
but subsequent patches will relax this.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic-v3-its.c