LCOV - code coverage report
Current view: top level - include/linux - msi_api.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2023-04-06 08:38:28 Functions: 0 0 -

          Line data    Source code
       1             : /* SPDX-License-Identifier: GPL-2.0 */
       2             : #ifndef LINUX_MSI_API_H
       3             : #define LINUX_MSI_API_H
       4             : 
       5             : /*
       6             :  * APIs which are relevant for device driver code for allocating and
       7             :  * freeing MSI interrupts and querying the associations between
       8             :  * hardware/software MSI indices and the Linux interrupt number.
       9             :  */
      10             : 
      11             : struct device;
      12             : 
      13             : /*
      14             :  * Per device interrupt domain related constants.
      15             :  */
      16             : enum msi_domain_ids {
      17             :         MSI_DEFAULT_DOMAIN,
      18             :         MSI_SECONDARY_DOMAIN,
      19             :         MSI_MAX_DEVICE_IRQDOMAINS,
      20             : };
      21             : 
      22             : /**
      23             :  * union msi_instance_cookie - MSI instance cookie
      24             :  * @value:      u64 value store
      25             :  * @ptr:        Pointer to usage site specific data
      26             :  *
      27             :  * This cookie is handed to the IMS allocation function and stored in the
      28             :  * MSI descriptor for the interrupt chip callbacks.
      29             :  *
      30             :  * The content of this cookie is MSI domain implementation defined.  For
      31             :  * PCI/IMS implementations this could be a PASID or a pointer to queue
      32             :  * memory.
      33             :  */
      34             : union msi_instance_cookie {
      35             :         u64     value;
      36             :         void    *ptr;
      37             : };
      38             : 
      39             : /**
      40             :  * msi_map - Mapping between MSI index and Linux interrupt number
      41             :  * @index:      The MSI index, e.g. slot in the MSI-X table or
      42             :  *              a software managed index if >= 0. If negative
      43             :  *              the allocation function failed and it contains
      44             :  *              the error code.
      45             :  * @virq:       The associated Linux interrupt number
      46             :  */
      47             : struct msi_map {
      48             :         int     index;
      49             :         int     virq;
      50             : };
      51             : 
      52             : /*
      53             :  * Constant to be used for dynamic allocations when the allocation is any
      54             :  * free MSI index, which is either an entry in a hardware table or a
      55             :  * software managed index.
      56             :  */
      57             : #define MSI_ANY_INDEX           UINT_MAX
      58             : 
      59             : unsigned int msi_domain_get_virq(struct device *dev, unsigned int domid, unsigned int index);
      60             : 
      61             : /**
      62             :  * msi_get_virq - Lookup the Linux interrupt number for a MSI index on the default interrupt domain
      63             :  * @dev:        Device for which the lookup happens
      64             :  * @index:      The MSI index to lookup
      65             :  *
      66             :  * Return: The Linux interrupt number on success (> 0), 0 if not found
      67             :  */
      68             : static inline unsigned int msi_get_virq(struct device *dev, unsigned int index)
      69             : {
      70           0 :         return msi_domain_get_virq(dev, MSI_DEFAULT_DOMAIN, index);
      71             : }
      72             : 
      73             : #endif

Generated by: LCOV version 1.14