/*
* Jailhouse, a Linux-based partitioning hypervisor
*
- * Copyright (c) Siemens AG, 2013
+ * Copyright (c) Siemens AG, 2013-2015
*
* Authors:
* Jan Kiszka <jan.kiszka@siemens.com>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
+ *
+ * Alternatively, you can use or redistribute this file under the following
+ * BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
*/
#define JAILHOUSE_BASE 0xf0000000
+#define JAILHOUSE_BORROW_ROOT_PT 1
#define JAILHOUSE_CALL_INS ".arch_extension virt\n\t" \
"hvc #0x4a48"
#define JAILHOUSE_CALL_NUM_RESULT "r0"
-#define JAILHOUSE_CALL_ARG "r1"
+#define JAILHOUSE_CALL_ARG1 "r1"
+#define JAILHOUSE_CALL_ARG2 "r2"
-#ifndef __asmeq
-#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
-#endif
+/* CPU statistics */
+#define JAILHOUSE_CPU_STAT_VMEXITS_MAINTENANCE JAILHOUSE_GENERIC_CPU_STATS
+#define JAILHOUSE_CPU_STAT_VMEXITS_VIRQ JAILHOUSE_GENERIC_CPU_STATS + 1
+#define JAILHOUSE_CPU_STAT_VMEXITS_VSGI JAILHOUSE_GENERIC_CPU_STATS + 2
+#define JAILHOUSE_NUM_CPU_STATS JAILHOUSE_GENERIC_CPU_STATS + 3
#ifndef __ASSEMBLY__
+struct jailhouse_comm_region {
+ COMM_REGION_GENERIC_HEADER;
+};
+
static inline __u32 jailhouse_call(__u32 num)
{
register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
asm volatile(
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
JAILHOUSE_CALL_INS
: "=r" (num_result)
: "r" (num_result)
return num_result;
}
-static inline __u32 jailhouse_call_arg(__u32 num, __u32 arg)
+static inline __u32 jailhouse_call_arg1(__u32 num, __u32 arg1)
+{
+ register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
+ register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
+
+ asm volatile(
+ JAILHOUSE_CALL_INS
+ : "=r" (num_result)
+ : "r" (num_result), "r" (__arg1)
+ : "memory");
+ return num_result;
+}
+
+static inline __u32 jailhouse_call_arg2(__u32 num, __u32 arg1, __u32 arg2)
{
register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
- register __u32 __arg asm(JAILHOUSE_CALL_ARG) = arg;
+ register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
+ register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
asm volatile(
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
- __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
- __asmeq(JAILHOUSE_CALL_ARG, "%2")
JAILHOUSE_CALL_INS
: "=r" (num_result)
- : "r" (num_result), "r" (__arg)
+ : "r" (num_result), "r" (__arg1), "r" (__arg2)
: "memory");
return num_result;
}