Skip to content

Commit

Permalink
genirq/msi: Rearrange MSI domain flags
Browse files Browse the repository at this point in the history
These flags got added as necessary and have no obvious structure. For
feature support checks and masking it's convenient to have two blocks of
flags:

   1) Flags to control the internal behaviour like allocating/freeing
      MSI descriptors. Those flags do not need any support from the
      underlying MSI parent domain. They are mostly under the control
      of the outermost domain which implements the actual MSI support.

   2) Flags to expose features, e.g. PCI multi-MSI or requirements
      which can depend on a underlying domain.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221124232325.322714918@linutronix.de
  • Loading branch information
Thomas Gleixner committed Dec 5, 2022
1 parent c459f11 commit 2d958b0
Showing 1 changed file with 34 additions and 15 deletions.
49 changes: 34 additions & 15 deletions include/linux/msi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include <linux/xarray.h>
#include <linux/mutex.h>
#include <linux/list.h>
#include <linux/bits.h>

#include <asm/msi.h>

/* Dummy shadow structures if an architecture does not define them */
Expand Down Expand Up @@ -440,7 +442,16 @@ struct msi_domain_info {
void *data;
};

/* Flags for msi_domain_info */
/*
* Flags for msi_domain_info
*
* Bit 0-15: Generic MSI functionality which is not subject to restriction
* by parent domains
*
* Bit 16-31: Functionality which depends on the underlying parent domain and
* can be masked out by msi_parent_ops::init_dev_msi_info() when
* a device MSI domain is initialized.
*/
enum {
/*
* Init non implemented ops callbacks with default MSI domain
Expand All @@ -452,33 +463,41 @@ enum {
* callbacks.
*/
MSI_FLAG_USE_DEF_CHIP_OPS = (1 << 1),
/* Support multiple PCI MSI interrupts */
MSI_FLAG_MULTI_PCI_MSI = (1 << 2),
/* Support PCI MSIX interrupts */
MSI_FLAG_PCI_MSIX = (1 << 3),
/* Needs early activate, required for PCI */
MSI_FLAG_ACTIVATE_EARLY = (1 << 4),
MSI_FLAG_ACTIVATE_EARLY = (1 << 2),
/*
* Must reactivate when irq is started even when
* MSI_FLAG_ACTIVATE_EARLY has been set.
*/
MSI_FLAG_MUST_REACTIVATE = (1 << 5),
/* Is level-triggered capable, using two messages */
MSI_FLAG_LEVEL_CAPABLE = (1 << 6),
MSI_FLAG_MUST_REACTIVATE = (1 << 3),
/* Populate sysfs on alloc() and destroy it on free() */
MSI_FLAG_DEV_SYSFS = (1 << 7),
/* MSI-X entries must be contiguous */
MSI_FLAG_MSIX_CONTIGUOUS = (1 << 8),
MSI_FLAG_DEV_SYSFS = (1 << 4),
/* Allocate simple MSI descriptors */
MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 9),
MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 5),
/* Free MSI descriptors */
MSI_FLAG_FREE_MSI_DESCS = (1 << 10),
MSI_FLAG_FREE_MSI_DESCS = (1 << 6),
/*
* Quirk to handle MSI implementations which do not provide
* masking. Currently known to affect x86, but has to be partially
* handled in the core MSI code.
*/
MSI_FLAG_NOMASK_QUIRK = (1 << 11),
MSI_FLAG_NOMASK_QUIRK = (1 << 7),

/* Mask for the generic functionality */
MSI_GENERIC_FLAGS_MASK = GENMASK(15, 0),

/* Mask for the domain specific functionality */
MSI_DOMAIN_FLAGS_MASK = GENMASK(31, 16),

/* Support multiple PCI MSI interrupts */
MSI_FLAG_MULTI_PCI_MSI = (1 << 16),
/* Support PCI MSIX interrupts */
MSI_FLAG_PCI_MSIX = (1 << 17),
/* Is level-triggered capable, using two messages */
MSI_FLAG_LEVEL_CAPABLE = (1 << 18),
/* MSI-X entries must be contiguous */
MSI_FLAG_MSIX_CONTIGUOUS = (1 << 19),

};

int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
Expand Down

0 comments on commit 2d958b0

Please sign in to comment.