arm-vgic.txt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ARM Virtual Generic Interrupt Controller v2 (VGIC)
  2. ==================================================
  3. Device types supported:
  4. KVM_DEV_TYPE_ARM_VGIC_V2 ARM Generic Interrupt Controller v2.0
  5. Only one VGIC instance may be instantiated through either this API or the
  6. legacy KVM_CREATE_IRQCHIP API. The created VGIC will act as the VM interrupt
  7. controller, requiring emulated user-space devices to inject interrupts to the
  8. VGIC instead of directly to CPUs.
  9. GICv3 implementations with hardware compatibility support allow creating a
  10. guest GICv2 through this interface. For information on creating a guest GICv3
  11. device and guest ITS devices, see arm-vgic-v3.txt. It is not possible to
  12. create both a GICv3 and GICv2 device on the same VM.
  13. Groups:
  14. KVM_DEV_ARM_VGIC_GRP_ADDR
  15. Attributes:
  16. KVM_VGIC_V2_ADDR_TYPE_DIST (rw, 64-bit)
  17. Base address in the guest physical address space of the GIC distributor
  18. register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V2.
  19. This address needs to be 4K aligned and the region covers 4 KByte.
  20. KVM_VGIC_V2_ADDR_TYPE_CPU (rw, 64-bit)
  21. Base address in the guest physical address space of the GIC virtual cpu
  22. interface register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V2.
  23. This address needs to be 4K aligned and the region covers 4 KByte.
  24. Errors:
  25. -E2BIG: Address outside of addressable IPA range
  26. -EINVAL: Incorrectly aligned address
  27. -EEXIST: Address already configured
  28. -ENXIO: The group or attribute is unknown/unsupported for this device
  29. or hardware support is missing.
  30. -EFAULT: Invalid user pointer for attr->addr.
  31. KVM_DEV_ARM_VGIC_GRP_DIST_REGS
  32. Attributes:
  33. The attr field of kvm_device_attr encodes two values:
  34. bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 |
  35. values: | reserved | vcpu_index | offset |
  36. All distributor regs are (rw, 32-bit)
  37. The offset is relative to the "Distributor base address" as defined in the
  38. GICv2 specs. Getting or setting such a register has the same effect as
  39. reading or writing the register on the actual hardware from the cpu whose
  40. index is specified with the vcpu_index field. Note that most distributor
  41. fields are not banked, but return the same value regardless of the
  42. vcpu_index used to access the register.
  43. Limitations:
  44. - Priorities are not implemented, and registers are RAZ/WI
  45. - Currently only implemented for KVM_DEV_TYPE_ARM_VGIC_V2.
  46. Errors:
  47. -ENXIO: Getting or setting this register is not yet supported
  48. -EBUSY: One or more VCPUs are running
  49. -EINVAL: Invalid vcpu_index supplied
  50. KVM_DEV_ARM_VGIC_GRP_CPU_REGS
  51. Attributes:
  52. The attr field of kvm_device_attr encodes two values:
  53. bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 |
  54. values: | reserved | vcpu_index | offset |
  55. All CPU interface regs are (rw, 32-bit)
  56. The offset specifies the offset from the "CPU interface base address" as
  57. defined in the GICv2 specs. Getting or setting such a register has the
  58. same effect as reading or writing the register on the actual hardware.
  59. The Active Priorities Registers APRn are implementation defined, so we set a
  60. fixed format for our implementation that fits with the model of a "GICv2
  61. implementation without the security extensions" which we present to the
  62. guest. This interface always exposes four register APR[0-3] describing the
  63. maximum possible 128 preemption levels. The semantics of the register
  64. indicate if any interrupts in a given preemption level are in the active
  65. state by setting the corresponding bit.
  66. Thus, preemption level X has one or more active interrupts if and only if:
  67. APRn[X mod 32] == 0b1, where n = X / 32
  68. Bits for undefined preemption levels are RAZ/WI.
  69. Limitations:
  70. - Priorities are not implemented, and registers are RAZ/WI
  71. - Currently only implemented for KVM_DEV_TYPE_ARM_VGIC_V2.
  72. Errors:
  73. -ENXIO: Getting or setting this register is not yet supported
  74. -EBUSY: One or more VCPUs are running
  75. -EINVAL: Invalid vcpu_index supplied
  76. KVM_DEV_ARM_VGIC_GRP_NR_IRQS
  77. Attributes:
  78. A value describing the number of interrupts (SGI, PPI and SPI) for
  79. this GIC instance, ranging from 64 to 1024, in increments of 32.
  80. Errors:
  81. -EINVAL: Value set is out of the expected range
  82. -EBUSY: Value has already be set, or GIC has already been initialized
  83. with default values.
  84. KVM_DEV_ARM_VGIC_GRP_CTRL
  85. Attributes:
  86. KVM_DEV_ARM_VGIC_CTRL_INIT
  87. request the initialization of the VGIC or ITS, no additional parameter
  88. in kvm_device_attr.addr.
  89. Errors:
  90. -ENXIO: VGIC not properly configured as required prior to calling
  91. this attribute
  92. -ENODEV: no online VCPU
  93. -ENOMEM: memory shortage when allocating vgic internal data