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.


Philip's changes along with some minor changes from Kevin.
Kevin Pedretti [Fri, 15 Jan 2010 00:16:12 +0000 (17:16 -0700)]
palacios/include/palacios/vmm.h
palacios/src/devices/apic.c
palacios/src/devices/keyboard.c
palacios/src/palacios/svm.c
palacios/src/palacios/vmm_xml.c
utils/guest_creator/default.xml

index b05871f..7ed54f6 100644 (file)
@@ -158,6 +158,24 @@ struct guest_info;
        })                                                              \
        
 
+#define V3_Get_CPU() ({                                                \
+            int ret = 0;                                                \
+            extern struct v3_os_hooks * os_hooks;                       \
+            if ((os_hooks) && (os_hooks)->get_cpu) {                    \
+                ret = (os_hooks)->get_cpu();                            \
+            }                                                           \
+            ret;                                                        \
+        })
+
+#define V3_Call_On_CPU(cpu, fn, arg)                   \
+    do {                                               \
+        extern struct v3_os_hooks * os_hooks;           \
+        if ((os_hooks) && (os_hooks)->call_on_cpu) {    \
+            (os_hooks)->call_on_cpu(cpu, fn, arg);      \
+        }                                               \
+    } while (0)
+
+
 #define V3_ACK_IRQ(irq)                                                \
     do {                                                       \
        extern struct v3_os_hooks * os_hooks;                   \
index ccb89e3..6a65d37 100644 (file)
@@ -22,6 +22,7 @@
 #include <devices/apic_regs.h>
 #include <palacios/vmm.h>
 #include <palacios/vmm_msr.h>
+#include <palacios/vmm_sprintf.h>
 #include <palacios/vm_guest.h>
 
 #ifndef CONFIG_DEBUG_APIC
@@ -183,6 +184,7 @@ struct apic_state {
 
 };
 
+static void apic_incoming_ipi(void *val);
 static int apic_read(addr_t guest_addr, void * dst, uint_t length, void * priv_data);
 static int apic_write(addr_t guest_addr, void * src, uint_t length, void * priv_data);
 
@@ -283,7 +285,7 @@ static int activate_apic_irq(struct apic_state * apic, uint32_t irq_num) {
     PrintDebug("Raising APIC IRQ %d\n", irq_num);
 
     if (*req_location & flag) {
-       V3_Print("Interrupts coallescing\n");
+       //V3_Print("Interrupts coallescing\n");
     }
 
     if (*en_location & flag) {
@@ -368,7 +370,7 @@ static int apic_do_eoi(struct apic_state * apic) {
        }
 #endif
     } else {
-       PrintError("Spurious EOI...\n");
+       //PrintError("Spurious EOI...\n");
     }
        
     return 0;
@@ -844,7 +846,13 @@ static int apic_write(addr_t guest_addr, void * src, uint_t length, void * priv_
            break;
 
        case INT_CMD_LO_OFFSET:
+           apic->int_cmd.lo = op_val;
+           V3_Call_On_CPU(apic->int_cmd.dst, apic_incoming_ipi, (void *)apic->int_cmd.val);
+    
+           break;
        case INT_CMD_HI_OFFSET:
+           apic->int_cmd.hi = op_val;
+           break;
            // Unhandled Registers
 
        case EXT_APIC_CMD_OFFSET:
@@ -1036,6 +1044,49 @@ static void apic_update_time(ullong_t cpu_cycles, ullong_t cpu_freq, void * priv
 
 }
 
+static void apic_incoming_ipi(void *val)
+{
+PrintError("In apic_incoming_ipi, val=%p\n", val);
+       struct int_cmd_reg int_cmd;
+       char *type = NULL, *dest;
+       char foo[8];
+       int_cmd.val = (uint64_t)val;
+       switch (int_cmd.dst_shorthand)
+       {
+       case 0x0:
+               sprintf(foo, "%d", int_cmd.dst);
+               dest = foo;
+               break;
+       case 0x1:
+               dest = "(self)";
+               break;
+       case 0x2:
+               dest = "(broadcast inclusive)";
+               break;
+       case 0x3:
+               dest = "(broadcast)";
+               break;
+       }
+       switch (int_cmd.msg_type) 
+       {
+       case 0x0:
+               type = "";
+               break;
+       case 0x4:
+               type = "(NMI)";
+               break;
+       case 0x5:
+               type = "(INIT)";
+               break;
+       case 0x6:
+               type = "(Startup)";
+               break;
+       }
+       PrintError("Receieved IPI on CPU %d type=%s dest=%s\n",
+                       V3_Get_CPU(), type, dest);
+//%p %s to CPU %d on CPU %d.\n", val, foo, type, dest, (int)V3_Get_CPU());
+       return;
+}
 
 
 static struct intr_ctrl_ops intr_ops = {
index eb76cc9..dfa2e6d 100644 (file)
@@ -354,7 +354,7 @@ static int key_event_handler(struct guest_info * info,
        PrintDebug("Toggling Debugging\n");     
        v3_dbg_enable ^= 1;
     } else if (evt->scan_code == 0x41) { // F7 telemetry dump
-       v3_print_telemetry(info);
+       //v3_print_telemetry(info);
        
     }
 
index acb5353..945aa70 100644 (file)
@@ -466,13 +466,15 @@ int v3_svm_enter(struct guest_info * info) {
 
     rdtscll(info->time_state.cached_host_tsc);
     guest_ctrl->TSC_OFFSET = info->time_state.guest_tsc - info->time_state.cached_host_tsc;
+
+    //V3_Print("Calling v3_svm_launch\n");
        
     v3_svm_launch((vmcb_t *)V3_PAddr(info->vmm_data), &(info->vm_regs), (vmcb_t *)host_vmcbs[info->cpu_id]);
     
+    //V3_Print("SVM Returned: Exit Code: %x, guest_rip=%lx\n", (uint32_t)(guest_ctrl->exit_code), (unsigned long)guest_state->rip);
 
-    v3_last_exit = (uint32_t)(guest_ctrl->exit_code);
 
-    //  v3_print_cond("SVM Returned: Exit Code: %x\n", (uint32_t)(guest_ctrl->exit_code));
+    v3_last_exit = (uint32_t)(guest_ctrl->exit_code);
 
     rdtscll(tmp_tsc);
 
index e632a4f..f3641be 100644 (file)
@@ -363,6 +363,7 @@ static int v3_xml_close_tag(struct v3_xml_root * root, char * name, char * s) {
     return 0;
 }
 
+#if 0
 // checks for circular entity references, returns non-zero if no circular
 // references are found, zero otherwise
 static int v3_xml_ent_ok(char * name, char * s, char ** ent) {
@@ -390,6 +391,7 @@ static int v3_xml_ent_ok(char * name, char * s, char ** ent) {
        }
     }
 }
+#endif
 
 
 
index d8576e7..5635dbd 100644 (file)
@@ -3,7 +3,7 @@
 <vm class="PC"> 
 
        <!-- Memory in MB -->
-       <memory>1024</memory> 
+       <memory>256</memory> 
 
        <!-- Basic VMM system flags -->
        <telemetry>enable</telemetry>
@@ -27,7 +27,7 @@
        <!-- This is where you add disk images -->
        <files>
                <!-- The file 'id' is used as a reference for other configuration components -->
-               <file id="boot-cd" filename="/home/jarusl/image.iso" />
+               <file id="boot-cd" filename="/home/ktpedre/google_code/smp_guest/kitten_guest/arch/x86_64/boot/image.iso" />
                <!--<file id="harddisk" filename="firefox.img" />-->
        </files>
 
                        <bus>pci0</bus>
                </device>
 
-               <device id="LNX_VIRTIO_SYM" name="sym_pci">
+               <device id="IDE" name="ide">
                        <bus>pci0</bus>
+                       <controller>southbridge</controller>
                </device>
 
-               <device id="LNX_VIRTIO_BLK" name="blk_virtio">
+<!--
+               <device id="LNX_VIRTIO_SYM" name="sym_pci">
                        <bus>pci0</bus>
                </device>
 
-               <device id="LNX_VIRTIO_BALLOON" name="balloon">
+               <device id="LNX_VIRTIO_BLK" name="blk_virtio">
                        <bus>pci0</bus>
                </device>
 
-               <device id="IDE" name="ide">
+               <device id="LNX_VIRTIO_BALLOON" name="balloon">
                        <bus>pci0</bus>
-                       <controller>southbridge</controller>
                </device>
 
                <device id="PCI_PASSTHROUGH" name="e1000">
@@ -94,6 +95,7 @@
                        <device_id>0x107c</device_id>
                        <irq>64</irq>
                </device>
+-->
 
 
                <!-- This is a Storage Backend that connects to a frontend -->
                        </frontend>
                </device>
 
+<!---
                <device id="SYM_SWAP" name="sym swap">
                        <frontend tag="blk_virtio" />
                        <size>150</size>
                </device>
+-->
 
 
 <!--