ia64/xen-unstable

changeset 14010:01476c7804b2

ia64: Fixes after changes to grant table code.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author kfraser@localhost.localdomain
date Mon Feb 19 16:06:03 2007 +0000 (2007-02-19)
parents 184db7a674d9
children 168030c8e0a9
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	Mon Feb 19 16:05:34 2007 +0000
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Mon Feb 19 16:06:03 2007 +0000
     1.3 @@ -521,6 +521,16 @@ int arch_domain_create(struct domain *d)
     1.4  	if ((d->arch.mm.pgd = pgd_alloc(&d->arch.mm)) == NULL)
     1.5  	    goto fail_nomem;
     1.6  
     1.7 +	/*
     1.8 +	 * grant_table_create() can't fully initialize grant table for domain
     1.9 +	 * because it is called before arch_domain_create().
    1.10 +	 * Here we complete the initialization which requires p2m table.
    1.11 +	 */
    1.12 +	spin_lock(&d->grant_table->lock);
    1.13 +	for (i = 0; i < nr_grant_frames(d->grant_table); i++)
    1.14 +		ia64_gnttab_create_shared_page(d, d->grant_table, i);
    1.15 +	spin_unlock(&d->grant_table->lock);
    1.16 +
    1.17  	d->arch.ioport_caps = rangeset_new(d, "I/O Ports",
    1.18  	                                   RANGESETF_prettyprint_hex);
    1.19  
     2.1 --- a/xen/include/asm-ia64/grant_table.h	Mon Feb 19 16:05:34 2007 +0000
     2.2 +++ b/xen/include/asm-ia64/grant_table.h	Mon Feb 19 16:06:03 2007 +0000
     2.3 @@ -14,15 +14,6 @@ int destroy_grant_host_mapping(unsigned 
     2.4  // for grant transfer
     2.5  void guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn);
     2.6  
     2.7 -// for grant table shared page
     2.8 -#define gnttab_create_shared_page(d, t, i)                              \
     2.9 -    do {                                                                \
    2.10 -        share_xen_page_with_guest(                                      \
    2.11 -            virt_to_page((char *)(t)->shared + ((i) << PAGE_SHIFT)),    \
    2.12 -            (d), XENSHARE_writable);                                    \
    2.13 -    } while (0)
    2.14 -
    2.15 -
    2.16  /* XXX
    2.17   * somewhere appropriate
    2.18   * those constand shouldn't be pre-defined and
    2.19 @@ -39,14 +30,32 @@ void guest_physmap_add_page(struct domai
    2.20  /* Guest physical address of the grant table.  */
    2.21  #define IA64_GRANT_TABLE_PADDR  IA64_XMAPPEDREGS_PADDR(NR_CPUS)
    2.22  
    2.23 -#define gnttab_shared_maddr(d, t, i)                        \
    2.24 -    virt_to_maddr((char*)(t)->shared + ((i) << PAGE_SHIFT))
    2.25 +#define gnttab_shared_maddr(t, i)       (virt_to_maddr((t)->shared[(i)]))
    2.26 +#define gnttab_shared_page(t, i)        (virt_to_page((t)->shared[(i)]))
    2.27  
    2.28 -# define gnttab_shared_gmfn(d, t, i)                                    \
    2.29 -    ({ assign_domain_page((d),                                          \
    2.30 -                          IA64_GRANT_TABLE_PADDR + ((i) << PAGE_SHIFT), \
    2.31 -                          gnttab_shared_maddr((d), (t), (i)));          \
    2.32 -        (IA64_GRANT_TABLE_PADDR >> PAGE_SHIFT) + (i);})
    2.33 +#define ia64_gnttab_create_shared_page(d, t, i)                         \
    2.34 +    do {                                                                \
    2.35 +        BUG_ON((d)->arch.mm.pgd == NULL);                               \
    2.36 +        assign_domain_page((d),                                         \
    2.37 +                           IA64_GRANT_TABLE_PADDR + ((i) << PAGE_SHIFT), \
    2.38 +                           gnttab_shared_maddr((t), (i)));              \
    2.39 +    } while (0)
    2.40 +
    2.41 +/*
    2.42 + * for grant table shared page
    2.43 + * grant_table_create() might call this macro before allocating the p2m table.
    2.44 + * In such case, arch_domain_create() completes the initialization.
    2.45 + */
    2.46 +#define gnttab_create_shared_page(d, t, i)                      \
    2.47 +    do {                                                        \
    2.48 +        share_xen_page_with_guest(gnttab_shared_page((t), (i)), \
    2.49 +                                  (d), XENSHARE_writable);      \
    2.50 +        if ((d)->arch.mm.pgd)                                   \
    2.51 +            ia64_gnttab_create_shared_page((d), (t), (i));      \
    2.52 +    } while (0)
    2.53 +
    2.54 +#define gnttab_shared_gmfn(d, t, i)                 \
    2.55 +    ((IA64_GRANT_TABLE_PADDR >> PAGE_SHIFT) + (i))
    2.56  
    2.57  #define gnttab_mark_dirty(d, f) ((void)f)
    2.58