irq_remapping.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2012 Advanced Micro Devices, Inc.
  4. * Author: Joerg Roedel <[email protected]>
  5. *
  6. * This header file contains the interface of the interrupt remapping code to
  7. * the x86 interrupt management code.
  8. */
  9. #ifndef __X86_IRQ_REMAPPING_H
  10. #define __X86_IRQ_REMAPPING_H
  11. #include <asm/irqdomain.h>
  12. #include <asm/hw_irq.h>
  13. #include <asm/io_apic.h>
  14. struct msi_msg;
  15. struct irq_alloc_info;
  16. enum irq_remap_cap {
  17. IRQ_POSTING_CAP = 0,
  18. };
  19. enum {
  20. IRQ_REMAP_XAPIC_MODE,
  21. IRQ_REMAP_X2APIC_MODE,
  22. };
  23. struct vcpu_data {
  24. u64 pi_desc_addr; /* Physical address of PI Descriptor */
  25. u32 vector; /* Guest vector of the interrupt */
  26. };
  27. #ifdef CONFIG_IRQ_REMAP
  28. extern raw_spinlock_t irq_2_ir_lock;
  29. extern bool irq_remapping_cap(enum irq_remap_cap cap);
  30. extern void set_irq_remapping_broken(void);
  31. extern int irq_remapping_prepare(void);
  32. extern int irq_remapping_enable(void);
  33. extern void irq_remapping_disable(void);
  34. extern int irq_remapping_reenable(int);
  35. extern int irq_remap_enable_fault_handling(void);
  36. extern void panic_if_irq_remap(const char *msg);
  37. /* Create PCI MSI/MSIx irqdomain, use @parent as the parent irqdomain. */
  38. extern struct irq_domain *
  39. arch_create_remap_msi_irq_domain(struct irq_domain *par, const char *n, int id);
  40. /* Get parent irqdomain for interrupt remapping irqdomain */
  41. static inline struct irq_domain *arch_get_ir_parent_domain(void)
  42. {
  43. return x86_vector_domain;
  44. }
  45. #else /* CONFIG_IRQ_REMAP */
  46. static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
  47. static inline void set_irq_remapping_broken(void) { }
  48. static inline int irq_remapping_prepare(void) { return -ENODEV; }
  49. static inline int irq_remapping_enable(void) { return -ENODEV; }
  50. static inline void irq_remapping_disable(void) { }
  51. static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
  52. static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
  53. static inline void panic_if_irq_remap(const char *msg)
  54. {
  55. }
  56. #endif /* CONFIG_IRQ_REMAP */
  57. #endif /* __X86_IRQ_REMAPPING_H */