ia64/xen-unstable

changeset 12881:178e46776c71

[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@valinux.co.jp>
author awilliam@xenbuild2.aw
date Thu Dec 07 14:53:47 2006 -0700 (2006-12-07)
parents d85c905beac4
children 566e0e95cf00
files xen/arch/ia64/xen/domain.c xen/include/asm-ia64/grant_table.h
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Thu Dec 07 14:49:00 2006 -0700
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Thu Dec 07 14:53:47 2006 -0700
     1.3 @@ -308,6 +308,16 @@ void relinquish_vcpu_resources(struct vc
     1.4      if (HAS_PERVCPU_VHPT(v->domain))
     1.5          pervcpu_vhpt_free(v);
     1.6      if (v->arch.privregs != NULL) {
     1.7 +        // this might be called by arch_do_domctl() with XEN_DOMCTL_arch_setup()
     1.8 +        // for domVTi.
     1.9 +        if (!(atomic_read(&v->domain->refcnt) & DOMAIN_DESTROYED)) {
    1.10 +            unsigned long i;
    1.11 +            for (i = 0; i < XMAPPEDREGS_SIZE; i += PAGE_SIZE)
    1.12 +                guest_physmap_remove_page(v->domain,
    1.13 +                    IA64_XMAPPEDREGS_PADDR(v->vcpu_id) + i,
    1.14 +                    virt_to_maddr(v->arch.privregs + i));
    1.15 +        }
    1.16 +
    1.17          free_xenheap_pages(v->arch.privregs,
    1.18                             get_order_from_shift(XMAPPEDREGS_SHIFT));
    1.19          v->arch.privregs = NULL;
    1.20 @@ -367,6 +377,15 @@ int vcpu_initialise(struct vcpu *v)
    1.21  		for (i = 0; i < (1 << order); i++)
    1.22  		    share_xen_page_with_guest(virt_to_page(v->arch.privregs) +
    1.23  		                              i, d, XENSHARE_writable);
    1.24 +		/*
    1.25 +		 * XXX IA64_XMAPPEDREGS_PADDR
    1.26 +		 * assign these pages into guest pseudo physical address
    1.27 +		 * space for dom0 to map this page by gmfn.
    1.28 +		 * this is necessary for domain save, restore and dump-core.
    1.29 +		 */
    1.30 +		for (i = 0; i < XMAPPEDREGS_SIZE; i += PAGE_SIZE)
    1.31 +		    assign_domain_page(d, IA64_XMAPPEDREGS_PADDR(v->vcpu_id) + i,
    1.32 +                                      virt_to_maddr(v->arch.privregs + i));
    1.33  
    1.34  		tlbflush_update_time(&v->arch.tlbflush_timestamp,
    1.35  		                     tlbflush_current_time());
    1.36 @@ -509,7 +528,8 @@ void arch_getdomaininfo_ctxt(struct vcpu
    1.37  	struct vcpu_extra_regs *er = &c->extra_regs;
    1.38  
    1.39  	c->user_regs = *vcpu_regs (v);
    1.40 - 	c->privregs_pfn = virt_to_maddr(v->arch.privregs) >> PAGE_SHIFT;
    1.41 + 	c->privregs_pfn = get_gpfn_from_mfn(virt_to_maddr(v->arch.privregs) >>
    1.42 +                                           PAGE_SHIFT);
    1.43  
    1.44  	/* Fill extra regs.  */
    1.45  	for (i = 0; i < 8; i++) {
     2.1 --- a/xen/include/asm-ia64/grant_table.h	Thu Dec 07 14:49:00 2006 -0700
     2.2 +++ b/xen/include/asm-ia64/grant_table.h	Thu Dec 07 14:53:47 2006 -0700
     2.3 @@ -30,9 +30,14 @@ void guest_physmap_add_page(struct domai
     2.4   */
     2.5  /* Guest phsyical address of shared_info */
     2.6  #define IA64_SHARED_INFO_PADDR	(1UL << 40)
     2.7 +/* Guest phsyical address of mapped_regs */
     2.8 +#define IA64_XMAPPEDREGS_BASE_PADDR     (IA64_SHARED_INFO_PADDR + XSI_SIZE)
     2.9 +#define IA64_XMAPPEDREGS_PADDR(vcpu_id)             \
    2.10 +    (IA64_XMAPPEDREGS_BASE_PADDR +                  \
    2.11 +     (vcpu_id) * max_t(unsigned long, PAGE_SIZE, XMAPPEDREGS_SIZE))
    2.12  
    2.13  /* Guest physical address of the grant table.  */
    2.14 -#define IA64_GRANT_TABLE_PADDR  (IA64_SHARED_INFO_PADDR + XSI_SIZE)
    2.15 +#define IA64_GRANT_TABLE_PADDR  IA64_XMAPPEDREGS_PADDR(NR_CPUS)
    2.16  
    2.17  #define gnttab_shared_maddr(d, t, i)                        \
    2.18      virt_to_maddr((char*)(t)->shared + ((i) << PAGE_SHIFT))