[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [IA64] Map vcpu memory mapped registers into guest psudo physical address space



# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Node ID 178e46776c710e337e5a21415cef07391f73e730
# Parent  d85c905beac438a9d62905a842f8e8ccfbde3bed
[IA64] Map vcpu memory mapped registers into guest psudo physical address space

Assign vcpu memory mapped registers into guest psudo physical address space
for foreign domain page mapping. This is used by domain save.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/domain.c         |   22 +++++++++++++++++++++-
 xen/include/asm-ia64/grant_table.h |    7 ++++++-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff -r d85c905beac4 -r 178e46776c71 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Thu Dec 07 14:49:00 2006 -0700
+++ b/xen/arch/ia64/xen/domain.c        Thu Dec 07 14:53:47 2006 -0700
@@ -308,6 +308,16 @@ void relinquish_vcpu_resources(struct vc
     if (HAS_PERVCPU_VHPT(v->domain))
         pervcpu_vhpt_free(v);
     if (v->arch.privregs != NULL) {
+        // this might be called by arch_do_domctl() with 
XEN_DOMCTL_arch_setup()
+        // for domVTi.
+        if (!(atomic_read(&v->domain->refcnt) & DOMAIN_DESTROYED)) {
+            unsigned long i;
+            for (i = 0; i < XMAPPEDREGS_SIZE; i += PAGE_SIZE)
+                guest_physmap_remove_page(v->domain,
+                    IA64_XMAPPEDREGS_PADDR(v->vcpu_id) + i,
+                    virt_to_maddr(v->arch.privregs + i));
+        }
+
         free_xenheap_pages(v->arch.privregs,
                            get_order_from_shift(XMAPPEDREGS_SHIFT));
         v->arch.privregs = NULL;
@@ -367,6 +377,15 @@ int vcpu_initialise(struct vcpu *v)
                for (i = 0; i < (1 << order); i++)
                    share_xen_page_with_guest(virt_to_page(v->arch.privregs) +
                                              i, d, XENSHARE_writable);
+               /*
+                * XXX IA64_XMAPPEDREGS_PADDR
+                * assign these pages into guest pseudo physical address
+                * space for dom0 to map this page by gmfn.
+                * this is necessary for domain save, restore and dump-core.
+                */
+               for (i = 0; i < XMAPPEDREGS_SIZE; i += PAGE_SIZE)
+                   assign_domain_page(d, IA64_XMAPPEDREGS_PADDR(v->vcpu_id) + 
i,
+                                      virt_to_maddr(v->arch.privregs + i));
 
                tlbflush_update_time(&v->arch.tlbflush_timestamp,
                                     tlbflush_current_time());
@@ -509,7 +528,8 @@ void arch_getdomaininfo_ctxt(struct vcpu
        struct vcpu_extra_regs *er = &c->extra_regs;
 
        c->user_regs = *vcpu_regs (v);
-       c->privregs_pfn = virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT;
+       c->privregs_pfn = get_gpfn_from_mfn(virt_to_maddr(v->arch.privregs) >>
+                                           PAGE_SHIFT);
 
        /* Fill extra regs.  */
        for (i = 0; i < 8; i++) {
diff -r d85c905beac4 -r 178e46776c71 xen/include/asm-ia64/grant_table.h
--- a/xen/include/asm-ia64/grant_table.h        Thu Dec 07 14:49:00 2006 -0700
+++ b/xen/include/asm-ia64/grant_table.h        Thu Dec 07 14:53:47 2006 -0700
@@ -30,9 +30,14 @@ void guest_physmap_add_page(struct domai
  */
 /* Guest phsyical address of shared_info */
 #define IA64_SHARED_INFO_PADDR (1UL << 40)
+/* Guest phsyical address of mapped_regs */
+#define IA64_XMAPPEDREGS_BASE_PADDR     (IA64_SHARED_INFO_PADDR + XSI_SIZE)
+#define IA64_XMAPPEDREGS_PADDR(vcpu_id)             \
+    (IA64_XMAPPEDREGS_BASE_PADDR +                  \
+     (vcpu_id) * max_t(unsigned long, PAGE_SIZE, XMAPPEDREGS_SIZE))
 
 /* Guest physical address of the grant table.  */
-#define IA64_GRANT_TABLE_PADDR  (IA64_SHARED_INFO_PADDR + XSI_SIZE)
+#define IA64_GRANT_TABLE_PADDR  IA64_XMAPPEDREGS_PADDR(NR_CPUS)
 
 #define gnttab_shared_maddr(d, t, i)                        \
     virt_to_maddr((char*)(t)->shared + ((i) << PAGE_SHIFT))

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.