intr_remapping.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include <linux/kernel.h>
  2. #include <linux/string.h>
  3. #include <linux/errno.h>
  4. #include "intr_remapping.h"
  5. int intr_remapping_enabled;
  6. int disable_intremap;
  7. int disable_sourceid_checking;
  8. int no_x2apic_optout;
  9. static struct irq_remap_ops *remap_ops;
  10. static __init int setup_nointremap(char *str)
  11. {
  12. disable_intremap = 1;
  13. return 0;
  14. }
  15. early_param("nointremap", setup_nointremap);
  16. static __init int setup_intremap(char *str)
  17. {
  18. if (!str)
  19. return -EINVAL;
  20. while (*str) {
  21. if (!strncmp(str, "on", 2))
  22. disable_intremap = 0;
  23. else if (!strncmp(str, "off", 3))
  24. disable_intremap = 1;
  25. else if (!strncmp(str, "nosid", 5))
  26. disable_sourceid_checking = 1;
  27. else if (!strncmp(str, "no_x2apic_optout", 16))
  28. no_x2apic_optout = 1;
  29. str += strcspn(str, ",");
  30. while (*str == ',')
  31. str++;
  32. }
  33. return 0;
  34. }
  35. early_param("intremap", setup_intremap);
  36. void __init setup_intr_remapping(void)
  37. {
  38. remap_ops = &intel_irq_remap_ops;
  39. }
  40. int intr_remapping_supported(void)
  41. {
  42. if (disable_intremap)
  43. return 0;
  44. if (!remap_ops || !remap_ops->supported)
  45. return 0;
  46. return remap_ops->supported();
  47. }
  48. int __init intr_hardware_init(void)
  49. {
  50. if (!remap_ops || !remap_ops->hardware_init)
  51. return -ENODEV;
  52. return remap_ops->hardware_init();
  53. }
  54. int __init intr_hardware_enable(void)
  55. {
  56. if (!remap_ops || !remap_ops->hardware_enable)
  57. return -ENODEV;
  58. return remap_ops->hardware_enable();
  59. }
  60. void intr_hardware_disable(void)
  61. {
  62. if (!remap_ops || !remap_ops->hardware_disable)
  63. return;
  64. remap_ops->hardware_disable();
  65. }
  66. int intr_hardware_reenable(int mode)
  67. {
  68. if (!remap_ops || !remap_ops->hardware_reenable)
  69. return 0;
  70. return remap_ops->hardware_reenable(mode);
  71. }
  72. int __init intr_enable_fault_handling(void)
  73. {
  74. if (!remap_ops || !remap_ops->enable_faulting)
  75. return -ENODEV;
  76. return remap_ops->enable_faulting();
  77. }