irq_remapping.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef _ASM_X86_IRQ_REMAPPING_H
  2. #define _ASM_X86_IRQ_REMAPPING_H
  3. #define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8)
  4. #ifdef CONFIG_IRQ_REMAP
  5. static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
  6. static inline void prepare_irte(struct irte *irte, int vector,
  7. unsigned int dest)
  8. {
  9. memset(irte, 0, sizeof(*irte));
  10. irte->present = 1;
  11. irte->dst_mode = apic->irq_dest_mode;
  12. /*
  13. * Trigger mode in the IRTE will always be edge, and for IO-APIC, the
  14. * actual level or edge trigger will be setup in the IO-APIC
  15. * RTE. This will help simplify level triggered irq migration.
  16. * For more details, see the comments (in io_apic.c) explainig IO-APIC
  17. * irq migration in the presence of interrupt-remapping.
  18. */
  19. irte->trigger_mode = 0;
  20. irte->dlvry_mode = apic->irq_delivery_mode;
  21. irte->vector = vector;
  22. irte->dest_id = IRTE_DEST(dest);
  23. irte->redir_hint = 1;
  24. }
  25. static inline bool irq_remapped(struct irq_cfg *cfg)
  26. {
  27. return cfg->irq_2_iommu.iommu != NULL;
  28. }
  29. #else
  30. static void prepare_irte(struct irte *irte, int vector, unsigned int dest)
  31. {
  32. }
  33. static inline bool irq_remapped(struct irq_cfg *cfg)
  34. {
  35. return false;
  36. }
  37. static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
  38. {
  39. }
  40. #endif
  41. #endif /* _ASM_X86_IRQ_REMAPPING_H */