]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core/driver: Extend "CPU Get State" to "CPU Get Info" hypercall
authorJan Kiszka <jan.kiszka@siemens.com>
Sat, 14 Jun 2014 06:36:57 +0000 (08:36 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Tue, 17 Jun 2014 15:41:39 +0000 (17:41 +0200)
Add a second argument to control which per-cpu information shall be
retrieved via JAILHOUSE_HC_CPU_GET_INFO. For now there will only be
JAILHOUSE_CPU_INFO_STATE, providing the original hypercall service.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Documentation/hypervisor-interfaces.txt
driver.c
hypervisor/control.c
hypervisor/include/jailhouse/hypercall.h

index de7ca1d73ee967a89f207a723cdd36cd48bbf8c9..a9fa43a8fe164620ac32c5c3ad883a060a6bef66 100644 (file)
@@ -178,14 +178,16 @@ Return code: Cell state (>=0) or negative error code
         -EINVAL (-22) - cell state is invalid
 
 
-Hypercall "CPU Get State" (code 7)
-- - - - - - - - - - - - - - - - - -
+Hypercall "CPU Get Info" (code 7)
+- - - - - - - - - - - - - - - - -
 
-Obtain information about the state of a specific CPU.
+Obtain information about a specific CPU.
 
-Arguments: 1. logical ID of CPU to be queried
+Arguments: 1. Logical ID of CPU to be queried
+           2. Information type:
+                  0 - CPU state
 
-Return code: CPU state (>=0) or negative error code
+Return code: Requested value (>=0) or negative error code
 
     Possible CPU states are:
         0 - Running
index 677545f72c676471c5149ea201fdc148e80740bd..afe853341962c6eeab812f2f96f3d37878357929 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -151,7 +151,8 @@ static ssize_t cpus_failed_show(struct kobject *kobj,
                return -ENOMEM;
 
        for_each_cpu(cpu, &cell->cpus_assigned)
-               if (jailhouse_call_arg1(JAILHOUSE_HC_CPU_GET_STATE, cpu) ==
+               if (jailhouse_call_arg2(JAILHOUSE_HC_CPU_GET_INFO, cpu,
+                                       JAILHOUSE_CPU_INFO_STATE) ==
                    JAILHOUSE_CPU_FAILED)
                        cpu_set(cpu, *cpus_failed);
 
index a4211d0a4bfcc922eefe06c34db63bfbc696717e..12676be2f64415d2ea88999a3d2399193e089637 100644 (file)
@@ -697,7 +697,8 @@ static long hypervisor_get_info(struct per_cpu *cpu_data, unsigned long type)
        }
 }
 
-static int cpu_get_state(struct per_cpu *cpu_data, unsigned long cpu_id)
+static int cpu_get_info(struct per_cpu *cpu_data, unsigned long cpu_id,
+                       unsigned long type)
 {
        if (!cpu_id_valid(cpu_id))
                return -EINVAL;
@@ -712,8 +713,11 @@ static int cpu_get_state(struct per_cpu *cpu_data, unsigned long cpu_id)
             !test_bit(cpu_id, cpu_data->cell->cpu_set->bitmap)))
                return -EPERM;
 
-       return per_cpu(cpu_id)->failed ? JAILHOUSE_CPU_FAILED :
-               JAILHOUSE_CPU_RUNNING;
+       if (type == JAILHOUSE_CPU_INFO_STATE) {
+               return per_cpu(cpu_id)->failed ? JAILHOUSE_CPU_FAILED :
+                       JAILHOUSE_CPU_RUNNING;
+       } else
+               return -EINVAL;
 }
 
 long hypercall(struct per_cpu *cpu_data, unsigned long code,
@@ -734,8 +738,8 @@ long hypercall(struct per_cpu *cpu_data, unsigned long code,
                return hypervisor_get_info(cpu_data, arg1);
        case JAILHOUSE_HC_CELL_GET_STATE:
                return cell_get_state(cpu_data, arg1);
-       case JAILHOUSE_HC_CPU_GET_STATE:
-               return cpu_get_state(cpu_data, arg1);
+       case JAILHOUSE_HC_CPU_GET_INFO:
+               return cpu_get_info(cpu_data, arg1, arg2);
        default:
                return -ENOSYS;
        }
index cd165c18df67669f920d6e33a1375b8ac7c11648..140e7fe65fdc8ed5d15801f67ebb50c946a2f56b 100644 (file)
@@ -20,7 +20,7 @@
 #define JAILHOUSE_HC_CELL_DESTROY              4
 #define JAILHOUSE_HC_HYPERVISOR_GET_INFO       5
 #define JAILHOUSE_HC_CELL_GET_STATE            6
-#define JAILHOUSE_HC_CPU_GET_STATE             7
+#define JAILHOUSE_HC_CPU_GET_INFO              7
 
 /* Hypervisor information type */
 #define JAILHOUSE_INFO_MEM_POOL_SIZE           0
@@ -29,6 +29,9 @@
 #define JAILHOUSE_INFO_REMAP_POOL_USED         3
 #define JAILHOUSE_INFO_NUM_CELLS               4
 
+/* Hypervisor information type */
+#define JAILHOUSE_CPU_INFO_STATE               0
+
 /* CPU state */
 #define JAILHOUSE_CPU_RUNNING                  0
 #define JAILHOUSE_CPU_FAILED                   2 /* terminal state */