ia64/xen-unstable

changeset 5602:2d8651ec10b9

bitkeeper revision 1.1726.1.8 (42c1acafTSObuXeDW7_GDxYN5dosRA)

Grant table support changes and fix cmpxchg_user
Signed-off-by: Matt Chapman <matthewc@hp.com>
author djm@kirby.fc.hp.com
date Tue Jun 28 20:01:51 2005 +0000 (2005-06-28)
parents cef83293394d
children da2752f150a0
files xen/arch/ia64/domain.c xen/arch/ia64/grant_table.c xen/include/asm-ia64/xensystem.h
line diff
     1.1 --- a/xen/arch/ia64/domain.c	Tue Jun 28 18:20:30 2005 +0000
     1.2 +++ b/xen/arch/ia64/domain.c	Tue Jun 28 20:01:51 2005 +0000
     1.3 @@ -465,10 +465,44 @@ if (unlikely(page_to_phys(p) > vhpt_padd
     1.4  		set_pte(pte, pfn_pte(page_to_phys(p) >> PAGE_SHIFT,
     1.5  			__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
     1.6  	}
     1.7 -	else printk("map_new_domain_page: page %p already mapped!\n",p);
     1.8 +	else printk("map_new_domain_page: mpaddr %lx already mapped!\n",mpaddr);
     1.9  	return p;
    1.10  }
    1.11  
    1.12 +/* map a physical address to the specified metaphysical addr */
    1.13 +void map_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physaddr)
    1.14 +{
    1.15 +	struct mm_struct *mm = d->arch.mm;
    1.16 +	pgd_t *pgd;
    1.17 +	pud_t *pud;
    1.18 +	pmd_t *pmd;
    1.19 +	pte_t *pte;
    1.20 +
    1.21 +	if (!mm->pgd) {
    1.22 +		printk("map_domain_page: domain pgd must exist!\n");
    1.23 +		return;
    1.24 +	}
    1.25 +	pgd = pgd_offset(mm,mpaddr);
    1.26 +	if (pgd_none(*pgd))
    1.27 +		pgd_populate(mm, pgd, pud_alloc_one(mm,mpaddr));
    1.28 +
    1.29 +	pud = pud_offset(pgd, mpaddr);
    1.30 +	if (pud_none(*pud))
    1.31 +		pud_populate(mm, pud, pmd_alloc_one(mm,mpaddr));
    1.32 +
    1.33 +	pmd = pmd_offset(pud, mpaddr);
    1.34 +	if (pmd_none(*pmd))
    1.35 +		pmd_populate_kernel(mm, pmd, pte_alloc_one_kernel(mm,mpaddr));
    1.36 +//		pmd_populate(mm, pmd, pte_alloc_one(mm,mpaddr));
    1.37 +
    1.38 +	pte = pte_offset_map(pmd, mpaddr);
    1.39 +	if (pte_none(*pte)) {
    1.40 +		set_pte(pte, pfn_pte(physaddr >> PAGE_SHIFT,
    1.41 +			__pgprot(__DIRTY_BITS | _PAGE_PL_2 | _PAGE_AR_RWX)));
    1.42 +	}
    1.43 +	else printk("map_domain_page: mpaddr %lx already mapped!\n",mpaddr);
    1.44 +}
    1.45 +
    1.46  void mpafoo(unsigned long mpaddr)
    1.47  {
    1.48  	extern unsigned long privop_trace;
     2.1 --- a/xen/arch/ia64/grant_table.c	Tue Jun 28 18:20:30 2005 +0000
     2.2 +++ b/xen/arch/ia64/grant_table.c	Tue Jun 28 20:01:51 2005 +0000
     2.3 @@ -570,13 +570,13 @@ static int
     2.4          /* Frame is now unmapped for device access. */
     2.5      }
     2.6  
     2.7 -#ifdef __ia64__
     2.8 -// FIXME-ia64: any error checking need to be done here?
     2.9 -#else
    2.10      if ( (virt != 0) &&
    2.11           (flags & GNTMAP_host_map) &&
    2.12           ((act->pin & (GNTPIN_hstw_mask | GNTPIN_hstr_mask)) > 0))
    2.13      {
    2.14 +#ifdef __ia64__
    2.15 +// FIXME-ia64: any error checking need to be done here?
    2.16 +#else
    2.17          l1_pgentry_t   *pl1e;
    2.18          unsigned long   _ol1e;
    2.19  
    2.20 @@ -609,6 +609,7 @@ static int
    2.21              rc = -EINVAL;
    2.22              goto unmap_out;
    2.23          }
    2.24 +#endif
    2.25  
    2.26          map->ref_and_flags &= ~GNTMAP_host_map;
    2.27  
    2.28 @@ -627,7 +628,6 @@ static int
    2.29          rc = 0;
    2.30          *va = virt;
    2.31      }
    2.32 -#endif
    2.33  
    2.34      if ( (map->ref_and_flags & (GNTMAP_device_map|GNTMAP_host_map)) == 0)
    2.35      {
    2.36 @@ -696,6 +696,7 @@ gnttab_setup_table(
    2.37      gnttab_setup_table_t  op;
    2.38      struct domain        *d;
    2.39      int                   i;
    2.40 +    unsigned long addr;
    2.41  
    2.42      if ( count != 1 )
    2.43          return -EINVAL;
    2.44 @@ -735,10 +736,24 @@ gnttab_setup_table(
    2.45      {
    2.46          ASSERT(d->grant_table != NULL);
    2.47          (void)put_user(GNTST_okay, &uop->status);
    2.48 +#ifdef __ia64__
    2.49 +	if (d == dom0) {
    2.50 +            for ( i = 0; i < op.nr_frames; i++ )
    2.51 +                (void)put_user(
    2.52 +                    (virt_to_phys(d->grant_table->shared) >> PAGE_SHIFT) + i,
    2.53 +                    &uop->frame_list[i]);
    2.54 +	} else {
    2.55 +            /* IA64 hack - need to map it somewhere */
    2.56 +            addr = (1UL << 40);
    2.57 +            map_domain_page(d, addr, virt_to_phys(d->grant_table->shared));
    2.58 +            (void)put_user(addr >> PAGE_SHIFT, &uop->frame_list[0]);
    2.59 +        }
    2.60 +#else
    2.61          for ( i = 0; i < op.nr_frames; i++ )
    2.62              (void)put_user(
    2.63                  (virt_to_phys(d->grant_table->shared) >> PAGE_SHIFT) + i,
    2.64                  &uop->frame_list[i]);
    2.65 +#endif
    2.66      }
    2.67  
    2.68      put_domain(d);
     3.1 --- a/xen/include/asm-ia64/xensystem.h	Tue Jun 28 18:20:30 2005 +0000
     3.2 +++ b/xen/include/asm-ia64/xensystem.h	Tue Jun 28 20:01:51 2005 +0000
     3.3 @@ -66,13 +66,12 @@ extern struct task_struct *vmx_ia64_swit
     3.4  	register long __gu_r8 asm ("r8");				\
     3.5  	register long __gu_r9 asm ("r9");				\
     3.6  	asm volatile ("mov ar.ccv=%0;;" :: "rO"(old));			\
     3.7 -	asm volatile ("mov %2=r0;;\n"					\
     3.8 -		"[1:]\tcmpxchg"_size".acq %0=[%3],%4,ar.ccv\n"		\
     3.9 -		"\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n"		\
    3.10 +	asm volatile ("mov %1=r0;;\n"					\
    3.11 +		"[1:]\tcmpxchg"_size".acq %0=[%2],%3,ar.ccv\n"		\
    3.12 +		"\t.xdata4 \"__ex_table\", 1b-., 1f-.\n"		\
    3.13  		"[1:]"							\
    3.14 -		: "=r"(old), "=r"(__gu_r9), "=r"(__gu_r8) :		\
    3.15 +		: "=r"(old), "=r"(__gu_r8) :				\
    3.16  		"r"(ptr), "r"(new) : "memory");				\
    3.17 -	(old) = __gu_r9;						\
    3.18  	__gu_r8;							\
    3.19  })
    3.20