brintos

brintos / linux-shallow public Read only

0
0
Text · 3.7 KiB · e88b34e Raw
82 lines · plain
1.. SPDX-License-Identifier: GPL-2.02 3Paravirtualized time support for arm644======================================5 6Arm specification DEN0057/A defines a standard for paravirtualised time7support for AArch64 guests:8 9https://developer.arm.com/docs/den0057/a10 11KVM/arm64 implements the stolen time part of this specification by providing12some hypervisor service calls to support a paravirtualized guest obtaining a13view of the amount of time stolen from its execution.14 15Two new SMCCC compatible hypercalls are defined:16 17* PV_TIME_FEATURES: 0xC500002018* PV_TIME_ST:       0xC500002119 20These are only available in the SMC64/HVC64 calling convention as21paravirtualized time is not available to 32 bit Arm guests. The existence of22the PV_TIME_FEATURES hypercall should be probed using the SMCCC 1.123ARCH_FEATURES mechanism before calling it.24 25PV_TIME_FEATURES26 27    ============= ========    =================================================28    Function ID:  (uint32)    0xC500002029    PV_call_id:   (uint32)    The function to query for support.30                              Currently only PV_TIME_ST is supported.31    Return value: (int64)     NOT_SUPPORTED (-1) or SUCCESS (0) if the relevant32                              PV-time feature is supported by the hypervisor.33    ============= ========    =================================================34 35PV_TIME_ST36 37    ============= ========    ==============================================38    Function ID:  (uint32)    0xC500002139    Return value: (int64)     IPA of the stolen time data structure for this40                              VCPU. On failure:41                              NOT_SUPPORTED (-1)42    ============= ========    ==============================================43 44The IPA returned by PV_TIME_ST should be mapped by the guest as normal memory45with inner and outer write back caching attributes, in the inner shareable46domain. A total of 16 bytes from the IPA returned are guaranteed to be47meaningfully filled by the hypervisor (see structure below).48 49PV_TIME_ST returns the structure for the calling VCPU.50 51Stolen Time52-----------53 54The structure pointed to by the PV_TIME_ST hypercall is as follows:55 56+-------------+-------------+-------------+----------------------------+57| Field       | Byte Length | Byte Offset | Description                |58+=============+=============+=============+============================+59| Revision    |      4      |      0      | Must be 0 for version 1.0  |60+-------------+-------------+-------------+----------------------------+61| Attributes  |      4      |      4      | Must be 0                  |62+-------------+-------------+-------------+----------------------------+63| Stolen time |      8      |      8      | Stolen time in unsigned    |64|             |             |             | nanoseconds indicating how |65|             |             |             | much time this VCPU thread |66|             |             |             | was involuntarily not      |67|             |             |             | running on a physical CPU. |68+-------------+-------------+-------------+----------------------------+69 70All values in the structure are stored little-endian.71 72The structure will be updated by the hypervisor prior to scheduling a VCPU. It73will be present within a reserved region of the normal memory given to the74guest. The guest should not attempt to write into this memory. There is a75structure per VCPU of the guest.76 77It is advisable that one or more 64k pages are set aside for the purpose of78these structures and not used for other purposes, this enables the guest to map79the region using 64k pages and avoids conflicting attributes with other memory.80 81For the user space interface see82:ref:`Documentation/virt/kvm/devices/vcpu.rst <kvm_arm_vcpu_pvtime_ctrl>`.