ia64/xen-unstable

changeset 15917:babe17e7a4ee

[XEN] p2m: internal p2m_set_entry() function uses types rather than
having callers decode them.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Mon Sep 17 10:38:59 2007 +0100 (2007-09-17)
parents f4bbd3f327e4
children 49700bb716bb
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Fri Sep 14 16:40:49 2007 +0100
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Mon Sep 17 10:38:59 2007 +0100
     1.3 @@ -201,7 +201,7 @@ p2m_next_level(struct domain *d, mfn_t *
     1.4  
     1.5  // Returns 0 on error (out of memory)
     1.6  static int
     1.7 -set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, u32 l1e_flags)
     1.8 +set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt)
     1.9  {
    1.10      // XXX -- this might be able to be faster iff current->domain == d
    1.11      mfn_t table_mfn = pagetable_get_mfn(d->arch.phys_table);
    1.12 @@ -245,7 +245,7 @@ set_p2m_entry(struct domain *d, unsigned
    1.13          d->arch.p2m.max_mapped_pfn = gfn;
    1.14  
    1.15      if ( mfn_valid(mfn) )
    1.16 -        entry_content = l1e_from_pfn(mfn_x(mfn), l1e_flags);
    1.17 +        entry_content = l1e_from_pfn(mfn_x(mfn), p2m_type_to_flags(p2mt));
    1.18      else
    1.19          entry_content = l1e_empty();
    1.20  
    1.21 @@ -328,11 +328,10 @@ int p2m_alloc_table(struct domain *d,
    1.22      P2M_PRINTK("populating p2m table\n");
    1.23  
    1.24      /* Initialise physmap tables for slot zero. Other code assumes this. */
    1.25 -    gfn = 0;
    1.26 -    mfn = _mfn(INVALID_MFN);
    1.27 -    if ( !set_p2m_entry(d, gfn, mfn, __PAGE_HYPERVISOR|_PAGE_USER) )
    1.28 +    if ( !set_p2m_entry(d, 0, _mfn(INVALID_MFN), p2m_invalid) )
    1.29          goto error;
    1.30  
    1.31 +    /* Copy all existing mappings from the page list and m2p */
    1.32      for ( entry = d->page_list.next;
    1.33            entry != &d->page_list;
    1.34            entry = entry->next )
    1.35 @@ -348,7 +347,7 @@ int p2m_alloc_table(struct domain *d,
    1.36              (gfn != 0x55555555L)
    1.37  #endif
    1.38               && gfn != INVALID_M2P_ENTRY
    1.39 -             && !set_p2m_entry(d, gfn, mfn, __PAGE_HYPERVISOR|_PAGE_USER) )
    1.40 +            && !set_p2m_entry(d, gfn, mfn, p2m_ram_rw) )
    1.41              goto error;
    1.42      }
    1.43  
    1.44 @@ -663,7 +662,7 @@ p2m_remove_page(struct domain *d, unsign
    1.45          return;
    1.46      P2M_DEBUG("removing gfn=%#lx mfn=%#lx\n", gfn, mfn);
    1.47  
    1.48 -    set_p2m_entry(d, gfn, _mfn(INVALID_MFN), 0);
    1.49 +    set_p2m_entry(d, gfn, _mfn(INVALID_MFN), p2m_invalid);
    1.50      set_gpfn_from_mfn(mfn, INVALID_M2P_ENTRY);
    1.51  }
    1.52  
    1.53 @@ -727,14 +726,14 @@ guest_physmap_add_entry(struct domain *d
    1.54  
    1.55      if ( mfn_valid(_mfn(mfn)) ) 
    1.56      {
    1.57 -        set_p2m_entry(d, gfn, _mfn(mfn), p2m_type_to_flags(t));
    1.58 +        set_p2m_entry(d, gfn, _mfn(mfn), t);
    1.59          set_gpfn_from_mfn(mfn, gfn);
    1.60      }
    1.61      else
    1.62      {
    1.63          gdprintk(XENLOG_WARNING, "Adding bad mfn to p2m map (%#lx -> %#lx)\n",
    1.64                   gfn, mfn);
    1.65 -        set_p2m_entry(d, gfn, _mfn(INVALID_MFN), 0);
    1.66 +        set_p2m_entry(d, gfn, _mfn(INVALID_MFN), p2m_invalid);
    1.67      }
    1.68  
    1.69      audit_p2m(d);
    1.70 @@ -854,7 +853,7 @@ p2m_type_t p2m_change_type(struct domain
    1.71  
    1.72      mfn = gfn_to_mfn(d, gfn, &pt);
    1.73      if ( pt == ot )
    1.74 -        set_p2m_entry(d, gfn, mfn, p2m_type_to_flags(nt));
    1.75 +        set_p2m_entry(d, gfn, mfn, nt);
    1.76  
    1.77      p2m_unlock(d);
    1.78