]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core/driver: Remove multi-arg support for hypercalls
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 13 Apr 2014 06:30:53 +0000 (08:30 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 2 May 2014 06:44:12 +0000 (08:44 +0200)
There is no scenario is sight where we may need to pass more than one
argument to a hypercall. So remove the related infrastructure and update
the ABI documentation for zero or single-argument hypercalls only.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Documentation/hypervisor-interfaces.txt
driver.c
hypervisor/arch/arm/include/asm/jailhouse_hypercall.h
hypervisor/arch/x86/include/asm/jailhouse_hypercall.h

index 36f2ca2c9cfa5ec20e5426ff8e7aaa5d89d5bdcb..5e6f98debe32efcfead10bbbc4f51ada705a6ac4 100644 (file)
@@ -25,10 +25,7 @@ Intel x86-64 (IA-32e) ABI
 
 Instruction:    vmcall
 Hypercall code: RAX
-1. argument:    RDI
-2. argument:    RSI
-3. argument:    RDX
-4. argument:    RCX
+Argument:       RDI
 Return code:    RAX
 
 
@@ -40,7 +37,7 @@ returning full control over the hardware back to Linux.
 
 This hypercall can only be issued on CPUs belonging to the Linux cell.
 
-Arguments: none
+Argument: none
 
 Return code: 0 on success, negative error code otherwise
 
@@ -60,8 +57,7 @@ reset state of cell CPUs.
 
 This hypercall can only be issued on CPUs belonging to the Linux cell.
 
-Arguments: 1. Guest-physical address of cell configuration (see [2] for
-              details)
+Argument: guest-physical address of cell configuration (see [2] for details)
 
 Return code: positive cell ID or negative error code
 
@@ -86,7 +82,7 @@ cell directly after hypervisor start.
 
 This hypercall can only be issued on CPUs belonging to the root cell.
 
-Arguments: 1. ID of cell to be destroyed
+Argument: ID of cell to be destroyed
 
 Return code: 0 on success, negative error code otherwise
 
@@ -107,7 +103,7 @@ Hypercall "Hypervisor Get Info" (code 3)
 
 Obtain information about specific hypervisor states.
 
-Arguments: 1. Information type:
+Argument: Information type:
         0 - number of pages in hypervisor memory pool
         1 - used pages of hypervisor memory pool
         2 - number of pages in hypervisor remapping pool
@@ -125,7 +121,7 @@ Hypercall "Cell Get State" (code 4)
 
 Obtain information about the state of a specific cell.
 
-Arguments: 1. ID of cell to be queried
+Argument: ID of cell to be queried
 
 This hypercall can only be issued on CPUs belonging to the root cell.
 
@@ -146,7 +142,7 @@ Hypercall "CPU Get State" (code 5)
 
 Obtain information about the state of a specific CPU.
 
-Arguments: 1. logical ID of CPU to be queried
+Argument: logical ID of CPU to be queried
 
 Return code: CPU state (>=0) or negative error code
 
index 653876dcf322f485144f1225917cc34214d9bd89..169da8e4d8ca2820761a4f03fb73cbb13b776c04 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -123,7 +123,7 @@ static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,
 {
        struct cell *cell = container_of(kobj, struct cell, kobj);
 
-       switch (jailhouse_call1(JAILHOUSE_HC_CELL_GET_STATE, cell->id)) {
+       switch (jailhouse_call_arg(JAILHOUSE_HC_CELL_GET_STATE, cell->id)) {
        case JAILHOUSE_CELL_RUNNING:
                return sprintf(buffer, "running\n");
        case JAILHOUSE_CELL_SHUT_DOWN:
@@ -158,7 +158,7 @@ static ssize_t cpus_failed_show(struct kobject *kobj,
                return -ENOMEM;
 
        for_each_cpu_mask(cpu, cell->cpus_assigned)
-               if (jailhouse_call1(JAILHOUSE_HC_CPU_GET_STATE, cpu) ==
+               if (jailhouse_call_arg(JAILHOUSE_HC_CPU_GET_STATE, cpu) ==
                    JAILHOUSE_CPU_FAILED)
                        cpu_set(cpu, *cpus_failed);
 
@@ -410,7 +410,7 @@ static void leave_hypervisor(void *info)
                readl(page);
 
        /* either returns 0 or the same error code across all CPUs */
-       err = jailhouse_call0(JAILHOUSE_HC_DISABLE);
+       err = jailhouse_call(JAILHOUSE_HC_DISABLE);
        if (err)
                error_code = err;
 
@@ -574,7 +574,7 @@ static int jailhouse_cell_create(struct jailhouse_new_cell __user *arg)
                        cpu_clear(cpu, root_cell->cpus_assigned);
                }
 
-       id = jailhouse_call1(JAILHOUSE_HC_CELL_CREATE, __pa(config));
+       id = jailhouse_call_arg(JAILHOUSE_HC_CELL_CREATE, __pa(config));
        if (id < 0) {
                err = id;
                goto error_cpu_online;
@@ -640,7 +640,7 @@ static int jailhouse_cell_destroy(const char __user *arg)
                goto unlock_out;
        }
 
-       err = jailhouse_call1(JAILHOUSE_HC_CELL_DESTROY, cell->id);
+       err = jailhouse_call_arg(JAILHOUSE_HC_CELL_DESTROY, cell->id);
        if (err)
                goto unlock_out;
 
@@ -738,7 +738,8 @@ static ssize_t info_show(struct device *dev, char *buffer, unsigned int type)
                return -EINTR;
 
        if (enabled)
-               val = jailhouse_call1(JAILHOUSE_HC_HYPERVISOR_GET_INFO, type);
+               val = jailhouse_call_arg(JAILHOUSE_HC_HYPERVISOR_GET_INFO,
+                                        type);
        if (val >= 0)
                result = sprintf(buffer, "%ld\n", val);
        else
index f216604b5e49b4298eb66da5ff71d3228b38372d..1fdac5543c9b717366213abcc8dffd0ff06d1667 100644 (file)
 #define JAILHOUSE_CALL_INS             ".arch_extension virt\n\t" \
                                        "hvc #0x4a48"
 #define JAILHOUSE_CALL_NUM_RESULT      "r0"
-#define JAILHOUSE_CALL_ARG1            "r1"
-#define JAILHOUSE_CALL_ARG2            "r2"
-#define JAILHOUSE_CALL_ARG3            "r3"
-#define JAILHOUSE_CALL_ARG4            "r4"
+#define JAILHOUSE_CALL_ARG             "r1"
 
 #ifndef __asmeq
 #define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
@@ -26,7 +23,7 @@
 
 #ifndef __ASSEMBLY__
 
-static inline __u32 jailhouse_call0(__u32 num)
+static inline __u32 jailhouse_call(__u32 num)
 {
        register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
 
@@ -40,81 +37,18 @@ static inline __u32 jailhouse_call0(__u32 num)
        return num_result;
 }
 
-static inline __u32 jailhouse_call1(__u32 num, __u32 arg1)
+static inline __u32 jailhouse_call_arg(__u32 num, __u32 arg)
 {
        register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
-       register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
+       register __u32 __arg asm(JAILHOUSE_CALL_ARG) = arg;
 
        asm volatile(
                __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
                __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
-               __asmeq(JAILHOUSE_CALL_ARG1, "%2")
+               __asmeq(JAILHOUSE_CALL_ARG, "%2")
                JAILHOUSE_CALL_INS
                : "=r" (num_result)
-               : "r" (num_result), "r" (__arg1)
-               : "memory");
-       return num_result;
-}
-
-static inline __u32 jailhouse_call2(__u32 num, __u32 arg1, __u32 arg2)
-{
-       register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
-       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_ARG1, "%2")
-               __asmeq(JAILHOUSE_CALL_ARG2, "%3")
-               JAILHOUSE_CALL_INS
-               : "=r" (num_result)
-               : "r" (num_result), "r" (__arg1), "r" (__arg2)
-               : "memory");
-       return num_result;
-}
-
-static inline __u32 jailhouse_call3(__u32 num, __u32 arg1, __u32 arg2,
-                                  __u32 arg3)
-{
-       register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
-       register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
-       register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
-       register __u32 __arg3 asm(JAILHOUSE_CALL_ARG3) = arg3;
-
-       asm volatile(
-               __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
-               __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
-               __asmeq(JAILHOUSE_CALL_ARG1, "%2")
-               __asmeq(JAILHOUSE_CALL_ARG2, "%3")
-               __asmeq(JAILHOUSE_CALL_ARG3, "%4")
-               JAILHOUSE_CALL_INS
-               : "=r" (num_result)
-               : "r" (num_result), "r" (__arg1), "r" (__arg2), "r" (__arg3)
-               : "memory");
-       return num_result;
-}
-
-static inline __u32 jailhouse_call4(__u32 num, __u32 arg1, __u32 arg2,
-                                  __u32 arg3, __u32 arg4)
-{
-       register __u32 num_result asm(JAILHOUSE_CALL_NUM_RESULT) = num;
-       register __u32 __arg1 asm(JAILHOUSE_CALL_ARG1) = arg1;
-       register __u32 __arg2 asm(JAILHOUSE_CALL_ARG2) = arg2;
-       register __u32 __arg3 asm(JAILHOUSE_CALL_ARG3) = arg3;
-       register __u32 __arg4 asm(JAILHOUSE_CALL_ARG4) = arg4;
-
-       asm volatile(
-               __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%0")
-               __asmeq(JAILHOUSE_CALL_NUM_RESULT, "%1")
-               __asmeq(JAILHOUSE_CALL_ARG1, "%2")
-               __asmeq(JAILHOUSE_CALL_ARG2, "%3")
-               __asmeq(JAILHOUSE_CALL_ARG3, "%4")
-               __asmeq(JAILHOUSE_CALL_ARG4, "%5")
-               JAILHOUSE_CALL_INS
-               : "=r" (num_result)
-               : "r" (num_result), "r" (__arg1), "r" (__arg2), "r" (__arg3),
-                 "r" (__arg4)
+               : "r" (num_result), "r" (__arg)
                : "memory");
        return num_result;
 }
index 5e148c81c49d8e669383677cb2a9821e868e22b3..43ea73f79bc75531929cc5d7980ad00427eeeb3c 100644 (file)
 #define JAILHOUSE_CALL_INS     "vmcall"
 #define JAILHOUSE_CALL_RESULT  "=a" (result)
 #define JAILHOUSE_CALL_NUM     "a" (num)
-#define JAILHOUSE_CALL_ARG1    "D" (arg1)
-#define JAILHOUSE_CALL_ARG2    "S" (arg2)
-#define JAILHOUSE_CALL_ARG3    "d" (arg3)
-#define JAILHOUSE_CALL_ARG4    "c" (arg4)
+#define JAILHOUSE_CALL_ARG     "D" (arg)
 
 #ifndef __ASSEMBLY__
 
-static inline __u32 jailhouse_call0(__u32 num)
+static inline __u32 jailhouse_call(__u32 num)
 {
        __u32 result;
 
@@ -37,50 +34,13 @@ static inline __u32 jailhouse_call0(__u32 num)
        return result;
 }
 
-static inline __u32 jailhouse_call1(__u32 num, __u32 arg1)
+static inline __u32 jailhouse_call_arg(__u32 num, __u32 arg)
 {
        __u32 result;
 
        asm volatile(JAILHOUSE_CALL_INS
                : JAILHOUSE_CALL_RESULT
-               : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1
-               : "memory");
-       return result;
-}
-
-static inline __u32 jailhouse_call2(__u32 num, __u32 arg1, __u32 arg2)
-{
-       __u32 result;
-
-       asm volatile(JAILHOUSE_CALL_INS
-               : JAILHOUSE_CALL_RESULT
-               : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1, JAILHOUSE_CALL_ARG2
-               : "memory");
-       return result;
-}
-
-static inline __u32 jailhouse_call3(__u32 num, __u32 arg1, __u32 arg2,
-                                  __u32 arg3)
-{
-       __u32 result;
-
-       asm volatile(JAILHOUSE_CALL_INS
-               : JAILHOUSE_CALL_RESULT
-               : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1, JAILHOUSE_CALL_ARG2,
-                 JAILHOUSE_CALL_ARG3
-               : "memory");
-       return result;
-}
-
-static inline __u32 jailhouse_call4(__u32 num, __u32 arg1, __u32 arg2,
-                                  __u32 arg3, __u32 arg4)
-{
-       __u32 result;
-
-       asm volatile(JAILHOUSE_CALL_INS
-               : JAILHOUSE_CALL_RESULT
-               : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG1, JAILHOUSE_CALL_ARG2,
-                 JAILHOUSE_CALL_ARG3, JAILHOUSE_CALL_ARG4
+               : JAILHOUSE_CALL_NUM, JAILHOUSE_CALL_ARG
                : "memory");
        return result;
 }