genirq/msi: Provide msi_alloc_msi_desc() and a simple allocator
authorThomas Gleixner <tglx@linutronix.de>
Mon, 6 Dec 2021 22:51:10 +0000 (23:51 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 16 Dec 2021 21:22:17 +0000 (22:22 +0100)
commit602905253607ba892336f7bba8bb45b5be819d87
treeb6339c6549c6b6da96d99fae229cadb2c7363e1a
parent1046f71d7268b1680d7b044dea83c664403f6302
genirq/msi: Provide msi_alloc_msi_desc() and a simple allocator

Provide msi_alloc_msi_desc() which takes a template MSI descriptor for
initializing a newly allocated descriptor. This allows to simplify various
usage sites of alloc_msi_entry() and moves the storage handling into the
core code.

For simple cases where only a linear vector space is required provide
msi_add_simple_msi_descs() which just allocates a linear range of MSI
descriptors and fills msi_desc::msi_index accordingly.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20211206210747.873833567@linutronix.de
include/linux/msi.h
kernel/irq/msi.c