Skip to content
  • Marc Zyngier's avatar
    irqchip/gic-v3-its: Refactor LPI allocator · 880cb3cd
    Marc Zyngier authored
    
    
    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: default avatarMarc Zyngier <marc.zyngier@arm.com>
    880cb3cd