# PTP_KVM support for arm/arm64

_Peios Kernel / Internals / Virtualisation / kvm / arm_

> PTP_KVM is used for high precision time sync between host and guests. It relies on transferring the wall clock and counter value from the host to the guest using a KVM-specific hypercall.

<a id="rst-ptp-kvm-support-for-arm-arm64"></a>

<!-- SPDX-License-Identifier: GPL-2.0 -->

PTP_KVM is used for high precision time sync between host and guests. It relies on transferring the wall clock and counter value from the host to the guest using a KVM-specific hypercall.

<a id="rst-arm-smccc-vendor-hyp-kvm-ptp-func-id"></a>

## `ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID`

Retrieve current time information for the specific counter. There are no endianness restrictions.


<table>
<tbody>
<tr>
<td>


Presence:

</td>
<td colspan="3">


Optional

</td>
</tr>
<tr>
<td>


Calling convention:

</td>
<td colspan="3">


HVC32

</td>
</tr>
<tr>
<td>


Function ID:

</td>
<td>


(uint32)

</td>
<td colspan="2">


0x86000001

</td>
</tr>
<tr>
<td rowspan="2">


Arguments:

</td>
<td rowspan="2">


(uint32)

</td>
<td rowspan="2">


R1

</td>
<td>


`KVM_PTP_VIRT_COUNTER (0)`

</td>
</tr>
<tr>
<td>


`KVM_PTP_PHYS_COUNTER (1)`

</td>
</tr>
<tr>
<td rowspan="4">


Return Values:

</td>
<td>


(int32)

</td>
<td>


R0

</td>
<td>


`NOT_SUPPORTED (-1)` on error, else upper 32 bits of wall clock time

</td>
</tr>
<tr>
<td>


(uint32)

</td>
<td>


R1

</td>
<td>


Lower 32 bits of wall clock time

</td>
</tr>
<tr>
<td>


(uint32)

</td>
<td>


R2

</td>
<td>


Upper 32 bits of counter

</td>
</tr>
<tr>
<td>


(uint32)

</td>
<td>


R3

</td>
<td>


Lower 32 bits of counter

</td>
</tr>
</tbody>
</table>
