19c5137aeSShuo Liu /* SPDX-License-Identifier: GPL-2.0 */ 29c5137aeSShuo Liu /* 39c5137aeSShuo Liu * ACRN HSM: hypercalls of ACRN Hypervisor 49c5137aeSShuo Liu */ 59c5137aeSShuo Liu #ifndef __ACRN_HSM_HYPERCALL_H 69c5137aeSShuo Liu #define __ACRN_HSM_HYPERCALL_H 79c5137aeSShuo Liu #include <asm/acrn.h> 89c5137aeSShuo Liu 99c5137aeSShuo Liu /* 109c5137aeSShuo Liu * Hypercall IDs of the ACRN Hypervisor 119c5137aeSShuo Liu */ 129c5137aeSShuo Liu #define _HC_ID(x, y) (((x) << 24) | (y)) 139c5137aeSShuo Liu 149c5137aeSShuo Liu #define HC_ID 0x80UL 159c5137aeSShuo Liu 169c5137aeSShuo Liu #define HC_ID_VM_BASE 0x10UL 179c5137aeSShuo Liu #define HC_CREATE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x00) 189c5137aeSShuo Liu #define HC_DESTROY_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x01) 199c5137aeSShuo Liu #define HC_START_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x02) 209c5137aeSShuo Liu #define HC_PAUSE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x03) 219c5137aeSShuo Liu #define HC_RESET_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x05) 22*2ad2aaeeSShuo Liu #define HC_SET_VCPU_REGS _HC_ID(HC_ID, HC_ID_VM_BASE + 0x06) 239c5137aeSShuo Liu 249c5137aeSShuo Liu /** 259c5137aeSShuo Liu * hcall_create_vm() - Create a User VM 269c5137aeSShuo Liu * @vminfo: Service VM GPA of info of User VM creation 279c5137aeSShuo Liu * 289c5137aeSShuo Liu * Return: 0 on success, <0 on failure 299c5137aeSShuo Liu */ 309c5137aeSShuo Liu static inline long hcall_create_vm(u64 vminfo) 319c5137aeSShuo Liu { 329c5137aeSShuo Liu return acrn_hypercall1(HC_CREATE_VM, vminfo); 339c5137aeSShuo Liu } 349c5137aeSShuo Liu 359c5137aeSShuo Liu /** 369c5137aeSShuo Liu * hcall_start_vm() - Start a User VM 379c5137aeSShuo Liu * @vmid: User VM ID 389c5137aeSShuo Liu * 399c5137aeSShuo Liu * Return: 0 on success, <0 on failure 409c5137aeSShuo Liu */ 419c5137aeSShuo Liu static inline long hcall_start_vm(u64 vmid) 429c5137aeSShuo Liu { 439c5137aeSShuo Liu return acrn_hypercall1(HC_START_VM, vmid); 449c5137aeSShuo Liu } 459c5137aeSShuo Liu 469c5137aeSShuo Liu /** 479c5137aeSShuo Liu * hcall_pause_vm() - Pause a User VM 489c5137aeSShuo Liu * @vmid: User VM ID 499c5137aeSShuo Liu * 509c5137aeSShuo Liu * Return: 0 on success, <0 on failure 519c5137aeSShuo Liu */ 529c5137aeSShuo Liu static inline long hcall_pause_vm(u64 vmid) 539c5137aeSShuo Liu { 549c5137aeSShuo Liu return acrn_hypercall1(HC_PAUSE_VM, vmid); 559c5137aeSShuo Liu } 569c5137aeSShuo Liu 579c5137aeSShuo Liu /** 589c5137aeSShuo Liu * hcall_destroy_vm() - Destroy a User VM 599c5137aeSShuo Liu * @vmid: User VM ID 609c5137aeSShuo Liu * 619c5137aeSShuo Liu * Return: 0 on success, <0 on failure 629c5137aeSShuo Liu */ 639c5137aeSShuo Liu static inline long hcall_destroy_vm(u64 vmid) 649c5137aeSShuo Liu { 659c5137aeSShuo Liu return acrn_hypercall1(HC_DESTROY_VM, vmid); 669c5137aeSShuo Liu } 679c5137aeSShuo Liu 689c5137aeSShuo Liu /** 699c5137aeSShuo Liu * hcall_reset_vm() - Reset a User VM 709c5137aeSShuo Liu * @vmid: User VM ID 719c5137aeSShuo Liu * 729c5137aeSShuo Liu * Return: 0 on success, <0 on failure 739c5137aeSShuo Liu */ 749c5137aeSShuo Liu static inline long hcall_reset_vm(u64 vmid) 759c5137aeSShuo Liu { 769c5137aeSShuo Liu return acrn_hypercall1(HC_RESET_VM, vmid); 779c5137aeSShuo Liu } 789c5137aeSShuo Liu 79*2ad2aaeeSShuo Liu /** 80*2ad2aaeeSShuo Liu * hcall_set_vcpu_regs() - Set up registers of virtual CPU of a User VM 81*2ad2aaeeSShuo Liu * @vmid: User VM ID 82*2ad2aaeeSShuo Liu * @regs_state: Service VM GPA of registers state 83*2ad2aaeeSShuo Liu * 84*2ad2aaeeSShuo Liu * Return: 0 on success, <0 on failure 85*2ad2aaeeSShuo Liu */ 86*2ad2aaeeSShuo Liu static inline long hcall_set_vcpu_regs(u64 vmid, u64 regs_state) 87*2ad2aaeeSShuo Liu { 88*2ad2aaeeSShuo Liu return acrn_hypercall2(HC_SET_VCPU_REGS, vmid, regs_state); 89*2ad2aaeeSShuo Liu } 90*2ad2aaeeSShuo Liu 919c5137aeSShuo Liu #endif /* __ACRN_HSM_HYPERCALL_H */ 92