arm-gic-v4.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2016,2017 ARM Limited, All Rights Reserved.
  3. * Author: Marc Zyngier <marc.zyngier@arm.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef __LINUX_IRQCHIP_ARM_GIC_V4_H
  18. #define __LINUX_IRQCHIP_ARM_GIC_V4_H
  19. struct its_vpe;
  20. /* Embedded in kvm.arch */
  21. struct its_vm {
  22. struct fwnode_handle *fwnode;
  23. struct irq_domain *domain;
  24. struct page *vprop_page;
  25. struct its_vpe **vpes;
  26. int nr_vpes;
  27. irq_hw_number_t db_lpi_base;
  28. unsigned long *db_bitmap;
  29. int nr_db_lpis;
  30. };
  31. /* Embedded in kvm_vcpu.arch */
  32. struct its_vpe {
  33. struct page *vpt_page;
  34. struct its_vm *its_vm;
  35. /* Doorbell interrupt */
  36. int irq;
  37. irq_hw_number_t vpe_db_lpi;
  38. /* VPE proxy mapping */
  39. int vpe_proxy_event;
  40. /*
  41. * This collection ID is used to indirect the target
  42. * redistributor for this VPE. The ID itself isn't involved in
  43. * programming of the ITS.
  44. */
  45. u16 col_idx;
  46. /* Unique (system-wide) VPE identifier */
  47. u16 vpe_id;
  48. /* Implementation Defined Area Invalid */
  49. bool idai;
  50. /* Pending VLPIs on schedule out? */
  51. bool pending_last;
  52. };
  53. /*
  54. * struct its_vlpi_map: structure describing the mapping of a
  55. * VLPI. Only to be interpreted in the context of a physical interrupt
  56. * it complements. To be used as the vcpu_info passed to
  57. * irq_set_vcpu_affinity().
  58. *
  59. * @vm: Pointer to the GICv4 notion of a VM
  60. * @vpe: Pointer to the GICv4 notion of a virtual CPU (VPE)
  61. * @vintid: Virtual LPI number
  62. * @db_enabled: Is the VPE doorbell to be generated?
  63. */
  64. struct its_vlpi_map {
  65. struct its_vm *vm;
  66. struct its_vpe *vpe;
  67. u32 vintid;
  68. bool db_enabled;
  69. };
  70. enum its_vcpu_info_cmd_type {
  71. MAP_VLPI,
  72. GET_VLPI,
  73. PROP_UPDATE_VLPI,
  74. PROP_UPDATE_AND_INV_VLPI,
  75. SCHEDULE_VPE,
  76. DESCHEDULE_VPE,
  77. INVALL_VPE,
  78. };
  79. struct its_cmd_info {
  80. enum its_vcpu_info_cmd_type cmd_type;
  81. union {
  82. struct its_vlpi_map *map;
  83. u8 config;
  84. };
  85. };
  86. int its_alloc_vcpu_irqs(struct its_vm *vm);
  87. void its_free_vcpu_irqs(struct its_vm *vm);
  88. int its_schedule_vpe(struct its_vpe *vpe, bool on);
  89. int its_invall_vpe(struct its_vpe *vpe);
  90. int its_map_vlpi(int irq, struct its_vlpi_map *map);
  91. int its_get_vlpi(int irq, struct its_vlpi_map *map);
  92. int its_unmap_vlpi(int irq);
  93. int its_prop_update_vlpi(int irq, u8 config, bool inv);
  94. int its_init_v4(struct irq_domain *domain, const struct irq_domain_ops *ops);
  95. #endif