diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/soc/tegra/virt/syscalls.h | 19 | ||||
| -rw-r--r-- | include/soc/tegra/virt/tegra_hv_sysmgr.h | 12 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/soc/tegra/virt/syscalls.h b/include/soc/tegra/virt/syscalls.h index 70a2611a7..bacef2471 100644 --- a/include/soc/tegra/virt/syscalls.h +++ b/include/soc/tegra/virt/syscalls.h | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #define HVC_NR_RAISE_IRQ 4 | 42 | #define HVC_NR_RAISE_IRQ 4 |
| 43 | #define HVC_NR_READ_NGUESTS 5 | 43 | #define HVC_NR_READ_NGUESTS 5 |
| 44 | #define HVC_NR_READ_IPA_PA 6 | 44 | #define HVC_NR_READ_IPA_PA 6 |
| 45 | #define HVC_NR_READ_GUEST_STATE 7 | ||
| 45 | #define HVC_NR_READ_HYP_INFO 9 | 46 | #define HVC_NR_READ_HYP_INFO 9 |
| 46 | #define HVC_NR_GUEST_RESET 10 | 47 | #define HVC_NR_GUEST_RESET 10 |
| 47 | #define HVC_NR_SYSINFO_IPA 13 | 48 | #define HVC_NR_SYSINFO_IPA 13 |
| @@ -174,6 +175,9 @@ struct hyp_server_page { | |||
| 174 | 175 | ||
| 175 | #ifdef CONFIG_ARM64 | 176 | #ifdef CONFIG_ARM64 |
| 176 | 177 | ||
| 178 | #define _X3_X17 "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", \ | ||
| 179 | "x13", "x14", "x15", "x16", "x17" | ||
| 180 | |||
| 177 | #define _X4_X17 "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", \ | 181 | #define _X4_X17 "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", \ |
| 178 | "x13", "x14", "x15", "x16", "x17" | 182 | "x13", "x14", "x15", "x16", "x17" |
| 179 | 183 | ||
| @@ -253,6 +257,20 @@ static inline int hyp_raise_irq(unsigned int irq, unsigned int vmid) | |||
| 253 | return (int)r0; | 257 | return (int)r0; |
| 254 | } | 258 | } |
| 255 | 259 | ||
| 260 | static inline int hyp_read_guest_state(unsigned int vmid, unsigned int *state) | ||
| 261 | { | ||
| 262 | register uint64_t r0 asm("x0") = vmid; | ||
| 263 | register uint64_t r1 asm("x1"); | ||
| 264 | |||
| 265 | asm("hvc %2" | ||
| 266 | : "+r"(r0), "=r"(r1) | ||
| 267 | : "i"(HVC_NR_READ_GUEST_STATE) | ||
| 268 | : "x2", _X3_X17); | ||
| 269 | |||
| 270 | *state = (unsigned int)r1; | ||
| 271 | return (int)r0; | ||
| 272 | } | ||
| 273 | |||
| 256 | static inline int hyp_read_hyp_info(uint64_t *hyp_info_page_pa) | 274 | static inline int hyp_read_hyp_info(uint64_t *hyp_info_page_pa) |
| 257 | { | 275 | { |
| 258 | register uint64_t r0 asm("x0"); | 276 | register uint64_t r0 asm("x0"); |
| @@ -302,6 +320,7 @@ static inline uint64_t hyp_sysinfo_ipa(void) | |||
| 302 | return r0; | 320 | return r0; |
| 303 | } | 321 | } |
| 304 | 322 | ||
| 323 | #undef _X3_X17 | ||
| 305 | #undef _X4_X17 | 324 | #undef _X4_X17 |
| 306 | 325 | ||
| 307 | #else | 326 | #else |
diff --git a/include/soc/tegra/virt/tegra_hv_sysmgr.h b/include/soc/tegra/virt/tegra_hv_sysmgr.h index 62b66fc19..e93879277 100644 --- a/include/soc/tegra/virt/tegra_hv_sysmgr.h +++ b/include/soc/tegra/virt/tegra_hv_sysmgr.h | |||
| @@ -101,6 +101,18 @@ enum system_function_id { | |||
| 101 | MAX_FUNC_ID, | 101 | MAX_FUNC_ID, |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
| 104 | typedef enum { | ||
| 105 | VM_STATE_BOOT, | ||
| 106 | VM_STATE_HALT, | ||
| 107 | VM_STATE_UNHALT, | ||
| 108 | VM_STATE_REBOOT, | ||
| 109 | VM_STATE_SHUTDOWN, | ||
| 110 | VM_STATE_SUSPEND, | ||
| 111 | VM_STATE_RESUME, | ||
| 112 | VM_STATE_INVALID, | ||
| 113 | VM_STATE_MAX | ||
| 114 | } vm_state; | ||
| 115 | |||
| 104 | #define CREATE_CMD(func_id, vmid) ((func_id << 24U) | vmid) | 116 | #define CREATE_CMD(func_id, vmid) ((func_id << 24U) | vmid) |
| 105 | 117 | ||
| 106 | #define QUERY_CMD CREATE_CMD(QUERY_SYSTEM_STATE, 0) | 118 | #define QUERY_CMD CREATE_CMD(QUERY_SYSTEM_STATE, 0) |
