# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1168063865 -32400 # Node ID 79fd3532f2e4c3c019cd535edf1068bc3cd96e93 # Parent 504addd06eeda65eb625b2969fb1d26cde7eb62b PATCHNAME: grow_granttable_ia64 Signed-off-by: Isaku Yamahata diff -r 504addd06eed -r 79fd3532f2e4 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Sat Jan 06 15:10:01 2007 +0900 +++ b/xen/arch/ia64/xen/domain.c Sat Jan 06 15:11:05 2007 +0900 @@ -491,6 +491,14 @@ int arch_domain_create(struct domain *d) if ((d->arch.mm.pgd = pgd_alloc(&d->arch.mm)) == NULL) goto fail_nomem; + /* + * grant_table_create() can't fully initialize grant table for domain + * because it is called before arch_domain_create(). + * Here we complete the initialization which requires p2m table. + */ + for (i = 0; i < d->grant_table->nr_grant_frames; i++) + ia64_gnttab_create_shared_page(d, d->grant_table, i); + d->arch.ioport_caps = rangeset_new(d, "I/O Ports", RANGESETF_prettyprint_hex); diff -r 504addd06eed -r 79fd3532f2e4 xen/include/asm-ia64/grant_table.h --- a/xen/include/asm-ia64/grant_table.h Sat Jan 06 15:10:01 2007 +0900 +++ b/xen/include/asm-ia64/grant_table.h Sat Jan 06 15:11:05 2007 +0900 @@ -13,15 +13,6 @@ int destroy_grant_host_mapping(unsigned // for grant transfer void guest_physmap_add_page(struct domain *d, unsigned long gpfn, unsigned long mfn); - -// for grant table shared page -#define gnttab_create_shared_page(d, t, i) \ - do { \ - share_xen_page_with_guest( \ - virt_to_page((char *)(t)->shared + ((i) << PAGE_SHIFT)), \ - (d), XENSHARE_writable); \ - } while (0) - /* XXX * somewhere appropriate @@ -40,13 +31,32 @@ void guest_physmap_add_page(struct domai #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)) + (virt_to_maddr((t)->shared_frames[(i)])) -# define gnttab_shared_gmfn(d, t, i) \ - ({ assign_domain_page((d), \ - IA64_GRANT_TABLE_PADDR + ((i) << PAGE_SHIFT), \ - gnttab_shared_maddr((d), (t), (i))); \ - (IA64_GRANT_TABLE_PADDR >> PAGE_SHIFT) + (i);}) +#define ia64_gnttab_create_shared_page(d, t, i) \ + do { \ + BUG_ON((d)->arch.mm.pgd == NULL); \ + assign_domain_page((d), \ + IA64_GRANT_TABLE_PADDR + ((i) << PAGE_SHIFT),\ + gnttab_shared_maddr((d), (t), (i))); \ + } while (0) + +/* + * for grant table shared page + * grant_table_create() might call this macro before allocating the p2m table. + * In such case, arch_domain_create() completes the initialization. + */ +#define gnttab_create_shared_page(d, t, i) \ + do { \ + share_xen_page_with_guest( \ + virt_to_page((t)->shared_frames[(i)]), \ + (d), XENSHARE_writable); \ + if ((d)->arch.mm.pgd) \ + ia64_gnttab_create_shared_page(d, t, i); \ + } while (0) + +#define gnttab_shared_gmfn(d, t, i) \ + (IA64_GRANT_TABLE_PADDR >> PAGE_SHIFT) + (i) #define gnttab_mark_dirty(d, f) ((void)f)