vmmcp: cut over to virtual apic; fix include mess after upgrade
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)
we really need to start building outside tree. This is just painful.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
12 files changed:
kern/arch/x86/vmm/intel/vmx.c
kern/include/ros/vmm.h
tests/vmm/vmrunkernel.c
user/vmm/include/acpi/acenv.h
user/vmm/include/acpi/acenvex.h
user/vmm/include/acpi/acpi.h
user/vmm/include/acpi/acpiosxf.h
user/vmm/include/acpi/acpixf.h
user/vmm/include/acpi/actbl.h
user/vmm/include/acpi/platform/acakaros.h
user/vmm/include/acpi/platform/acenv.h
user/vmm/include/acpi/platform/acenvex.h

index 41d3ea6..bfbe663 100644 (file)
@@ -517,6 +517,7 @@ 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 |
@@ -525,7 +526,6 @@ static const struct vmxec cbec = {
                     CPU_BASED_RDTSC_EXITING |
                     CPU_BASED_CR3_LOAD_EXITING |
                     CPU_BASED_CR3_STORE_EXITING |
-                    CPU_BASED_TPR_SHADOW |
                     CPU_BASED_MOV_DR_EXITING |
                     CPU_BASED_VIRTUAL_NMI_PENDING |
                     CPU_BASED_MONITOR_TRAP |
@@ -1714,6 +1714,11 @@ int vmx_launch(struct vmctl *v) {
                printd("REG_RSP_RIP_CR3\n");
                vmcs_writel(GUEST_RSP, v->regs.tf_rsp);
                vmcs_writel(GUEST_CR3, v->cr3);
+               vmcs_writel(POSTED_INTR_DESC_ADDR, v->pir);
+               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);
+               printk("v->apic %p v->pir %p\n", (void *)v->vapic, (void *)v->pir);
                // fallthrough
        case REG_RIP:
                printd("REG_RIP %p\n", v->regs.tf_rip);
index 3017390..c56cead 100644 (file)
@@ -34,6 +34,9 @@ struct vmctl {
        uint32_t interrupt;
        uint32_t intrinfo1;
        uint32_t intrinfo2;
+       // These two page-sized entities must be page-aligned
+       uint64_t pir;
+       uint64_t vapic;
        struct hw_trapframe regs;
 };
 
index 9bea60e..94a1039 100644 (file)
@@ -317,7 +317,7 @@ int main(int argc, char **argv)
        int vmmflags = 0; // Disabled probably forever. VMM_VMCALL_PRINTF;
        uint64_t entry = 0x1200000, kerneladdress = 0x1200000;
        int nr_gpcs = 1;
-       int fd = open("#c/vmctl", O_RDWR), ret;
+       int fd = open("#cons/vmctl", O_RDWR), ret;
        void * xp;
        int kfd = -1;
        static char cmd[512];
@@ -401,6 +401,7 @@ fprintf(stderr, "%p %p %p %p\n", PGSIZE, PGSHIFT, PML1_SHIFT, PML1_PTE_REACH);
        close(kfd);
 
        // The low 1m so we can fill in bullshit like ACPI. */
+       // And, sorry, due to the STUPID format of the RSDP for now we need the low 1M.
        low1m = mmap((int*)4096, MiB-4096, PROT_READ | PROT_WRITE,
                         MAP_ANONYMOUS, -1, 0);
        if (low1m != (void *)4096) {
@@ -477,6 +478,12 @@ fprintf(stderr, "%p %p %p %p\n", PGSIZE, PGSHIFT, PML1_SHIFT, PML1_PTE_REACH);
 
        hexdump(stdout, r, a-(void *)r);
 
+       a = (void *)(((unsigned long)a + 0xfff) & ~0xfff);
+       vmctl.pir = (uint64_t) a;
+       a += 4096;
+       vmctl.vapic = (uint64_t) a;
+       a += 4096;
+
        if (ros_syscall(SYS_setup_vmm, nr_gpcs, vmmflags, 0, 0, 0, 0) != nr_gpcs) {
                perror("Guest pcore setup failed");
                exit(1);
index 8cec453..98b43e2 100644 (file)
  *****************************************************************************/
 
 #if defined(__akaros__)
-#include <acpi/platform/acakaros.h>
+#include "platform/acakaros.h"
 
 #if defined(_LINUX) || defined(__linux__)
-#include <acpi/platform/aclinux.h>
+#include "platform/aclinux.h"
 
 #elif defined(_APPLE) || defined(__APPLE__)
 #include "acmacosx.h"
index 30863a9..b719914 100644 (file)
@@ -54,7 +54,7 @@
  *****************************************************************************/
 
 #if defined(_LINUX) || defined(__linux__)
-#include <acpi/platform/aclinuxex.h>
+#include "platform/aclinuxex.h"
 
 #elif defined(__DragonFly__)
 #include "acdragonflyex.h"
index 81461ea..f8e513c 100644 (file)
  *
  * Note: The order of these include files is important.
  */
-#include <ros/acpi/platform/acenv.h>   /* Environment-specific items */
-#include <ros/acpi/acnames.h>          /* Common ACPI names and strings */
-#include <ros/acpi/actypes.h>          /* ACPICA data types and structures */
-#include <ros/acpi/acexcep.h>          /* ACPICA exceptions */
-#include <ros/acpi/actbl.h>            /* ACPI table definitions */
-#include <ros/acpi/acoutput.h>         /* Error output and Debug macros */
-#include <ros/acpi/acrestyp.h>         /* Resource Descriptor structs */
-#include <ros/acpi/acpiosxf.h>         /* OSL interfaces (ACPICA-to-OS) */
-#include <ros/acpi/acpixf.h>           /* ACPI core subsystem external interfaces */
-#include <ros/acpi/platform/acenvex.h> /* Extra environment-specific items */
+#include "platform/acenv.h"    /* Environment-specific items */
+#include "acnames.h"           /* Common ACPI names and strings */
+#include "actypes.h"           /* ACPICA data types and structures */
+#include "acexcep.h"           /* ACPICA exceptions */
+#include "actbl.h"             /* ACPI table definitions */
+#include "acoutput.h"          /* Error output and Debug macros */
+#include "acrestyp.h"          /* Resource Descriptor structs */
+#include "acpiosxf.h"          /* OSL interfaces (ACPICA-to-OS) */
+#include "acpixf.h"            /* ACPI core subsystem external interfaces */
+#include "platform/acenvex.h"  /* Extra environment-specific items */
 
 #endif                         /* __ACPI_H__ */
index d02df0a..cda0ab3 100644 (file)
@@ -46,8 +46,8 @@
 #ifndef __ACPIOSXF_H__
 #define __ACPIOSXF_H__
 
-#include <acpi/platform/acenv.h>
-#include <acpi/actypes.h>
+#include "platform/acenv.h"
+#include "actypes.h"
 
 /* Types for acpi_os_execute */
 
index d68f1cd..f77948b 100644 (file)
 
 #define ACPI_CA_VERSION                 0x20150515
 
-#include <acpi/acconfig.h>
-#include <acpi/actypes.h>
-#include <acpi/actbl.h>
-#include <acpi/acbuffer.h>
+#include "acconfig.h"
+#include "actypes.h"
+#include "actbl.h"
+#include "acbuffer.h"
 
 /*****************************************************************************
  *
index cb8a6b9..48d8394 100644 (file)
@@ -383,9 +383,9 @@ struct acpi_table_desc {
 /*
  * Get the remaining ACPI tables
  */
-#include <acpi/actbl1.h>
-#include <acpi/actbl2.h>
-#include <acpi/actbl3.h>
+#include "actbl1.h"
+#include "actbl2.h"
+#include "actbl3.h"
 
 /* Macros used to generate offsets to specific table fields */
 
index e560309..52c21bf 100644 (file)
@@ -61,6 +61,6 @@
 #define COMPILER_DEPENDENT_INT64    long
 #define COMPILER_DEPENDENT_UINT64   unsigned long
 
-#include <acpi/platform/acgcc.h>
+#include "acgcc.h"
 
 #endif                         /* __ACAKAROS_H__ */
index 708f04d..ce2897d 100644 (file)
  *****************************************************************************/
 
 #if defined(__akaros__)
-#include <acpi/platform/acakaros.h>
+#include "acakaros.h"
 
 #elif defined(_LINUX) || defined(__linux__)
-#include <acpi/platform/aclinux.h>
+#include "aclinux.h"
 
 #elif defined(_APPLE) || defined(__APPLE__)
 #include "acmacosx.h"
index 30863a9..5e1cdb4 100644 (file)
@@ -54,7 +54,7 @@
  *****************************************************************************/
 
 #if defined(_LINUX) || defined(__linux__)
-#include <acpi/platform/aclinuxex.h>
+#include "aclinuxex.h"
 
 #elif defined(__DragonFly__)
 #include "acdragonflyex.h"