]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
core: Provide number of registered cells via hypercall
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 11 Mar 2014 11:35:32 +0000 (12:35 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Tue, 11 Mar 2014 16:47:55 +0000 (17:47 +0100)
Extend the Hypervisor Get Info hypercall to also provide the number of
registered cell (including the root cell).

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

index c8790e5f6f370a82b2f62e4e675763783f2e2f21..e82f7a7204d25d16c1cdff96e8d77b58285abe84 100644 (file)
@@ -112,6 +112,7 @@ Arguments: 1. Information type:
         1 - used pages of hypervisor memory pool
         2 - number of pages in hypervisor remapping pool
         3 - used pages of hypervisor remapping pool
+        4 - number of registered cells
 
 Return code: requested value (>=0) or negative error code
 
index 18042b509342ee9228ffd456df23601638f0a11a..34abf823ea0fc966ab0346d91751d939bb8ad114 100644 (file)
@@ -22,6 +22,7 @@
 struct jailhouse_system *system_config;
 
 static DEFINE_SPINLOCK(shutdown_lock);
+static unsigned int num_cells = 1;
 
 #define for_each_cell(c)       for (c = &linux_cell; c; c = c->next)
 
@@ -225,6 +226,7 @@ int cell_create(struct per_cpu *cpu_data, unsigned long config_address)
        while (last->next)
                last = last->next;
        last->next = cell;
+       num_cells++;
 
        /* update cell references and clean up before releasing the cpus of
         * the new cell */
@@ -378,6 +380,7 @@ int cell_destroy(struct per_cpu *cpu_data, unsigned long id)
        while (previous->next != cell)
                previous = previous->next;
        previous->next = cell->next;
+       num_cells--;
 
        page_free(&mem_pool, cell, cell->data_pages);
        page_map_dump_stats("after cell destruction");
@@ -477,6 +480,8 @@ long hypervisor_get_info(struct per_cpu *cpu_data, unsigned long type)
                return remap_pool.pages;
        case JAILHOUSE_INFO_REMAP_POOL_USED:
                return remap_pool.used_pages;
+       case JAILHOUSE_INFO_NUM_CELLS:
+               return num_cells;
        default:
                return -EINVAL;
        }
index 1151c02a722da5c37dba8001461515887878a3d9..59861127578228f342252e05f58fd9c2be3cde7a 100644 (file)
@@ -25,6 +25,7 @@
 #define JAILHOUSE_INFO_MEM_POOL_USED           1
 #define JAILHOUSE_INFO_REMAP_POOL_SIZE         2
 #define JAILHOUSE_INFO_REMAP_POOL_USED         3
+#define JAILHOUSE_INFO_NUM_CELLS               4
 
 /* CPU state */
 #define JAILHOUSE_CPU_RUNNING                  0