xref: /linux/Documentation/virt/kvm/devices/arm-vgic-v5.rst (revision 01f492e1817e858d1712f2489d0afbaa552f417b)
1eb3c4d2cSSascha Bischoff.. SPDX-License-Identifier: GPL-2.0
2eb3c4d2cSSascha Bischoff
3eb3c4d2cSSascha Bischoff====================================================
4eb3c4d2cSSascha BischoffARM Virtual Generic Interrupt Controller v5 (VGICv5)
5eb3c4d2cSSascha Bischoff====================================================
6eb3c4d2cSSascha Bischoff
7eb3c4d2cSSascha Bischoff
8eb3c4d2cSSascha BischoffDevice types supported:
9eb3c4d2cSSascha Bischoff  - KVM_DEV_TYPE_ARM_VGIC_V5     ARM Generic Interrupt Controller v5.0
10eb3c4d2cSSascha Bischoff
11eb3c4d2cSSascha BischoffOnly one VGIC instance may be instantiated through this API.  The created VGIC
12eb3c4d2cSSascha Bischoffwill act as the VM interrupt controller, requiring emulated user-space devices
13eb3c4d2cSSascha Bischoffto inject interrupts to the VGIC instead of directly to CPUs.
14eb3c4d2cSSascha Bischoff
15eb3c4d2cSSascha BischoffCreating a guest GICv5 device requires a host GICv5 host.  The current VGICv5
16eb3c4d2cSSascha Bischoffdevice only supports PPI interrupts.  These can either be injected from emulated
17eb3c4d2cSSascha Bischoffin-kernel devices (such as the Arch Timer, or PMU), or via the KVM_IRQ_LINE
18eb3c4d2cSSascha Bischoffioctl.
19eb3c4d2cSSascha Bischoff
20eb3c4d2cSSascha BischoffGroups:
21eb3c4d2cSSascha Bischoff  KVM_DEV_ARM_VGIC_GRP_CTRL
22eb3c4d2cSSascha Bischoff   Attributes:
23eb3c4d2cSSascha Bischoff
24eb3c4d2cSSascha Bischoff    KVM_DEV_ARM_VGIC_CTRL_INIT
25eb3c4d2cSSascha Bischoff      request the initialization of the VGIC, no additional parameter in
26eb3c4d2cSSascha Bischoff      kvm_device_attr.addr. Must be called after all VCPUs have been created.
27eb3c4d2cSSascha Bischoff
28*d51c978bSSascha Bischoff   KVM_DEV_ARM_VGIC_USERPSPACE_PPIs
29*d51c978bSSascha Bischoff      request the mask of userspace-drivable PPIs. Only a subset of the PPIs can
30*d51c978bSSascha Bischoff      be directly driven from userspace with GICv5, and the returned mask
31*d51c978bSSascha Bischoff      informs userspace of which it is allowed to drive via KVM_IRQ_LINE.
32*d51c978bSSascha Bischoff
33*d51c978bSSascha Bischoff      Userspace must allocate and point to __u64[2] of data in
34*d51c978bSSascha Bischoff      kvm_device_attr.addr. When this call returns, the provided memory will be
35*d51c978bSSascha Bischoff      populated with the userspace PPI mask. The lower __u64 contains the mask
36*d51c978bSSascha Bischoff      for the lower 64 PPIS, with the remaining 64 being in the second __u64.
37*d51c978bSSascha Bischoff
38*d51c978bSSascha Bischoff      This is a read-only attribute, and cannot be set. Attempts to set it are
39*d51c978bSSascha Bischoff      rejected.
40*d51c978bSSascha Bischoff
41eb3c4d2cSSascha Bischoff  Errors:
42eb3c4d2cSSascha Bischoff
43eb3c4d2cSSascha Bischoff    =======  ========================================================
44eb3c4d2cSSascha Bischoff    -ENXIO   VGIC not properly configured as required prior to calling
45eb3c4d2cSSascha Bischoff             this attribute
46eb3c4d2cSSascha Bischoff    -ENODEV  no online VCPU
47eb3c4d2cSSascha Bischoff    -ENOMEM  memory shortage when allocating vgic internal data
48eb3c4d2cSSascha Bischoff    -EFAULT  Invalid guest ram access
49eb3c4d2cSSascha Bischoff    -EBUSY   One or more VCPUS are running
50eb3c4d2cSSascha Bischoff    =======  ========================================================
51