1.. SPDX-License-Identifier: GPL-2.0 2 3=============================================== 4KVM/arm64-specific hypercalls exposed to guests 5=============================================== 6 7This file documents the KVM/arm64-specific hypercalls which may be 8exposed by KVM/arm64 to guest operating systems. These hypercalls are 9issued using the HVC instruction according to version 1.1 of the Arm SMC 10Calling Convention (DEN0028/C): 11 12https://developer.arm.com/docs/den0028/c 13 14All KVM/arm64-specific hypercalls are allocated within the "Vendor 15Specific Hypervisor Service Call" range with a UID of 16``28b46fb6-2ec5-11e9-a9ca-4b564d003a74``. This UID should be queried by the 17guest using the standard "Call UID" function for the service range in 18order to determine that the KVM/arm64-specific hypercalls are available. 19 20``ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID`` 21--------------------------------------------- 22 23Provides a discovery mechanism for other KVM/arm64 hypercalls. 24 25+---------------------+-------------------------------------------------------------+ 26| Presence: | Mandatory for the KVM/arm64 UID | 27+---------------------+-------------------------------------------------------------+ 28| Calling convention: | HVC32 | 29+---------------------+----------+--------------------------------------------------+ 30| Function ID: | (uint32) | 0x86000000 | 31+---------------------+----------+--------------------------------------------------+ 32| Arguments: | None | 33+---------------------+----------+----+---------------------------------------------+ 34| Return Values: | (uint32) | R0 | Bitmap of available function numbers 0-31 | 35| +----------+----+---------------------------------------------+ 36| | (uint32) | R1 | Bitmap of available function numbers 32-63 | 37| +----------+----+---------------------------------------------+ 38| | (uint32) | R2 | Bitmap of available function numbers 64-95 | 39| +----------+----+---------------------------------------------+ 40| | (uint32) | R3 | Bitmap of available function numbers 96-127 | 41+---------------------+----------+----+---------------------------------------------+ 42 43``ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID`` 44---------------------------------------- 45 46See ptp_kvm.rst 47 48``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO`` 49---------------------------------- 50 51Query the memory protection parameters for a pKVM protected virtual machine. 52 53+---------------------+-------------------------------------------------------------+ 54| Presence: | Optional; pKVM protected guests only. | 55+---------------------+-------------------------------------------------------------+ 56| Calling convention: | HVC64 | 57+---------------------+----------+--------------------------------------------------+ 58| Function ID: | (uint32) | 0xC6000002 | 59+---------------------+----------+----+---------------------------------------------+ 60| Arguments: | (uint64) | R1 | Reserved / Must be zero | 61| +----------+----+---------------------------------------------+ 62| | (uint64) | R2 | Reserved / Must be zero | 63| +----------+----+---------------------------------------------+ 64| | (uint64) | R3 | Reserved / Must be zero | 65+---------------------+----------+----+---------------------------------------------+ 66| Return Values: | (int64) | R0 | ``INVALID_PARAMETER (-3)`` on error, else | 67| | | | memory protection granule in bytes | 68+---------------------+----------+----+---------------------------------------------+ 69 70``ARM_SMCCC_KVM_FUNC_MEM_SHARE`` 71-------------------------------- 72 73Share a region of memory with the KVM host, granting it read, write and execute 74permissions. The size of the region is equal to the memory protection granule 75advertised by ``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO``. 76 77+---------------------+-------------------------------------------------------------+ 78| Presence: | Optional; pKVM protected guests only. | 79+---------------------+-------------------------------------------------------------+ 80| Calling convention: | HVC64 | 81+---------------------+----------+--------------------------------------------------+ 82| Function ID: | (uint32) | 0xC6000003 | 83+---------------------+----------+----+---------------------------------------------+ 84| Arguments: | (uint64) | R1 | Base IPA of memory region to share | 85| +----------+----+---------------------------------------------+ 86| | (uint64) | R2 | Reserved / Must be zero | 87| +----------+----+---------------------------------------------+ 88| | (uint64) | R3 | Reserved / Must be zero | 89+---------------------+----------+----+---------------------------------------------+ 90| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | 91| | | +---------------------------------------------+ 92| | | | ``INVALID_PARAMETER (-3)`` | 93+---------------------+----------+----+---------------------------------------------+ 94 95``ARM_SMCCC_KVM_FUNC_MEM_UNSHARE`` 96---------------------------------- 97 98Revoke access permission from the KVM host to a memory region previously shared 99with ``ARM_SMCCC_KVM_FUNC_MEM_SHARE``. The size of the region is equal to the 100memory protection granule advertised by ``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO``. 101 102+---------------------+-------------------------------------------------------------+ 103| Presence: | Optional; pKVM protected guests only. | 104+---------------------+-------------------------------------------------------------+ 105| Calling convention: | HVC64 | 106+---------------------+----------+--------------------------------------------------+ 107| Function ID: | (uint32) | 0xC6000004 | 108+---------------------+----------+----+---------------------------------------------+ 109| Arguments: | (uint64) | R1 | Base IPA of memory region to unshare | 110| +----------+----+---------------------------------------------+ 111| | (uint64) | R2 | Reserved / Must be zero | 112| +----------+----+---------------------------------------------+ 113| | (uint64) | R3 | Reserved / Must be zero | 114+---------------------+----------+----+---------------------------------------------+ 115| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | 116| | | +---------------------------------------------+ 117| | | | ``INVALID_PARAMETER (-3)`` | 118+---------------------+----------+----+---------------------------------------------+ 119 120``ARM_SMCCC_KVM_FUNC_MMIO_GUARD`` 121---------------------------------- 122 123Request that a given memory region is handled as MMIO by the hypervisor, 124allowing accesses to this region to be emulated by the KVM host. The size of the 125region is equal to the memory protection granule advertised by 126``ARM_SMCCC_KVM_FUNC_HYP_MEMINFO``. 127 128+---------------------+-------------------------------------------------------------+ 129| Presence: | Optional; pKVM protected guests only. | 130+---------------------+-------------------------------------------------------------+ 131| Calling convention: | HVC64 | 132+---------------------+----------+--------------------------------------------------+ 133| Function ID: | (uint32) | 0xC6000007 | 134+---------------------+----------+----+---------------------------------------------+ 135| Arguments: | (uint64) | R1 | Base IPA of MMIO memory region | 136| +----------+----+---------------------------------------------+ 137| | (uint64) | R2 | Reserved / Must be zero | 138| +----------+----+---------------------------------------------+ 139| | (uint64) | R3 | Reserved / Must be zero | 140+---------------------+----------+----+---------------------------------------------+ 141| Return Values: | (int64) | R0 | ``SUCCESS (0)`` | 142| | | +---------------------------------------------+ 143| | | | ``INVALID_PARAMETER (-3)`` | 144+---------------------+----------+----+---------------------------------------------+ 145