Commit | Line | Data |
---|---|---|
f577f6c2 SZ |
1 | Generic vcpu interface |
2 | ==================================== | |
3 | ||
4 | The virtual cpu "device" also accepts the ioctls KVM_SET_DEVICE_ATTR, | |
5 | KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same struct | |
6 | kvm_device_attr as other devices, but targets VCPU-wide settings and controls. | |
7 | ||
8 | The groups and attributes per virtual cpu, if any, are architecture specific. | |
bb0c70bc SZ |
9 | |
10 | 1. GROUP: KVM_ARM_VCPU_PMU_V3_CTRL | |
11 | Architectures: ARM64 | |
12 | ||
13 | 1.1. ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_IRQ | |
14 | Parameters: in kvm_device_attr.addr the address for PMU overflow interrupt is a | |
15 | pointer to an int | |
16 | Returns: -EBUSY: The PMU overflow interrupt is already set | |
17 | -ENXIO: The overflow interrupt not set when attempting to get it | |
18 | -ENODEV: PMUv3 not supported | |
a2befacf CD |
19 | -EINVAL: Invalid PMU overflow interrupt number supplied or |
20 | trying to set the IRQ number without using an in-kernel | |
21 | irqchip. | |
bb0c70bc SZ |
22 | |
23 | A value describing the PMUv3 (Performance Monitor Unit v3) overflow interrupt | |
24 | number for this vcpu. This interrupt could be a PPI or SPI, but the interrupt | |
25 | type must be same for each vcpu. As a PPI, the interrupt number is the same for | |
26 | all vcpus, while as an SPI it must be a separate number per vcpu. | |
27 | ||
28 | 1.2 ATTRIBUTE: KVM_ARM_VCPU_PMU_V3_INIT | |
29 | Parameters: no additional parameter in kvm_device_attr.addr | |
a2befacf CD |
30 | Returns: -ENODEV: PMUv3 not supported or GIC not initialized |
31 | -ENXIO: PMUv3 not properly configured or in-kernel irqchip not | |
32 | configured as required prior to calling this attribute | |
bb0c70bc SZ |
33 | -EBUSY: PMUv3 already initialized |
34 | ||
a2befacf CD |
35 | Request the initialization of the PMUv3. If using the PMUv3 with an in-kernel |
36 | virtual GIC implementation, this must be done after initializing the in-kernel | |
37 | irqchip. | |
99a1db7a CD |
38 | |
39 | ||
40 | 2. GROUP: KVM_ARM_VCPU_TIMER_CTRL | |
41 | Architectures: ARM,ARM64 | |
42 | ||
43 | 2.1. ATTRIBUTE: KVM_ARM_VCPU_TIMER_IRQ_VTIMER | |
44 | 2.2. ATTRIBUTE: KVM_ARM_VCPU_TIMER_IRQ_PTIMER | |
45 | Parameters: in kvm_device_attr.addr the address for the timer interrupt is a | |
46 | pointer to an int | |
47 | Returns: -EINVAL: Invalid timer interrupt number | |
48 | -EBUSY: One or more VCPUs has already run | |
49 | ||
50 | A value describing the architected timer interrupt number when connected to an | |
51 | in-kernel virtual GIC. These must be a PPI (16 <= intid < 32). Setting the | |
52 | attribute overrides the default values (see below). | |
53 | ||
54 | KVM_ARM_VCPU_TIMER_IRQ_VTIMER: The EL1 virtual timer intid (default: 27) | |
55 | KVM_ARM_VCPU_TIMER_IRQ_PTIMER: The EL1 physical timer intid (default: 30) | |
56 | ||
57 | Setting the same PPI for different timers will prevent the VCPUs from running. | |
58 | Setting the interrupt number on a VCPU configures all VCPUs created at that | |
59 | time to use the number provided for a given timer, overwriting any previously | |
60 | configured values on other VCPUs. Userspace should configure the interrupt | |
61 | numbers on at least one VCPU after creating all VCPUs and before running any | |
62 | VCPUs. |