direct-io.hg

changeset 10127:41e7549d7df9

[IA64] struct mm is now a field of struct domain

struct mm is now a field of struct domain (instead of a pointer).

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Wed May 17 15:53:05 2006 -0600 (2006-05-17)
parents 8df6a7308178
children bd714da877c7
files xen/arch/ia64/linux-xen/setup.c xen/arch/ia64/xen/domain.c xen/include/asm-ia64/domain.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/setup.c	Wed May 17 15:53:00 2006 -0600
     1.2 +++ b/xen/arch/ia64/linux-xen/setup.c	Wed May 17 15:53:05 2006 -0600
     1.3 @@ -800,8 +800,7 @@ cpu_init (void)
     1.4  	cpu_data = per_cpu_init();
     1.5  
     1.6  #ifdef XEN
     1.7 -	printf ("cpu_init: current=%p, current->domain->arch.mm=%p\n",
     1.8 -		current, current->domain->arch.mm);
     1.9 +	printf ("cpu_init: current=%p\n", current);
    1.10  #endif
    1.11  
    1.12  	/*
    1.13 @@ -871,12 +870,11 @@ cpu_init (void)
    1.14  	atomic_inc(&init_mm.mm_count);
    1.15  	current->active_mm = &init_mm;
    1.16  #endif
    1.17 -#ifdef XEN
    1.18 -	if (current->domain->arch.mm)
    1.19 -#else
    1.20 +#ifndef XEN
    1.21  	if (current->mm)
    1.22 +		BUG();
    1.23  #endif
    1.24 -		BUG();
    1.25 +
    1.26  
    1.27  #ifdef XEN
    1.28  	ia64_fph_enable();
     2.1 --- a/xen/arch/ia64/xen/domain.c	Wed May 17 15:53:00 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/domain.c	Wed May 17 15:53:05 2006 -0600
     2.3 @@ -83,9 +83,7 @@ static void try_to_clear_PGC_allocate(st
     2.4  /* this belongs in include/asm, but there doesn't seem to be a suitable place */
     2.5  void arch_domain_destroy(struct domain *d)
     2.6  {
     2.7 -	BUG_ON(d->arch.mm->pgd != NULL);
     2.8 -	if (d->arch.mm != NULL)
     2.9 -		xfree(d->arch.mm);
    2.10 +	BUG_ON(d->arch.mm.pgd != NULL);
    2.11  	if (d->shared_info != NULL)
    2.12  		free_xenheap_page(d->shared_info);
    2.13  
    2.14 @@ -242,22 +240,18 @@ int arch_domain_create(struct domain *d)
    2.15  		goto fail_nomem;
    2.16  	d->arch.sys_pgnr = 0;
    2.17  
    2.18 -	if ((d->arch.mm = xmalloc(struct mm_struct)) == NULL)
    2.19 -	    goto fail_nomem;
    2.20 -	memset(d->arch.mm, 0, sizeof(*d->arch.mm));
    2.21 +	memset(&d->arch.mm, 0, sizeof(d->arch.mm));
    2.22  
    2.23  	d->arch.physmap_built = 0;
    2.24 -	if ((d->arch.mm->pgd = pgd_alloc(d->arch.mm)) == NULL)
    2.25 +	if ((d->arch.mm.pgd = pgd_alloc(&d->arch.mm)) == NULL)
    2.26  	    goto fail_nomem;
    2.27  
    2.28  	printf ("arch_domain_create: domain=%p\n", d);
    2.29  	return 0;
    2.30  
    2.31  fail_nomem:
    2.32 -	if (d->arch.mm->pgd != NULL)
    2.33 -	    pgd_free(d->arch.mm->pgd);
    2.34 -	if (d->arch.mm != NULL)
    2.35 -	    xfree(d->arch.mm);
    2.36 +	if (d->arch.mm.pgd != NULL)
    2.37 +	    pgd_free(d->arch.mm.pgd);
    2.38  	if (d->shared_info != NULL)
    2.39  	    free_xenheap_page(d->shared_info);
    2.40  	return -ENOMEM;
    2.41 @@ -469,7 +463,7 @@ relinquish_pgd(struct domain* d, pgd_t *
    2.42  static void
    2.43  relinquish_mm(struct domain* d)
    2.44  {
    2.45 -    struct mm_struct* mm = d->arch.mm;
    2.46 +    struct mm_struct* mm = &d->arch.mm;
    2.47      unsigned long i;
    2.48      pgd_t* pgd;
    2.49  
    2.50 @@ -622,7 +616,7 @@ share_xen_page_with_guest(struct page_in
    2.51  static pte_t*
    2.52  lookup_alloc_domain_pte(struct domain* d, unsigned long mpaddr)
    2.53  {
    2.54 -    struct mm_struct *mm = d->arch.mm;
    2.55 +    struct mm_struct *mm = &d->arch.mm;
    2.56      pgd_t *pgd;
    2.57      pud_t *pud;
    2.58      pmd_t *pmd;
    2.59 @@ -650,7 +644,7 @@ lookup_alloc_domain_pte(struct domain* d
    2.60  static pte_t*
    2.61  lookup_noalloc_domain_pte(struct domain* d, unsigned long mpaddr)
    2.62  {
    2.63 -    struct mm_struct *mm = d->arch.mm;
    2.64 +    struct mm_struct *mm = &d->arch.mm;
    2.65      pgd_t *pgd;
    2.66      pud_t *pud;
    2.67      pmd_t *pmd;
    2.68 @@ -678,7 +672,7 @@ not_present:
    2.69  static pte_t*
    2.70  lookup_noalloc_domain_pte_none(struct domain* d, unsigned long mpaddr)
    2.71  {
    2.72 -    struct mm_struct *mm = d->arch.mm;
    2.73 +    struct mm_struct *mm = &d->arch.mm;
    2.74      pgd_t *pgd;
    2.75      pud_t *pud;
    2.76      pmd_t *pmd;
    2.77 @@ -917,7 +911,7 @@ try_to_clear_PGC_allocate(struct domain*
    2.78  static void
    2.79  zap_domain_page_one(struct domain *d, unsigned long mpaddr, int do_put_page)
    2.80  {
    2.81 -    struct mm_struct *mm = d->arch.mm;
    2.82 +    struct mm_struct *mm = &d->arch.mm;
    2.83      pte_t *pte;
    2.84      pte_t old_pte;
    2.85      unsigned long mfn;
    2.86 @@ -1071,7 +1065,7 @@ static void
    2.87  assign_domain_page_replace(struct domain *d, unsigned long mpaddr,
    2.88                             unsigned long mfn, unsigned int flags)
    2.89  {
    2.90 -    struct mm_struct *mm = d->arch.mm;
    2.91 +    struct mm_struct *mm = &d->arch.mm;
    2.92      pte_t* pte;
    2.93      pte_t old_pte;
    2.94  
    2.95 @@ -1195,7 +1189,7 @@ destroy_grant_host_mapping(unsigned long
    2.96          return GNTST_general_error;//XXX GNTST_bad_pseudo_phys_addr
    2.97  
    2.98      // update pte
    2.99 -    old_pte = ptep_get_and_clear(d->arch.mm, gpaddr, pte);
   2.100 +    old_pte = ptep_get_and_clear(&d->arch.mm, gpaddr, pte);
   2.101      if (pte_present(old_pte)) {
   2.102          old_mfn = pte_pfn(old_pte);//XXX
   2.103      }
   2.104 @@ -1316,7 +1310,7 @@ guest_physmap_remove_page(struct domain 
   2.105  /* Flush cache of domain d.  */
   2.106  void domain_cache_flush (struct domain *d, int sync_only)
   2.107  {
   2.108 -	struct mm_struct *mm = d->arch.mm;
   2.109 +	struct mm_struct *mm = &d->arch.mm;
   2.110  	pgd_t *pgd = mm->pgd;
   2.111  	unsigned long maddr;
   2.112  	int i,j,k, l;
     3.1 --- a/xen/include/asm-ia64/domain.h	Wed May 17 15:53:00 2006 -0600
     3.2 +++ b/xen/include/asm-ia64/domain.h	Wed May 17 15:53:05 2006 -0600
     3.3 @@ -22,8 +22,13 @@ extern void domain_cache_flush (struct d
     3.4  extern void panic_domain(struct pt_regs *, const char *, ...)
     3.5       __attribute__ ((noreturn, format (printf, 2, 3)));
     3.6  
     3.7 +struct mm_struct {
     3.8 +	pgd_t * pgd;
     3.9 +    //	atomic_t mm_users;			/* How many users with user space? */
    3.10 +};
    3.11 +
    3.12  struct arch_domain {
    3.13 -    struct mm_struct *mm;
    3.14 +    struct mm_struct mm;
    3.15      unsigned long metaphysical_rr0;
    3.16      unsigned long metaphysical_rr4;
    3.17  
    3.18 @@ -105,17 +110,6 @@ struct arch_vcpu {
    3.19      struct arch_vmx_struct arch_vmx; /* Virtual Machine Extensions */
    3.20  };
    3.21  
    3.22 -//#define thread arch._thread
    3.23 -
    3.24 -// FOLLOWING FROM linux-2.6.7/include/sched.h
    3.25 -
    3.26 -struct mm_struct {
    3.27 -	pgd_t * pgd;
    3.28 -    //	atomic_t mm_users;			/* How many users with user space? */
    3.29 -};
    3.30 -
    3.31 -extern struct mm_struct init_mm;
    3.32 -
    3.33  struct page_info * assign_new_domain_page(struct domain *d, unsigned long mpaddr);
    3.34  void assign_new_domain0_page(struct domain *d, unsigned long mpaddr);
    3.35  void __assign_domain_page(struct domain *d, unsigned long mpaddr, unsigned long physaddr);