2 * Jailhouse, a Linux-based partitioning hypervisor
4 * Copyright (c) Siemens AG, 2013
7 * Jan Kiszka <jan.kiszka@siemens.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
13 #define JAILHOUSE_BASE 0xf0000000
15 #define JAILHOUSE_CALL_INS ".arch_extension virt\n\t" \
17 #define JAILHOUSE_CALL_NUM_RESULT "r0"
18 #define JAILHOUSE_CALL_ARG1 "r1"
19 #define JAILHOUSE_CALL_ARG2 "r2"
22 #define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS
25 #define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
30 struct jailhouse_comm_region {
31 COMM_REGION_GENERIC_HEADER;
34 static inline __u32 jailhouse_call(__u32 num)
36 register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
39 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
40 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
48 static inline __u32 jailhouse_call_arg1(__u32 num, __u32 arg1)
50 register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
51 register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
54 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
55 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
56 __asmeq(JAILHOUSE_CALL_ARG1, "%2")
59 : "r" (num_result), "r" (__arg1)
64 static inline __u32 jailhouse_call_arg2(__u32 num, __u32 arg1, __u32 arg2)
66 register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
67 register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
68 register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
71 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
72 __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
73 __asmeq(JAILHOUSE_CALL_ARG1, "%2")
74 __asmeq(JAILHOUSE_CALL_ARG2, "%3")
77 : "r" (num_result), "r" (__arg1), "r" (__arg2)
83 jailhouse_send_msg_to_cell(struct jailhouse_comm_region *comm_region,
86 comm_region->reply_from_cell = JAILHOUSE_MSG_NONE;
87 /* ensure reply was cleared before sending new message */
88 asm volatile("dmb ishst" : : : "memory");
89 comm_region->msg_to_cell = msg;
93 jailhouse_send_reply_from_cell(struct jailhouse_comm_region *comm_region,
96 comm_region->msg_to_cell = JAILHOUSE_MSG_NONE;
97 /* ensure message was cleared before sending reply */
98 asm volatile("dmb ishst" : : : "memory");
99 comm_region->reply_from_cell = reply;
102 #endif /* !__ASSEMBLY__ */