mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![Thomas Gleixner](/assets/img/avatar_default.png)
Provide the necessary constants for PCI/IMS support: - A new bus token for MSI irqdomain identification - A MSI feature flag for the MSI irqdomains to signal support - A secondary domain id The latter expands the device internal domain pointer storage array from 1 to 2 entries. That extra pointer is mostly unused today, but the alternative solutions would not be free either and would introduce more complexity all over the place. Trade the 8bytes for simplicity. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20221124232326.846169830@linutronix.de
73 lines
2 KiB
C
73 lines
2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef LINUX_MSI_API_H
|
|
#define LINUX_MSI_API_H
|
|
|
|
/*
|
|
* APIs which are relevant for device driver code for allocating and
|
|
* freeing MSI interrupts and querying the associations between
|
|
* hardware/software MSI indices and the Linux interrupt number.
|
|
*/
|
|
|
|
struct device;
|
|
|
|
/*
|
|
* Per device interrupt domain related constants.
|
|
*/
|
|
enum msi_domain_ids {
|
|
MSI_DEFAULT_DOMAIN,
|
|
MSI_SECONDARY_DOMAIN,
|
|
MSI_MAX_DEVICE_IRQDOMAINS,
|
|
};
|
|
|
|
/**
|
|
* union msi_instance_cookie - MSI instance cookie
|
|
* @value: u64 value store
|
|
* @ptr: Pointer to usage site specific data
|
|
*
|
|
* This cookie is handed to the IMS allocation function and stored in the
|
|
* MSI descriptor for the interrupt chip callbacks.
|
|
*
|
|
* The content of this cookie is MSI domain implementation defined. For
|
|
* PCI/IMS implementations this could be a PASID or a pointer to queue
|
|
* memory.
|
|
*/
|
|
union msi_instance_cookie {
|
|
u64 value;
|
|
void *ptr;
|
|
};
|
|
|
|
/**
|
|
* msi_map - Mapping between MSI index and Linux interrupt number
|
|
* @index: The MSI index, e.g. slot in the MSI-X table or
|
|
* a software managed index if >= 0. If negative
|
|
* the allocation function failed and it contains
|
|
* the error code.
|
|
* @virq: The associated Linux interrupt number
|
|
*/
|
|
struct msi_map {
|
|
int index;
|
|
int virq;
|
|
};
|
|
|
|
/*
|
|
* Constant to be used for dynamic allocations when the allocation is any
|
|
* free MSI index, which is either an entry in a hardware table or a
|
|
* software managed index.
|
|
*/
|
|
#define MSI_ANY_INDEX UINT_MAX
|
|
|
|
unsigned int msi_domain_get_virq(struct device *dev, unsigned int domid, unsigned int index);
|
|
|
|
/**
|
|
* msi_get_virq - Lookup the Linux interrupt number for a MSI index on the default interrupt domain
|
|
* @dev: Device for which the lookup happens
|
|
* @index: The MSI index to lookup
|
|
*
|
|
* Return: The Linux interrupt number on success (> 0), 0 if not found
|
|
*/
|
|
static inline unsigned int msi_get_virq(struct device *dev, unsigned int index)
|
|
{
|
|
return msi_domain_get_virq(dev, MSI_DEFAULT_DOMAIN, index);
|
|
}
|
|
|
|
#endif
|