platform-msi: Simplify platform device MSI code
authorThomas Gleixner <tglx@linutronix.de>
Mon, 6 Dec 2021 22:51:42 +0000 (23:51 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 16 Dec 2021 21:22:19 +0000 (22:22 +0100)
commita80713fea3d12344e1da18f9113c74cdb3c463f1
treee410c5179f84072e10b6019487f32a20908e2fff
parent653b50c5f96918238e0b51e783b291f6e9e692f9
platform-msi: Simplify platform device MSI code

The allocation code is overly complex. It tries to have the MSI index space
packed, which is not working when an interrupt is freed. There is no
requirement for this. The only requirement is that the MSI index is unique.

Move the MSI descriptor allocation into msi_domain_populate_irqs() and use
the Linux interrupt number as MSI index which fulfils the unique
requirement.

This requires to lock the MSI descriptors which makes the lock order
reverse to the regular MSI alloc/free functions vs. the domain
mutex. Assign a seperate lockdep class for these MSI device domains.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211206210748.956731741@linutronix.de
drivers/base/platform-msi.c
kernel/irq/msi.c