Track the guest physical address used for VMs
authorRonald G. Minnich <rminnich@google.com>
Fri, 14 Feb 2014 23:32:42 +0000 (15:32 -0800)
committerRonald G. Minnich <rminnich@google.com>
Fri, 14 Feb 2014 23:32:42 +0000 (15:32 -0800)
It's pretty trivial to just track the guest pa in the
page struct, and it greatly simplifies VM code.

The alternatives are all ugly, as many of the extant VMs
out there show. We own this kernel, might as well make it easy.

pg_private was likely overcommited so I went this route.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
kern/include/page_alloc.h

index 40ce8c4..d2bf5f5 100644 (file)
@@ -49,6 +49,8 @@ struct page {
        void                                            **pg_tree_slot;
        void                                            *pg_private;    /* type depends on page usage */
        struct semaphore                        pg_sem;         /* for blocking on IO */
+       uint64_t                                gpa;            /* physical address in guest */
+                                                               /* pg_private is overloaded. */
 };
 
 /******** Externally visible global variables ************/