xref: /linux/Documentation/virt/kvm/devices/arm-vgic-v3.rst (revision 298c41b8fa1e02c5a35e2263d138583220ab6094)
1c0d1c8a0SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2c0d1c8a0SMauro Carvalho Chehab
3c0d1c8a0SMauro Carvalho Chehab==============================================================
4c0d1c8a0SMauro Carvalho ChehabARM Virtual Generic Interrupt Controller v3 and later (VGICv3)
5c0d1c8a0SMauro Carvalho Chehab==============================================================
6c0d1c8a0SMauro Carvalho Chehab
7c0d1c8a0SMauro Carvalho Chehab
8c0d1c8a0SMauro Carvalho ChehabDevice types supported:
9c0d1c8a0SMauro Carvalho Chehab  - KVM_DEV_TYPE_ARM_VGIC_V3     ARM Generic Interrupt Controller v3.0
10c0d1c8a0SMauro Carvalho Chehab
11c0d1c8a0SMauro Carvalho ChehabOnly one VGIC instance may be instantiated through this API.  The created VGIC
12c0d1c8a0SMauro Carvalho Chehabwill act as the VM interrupt controller, requiring emulated user-space devices
13c0d1c8a0SMauro Carvalho Chehabto inject interrupts to the VGIC instead of directly to CPUs.  It is not
14c0d1c8a0SMauro Carvalho Chehabpossible to create both a GICv3 and GICv2 on the same VM.
15c0d1c8a0SMauro Carvalho Chehab
16c0d1c8a0SMauro Carvalho ChehabCreating a guest GICv3 device requires a host GICv3 as well.
17c0d1c8a0SMauro Carvalho Chehab
18c0d1c8a0SMauro Carvalho Chehab
19c0d1c8a0SMauro Carvalho ChehabGroups:
20c0d1c8a0SMauro Carvalho Chehab  KVM_DEV_ARM_VGIC_GRP_ADDR
21c0d1c8a0SMauro Carvalho Chehab   Attributes:
22c0d1c8a0SMauro Carvalho Chehab
23c0d1c8a0SMauro Carvalho Chehab    KVM_VGIC_V3_ADDR_TYPE_DIST (rw, 64-bit)
24c0d1c8a0SMauro Carvalho Chehab      Base address in the guest physical address space of the GICv3 distributor
25c0d1c8a0SMauro Carvalho Chehab      register mappings. Only valid for KVM_DEV_TYPE_ARM_VGIC_V3.
26c0d1c8a0SMauro Carvalho Chehab      This address needs to be 64K aligned and the region covers 64 KByte.
27c0d1c8a0SMauro Carvalho Chehab
28c0d1c8a0SMauro Carvalho Chehab    KVM_VGIC_V3_ADDR_TYPE_REDIST (rw, 64-bit)
29c0d1c8a0SMauro Carvalho Chehab      Base address in the guest physical address space of the GICv3
30c0d1c8a0SMauro Carvalho Chehab      redistributor register mappings. There are two 64K pages for each
31c0d1c8a0SMauro Carvalho Chehab      VCPU and all of the redistributor pages are contiguous.
32c0d1c8a0SMauro Carvalho Chehab      Only valid for KVM_DEV_TYPE_ARM_VGIC_V3.
33c0d1c8a0SMauro Carvalho Chehab      This address needs to be 64K aligned.
34c0d1c8a0SMauro Carvalho Chehab
35c0d1c8a0SMauro Carvalho Chehab    KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION (rw, 64-bit)
36c0d1c8a0SMauro Carvalho Chehab      The attribute data pointed to by kvm_device_attr.addr is a __u64 value::
37c0d1c8a0SMauro Carvalho Chehab
38c0d1c8a0SMauro Carvalho Chehab        bits:     | 63   ....  52  |  51   ....   16 | 15 - 12  |11 - 0
39c0d1c8a0SMauro Carvalho Chehab        values:   |     count      |       base      |  flags   | index
40c0d1c8a0SMauro Carvalho Chehab
41c0d1c8a0SMauro Carvalho Chehab      - index encodes the unique redistributor region index
42c0d1c8a0SMauro Carvalho Chehab      - flags: reserved for future use, currently 0
43c0d1c8a0SMauro Carvalho Chehab      - base field encodes bits [51:16] of the guest physical base address
44c0d1c8a0SMauro Carvalho Chehab        of the first redistributor in the region.
45c0d1c8a0SMauro Carvalho Chehab      - count encodes the number of redistributors in the region. Must be
46c0d1c8a0SMauro Carvalho Chehab        greater than 0.
47c0d1c8a0SMauro Carvalho Chehab
48c0d1c8a0SMauro Carvalho Chehab      There are two 64K pages for each redistributor in the region and
49c0d1c8a0SMauro Carvalho Chehab      redistributors are laid out contiguously within the region. Regions
50c0d1c8a0SMauro Carvalho Chehab      are filled with redistributors in the index order. The sum of all
51c0d1c8a0SMauro Carvalho Chehab      region count fields must be greater than or equal to the number of
52c0d1c8a0SMauro Carvalho Chehab      VCPUs. Redistributor regions must be registered in the incremental
53c0d1c8a0SMauro Carvalho Chehab      index order, starting from index 0.
54c0d1c8a0SMauro Carvalho Chehab
55c0d1c8a0SMauro Carvalho Chehab      The characteristics of a specific redistributor region can be read
56c0d1c8a0SMauro Carvalho Chehab      by presetting the index field in the attr data.
57c0d1c8a0SMauro Carvalho Chehab      Only valid for KVM_DEV_TYPE_ARM_VGIC_V3.
58c0d1c8a0SMauro Carvalho Chehab
59c0d1c8a0SMauro Carvalho Chehab  It is invalid to mix calls with KVM_VGIC_V3_ADDR_TYPE_REDIST and
60c0d1c8a0SMauro Carvalho Chehab  KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attributes.
61c0d1c8a0SMauro Carvalho Chehab
62c0d1c8a0SMauro Carvalho Chehab  Errors:
63c0d1c8a0SMauro Carvalho Chehab
64c0d1c8a0SMauro Carvalho Chehab    =======  =============================================================
65c0d1c8a0SMauro Carvalho Chehab    -E2BIG   Address outside of addressable IPA range
66c0d1c8a0SMauro Carvalho Chehab    -EINVAL  Incorrectly aligned address, bad redistributor region
67c0d1c8a0SMauro Carvalho Chehab             count/index, mixed redistributor region attribute usage
68c0d1c8a0SMauro Carvalho Chehab    -EEXIST  Address already configured
69c0d1c8a0SMauro Carvalho Chehab    -ENOENT  Attempt to read the characteristics of a non existing
70c0d1c8a0SMauro Carvalho Chehab             redistributor region
71c0d1c8a0SMauro Carvalho Chehab    -ENXIO   The group or attribute is unknown/unsupported for this device
72c0d1c8a0SMauro Carvalho Chehab             or hardware support is missing.
73c0d1c8a0SMauro Carvalho Chehab    -EFAULT  Invalid user pointer for attr->addr.
74c0d1c8a0SMauro Carvalho Chehab    =======  =============================================================
75c0d1c8a0SMauro Carvalho Chehab
76c0d1c8a0SMauro Carvalho Chehab
77c0d1c8a0SMauro Carvalho Chehab  KVM_DEV_ARM_VGIC_GRP_DIST_REGS, KVM_DEV_ARM_VGIC_GRP_REDIST_REGS
78c0d1c8a0SMauro Carvalho Chehab   Attributes:
79c0d1c8a0SMauro Carvalho Chehab
80c0d1c8a0SMauro Carvalho Chehab    The attr field of kvm_device_attr encodes two values::
81c0d1c8a0SMauro Carvalho Chehab
82c0d1c8a0SMauro Carvalho Chehab      bits:     | 63   ....  32  |  31   ....    0 |
83c0d1c8a0SMauro Carvalho Chehab      values:   |      mpidr     |      offset     |
84c0d1c8a0SMauro Carvalho Chehab
85c0d1c8a0SMauro Carvalho Chehab    All distributor regs are (rw, 32-bit) and kvm_device_attr.addr points to a
86c0d1c8a0SMauro Carvalho Chehab    __u32 value.  64-bit registers must be accessed by separately accessing the
87c0d1c8a0SMauro Carvalho Chehab    lower and higher word.
88c0d1c8a0SMauro Carvalho Chehab
89c0d1c8a0SMauro Carvalho Chehab    Writes to read-only registers are ignored by the kernel.
90c0d1c8a0SMauro Carvalho Chehab
91c0d1c8a0SMauro Carvalho Chehab    KVM_DEV_ARM_VGIC_GRP_DIST_REGS accesses the main distributor registers.
92c0d1c8a0SMauro Carvalho Chehab    KVM_DEV_ARM_VGIC_GRP_REDIST_REGS accesses the redistributor of the CPU
93c0d1c8a0SMauro Carvalho Chehab    specified by the mpidr.
94c0d1c8a0SMauro Carvalho Chehab
95c0d1c8a0SMauro Carvalho Chehab    The offset is relative to the "[Re]Distributor base address" as defined
96c0d1c8a0SMauro Carvalho Chehab    in the GICv3/4 specs.  Getting or setting such a register has the same
97c0d1c8a0SMauro Carvalho Chehab    effect as reading or writing the register on real hardware, except for the
98c0d1c8a0SMauro Carvalho Chehab    following registers: GICD_STATUSR, GICR_STATUSR, GICD_ISPENDR,
99c0d1c8a0SMauro Carvalho Chehab    GICR_ISPENDR0, GICD_ICPENDR, and GICR_ICPENDR0.  These registers behave
100c0d1c8a0SMauro Carvalho Chehab    differently when accessed via this interface compared to their
101c0d1c8a0SMauro Carvalho Chehab    architecturally defined behavior to allow software a full view of the
102c0d1c8a0SMauro Carvalho Chehab    VGIC's internal state.
103c0d1c8a0SMauro Carvalho Chehab
104c0d1c8a0SMauro Carvalho Chehab    The mpidr field is used to specify which
105c0d1c8a0SMauro Carvalho Chehab    redistributor is accessed.  The mpidr is ignored for the distributor.
106c0d1c8a0SMauro Carvalho Chehab
107c0d1c8a0SMauro Carvalho Chehab    The mpidr encoding is based on the affinity information in the
108c0d1c8a0SMauro Carvalho Chehab    architecture defined MPIDR, and the field is encoded as follows::
109c0d1c8a0SMauro Carvalho Chehab
110c0d1c8a0SMauro Carvalho Chehab      | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 |
111c0d1c8a0SMauro Carvalho Chehab      |    Aff3    |    Aff2    |    Aff1    |    Aff0    |
112c0d1c8a0SMauro Carvalho Chehab
113c0d1c8a0SMauro Carvalho Chehab    Note that distributor fields are not banked, but return the same value
114c0d1c8a0SMauro Carvalho Chehab    regardless of the mpidr used to access the register.
115c0d1c8a0SMauro Carvalho Chehab
116c0d1c8a0SMauro Carvalho Chehab    GICD_IIDR.Revision is updated when the KVM implementation is changed in a
117c0d1c8a0SMauro Carvalho Chehab    way directly observable by the guest or userspace.  Userspace should read
118c0d1c8a0SMauro Carvalho Chehab    GICD_IIDR from KVM and write back the read value to confirm its expected
119c0d1c8a0SMauro Carvalho Chehab    behavior is aligned with the KVM implementation.  Userspace should set
120c0d1c8a0SMauro Carvalho Chehab    GICD_IIDR before setting any other registers to ensure the expected
121c0d1c8a0SMauro Carvalho Chehab    behavior.
122c0d1c8a0SMauro Carvalho Chehab
123c0d1c8a0SMauro Carvalho Chehab
124c0d1c8a0SMauro Carvalho Chehab    The GICD_STATUSR and GICR_STATUSR registers are architecturally defined such
125c0d1c8a0SMauro Carvalho Chehab    that a write of a clear bit has no effect, whereas a write with a set bit
126c0d1c8a0SMauro Carvalho Chehab    clears that value.  To allow userspace to freely set the values of these two
127c0d1c8a0SMauro Carvalho Chehab    registers, setting the attributes with the register offsets for these two
128c0d1c8a0SMauro Carvalho Chehab    registers simply sets the non-reserved bits to the value written.
129c0d1c8a0SMauro Carvalho Chehab
130c0d1c8a0SMauro Carvalho Chehab
131c0d1c8a0SMauro Carvalho Chehab    Accesses (reads and writes) to the GICD_ISPENDR register region and
132c0d1c8a0SMauro Carvalho Chehab    GICR_ISPENDR0 registers get/set the value of the latched pending state for
133c0d1c8a0SMauro Carvalho Chehab    the interrupts.
134c0d1c8a0SMauro Carvalho Chehab
135c0d1c8a0SMauro Carvalho Chehab    This is identical to the value returned by a guest read from ISPENDR for an
136c0d1c8a0SMauro Carvalho Chehab    edge triggered interrupt, but may differ for level triggered interrupts.
137c0d1c8a0SMauro Carvalho Chehab    For edge triggered interrupts, once an interrupt becomes pending (whether
138c0d1c8a0SMauro Carvalho Chehab    because of an edge detected on the input line or because of a guest write
139c0d1c8a0SMauro Carvalho Chehab    to ISPENDR) this state is "latched", and only cleared when either the
140c0d1c8a0SMauro Carvalho Chehab    interrupt is activated or when the guest writes to ICPENDR. A level
141c0d1c8a0SMauro Carvalho Chehab    triggered interrupt may be pending either because the level input is held
142c0d1c8a0SMauro Carvalho Chehab    high by a device, or because of a guest write to the ISPENDR register. Only
143c0d1c8a0SMauro Carvalho Chehab    ISPENDR writes are latched; if the device lowers the line level then the
144c0d1c8a0SMauro Carvalho Chehab    interrupt is no longer pending unless the guest also wrote to ISPENDR, and
145c0d1c8a0SMauro Carvalho Chehab    conversely writes to ICPENDR or activations of the interrupt do not clear
146c0d1c8a0SMauro Carvalho Chehab    the pending status if the line level is still being held high.  (These
147c0d1c8a0SMauro Carvalho Chehab    rules are documented in the GICv3 specification descriptions of the ICPENDR
148c0d1c8a0SMauro Carvalho Chehab    and ISPENDR registers.) For a level triggered interrupt the value accessed
149c0d1c8a0SMauro Carvalho Chehab    here is that of the latch which is set by ISPENDR and cleared by ICPENDR or
150c0d1c8a0SMauro Carvalho Chehab    interrupt activation, whereas the value returned by a guest read from
151c0d1c8a0SMauro Carvalho Chehab    ISPENDR is the logical OR of the latch value and the input line level.
152c0d1c8a0SMauro Carvalho Chehab
153c0d1c8a0SMauro Carvalho Chehab    Raw access to the latch state is provided to userspace so that it can save
154c0d1c8a0SMauro Carvalho Chehab    and restore the entire GIC internal state (which is defined by the
155c0d1c8a0SMauro Carvalho Chehab    combination of the current input line level and the latch state, and cannot
156c0d1c8a0SMauro Carvalho Chehab    be deduced from purely the line level and the value of the ISPENDR
157c0d1c8a0SMauro Carvalho Chehab    registers).
158c0d1c8a0SMauro Carvalho Chehab
159c0d1c8a0SMauro Carvalho Chehab    Accesses to GICD_ICPENDR register region and GICR_ICPENDR0 registers have
160c0d1c8a0SMauro Carvalho Chehab    RAZ/WI semantics, meaning that reads always return 0 and writes are always
161c0d1c8a0SMauro Carvalho Chehab    ignored.
162c0d1c8a0SMauro Carvalho Chehab
163c0d1c8a0SMauro Carvalho Chehab  Errors:
164c0d1c8a0SMauro Carvalho Chehab
165c0d1c8a0SMauro Carvalho Chehab    ======  =====================================================
166c0d1c8a0SMauro Carvalho Chehab    -ENXIO  Getting or setting this register is not yet supported
167c0d1c8a0SMauro Carvalho Chehab    -EBUSY  One or more VCPUs are running
168c0d1c8a0SMauro Carvalho Chehab    ======  =====================================================
169c0d1c8a0SMauro Carvalho Chehab
170c0d1c8a0SMauro Carvalho Chehab
171c0d1c8a0SMauro Carvalho Chehab  KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS
172c0d1c8a0SMauro Carvalho Chehab   Attributes:
173c0d1c8a0SMauro Carvalho Chehab
174c0d1c8a0SMauro Carvalho Chehab    The attr field of kvm_device_attr encodes two values::
175c0d1c8a0SMauro Carvalho Chehab
176c0d1c8a0SMauro Carvalho Chehab      bits:     | 63      ....       32 | 31  ....  16 | 15  ....  0 |
177c0d1c8a0SMauro Carvalho Chehab      values:   |         mpidr         |      RES     |    instr    |
178c0d1c8a0SMauro Carvalho Chehab
179c0d1c8a0SMauro Carvalho Chehab    The mpidr field encodes the CPU ID based on the affinity information in the
180c0d1c8a0SMauro Carvalho Chehab    architecture defined MPIDR, and the field is encoded as follows::
181c0d1c8a0SMauro Carvalho Chehab
182c0d1c8a0SMauro Carvalho Chehab      | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 |
183c0d1c8a0SMauro Carvalho Chehab      |    Aff3    |    Aff2    |    Aff1    |    Aff0    |
184c0d1c8a0SMauro Carvalho Chehab
185c0d1c8a0SMauro Carvalho Chehab    The instr field encodes the system register to access based on the fields
186c0d1c8a0SMauro Carvalho Chehab    defined in the A64 instruction set encoding for system register access
187c0d1c8a0SMauro Carvalho Chehab    (RES means the bits are reserved for future use and should be zero)::
188c0d1c8a0SMauro Carvalho Chehab
189c0d1c8a0SMauro Carvalho Chehab      | 15 ... 14 | 13 ... 11 | 10 ... 7 | 6 ... 3 | 2 ... 0 |
190c0d1c8a0SMauro Carvalho Chehab      |   Op 0    |    Op1    |    CRn   |   CRm   |   Op2   |
191c0d1c8a0SMauro Carvalho Chehab
192c0d1c8a0SMauro Carvalho Chehab    All system regs accessed through this API are (rw, 64-bit) and
193c0d1c8a0SMauro Carvalho Chehab    kvm_device_attr.addr points to a __u64 value.
194c0d1c8a0SMauro Carvalho Chehab
195c0d1c8a0SMauro Carvalho Chehab    KVM_DEV_ARM_VGIC_GRP_CPU_SYSREGS accesses the CPU interface registers for the
196c0d1c8a0SMauro Carvalho Chehab    CPU specified by the mpidr field.
197c0d1c8a0SMauro Carvalho Chehab
198c0d1c8a0SMauro Carvalho Chehab    CPU interface registers access is not implemented for AArch32 mode.
199c0d1c8a0SMauro Carvalho Chehab    Error -ENXIO is returned when accessed in AArch32 mode.
200c0d1c8a0SMauro Carvalho Chehab
201c0d1c8a0SMauro Carvalho Chehab  Errors:
202c0d1c8a0SMauro Carvalho Chehab
203c0d1c8a0SMauro Carvalho Chehab    =======  =====================================================
204c0d1c8a0SMauro Carvalho Chehab    -ENXIO   Getting or setting this register is not yet supported
205c0d1c8a0SMauro Carvalho Chehab    -EBUSY   VCPU is running
206c0d1c8a0SMauro Carvalho Chehab    -EINVAL  Invalid mpidr or register value supplied
207c0d1c8a0SMauro Carvalho Chehab    =======  =====================================================
208c0d1c8a0SMauro Carvalho Chehab
209c0d1c8a0SMauro Carvalho Chehab
210c0d1c8a0SMauro Carvalho Chehab  KVM_DEV_ARM_VGIC_GRP_NR_IRQS
211c0d1c8a0SMauro Carvalho Chehab   Attributes:
212c0d1c8a0SMauro Carvalho Chehab
213c0d1c8a0SMauro Carvalho Chehab    A value describing the number of interrupts (SGI, PPI and SPI) for
214c0d1c8a0SMauro Carvalho Chehab    this GIC instance, ranging from 64 to 1024, in increments of 32.
215c0d1c8a0SMauro Carvalho Chehab
216c0d1c8a0SMauro Carvalho Chehab    kvm_device_attr.addr points to a __u32 value.
217c0d1c8a0SMauro Carvalho Chehab
218c0d1c8a0SMauro Carvalho Chehab  Errors:
219c0d1c8a0SMauro Carvalho Chehab
220c0d1c8a0SMauro Carvalho Chehab    =======  ======================================
221c0d1c8a0SMauro Carvalho Chehab    -EINVAL  Value set is out of the expected range
222c0d1c8a0SMauro Carvalho Chehab    -EBUSY   Value has already be set.
223c0d1c8a0SMauro Carvalho Chehab    =======  ======================================
224c0d1c8a0SMauro Carvalho Chehab
225c0d1c8a0SMauro Carvalho Chehab
226c0d1c8a0SMauro Carvalho Chehab  KVM_DEV_ARM_VGIC_GRP_CTRL
227c0d1c8a0SMauro Carvalho Chehab   Attributes:
228c0d1c8a0SMauro Carvalho Chehab
229c0d1c8a0SMauro Carvalho Chehab    KVM_DEV_ARM_VGIC_CTRL_INIT
230c0d1c8a0SMauro Carvalho Chehab      request the initialization of the VGIC, no additional parameter in
231*298c41b8SEric Auger      kvm_device_attr.addr. Must be called after all VCPUs have been created.
232c0d1c8a0SMauro Carvalho Chehab    KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES
233c0d1c8a0SMauro Carvalho Chehab      save all LPI pending bits into guest RAM pending tables.
234c0d1c8a0SMauro Carvalho Chehab
235c0d1c8a0SMauro Carvalho Chehab      The first kB of the pending table is not altered by this operation.
236c0d1c8a0SMauro Carvalho Chehab
237c0d1c8a0SMauro Carvalho Chehab  Errors:
238c0d1c8a0SMauro Carvalho Chehab
239c0d1c8a0SMauro Carvalho Chehab    =======  ========================================================
240c0d1c8a0SMauro Carvalho Chehab    -ENXIO   VGIC not properly configured as required prior to calling
241c0d1c8a0SMauro Carvalho Chehab             this attribute
242c0d1c8a0SMauro Carvalho Chehab    -ENODEV  no online VCPU
243c0d1c8a0SMauro Carvalho Chehab    -ENOMEM  memory shortage when allocating vgic internal data
244c0d1c8a0SMauro Carvalho Chehab    -EFAULT  Invalid guest ram access
245c0d1c8a0SMauro Carvalho Chehab    -EBUSY   One or more VCPUS are running
246c0d1c8a0SMauro Carvalho Chehab    =======  ========================================================
247c0d1c8a0SMauro Carvalho Chehab
248c0d1c8a0SMauro Carvalho Chehab
249c0d1c8a0SMauro Carvalho Chehab  KVM_DEV_ARM_VGIC_GRP_LEVEL_INFO
250c0d1c8a0SMauro Carvalho Chehab   Attributes:
251c0d1c8a0SMauro Carvalho Chehab
252c0d1c8a0SMauro Carvalho Chehab    The attr field of kvm_device_attr encodes the following values::
253c0d1c8a0SMauro Carvalho Chehab
254c0d1c8a0SMauro Carvalho Chehab      bits:     | 63      ....       32 | 31   ....    10 | 9  ....  0 |
255c0d1c8a0SMauro Carvalho Chehab      values:   |         mpidr         |      info       |   vINTID   |
256c0d1c8a0SMauro Carvalho Chehab
257c0d1c8a0SMauro Carvalho Chehab    The vINTID specifies which set of IRQs is reported on.
258c0d1c8a0SMauro Carvalho Chehab
259c0d1c8a0SMauro Carvalho Chehab    The info field specifies which information userspace wants to get or set
260c0d1c8a0SMauro Carvalho Chehab    using this interface.  Currently we support the following info values:
261c0d1c8a0SMauro Carvalho Chehab
262c0d1c8a0SMauro Carvalho Chehab      VGIC_LEVEL_INFO_LINE_LEVEL:
263c0d1c8a0SMauro Carvalho Chehab	Get/Set the input level of the IRQ line for a set of 32 contiguously
264c0d1c8a0SMauro Carvalho Chehab	numbered interrupts.
265c0d1c8a0SMauro Carvalho Chehab
266c0d1c8a0SMauro Carvalho Chehab	vINTID must be a multiple of 32.
267c0d1c8a0SMauro Carvalho Chehab
268c0d1c8a0SMauro Carvalho Chehab	kvm_device_attr.addr points to a __u32 value which will contain a
269c0d1c8a0SMauro Carvalho Chehab	bitmap where a set bit means the interrupt level is asserted.
270c0d1c8a0SMauro Carvalho Chehab
271c0d1c8a0SMauro Carvalho Chehab	Bit[n] indicates the status for interrupt vINTID + n.
272c0d1c8a0SMauro Carvalho Chehab
273c0d1c8a0SMauro Carvalho Chehab    SGIs and any interrupt with a higher ID than the number of interrupts
274c0d1c8a0SMauro Carvalho Chehab    supported, will be RAZ/WI.  LPIs are always edge-triggered and are
275c0d1c8a0SMauro Carvalho Chehab    therefore not supported by this interface.
276c0d1c8a0SMauro Carvalho Chehab
277c0d1c8a0SMauro Carvalho Chehab    PPIs are reported per VCPU as specified in the mpidr field, and SPIs are
278c0d1c8a0SMauro Carvalho Chehab    reported with the same value regardless of the mpidr specified.
279c0d1c8a0SMauro Carvalho Chehab
280c0d1c8a0SMauro Carvalho Chehab    The mpidr field encodes the CPU ID based on the affinity information in the
281c0d1c8a0SMauro Carvalho Chehab    architecture defined MPIDR, and the field is encoded as follows::
282c0d1c8a0SMauro Carvalho Chehab
283c0d1c8a0SMauro Carvalho Chehab      | 63 .... 56 | 55 .... 48 | 47 .... 40 | 39 .... 32 |
284c0d1c8a0SMauro Carvalho Chehab      |    Aff3    |    Aff2    |    Aff1    |    Aff0    |
285c0d1c8a0SMauro Carvalho Chehab
286c0d1c8a0SMauro Carvalho Chehab  Errors:
287c0d1c8a0SMauro Carvalho Chehab
288c0d1c8a0SMauro Carvalho Chehab    =======  =============================================
289c0d1c8a0SMauro Carvalho Chehab    -EINVAL  vINTID is not multiple of 32 or info field is
290c0d1c8a0SMauro Carvalho Chehab	     not VGIC_LEVEL_INFO_LINE_LEVEL
291c0d1c8a0SMauro Carvalho Chehab    =======  =============================================
292