• Michael Ellerman's avatar
    powerpc: Split-out common MSI bitmap logic into msi_bitmap.c · 7e302869
    Michael Ellerman authored
    There are now two almost identical implementations of an MSI bitmap
    allocator, one in mpic_msi.c and the other in fsl_msi.c.
    
    Merge them together and put the result in msi_bitmap.c.  Some of the
    MPIC bits will remain to provide a nicer interface for the MPIC users.
    
    In the process we fix two buglets.  The first is that the allocation
    routines, now msi_bitmap_alloc_hwirqs(), returned an unsigned result,
    even though they use -1 to indicate allocation failure.  Although all
    the callers were checking correctly, it is much better for the routine
    to just return an int.  At least until someone wants > ~2 billion MSIs.
    
    The second buglet is that the device tree reservation logic only
    allowed power-of-two reservations.  AFAICT that didn't effect any
    existing code but it's nicer if we can reserve arbitrary irqs from MSI
    use.
    
    We also add some selftests, which exposed the two buglets and now test
    for them, as well as some basic sanity tests.  The tests are only built
    when CONFIG_DEBUG_KERNEL=y.
    Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    7e302869
msi_bitmap.c 6.45 KB