[22/33] genirq/msi: Provide MSI_FLAG_MSIX_ALLOC_DYN

Message ID 20221111135206.521387616@linutronix.de
State New
Headers
Series genirq, PCI/MSI: Support for per device MSI and PCI/IMS - Part 3 implementation |

Commit Message

Thomas Gleixner Nov. 11, 2022, 1:58 p.m. UTC
  Provide a new MSI feature flag in preparation for dynamic MSIX allocation
after the initial MSI-X enable has been done.

This needs to be an explicit MSI interrupt domain feature because quite
some implementations (both interrupt domains and legacy allocation mode)
have clear expectations that the allocation code is only invoked when MSI-X
is about to be enabled. They either talk to hypervisors or do some other
work and are not prepared to be invoked on an already MSI-X enabled device.

This is also explicit MSI-X only because rewriting the size of the MSI
entries is only possible when disabling MSI which in turn might cause lost
interrupts on the device.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/msi.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Jason Gunthorpe Nov. 16, 2022, 7:36 p.m. UTC | #1
On Fri, Nov 11, 2022 at 02:58:46PM +0100, Thomas Gleixner wrote:
> Provide a new MSI feature flag in preparation for dynamic MSIX allocation
> after the initial MSI-X enable has been done.
> 
> This needs to be an explicit MSI interrupt domain feature because quite
> some implementations (both interrupt domains and legacy allocation mode)
> have clear expectations that the allocation code is only invoked when MSI-X
> is about to be enabled. They either talk to hypervisors or do some other
> work and are not prepared to be invoked on an already MSI-X enabled device.
> 
> This is also explicit MSI-X only because rewriting the size of the MSI
> entries is only possible when disabling MSI which in turn might cause lost
> interrupts on the device.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  include/linux/msi.h |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason
  

Patch

--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -523,7 +523,8 @@  enum {
 	MSI_FLAG_LEVEL_CAPABLE		= (1 << 18),
 	/* MSI-X entries must be contiguous */
 	MSI_FLAG_MSIX_CONTIGUOUS	= (1 << 19),
-
+	/* PCI/MSI-X vectors can be dynamically allocated/freed post MSI-X enable */
+	MSI_FLAG_PCI_MSIX_ALLOC_DYN	= (1 << 20),
 };
 
 /**