blob: 30f5427cf9b0b873756bb7c539bff64eb410d6e4 [file] [log] [blame]
Christoffer Dall73306722013-10-25 17:29:18 +01001ARM Virtual Generic Interrupt Controller (VGIC)
2===============================================
3
4Device types supported:
5 KVM_DEV_TYPE_ARM_VGIC_V2 ARM Generic Interrupt Controller v2.0
6
7Only one VGIC instance may be instantiated through either this API or the
8legacy KVM_CREATE_IRQCHIP api. The created VGIC will act as the VM interrupt
9controller, requiring emulated user-space devices to inject interrupts to the
10VGIC instead of directly to CPUs.
Christoffer Dallce01e4e2013-09-23 14:55:56 -070011
12Groups:
13 KVM_DEV_ARM_VGIC_GRP_ADDR
14 Attributes:
15 KVM_VGIC_V2_ADDR_TYPE_DIST (rw, 64-bit)
16 Base address in the guest physical address space of the GIC distributor
17 register mappings.
18
19 KVM_VGIC_V2_ADDR_TYPE_CPU (rw, 64-bit)
20 Base address in the guest physical address space of the GIC virtual cpu
21 interface register mappings.
Christoffer Dallc07a0192013-10-25 21:17:31 +010022
23 KVM_DEV_ARM_VGIC_GRP_DIST_REGS
24 Attributes:
25 The attr field of kvm_device_attr encodes two values:
26 bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 |
27 values: | reserved | cpu id | offset |
28
29 All distributor regs are (rw, 32-bit)
30
31 The offset is relative to the "Distributor base address" as defined in the
32 GICv2 specs. Getting or setting such a register has the same effect as
33 reading or writing the register on the actual hardware from the cpu
34 specified with cpu id field. Note that most distributor fields are not
35 banked, but return the same value regardless of the cpu id used to access
36 the register.
37 Limitations:
38 - Priorities are not implemented, and registers are RAZ/WI
39 Errors:
40 -ENODEV: Getting or setting this register is not yet supported
41 -EBUSY: One or more VCPUs are running
42
43 KVM_DEV_ARM_VGIC_GRP_CPU_REGS
44 Attributes:
45 The attr field of kvm_device_attr encodes two values:
46 bits: | 63 .... 40 | 39 .. 32 | 31 .... 0 |
47 values: | reserved | cpu id | offset |
48
49 All CPU interface regs are (rw, 32-bit)
50
51 The offset specifies the offset from the "CPU interface base address" as
52 defined in the GICv2 specs. Getting or setting such a register has the
53 same effect as reading or writing the register on the actual hardware.
54
55 The Active Priorities Registers APRn are implementation defined, so we set a
56 fixed format for our implementation that fits with the model of a "GICv2
57 implementation without the security extensions" which we present to the
58 guest. This interface always exposes four register APR[0-3] describing the
59 maximum possible 128 preemption levels. The semantics of the register
60 indicate if any interrupts in a given preemption level are in the active
61 state by setting the corresponding bit.
62
63 Thus, preemption level X has one or more active interrupts if and only if:
64
65 APRn[X mod 32] == 0b1, where n = X / 32
66
67 Bits for undefined preemption levels are RAZ/WI.
68
69 Limitations:
70 - Priorities are not implemented, and registers are RAZ/WI
71 Errors:
72 -ENODEV: Getting or setting this register is not yet supported
73 -EBUSY: One or more VCPUs are running
Marc Zyngiera98f26f2014-07-08 12:09:07 +010074
75 KVM_DEV_ARM_VGIC_GRP_NR_IRQS
76 Attributes:
77 A value describing the number of interrupts (SGI, PPI and SPI) for
78 this GIC instance, ranging from 64 to 1024, in increments of 32.
79
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.
Eric Auger065c0032014-12-15 18:43:33 +010084
85 KVM_DEV_ARM_VGIC_GRP_CTRL
86 Attributes:
87 KVM_DEV_ARM_VGIC_CTRL_INIT
88 request the initialization of the VGIC, no additional parameter in
89 kvm_device_attr.addr.
90 Errors:
91 -ENXIO: VGIC not properly configured as required prior to calling
92 this attribute
93 -ENODEV: no online VCPU
94 -ENOMEM: memory shortage when allocating vgic internal data