9bf3cbad111499d7503eaf338b92df76e86cb21e
[sfrench/cifs-2.6.git] / include / linux / msi.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_MSI_H
3 #define LINUX_MSI_H
4
5 /*
6  * This header file contains MSI data structures and functions which are
7  * only relevant for:
8  *      - Interrupt core code
9  *      - PCI/MSI core code
10  *      - MSI interrupt domain implementations
11  *      - IOMMU, low level VFIO, NTB and other justified exceptions
12  *        dealing with low level MSI details.
13  *
14  * Regular device drivers have no business with any of these functions and
15  * especially storing MSI descriptor pointers in random code is considered
16  * abuse.
17  *
18  * Device driver relevant functions are available in <linux/msi_api.h>
19  */
20
21 #include <linux/irqdomain_defs.h>
22 #include <linux/cpumask.h>
23 #include <linux/msi_api.h>
24 #include <linux/xarray.h>
25 #include <linux/mutex.h>
26 #include <linux/list.h>
27 #include <linux/bits.h>
28
29 #include <asm/msi.h>
30
31 /* Dummy shadow structures if an architecture does not define them */
32 #ifndef arch_msi_msg_addr_lo
33 typedef struct arch_msi_msg_addr_lo {
34         u32     address_lo;
35 } __attribute__ ((packed)) arch_msi_msg_addr_lo_t;
36 #endif
37
38 #ifndef arch_msi_msg_addr_hi
39 typedef struct arch_msi_msg_addr_hi {
40         u32     address_hi;
41 } __attribute__ ((packed)) arch_msi_msg_addr_hi_t;
42 #endif
43
44 #ifndef arch_msi_msg_data
45 typedef struct arch_msi_msg_data {
46         u32     data;
47 } __attribute__ ((packed)) arch_msi_msg_data_t;
48 #endif
49
50 /**
51  * msi_msg - Representation of a MSI message
52  * @address_lo:         Low 32 bits of msi message address
53  * @arch_addrlo:        Architecture specific shadow of @address_lo
54  * @address_hi:         High 32 bits of msi message address
55  *                      (only used when device supports it)
56  * @arch_addrhi:        Architecture specific shadow of @address_hi
57  * @data:               MSI message data (usually 16 bits)
58  * @arch_data:          Architecture specific shadow of @data
59  */
60 struct msi_msg {
61         union {
62                 u32                     address_lo;
63                 arch_msi_msg_addr_lo_t  arch_addr_lo;
64         };
65         union {
66                 u32                     address_hi;
67                 arch_msi_msg_addr_hi_t  arch_addr_hi;
68         };
69         union {
70                 u32                     data;
71                 arch_msi_msg_data_t     arch_data;
72         };
73 };
74
75 extern int pci_msi_ignore_mask;
76 /* Helper functions */
77 struct irq_data;
78 struct msi_desc;
79 struct pci_dev;
80 struct platform_msi_priv_data;
81 struct device_attribute;
82 struct irq_domain;
83
84 void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
85 #ifdef CONFIG_GENERIC_MSI_IRQ
86 void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg);
87 #else
88 static inline void get_cached_msi_msg(unsigned int irq, struct msi_msg *msg) { }
89 #endif
90
91 typedef void (*irq_write_msi_msg_t)(struct msi_desc *desc,
92                                     struct msi_msg *msg);
93
94 /**
95  * pci_msi_desc - PCI/MSI specific MSI descriptor data
96  *
97  * @msi_mask:   [PCI MSI]   MSI cached mask bits
98  * @msix_ctrl:  [PCI MSI-X] MSI-X cached per vector control bits
99  * @is_msix:    [PCI MSI/X] True if MSI-X
100  * @multiple:   [PCI MSI/X] log2 num of messages allocated
101  * @multi_cap:  [PCI MSI/X] log2 num of messages supported
102  * @can_mask:   [PCI MSI/X] Masking supported?
103  * @is_64:      [PCI MSI/X] Address size: 0=32bit 1=64bit
104  * @default_irq:[PCI MSI/X] The default pre-assigned non-MSI irq
105  * @mask_pos:   [PCI MSI]   Mask register position
106  * @mask_base:  [PCI MSI-X] Mask register base address
107  */
108 struct pci_msi_desc {
109         union {
110                 u32 msi_mask;
111                 u32 msix_ctrl;
112         };
113         struct {
114                 u8      is_msix         : 1;
115                 u8      multiple        : 3;
116                 u8      multi_cap       : 3;
117                 u8      can_mask        : 1;
118                 u8      is_64           : 1;
119                 u8      is_virtual      : 1;
120                 unsigned default_irq;
121         } msi_attrib;
122         union {
123                 u8      mask_pos;
124                 void __iomem *mask_base;
125         };
126 };
127
128 #define MSI_MAX_INDEX           ((unsigned int)USHRT_MAX)
129
130 /**
131  * struct msi_desc - Descriptor structure for MSI based interrupts
132  * @irq:        The base interrupt number
133  * @nvec_used:  The number of vectors used
134  * @dev:        Pointer to the device which uses this descriptor
135  * @msg:        The last set MSI message cached for reuse
136  * @affinity:   Optional pointer to a cpu affinity mask for this descriptor
137  * @sysfs_attr: Pointer to sysfs device attribute
138  *
139  * @write_msi_msg:      Callback that may be called when the MSI message
140  *                      address or data changes
141  * @write_msi_msg_data: Data parameter for the callback.
142  *
143  * @msi_index:  Index of the msi descriptor
144  * @pci:        PCI specific msi descriptor data
145  */
146 struct msi_desc {
147         /* Shared device/bus type independent data */
148         unsigned int                    irq;
149         unsigned int                    nvec_used;
150         struct device                   *dev;
151         struct msi_msg                  msg;
152         struct irq_affinity_desc        *affinity;
153 #ifdef CONFIG_IRQ_MSI_IOMMU
154         const void                      *iommu_cookie;
155 #endif
156 #ifdef CONFIG_SYSFS
157         struct device_attribute         *sysfs_attrs;
158 #endif
159
160         void (*write_msi_msg)(struct msi_desc *entry, void *data);
161         void *write_msi_msg_data;
162
163         u16                             msi_index;
164         struct pci_msi_desc             pci;
165 };
166
167 /*
168  * Filter values for the MSI descriptor iterators and accessor functions.
169  */
170 enum msi_desc_filter {
171         /* All descriptors */
172         MSI_DESC_ALL,
173         /* Descriptors which have no interrupt associated */
174         MSI_DESC_NOTASSOCIATED,
175         /* Descriptors which have an interrupt associated */
176         MSI_DESC_ASSOCIATED,
177 };
178
179
180 /**
181  * struct msi_dev_domain - The internals of MSI domain info per device
182  * @store:              Xarray for storing MSI descriptor pointers
183  * @irqdomain:          Pointer to a per device interrupt domain
184  */
185 struct msi_dev_domain {
186         struct xarray           store;
187         struct irq_domain       *domain;
188 };
189
190 /**
191  * msi_device_data - MSI per device data
192  * @properties:         MSI properties which are interesting to drivers
193  * @platform_data:      Platform-MSI specific data
194  * @mutex:              Mutex protecting the MSI descriptor store
195  * @__domains:          Internal data for per device MSI domains
196  * @__iter_idx:         Index to search the next entry for iterators
197  */
198 struct msi_device_data {
199         unsigned long                   properties;
200         struct platform_msi_priv_data   *platform_data;
201         struct mutex                    mutex;
202         struct msi_dev_domain           __domains[MSI_MAX_DEVICE_IRQDOMAINS];
203         unsigned long                   __iter_idx;
204 };
205
206 int msi_setup_device_data(struct device *dev);
207
208 void msi_lock_descs(struct device *dev);
209 void msi_unlock_descs(struct device *dev);
210
211 struct msi_desc *msi_domain_first_desc(struct device *dev, unsigned int domid,
212                                        enum msi_desc_filter filter);
213
214 /**
215  * msi_first_desc - Get the first MSI descriptor of the default irqdomain
216  * @dev:        Device to operate on
217  * @filter:     Descriptor state filter
218  *
219  * Must be called with the MSI descriptor mutex held, i.e. msi_lock_descs()
220  * must be invoked before the call.
221  *
222  * Return: Pointer to the first MSI descriptor matching the search
223  *         criteria, NULL if none found.
224  */
225 static inline struct msi_desc *msi_first_desc(struct device *dev,
226                                               enum msi_desc_filter filter)
227 {
228         return msi_domain_first_desc(dev, MSI_DEFAULT_DOMAIN, filter);
229 }
230
231 struct msi_desc *msi_next_desc(struct device *dev, unsigned int domid,
232                                enum msi_desc_filter filter);
233
234 /**
235  * msi_domain_for_each_desc - Iterate the MSI descriptors in a specific domain
236  *
237  * @desc:       struct msi_desc pointer used as iterator
238  * @dev:        struct device pointer - device to iterate
239  * @domid:      The id of the interrupt domain which should be walked.
240  * @filter:     Filter for descriptor selection
241  *
242  * Notes:
243  *  - The loop must be protected with a msi_lock_descs()/msi_unlock_descs()
244  *    pair.
245  *  - It is safe to remove a retrieved MSI descriptor in the loop.
246  */
247 #define msi_domain_for_each_desc(desc, dev, domid, filter)                      \
248         for ((desc) = msi_domain_first_desc((dev), (domid), (filter)); (desc);  \
249              (desc) = msi_next_desc((dev), (domid), (filter)))
250
251 /**
252  * msi_for_each_desc - Iterate the MSI descriptors in the default irqdomain
253  *
254  * @desc:       struct msi_desc pointer used as iterator
255  * @dev:        struct device pointer - device to iterate
256  * @filter:     Filter for descriptor selection
257  *
258  * Notes:
259  *  - The loop must be protected with a msi_lock_descs()/msi_unlock_descs()
260  *    pair.
261  *  - It is safe to remove a retrieved MSI descriptor in the loop.
262  */
263 #define msi_for_each_desc(desc, dev, filter)                                    \
264         msi_domain_for_each_desc((desc), (dev), MSI_DEFAULT_DOMAIN, (filter))
265
266 #define msi_desc_to_dev(desc)           ((desc)->dev)
267
268 #ifdef CONFIG_IRQ_MSI_IOMMU
269 static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
270 {
271         return desc->iommu_cookie;
272 }
273
274 static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
275                                              const void *iommu_cookie)
276 {
277         desc->iommu_cookie = iommu_cookie;
278 }
279 #else
280 static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
281 {
282         return NULL;
283 }
284
285 static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
286                                              const void *iommu_cookie)
287 {
288 }
289 #endif
290
291 int msi_domain_insert_msi_desc(struct device *dev, unsigned int domid,
292                                struct msi_desc *init_desc);
293 /**
294  * msi_insert_msi_desc - Allocate and initialize a MSI descriptor in the
295  *                       default irqdomain and insert it at @init_desc->msi_index
296  * @dev:        Pointer to the device for which the descriptor is allocated
297  * @init_desc:  Pointer to an MSI descriptor to initialize the new descriptor
298  *
299  * Return: 0 on success or an appropriate failure code.
300  */
301 static inline int msi_insert_msi_desc(struct device *dev, struct msi_desc *init_desc)
302 {
303         return msi_domain_insert_msi_desc(dev, MSI_DEFAULT_DOMAIN, init_desc);
304 }
305
306 void msi_domain_free_msi_descs_range(struct device *dev, unsigned int domid,
307                                      unsigned int first, unsigned int last);
308
309 /**
310  * msi_free_msi_descs_range - Free a range of MSI descriptors of a device
311  *                            in the default irqdomain
312  *
313  * @dev:        Device for which to free the descriptors
314  * @first:      Index to start freeing from (inclusive)
315  * @last:       Last index to be freed (inclusive)
316  */
317 static inline void msi_free_msi_descs_range(struct device *dev, unsigned int first,
318                                             unsigned int last)
319 {
320         msi_domain_free_msi_descs_range(dev, MSI_DEFAULT_DOMAIN, first, last);
321 }
322
323 /**
324  * msi_free_msi_descs - Free all MSI descriptors of a device in the default irqdomain
325  * @dev:        Device to free the descriptors
326  */
327 static inline void msi_free_msi_descs(struct device *dev)
328 {
329         msi_free_msi_descs_range(dev, 0, MSI_MAX_INDEX);
330 }
331
332 /*
333  * The arch hooks to setup up msi irqs. Default functions are implemented
334  * as weak symbols so that they /can/ be overriden by architecture specific
335  * code if needed. These hooks can only be enabled by the architecture.
336  *
337  * If CONFIG_PCI_MSI_ARCH_FALLBACKS is not selected they are replaced by
338  * stubs with warnings.
339  */
340 #ifdef CONFIG_PCI_MSI_ARCH_FALLBACKS
341 int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
342 void arch_teardown_msi_irq(unsigned int irq);
343 int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
344 void arch_teardown_msi_irqs(struct pci_dev *dev);
345 #ifdef CONFIG_SYSFS
346 int msi_device_populate_sysfs(struct device *dev);
347 void msi_device_destroy_sysfs(struct device *dev);
348 #else /* CONFIG_SYSFS */
349 static inline int msi_device_populate_sysfs(struct device *dev) { return 0; }
350 static inline void msi_device_destroy_sysfs(struct device *dev) { }
351 #endif /* !CONFIG_SYSFS */
352 #endif /* CONFIG_PCI_MSI_ARCH_FALLBACKS */
353
354 /*
355  * The restore hook is still available even for fully irq domain based
356  * setups. Courtesy to XEN/X86.
357  */
358 bool arch_restore_msi_irqs(struct pci_dev *dev);
359
360 #ifdef CONFIG_GENERIC_MSI_IRQ
361
362 #include <linux/irqhandler.h>
363
364 struct irq_domain;
365 struct irq_domain_ops;
366 struct irq_chip;
367 struct device_node;
368 struct fwnode_handle;
369 struct msi_domain_info;
370
371 /**
372  * struct msi_domain_ops - MSI interrupt domain callbacks
373  * @get_hwirq:          Retrieve the resulting hw irq number
374  * @msi_init:           Domain specific init function for MSI interrupts
375  * @msi_free:           Domain specific function to free a MSI interrupts
376  * @msi_prepare:        Prepare the allocation of the interrupts in the domain
377  * @set_desc:           Set the msi descriptor for an interrupt
378  * @domain_alloc_irqs:  Optional function to override the default allocation
379  *                      function.
380  * @domain_free_irqs:   Optional function to override the default free
381  *                      function.
382  * @msi_post_free:      Optional function which is invoked after freeing
383  *                      all interrupts.
384  *
385  * @get_hwirq, @msi_init and @msi_free are callbacks used by the underlying
386  * irqdomain.
387  *
388  * @msi_check, @msi_prepare and @set_desc are callbacks used by the
389  * msi_domain_alloc/free_irqs*() variants.
390  *
391  * @domain_alloc_irqs, @domain_free_irqs can be used to override the
392  * default allocation/free functions (__msi_domain_alloc/free_irqs). This
393  * is initially for a wrapper around XENs seperate MSI universe which can't
394  * be wrapped into the regular irq domains concepts by mere mortals.  This
395  * allows to universally use msi_domain_alloc/free_irqs without having to
396  * special case XEN all over the place.
397  */
398 struct msi_domain_ops {
399         irq_hw_number_t (*get_hwirq)(struct msi_domain_info *info,
400                                      msi_alloc_info_t *arg);
401         int             (*msi_init)(struct irq_domain *domain,
402                                     struct msi_domain_info *info,
403                                     unsigned int virq, irq_hw_number_t hwirq,
404                                     msi_alloc_info_t *arg);
405         void            (*msi_free)(struct irq_domain *domain,
406                                     struct msi_domain_info *info,
407                                     unsigned int virq);
408         int             (*msi_prepare)(struct irq_domain *domain,
409                                        struct device *dev, int nvec,
410                                        msi_alloc_info_t *arg);
411         void            (*set_desc)(msi_alloc_info_t *arg,
412                                     struct msi_desc *desc);
413         int             (*domain_alloc_irqs)(struct irq_domain *domain,
414                                              struct device *dev, int nvec);
415         void            (*domain_free_irqs)(struct irq_domain *domain,
416                                             struct device *dev);
417         void            (*msi_post_free)(struct irq_domain *domain,
418                                          struct device *dev);
419 };
420
421 /**
422  * struct msi_domain_info - MSI interrupt domain data
423  * @flags:              Flags to decribe features and capabilities
424  * @bus_token:          The domain bus token
425  * @ops:                The callback data structure
426  * @chip:               Optional: associated interrupt chip
427  * @chip_data:          Optional: associated interrupt chip data
428  * @handler:            Optional: associated interrupt flow handler
429  * @handler_data:       Optional: associated interrupt flow handler data
430  * @handler_name:       Optional: associated interrupt flow handler name
431  * @data:               Optional: domain specific data
432  */
433 struct msi_domain_info {
434         u32                             flags;
435         enum irq_domain_bus_token       bus_token;
436         struct msi_domain_ops           *ops;
437         struct irq_chip                 *chip;
438         void                            *chip_data;
439         irq_flow_handler_t              handler;
440         void                            *handler_data;
441         const char                      *handler_name;
442         void                            *data;
443 };
444
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  */
455 enum {
456         /*
457          * Init non implemented ops callbacks with default MSI domain
458          * callbacks.
459          */
460         MSI_FLAG_USE_DEF_DOM_OPS        = (1 << 0),
461         /*
462          * Init non implemented chip callbacks with default MSI chip
463          * callbacks.
464          */
465         MSI_FLAG_USE_DEF_CHIP_OPS       = (1 << 1),
466         /* Needs early activate, required for PCI */
467         MSI_FLAG_ACTIVATE_EARLY         = (1 << 2),
468         /*
469          * Must reactivate when irq is started even when
470          * MSI_FLAG_ACTIVATE_EARLY has been set.
471          */
472         MSI_FLAG_MUST_REACTIVATE        = (1 << 3),
473         /* Populate sysfs on alloc() and destroy it on free() */
474         MSI_FLAG_DEV_SYSFS              = (1 << 4),
475         /* Allocate simple MSI descriptors */
476         MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS = (1 << 5),
477         /* Free MSI descriptors */
478         MSI_FLAG_FREE_MSI_DESCS         = (1 << 6),
479         /*
480          * Quirk to handle MSI implementations which do not provide
481          * masking. Currently known to affect x86, but has to be partially
482          * handled in the core MSI code.
483          */
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
501 };
502
503 /**
504  * struct msi_parent_ops - MSI parent domain callbacks and configuration info
505  *
506  * @supported_flags:    Required: The supported MSI flags of the parent domain
507  * @prefix:             Optional: Prefix for the domain and chip name
508  * @init_dev_msi_info:  Required: Callback for MSI parent domains to setup parent
509  *                      domain specific domain flags, domain ops and interrupt chip
510  *                      callbacks when a per device domain is created.
511  */
512 struct msi_parent_ops {
513         u32             supported_flags;
514         const char      *prefix;
515         bool            (*init_dev_msi_info)(struct device *dev, struct irq_domain *domain,
516                                              struct irq_domain *msi_parent_domain,
517                                              struct msi_domain_info *msi_child_info);
518 };
519
520 bool msi_parent_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
521                                   struct irq_domain *msi_parent_domain,
522                                   struct msi_domain_info *msi_child_info);
523
524 int msi_domain_set_affinity(struct irq_data *data, const struct cpumask *mask,
525                             bool force);
526
527 struct irq_domain *msi_create_irq_domain(struct fwnode_handle *fwnode,
528                                          struct msi_domain_info *info,
529                                          struct irq_domain *parent);
530
531 int msi_domain_alloc_irqs_range_locked(struct device *dev, unsigned int domid,
532                                        unsigned int first, unsigned int last);
533 int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid,
534                                 unsigned int first, unsigned int last);
535 int msi_domain_alloc_irqs_all_locked(struct device *dev, unsigned int domid, int nirqs);
536
537
538 void msi_domain_free_irqs_range_locked(struct device *dev, unsigned int domid,
539                                        unsigned int first, unsigned int last);
540 void msi_domain_free_irqs_range(struct device *dev, unsigned int domid,
541                                 unsigned int first, unsigned int last);
542 void msi_domain_free_irqs_all_locked(struct device *dev, unsigned int domid);
543 void msi_domain_free_irqs_all(struct device *dev, unsigned int domid);
544
545 struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain);
546
547 struct irq_domain *platform_msi_create_irq_domain(struct fwnode_handle *fwnode,
548                                                   struct msi_domain_info *info,
549                                                   struct irq_domain *parent);
550 int platform_msi_domain_alloc_irqs(struct device *dev, unsigned int nvec,
551                                    irq_write_msi_msg_t write_msi_msg);
552 void platform_msi_domain_free_irqs(struct device *dev);
553
554 /* When an MSI domain is used as an intermediate domain */
555 int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev,
556                             int nvec, msi_alloc_info_t *args);
557 int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
558                              int virq, int nvec, msi_alloc_info_t *args);
559 struct irq_domain *
560 __platform_msi_create_device_domain(struct device *dev,
561                                     unsigned int nvec,
562                                     bool is_tree,
563                                     irq_write_msi_msg_t write_msi_msg,
564                                     const struct irq_domain_ops *ops,
565                                     void *host_data);
566
567 #define platform_msi_create_device_domain(dev, nvec, write, ops, data)  \
568         __platform_msi_create_device_domain(dev, nvec, false, write, ops, data)
569 #define platform_msi_create_device_tree_domain(dev, nvec, write, ops, data) \
570         __platform_msi_create_device_domain(dev, nvec, true, write, ops, data)
571
572 int platform_msi_device_domain_alloc(struct irq_domain *domain, unsigned int virq,
573                                      unsigned int nr_irqs);
574 void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int virq,
575                                      unsigned int nvec);
576 void *platform_msi_get_host_data(struct irq_domain *domain);
577 #endif /* CONFIG_GENERIC_MSI_IRQ */
578
579 /* PCI specific interfaces */
580 #ifdef CONFIG_PCI_MSI
581 struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc);
582 void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg);
583 void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
584 void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg);
585 void pci_msi_mask_irq(struct irq_data *data);
586 void pci_msi_unmask_irq(struct irq_data *data);
587 struct irq_domain *pci_msi_create_irq_domain(struct fwnode_handle *fwnode,
588                                              struct msi_domain_info *info,
589                                              struct irq_domain *parent);
590 u32 pci_msi_domain_get_msi_rid(struct irq_domain *domain, struct pci_dev *pdev);
591 struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev);
592 bool pci_dev_has_special_msi_domain(struct pci_dev *pdev);
593 #else /* CONFIG_PCI_MSI */
594 static inline struct irq_domain *pci_msi_get_device_domain(struct pci_dev *pdev)
595 {
596         return NULL;
597 }
598 static inline void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg) { }
599 #endif /* !CONFIG_PCI_MSI */
600
601 #endif /* LINUX_MSI_H */