Skip to content

Commit 2d958b0

Browse files
committed
genirq/msi: Rearrange MSI domain flags
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
1 parent c459f11 commit 2d958b0

File tree

1 file changed

+34
-15
lines changed

1 file changed

+34
-15
lines changed

include/linux/msi.h

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <linux/xarray.h>
2525
#include <linux/mutex.h>
2626
#include <linux/list.h>
27+
#include <linux/bits.h>
28+
2729
#include <asm/msi.h>
2830

2931
/* Dummy shadow structures if an architecture does not define them */
@@ -440,7 +442,16 @@ struct msi_domain_info {
440442
void *data;
441443
};
442444

443-
/* Flags for msi_domain_info */
445+
/*
446+
* Flags for msi_domain_info
447+
*
448+
* Bit 0-15: Generic MSI functionality which is not subject to restriction
449+
* by parent domains
450+
*
451+
* Bit 16-31: Functionality which depends on the underlying parent domain and
452+
* can be masked out by msi_parent_ops::init_dev_msi_info() when
453+
* a device MSI domain is initialized.
454+
*/
444455
enum {
445456
/*
446457
* Init non implemented ops callbacks with default MSI domain
@@ -452,33 +463,41 @@ enum {
452463
* callbacks.
453464
*/
454465
MSI_FLAG_USE_DEF_CHIP_OPS = (1 << 1),
455-
/* Support multiple PCI MSI interrupts */
456-
MSI_FLAG_MULTI_PCI_MSI = (1 << 2),
457-
/* Support PCI MSIX interrupts */
458-
MSI_FLAG_PCI_MSIX = (1 << 3),
459466
/* Needs early activate, required for PCI */
460-
MSI_FLAG_ACTIVATE_EARLY = (1 << 4),
467+
MSI_FLAG_ACTIVATE_EARLY = (1 << 2),
461468
/*
462469
* Must reactivate when irq is started even when
463470
* MSI_FLAG_ACTIVATE_EARLY has been set.
464471
*/
465-
MSI_FLAG_MUST_REACTIVATE = (1 << 5),
466-
/* Is level-triggered capable, using two messages */
467-
MSI_FLAG_LEVEL_CAPABLE = (1 << 6),
472+
MSI_FLAG_MUST_REACTIVATE = (1 << 3),
468473
/* Populate sysfs on alloc() and destroy it on free() */
469-
MSI_FLAG_DEV_SYSFS = (1 << 7),
470-
/* MSI-X entries must be contiguous */
471-
MSI_FLAG_MSIX_CONTIGUOUS = (1 << 8),
474+
MSI_FLAG_DEV_SYSFS = (1 << 4),
472475
/* Allocate simple MSI descriptors */
473-
MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 9),
476+
MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 5),
474477
/* Free MSI descriptors */
475-
MSI_FLAG_FREE_MSI_DESCS = (1 << 10),
478+
MSI_FLAG_FREE_MSI_DESCS = (1 << 6),
476479
/*
477480
* Quirk to handle MSI implementations which do not provide
478481
* masking. Currently known to affect x86, but has to be partially
479482
* handled in the core MSI code.
480483
*/
481-
MSI_FLAG_NOMASK_QUIRK = (1 << 11),
484+
MSI_FLAG_NOMASK_QUIRK = (1 << 7),
485+
486+
/* Mask for the generic functionality */
487+
MSI_GENERIC_FLAGS_MASK = GENMASK(15, 0),
488+
489+
/* Mask for the domain specific functionality */
490+
MSI_DOMAIN_FLAGS_MASK = GENMASK(31, 16),
491+
492+
/* Support multiple PCI MSI interrupts */
493+
MSI_FLAG_MULTI_PCI_MSI = (1 << 16),
494+
/* Support PCI MSIX interrupts */
495+
MSI_FLAG_PCI_MSIX = (1 << 17),
496+
/* Is level-triggered capable, using two messages */
497+
MSI_FLAG_LEVEL_CAPABLE = (1 << 18),
498+
/* MSI-X entries must be contiguous */
499+
MSI_FLAG_MSIX_CONTIGUOUS = (1 << 19),
500+
482501
};
483502

484503
int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,

0 commit comments

Comments
 (0)