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