Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Convert shadow paging to use 32 PAE (Remove 32 Bit Restrictions)
Chunxiao Diao, Daniel Zuo, Yuanbo Fan [Mon, 26 May 2014 21:23:04 +0000 (16:23 -0500)]
This changes shadow paging to use, at minimum, 32PAE
shadow page tables.   This makes it possible to place
a guest using shadow paging anywhere in host physical
memory instead of just the first 4 GB

This patch removes the concept of "Shadow Safe" memory
from Palacios, and it removes all places where it was used,
most importantly, in the allocation of the guest itself.

These patches must be used together.

palacios/include/palacios/vmm.h
palacios/src/devices/cga.c
palacios/src/devices/cirrus_gfx_card.c
palacios/src/devices/paragraph.c
palacios/src/devices/swapbypass_cache.c
palacios/src/devices/swapbypass_cache2.c
palacios/src/devices/tmpdisk.c
palacios/src/devices/vga.c
palacios/src/palacios/vmm_mem.c
palacios/src/palacios/vmm_mem_hook.c
palacios/src/palacios/vmm_symspy.c

index 2b02058..78373bc 100644 (file)
@@ -65,24 +65,6 @@ int      v3_get_vcore(struct guest_info *);
     })
 
 
-// Use 32 bit constraints if the vm uses 32bit shadow paging at any point
-// Should be used for shadow page tables and any physical memory
-// mapped into the vm
-#define V3_AllocShadowSafePages(vm,num_pages)                          \
-    ({                                                                 \
-       extern struct v3_os_hooks * os_hooks;                           \
-       void * ptr = 0;                                                 \
-       int c; int shadow=0;                                            \
-        for (c=0;c<(vm)->num_cores && !shadow;c++) {                    \
-            shadow|=vm->cores[c].shdw_pg_mode==SHADOW_PAGING;           \
-        }                                                               \
-       if ((os_hooks) && (os_hooks)->allocate_pages) {                 \
-           ptr = (os_hooks)->allocate_pages(num_pages,PAGE_SIZE_4KB,-1,\
-                    shadow ? V3_ALLOC_PAGES_CONSTRAINT_4GB : 0);        \
-       }                                                               \
-       ptr;                                                            \
-    })
-
 #define V3_AllocAlignedPages(num_pages, align)                         \
     ({                                                                 \
        extern struct v3_os_hooks * os_hooks;                           \
index 0513b8c..36bec51 100644 (file)
@@ -1252,7 +1252,7 @@ static int cga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
   
     video_state->dev = dev;
 
-    video_state->framebuf_pa = (addr_t)V3_AllocShadowSafePages(vm,FRAMEBUF_SIZE / 4096);
+    video_state->framebuf_pa = (addr_t)V3_AllocPages(FRAMEBUF_SIZE / 4096);
 
     if (!video_state->framebuf_pa) { 
        PrintError(vm, VCORE_NONE, "Cannot allocate frame buffer\n");
index 66f75b4..c6b7a43 100644 (file)
@@ -442,7 +442,7 @@ static int cirrus_gfx_card_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg){
     PrintDebug(info->vm_info, info, "video: init_device\n");
     PrintDebug(info->vm_info, info, "Num Pages=%d\n", SIZE_OF_REGION / 4096);
 
-    video_state->video_memory_pa = (addr_t)V3_AllocShadowSafePages(vm, SIZE_OF_REGION / 4096);
+    video_state->video_memory_pa = (addr_t)V3_AllocPages(SIZE_OF_REGION / 4096);
     if (!video_state->video_memory_pa) { 
        PrintError(info->vm_info, info, "Cannot allocate video memory\n");
        V3_Free(video_state);
index 32f07f1..36e44d8 100644 (file)
@@ -452,7 +452,7 @@ static int paragraph_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg)
   if (state->mode==MEM || state->mode==GCONS_MEM) { 
     state->mem_size=MAXX*MAXY*MAXBPP;
     PrintDebug(vm, VCORE_NONE, "paragraph: allocating %llu bytes for local framebuffer\n", state->mem_size);
-    state->mem_paddr = V3_AllocShadowSafePages(vm,ceil_pages(state->mem_size));
+    state->mem_paddr = V3_AllocPages(ceil_pages(state->mem_size));
     if (!state->mem_paddr) { 
       PrintError(state->vm, VCORE_NONE, "paragraph: Cannot allocate memory for framebuffer\n");
       paragraph_free_internal(state);
index 882d55f..bb5e9fe 100644 (file)
@@ -296,7 +296,7 @@ static int swap_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     swap->active = 0;
     swap->hdr = (union swap_header *)swap;
 
-    swap->swap_base_addr = (addr_t)V3_AllocShadowSafePages(swap->capacity / 4096); 
+    swap->swap_base_addr = (addr_t)V3_AllocPages(swap->capacity / 4096); 
 
     if (!swap->swap_base_addr) { 
        PrintError(vm, VCORE_NONE, "Cannot allocate swap space\n");
index 408d2b8..09d090b 100644 (file)
@@ -578,7 +578,7 @@ static int connect_fn(struct v3_vm_info * vm,
 
        swap->active = 0;
 
-       swap->cache_base_addr = (addr_t)V3_AllocShadowSafePages(vm,swap->cache_size / 4096);
+       swap->cache_base_addr = (addr_t)V3_AllocPages(swap->cache_size / 4096);
 
        if (!swap->cache_base_addr) { 
            PrintError(vm, VCORE_NONE, "Cannot allocate cache space\n");
index 1046b9b..eb49a64 100644 (file)
@@ -120,7 +120,7 @@ static int blk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     blk->capacity = capacity;
     
-    blk->blk_base_addr = (addr_t)V3_AllocShadowSafePages(vm,blk->capacity / 4096);
+    blk->blk_base_addr = (addr_t)V3_AllocPages(blk->capacity / 4096);
 
     if (!blk->blk_base_addr) { 
        PrintError(vm, VCORE_NONE, "Cannot allocate block space\n");
index 8d21fa7..037223e 100644 (file)
@@ -2870,7 +2870,7 @@ static int vga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     for (i=0;i<MAP_NUM;i++) { 
        void *temp;
 
-       temp = (void*)V3_AllocShadowSafePages(vm,MAP_SIZE/4096);
+       temp = (void*)V3_AllocPages(MAP_SIZE/4096);
        if (!temp) { 
            PrintError(vm, VCORE_NONE, "vga: cannot allocate maps\n");
            free_vga(vga);
index 1553b14..b205ea1 100644 (file)
@@ -176,8 +176,7 @@ int v3_init_mem_map(struct v3_vm_info * vm) {
        region->host_addr = (addr_t)V3_AllocPagesExtended(block_pages,
                                                          PAGE_SIZE_4KB,
                                                          node_id,
-                                                         will_use_shadow_paging(vm) ? 
-                                                         V3_ALLOC_PAGES_CONSTRAINT_4GB : 0 ); 
+                                                         0); // no constraints 
                                                             
         if ((void *)region->host_addr == NULL) { 
             PrintError(vm, VCORE_NONE, "Could not allocate guest memory\n");
index c30e51d..1d49294 100644 (file)
@@ -58,7 +58,7 @@ int v3_init_mem_hooks(struct v3_vm_info * vm) {
 
     struct v3_mem_hooks * hooks = &(vm->mem_hooks);
 
-    temp = V3_AllocShadowSafePages(vm,vm->num_cores);
+    temp = V3_AllocPages(vm->num_cores);
 
     if (!temp) {
        PrintError(vm, VCORE_NONE, "Cannot allocate space for mem hooks\n");
@@ -67,7 +67,7 @@ int v3_init_mem_hooks(struct v3_vm_info * vm) {
 
     hooks->hook_hvas_1 = V3_VAddr(temp);
 
-    temp = V3_AllocShadowSafePages(vm,vm->num_cores);
+    temp = V3_AllocPages(vm->num_cores);
 
     if (!temp) {
        PrintError(vm, VCORE_NONE,"Cannot allocate space for mem hooks\n");
index 148cbcb..58f8aed 100644 (file)
@@ -117,7 +117,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
 
 int v3_init_symspy_vm(struct v3_vm_info * vm, struct v3_symspy_global_state * state) {
 
-    state->global_page_pa = (addr_t)V3_AllocShadowSafePages(vm, 1);
+    state->global_page_pa = (addr_t)V3_AllocPages(1);
     if (!state->global_page_pa) { 
        PrintError(vm, VCORE_NONE, "Cannot allocate page\n");
        return -1;
@@ -137,7 +137,7 @@ int v3_init_symspy_vm(struct v3_vm_info * vm, struct v3_symspy_global_state * st
 
 
 int v3_init_symspy_core(struct guest_info * core, struct v3_symspy_local_state * state) {
-    state->local_page_pa = (addr_t)V3_AllocShadowSafePages(core->vm_info, 1);
+    state->local_page_pa = (addr_t)V3_AllocPages(1);
 
     if (!state->local_page_pa) { 
        PrintError(core->vm_info, core, "Cannot allocate page\n");