VMMCP: start move to systems I can't use on my mac
authorRonald G. Minnich <rminnich@gmail.com>
Wed, 30 Sep 2015 22:20:20 +0000 (15:20 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 2 Nov 2015 23:53:50 +0000 (18:53 -0500)
Oh well, I just wasted a day because we decided to ignore an error a few months back.

Bad Giraffe!

Anyway, I'm going to start enabling this stuff, and say goodbye to vmware fusion,
since it can no longer play the game. Damn. Gotta fine a real computer now.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/vmm/intel/vmx.c
tests/vmm/vmrunkernel.c

index bfbe663..065b6c2 100644 (file)
@@ -476,8 +476,8 @@ check_vmxec_controls(struct vmxec const *v, bool have_true_msr,
                           v->set_to_1, v->set_to_0, reserved_1);
                printk(" reserved_0 0x%x", reserved_0);
                printk(" changeable_bits 0x%x\n", changeable_bits);
-               printk(" TOO BAD MAX ... we're going ahead .... no error .... \n");
-               //return false;
+               //printk(" TOO BAD MAX ... we're going ahead .... no error .... \n");
+               return false;
        }
 
        *result = v->set_to_1 | reserved_1;
@@ -517,7 +517,6 @@ static const struct vmxec cbec = {
                     CPU_BASED_USE_MSR_BITMAPS |
                     CPU_BASED_MONITOR_EXITING |
                     CPU_BASED_USE_IO_BITMAPS |
-                    CPU_BASED_TPR_SHADOW |
                     CPU_BASED_ACTIVATE_SECONDARY_CONTROLS),
 
        .set_to_0 = (CPU_BASED_VIRTUAL_INTR_PENDING |
@@ -530,6 +529,9 @@ static const struct vmxec cbec = {
                     CPU_BASED_VIRTUAL_NMI_PENDING |
                     CPU_BASED_MONITOR_TRAP |
                     CPU_BASED_PAUSE_EXITING |
+
+                    CPU_BASED_TPR_SHADOW |
+
                     CPU_BASED_UNCOND_IO_EXITING),
 };
 
@@ -539,15 +541,18 @@ static const struct vmxec cb2ec = {
        .truemsr = MSR_IA32_VMX_PROCBASED_CTLS2,
 
        .set_to_1 = (SECONDARY_EXEC_ENABLE_EPT |
+                       SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
+                    //SECONDARY_EXEC_APIC_REGISTER_VIRT |
+                    //SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                     SECONDARY_EXEC_WBINVD_EXITING),
 
-       .set_to_0 = (SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
+       .set_to_0 = (
+                    SECONDARY_EXEC_APIC_REGISTER_VIRT |
+                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                     SECONDARY_EXEC_DESCRIPTOR_EXITING |
                     SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE |
                     SECONDARY_EXEC_ENABLE_VPID |
                     SECONDARY_EXEC_UNRESTRICTED_GUEST |
-                    SECONDARY_EXEC_APIC_REGISTER_VIRT |
-                    SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY |
                     SECONDARY_EXEC_PAUSE_LOOP_EXITING |
                     SECONDARY_EXEC_RDRAND_EXITING |
                     SECONDARY_EXEC_ENABLE_INVPCID |
@@ -1718,6 +1723,8 @@ int vmx_launch(struct vmctl *v) {
                vmcs_writel(POSTED_INTR_DESC_ADDR_HIGH, v->pir>>32);
                vmcs_writel(VIRTUAL_APIC_PAGE_ADDR, v->vapic);
                vmcs_writel(VIRTUAL_APIC_PAGE_ADDR_HIGH, v->vapic>>32);
+               vmcs_writel(APIC_ACCESS_ADDR, 0xfee00000);
+               vmcs_writel(APIC_ACCESS_ADDR_HIGH, 0);
                printk("v->apic %p v->pir %p\n", (void *)v->vapic, (void *)v->pir);
                // fallthrough
        case REG_RIP:
index 94a1039..409e349 100644 (file)
@@ -304,6 +304,7 @@ static void gencsum(uint8_t *target, void *data, int len)
 
 int main(int argc, char **argv)
 {
+       uint64_t *p64;
        void *a = (void *)0xe0000;
        struct acpi_table_rsdp *r;
        struct acpi_table_fadt *f;
@@ -482,6 +483,10 @@ fprintf(stderr, "%p %p %p %p\n", PGSIZE, PGSHIFT, PML1_SHIFT, PML1_PTE_REACH);
        vmctl.pir = (uint64_t) a;
        a += 4096;
        vmctl.vapic = (uint64_t) a;
+       p64 = a;
+       // set up apic values? do we need to?
+       // qemu does this.
+       ((uint8_t *)a)[4] = 1;
        a += 4096;
 
        if (ros_syscall(SYS_setup_vmm, nr_gpcs, vmmflags, 0, 0, 0, 0) != nr_gpcs) {