Andrew Scull | f35a5c9 | 2018-08-07 18:09:46 +0100 | [diff] [blame^] | 1 | #ifndef _VMAPI_HF_HVC_H |
| 2 | #define _VMAPI_HF_HVC_H |
| 3 | |
| 4 | #include <stddef.h> |
| 5 | |
| 6 | /* Keep macro alignment */ |
| 7 | /* clang-format off */ |
| 8 | |
| 9 | /* Return values for vcpu_run() hypervisor call. */ |
| 10 | #define HF_VCPU_YIELD 0x00 |
| 11 | #define HF_VCPU_WAIT_FOR_INTERRUPT 0x01 |
| 12 | #define HF_VCPU_WAKE_UP 0x02 |
| 13 | #define HF_VCPU_RESPONSE_READY 0x03 |
| 14 | |
| 15 | /* TODO: Define constants below according to spec. */ |
| 16 | #define HF_VCPU_RUN 0xff00 |
| 17 | #define HF_VM_GET_COUNT 0xff01 |
| 18 | #define HF_VCPU_GET_COUNT 0xff02 |
| 19 | #define HF_VM_CONFIGURE 0xff03 |
| 20 | #define HF_RPC_REQUEST 0xff04 |
| 21 | #define HF_RPC_READ_REQUEST 0xff05 |
| 22 | #define HF_RPC_ACK 0xff06 |
| 23 | #define HF_RPC_REPLY 0xff07 |
| 24 | |
| 25 | /* clang-format on */ |
| 26 | |
| 27 | /* |
| 28 | * This function must be implemented to trigger the architecture specific call |
| 29 | * to the hypervisor. |
| 30 | */ |
| 31 | long hf_call(size_t arg0, size_t arg1, size_t arg2, size_t arg3); |
| 32 | |
| 33 | /* |
| 34 | * Returns the number of secondary VMs. |
| 35 | */ |
| 36 | static inline long hf_vm_get_count(void) |
| 37 | { |
| 38 | return hf_call(HF_VM_GET_COUNT, 0, 0, 0); |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | * Returns the number of VCPUs configured in the given secondary VM. |
| 43 | */ |
| 44 | static inline long hf_vcpu_get_count(size_t vm_idx) |
| 45 | { |
| 46 | return hf_call(HF_VCPU_GET_COUNT, vm_idx, 0, 0); |
| 47 | } |
| 48 | |
| 49 | #endif /* _VMAPI_HF_HVC_H */ |