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.


HVM support for forwarding events to ROS
Peter Dinda [Tue, 8 Sep 2015 22:41:34 +0000 (17:41 -0500)]
Protocol and hypercall logic to support forwarding
of system calls and page faults from the HRT to the ROS

This allows an HRT with a merged address space to rely on
the ROS for page faults on the shared part of the address
space, and it allows the HRT to make system calls on the
ROS, provided all arguments, directly or indirectly, are
in the shared part of the address space.

palacios/include/palacios/vmm_hvm.h
palacios/src/palacios/vmm_hvm.c

index cb37225..a206d54 100644 (file)
 #include <palacios/vmm_types.h>
 #include <palacios/vmm_multiboot.h>
 
+struct v3_ros_event {
+    enum { ROS_NONE=0, ROS_PAGE_FAULT=1, ROS_SYSCALL=2 } event_type;
+    uint64_t       last_ros_event_result; // valid when ROS_NONE
+    union {
+       struct {   // valid when ROS_PAGE_FAULT
+           uint64_t rip;
+           uint64_t cr2;
+           enum {ROS_READ, ROS_WRITE} action;
+       } page_fault;
+       struct { // valid when ROS_SYSCALL
+           uint64_t args[8];
+       } syscall;
+    };
+};
+
 struct v3_vm_hvm {
     uint8_t   is_hvm;
     uint32_t  first_hrt_core;
@@ -50,6 +65,10 @@ struct v3_vm_hvm {
 
     enum {HRT_IDLE=0, HRT_CALL=1, HRT_PARCALL=2, HRT_SYNCSETUP=3, HRT_SYNC=4, HRT_SYNCTEARDOWN=5, HRT_MERGE=6} trans_state;
     uint64_t  trans_count;
+
+    // the ROS event to be handed back
+    struct v3_ros_event ros_event;
+
 };
 
 struct v3_core_hvm {
@@ -173,7 +192,14 @@ int v3_handle_hvm_reset(struct guest_info *core);
    0x1  =>  Reboot ROS
    0x2  =>  Reboot HRT
    0x3  =>  Reboot Both
-   0xf  =>  Get HRT transaction state
+   0xf  =>  Get HRT transaction state and current ROS event
+            first argument is pointer to the ROS event state 
+           to be filled out
+
+   0x10 =>  ROS event request (HRT->ROS)
+            first argument is pointer where to write the ROS event state
+   0x1f =>  ROS event completion (ROS->HRT)
+            first argument is the result code
 
    0x20 =>  Invoke function (ROS->HRT)
             first argument is pointer to structure describing call
index 26d3298..ff5b34f 100644 (file)
@@ -157,9 +157,34 @@ static int hvm_hcall_handler(struct guest_info * core , hcall_id_t hcall_id, voi
            
        case 0xf: // get HRT state
            core->vm_regs.rax = h->trans_state;
+           if (v3_write_gva_memory(core, a2, sizeof(h->ros_event), (uint8_t*) &h->ros_event)!=sizeof(h->ros_event)) { 
+               PrintError(core->vm_info, core, "hvm: cannot write back ROS event state to %p - continuing\n",(void*)a2);
+           }
            //PrintDebug(core->vm_info,core,"hvm: get HRT transaction state 0x%llx\n",core->vm_regs.rax);
            break;
 
+       case 0x10:
+           PrintDebug(core->vm_info, core, "hvm: ROS event request\n");
+           if (h->ros_event.event_type!=ROS_NONE) { 
+               PrintError(core->vm_info, core, "hvm: ROS event is already in progress\n");
+               core->vm_regs.rax = -1;
+           } else {
+               if (v3_read_gva_memory(core, a2, sizeof(h->ros_event), (uint8_t*)&h->ros_event)!=sizeof(h->ros_event)) { 
+                   PrintError(core->vm_info, core, "hvm: cannot read ROS event from %p\n",(void*)a2);
+                   core->vm_regs.rax = -1;
+               } else {
+                   core->vm_regs.rax = 0;
+               }
+           }
+
+           break;
+
+       case 0x1f:
+           PrintDebug(core->vm_info, core, "hvm: completion of ROS event (rc=0x%llx)\n",a2);
+           h->ros_event.event_type=ROS_NONE;
+           h->ros_event.last_ros_event_result = a2;
+           break;
+
        case 0x20: // invoke function (ROS->HRT)
        case 0x21: // invoke parallel function (ROS->HRT)
            if (v3_is_hvm_hrt_core(core)) {