Skip to content

Commit 1935d34

Browse files
author
Marc Zyngier
committed
KVM: arm64: Document KVM_ARM_SET_CNT_OFFSETS and co
Add some basic documentation on the effects of KVM_ARM_SET_CNT_OFFSETS. Reviewed-by: Colton Lewis <coltonlewis@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20230330174800.2677007-16-maz@kernel.org
1 parent 476fcd4 commit 1935d34

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Documentation/virt/kvm/api.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6029,6 +6029,44 @@ delivery must be provided via the "reg_aen" struct.
60296029
The "pad" and "reserved" fields may be used for future extensions and should be
60306030
set to 0s by userspace.
60316031

6032+
4.138 KVM_ARM_SET_COUNTER_OFFSET
6033+
--------------------------------
6034+
6035+
:Capability: KVM_CAP_COUNTER_OFFSET
6036+
:Architectures: arm64
6037+
:Type: vm ioctl
6038+
:Parameters: struct kvm_arm_counter_offset (in)
6039+
:Returns: 0 on success, < 0 on error
6040+
6041+
This capability indicates that userspace is able to apply a single VM-wide
6042+
offset to both the virtual and physical counters as viewed by the guest
6043+
using the KVM_ARM_SET_CNT_OFFSET ioctl and the following data structure:
6044+
6045+
::
6046+
6047+
struct kvm_arm_counter_offset {
6048+
__u64 counter_offset;
6049+
__u64 reserved;
6050+
};
6051+
6052+
The offset describes a number of counter cycles that are subtracted from
6053+
both virtual and physical counter views (similar to the effects of the
6054+
CNTVOFF_EL2 and CNTPOFF_EL2 system registers, but only global). The offset
6055+
always applies to all vcpus (already created or created after this ioctl)
6056+
for this VM.
6057+
6058+
It is userspace's responsibility to compute the offset based, for example,
6059+
on previous values of the guest counters.
6060+
6061+
Any value other than 0 for the "reserved" field may result in an error
6062+
(-EINVAL) being returned. This ioctl can also return -EBUSY if any vcpu
6063+
ioctl is issued concurrently.
6064+
6065+
Note that using this ioctl results in KVM ignoring subsequent userspace
6066+
writes to the CNTVCT_EL0 and CNTPCT_EL0 registers using the SET_ONE_REG
6067+
interface. No error will be returned, but the resulting offset will not be
6068+
applied.
6069+
60326070
5. The kvm_run structure
60336071
========================
60346072

0 commit comments

Comments
 (0)