arm-vgic.txt 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ARM Virtual Generic Interrupt Controller (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. Groups:
  10. KVM_DEV_ARM_VGIC_GRP_ADDR
  11. Attributes:
  12. KVM_VGIC_V2_ADDR_TYPE_DIST (rw, 64-bit)
  13. Base address in the guest physical address space of the GIC distributor
  14. register mappings.
  15. KVM_VGIC_V2_ADDR_TYPE_CPU (rw, 64-bit)
  16. Base address in the guest physical address space of the GIC virtual cpu
  17. interface register mappings.
  18. KVM_DEV_ARM_VGIC_GRP_DIST_REGS
  19. Attributes:
  20. The attr field of kvm_device_attr encodes two values:
  21. bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 |
  22. values: | reserved | cpu id | offset |
  23. All distributor regs are (rw, 32-bit)
  24. The offset is relative to the "Distributor base address" as defined in the
  25. GICv2 specs. Getting or setting such a register has the same effect as
  26. reading or writing the register on the actual hardware from the cpu
  27. specified with cpu id field. Note that most distributor fields are not
  28. banked, but return the same value regardless of the cpu id used to access
  29. the register.
  30. Limitations:
  31. - Priorities are not implemented, and registers are RAZ/WI
  32. Errors:
  33. -ENODEV: Getting or setting this register is not yet supported
  34. -EBUSY: One or more VCPUs are running
  35. KVM_DEV_ARM_VGIC_GRP_CPU_REGS
  36. Attributes:
  37. The attr field of kvm_device_attr encodes two values:
  38. bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 |
  39. values: | reserved | cpu id | offset |
  40. All CPU interface regs are (rw, 32-bit)
  41. The offset specifies the offset from the "CPU interface base address" as
  42. defined in the GICv2 specs. Getting or setting such a register has the
  43. same effect as reading or writing the register on the actual hardware.
  44. The Active Priorities Registers APRn are implementation defined, so we set a
  45. fixed format for our implementation that fits with the model of a "GICv2
  46. implementation without the security extensions" which we present to the
  47. guest. This interface always exposes four register APR[0-3] describing the
  48. maximum possible 128 preemption levels. The semantics of the register
  49. indicate if any interrupts in a given preemption level are in the active
  50. state by setting the corresponding bit.
  51. Thus, preemption level X has one or more active interrupts if and only if:
  52. APRn[X mod 32] == 0b1, where n = X / 32
  53. Bits for undefined preemption levels are RAZ/WI.
  54. Limitations:
  55. - Priorities are not implemented, and registers are RAZ/WI
  56. Errors:
  57. -ENODEV: Getting or setting this register is not yet supported
  58. -EBUSY: One or more VCPUs are running
  59. KVM_DEV_ARM_VGIC_GRP_NR_IRQS
  60. Attributes:
  61. A value describing the number of interrupts (SGI, PPI and SPI) for
  62. this GIC instance, ranging from 64 to 1024, in increments of 32.
  63. Errors:
  64. -EINVAL: Value set is out of the expected range
  65. -EBUSY: Value has already be set, or GIC has already been initialized
  66. with default values.