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.


added per core memory map support
[palacios.git] / palacios / src / devices / apic.c
index dc5257a..3ea76cb 100644 (file)
@@ -22,7 +22,7 @@
 #include <devices/apic_regs.h>
 #include <palacios/vmm.h>
 #include <palacios/vmm_msr.h>
-
+#include <palacios/vm_guest.h>
 
 #ifndef CONFIG_DEBUG_APIC
 #undef PrintDebug
@@ -181,6 +181,7 @@ struct apic_state {
     uint32_t eoi;
 
 
+    struct guest_info * core;
 };
 
 static int apic_read(addr_t guest_addr, void * dst, uint_t length, void * priv_data);
@@ -282,6 +283,10 @@ 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");
+    }
+
     if (*en_location & flag) {
        *req_location |= flag;
     } else {
@@ -947,7 +952,7 @@ int v3_apic_raise_intr(struct guest_info * info, struct vm_device * apic_dev, in
 
 
 /* Timer Functions */
-static void apic_update_time(ullong_t cpu_cycles, ullong_t cpu_freq, void * priv_data) {
+static void apic_update_time(struct guest_info * info, ullong_t cpu_cycles, ullong_t cpu_freq, void * priv_data) {
     struct vm_device * dev = (struct vm_device *)priv_data;
     struct apic_state * apic = (struct apic_state *)dev->private_data;
     // The 32 bit GCC runtime is a pile of shit
@@ -1015,7 +1020,7 @@ static void apic_update_time(ullong_t cpu_cycles, ullong_t cpu_freq, void * priv
        PrintDebug("Raising APIC Timer interrupt (periodic=%d) (icnt=%d) (div=%d)\n", 
                   apic->tmr_vec_tbl.tmr_mode, apic->tmr_init_cnt, shift_num);
 
-       if (apic_intr_pending(dev->vm, priv_data)) {
+       if (apic_intr_pending(info, priv_data)) {
            PrintDebug("Overriding pending IRQ %d\n", apic_get_intr_number(dev->vm, priv_data));
        }
 
@@ -1051,9 +1056,9 @@ static struct vm_timer_ops timer_ops = {
 
 
 static int apic_free(struct vm_device * dev) {
-    struct guest_info * info = dev->vm;
+    //   struct apic_state * apic = (struct apic_state *)dev->private_data;
 
-    v3_unhook_msr(info, BASE_ADDR_MSR);
+    v3_unhook_msr(dev->vm, BASE_ADDR_MSR);
 
     return 0;
 }
@@ -1068,15 +1073,16 @@ static struct v3_device_ops dev_ops = {
 
 
 
-static int apic_init(struct guest_info * vm, void * cfg_data) {
+static int apic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     PrintDebug("Creating APIC\n");
+    char * name = v3_cfg_val(cfg, "name");
 
     struct apic_state * apic = (struct apic_state *)V3_Malloc(sizeof(struct apic_state));
 
-    struct vm_device * dev = v3_allocate_device("LAPIC", &dev_ops, apic);
+    struct vm_device * dev = v3_allocate_device(name, &dev_ops, apic);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", "LAPIC");
+       PrintError("Could not attach device %s\n", name);
        return -1;
     }