ia64/xen-unstable

changeset 6345:0b5ee83ea35c

Fix PAE and x86/64 when NX/XD is unavailable.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Aug 23 13:13:39 2005 +0000 (2005-08-23)
parents 3889ca17ff58
children b09f13ddd27b
files linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/ioremap.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c xen/arch/x86/mm.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Tue Aug 23 12:30:35 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c	Tue Aug 23 13:13:39 2005 +0000
     1.3 @@ -346,7 +346,7 @@ int direct_remap_area_pages(struct mm_st
     1.4  		 * Fill in the machine address: PTE ptr is done later by
     1.5  		 * __direct_remap_area_pages(). 
     1.6  		 */
     1.7 -		v->val = (machine_addr & PAGE_MASK) | pgprot_val(prot);
     1.8 +		v->val = pte_val_ma(pfn_pte_ma(machine_addr >> PAGE_SHIFT, prot));
     1.9  
    1.10  		machine_addr += PAGE_SIZE;
    1.11  		address += PAGE_SIZE; 
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/mm/ioremap.c	Tue Aug 23 12:30:35 2005 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/mm/ioremap.c	Tue Aug 23 13:13:39 2005 +0000
     2.3 @@ -50,7 +50,6 @@ void __init bt_iounmap(void *addr, unsig
     2.4  
     2.5  #else
     2.6  
     2.7 -#if defined(__i386__)
     2.8  /*
     2.9   * Does @address reside within a non-highmem page that is local to this virtual
    2.10   * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
    2.11 @@ -64,14 +63,7 @@ static inline int is_local_lowmem(unsign
    2.12  	unsigned long pfn = mfn_to_pfn(mfn);
    2.13  	return ((pfn < max_low_pfn) && (phys_to_machine_mapping[pfn] == mfn));
    2.14  }
    2.15 -#elif defined(__x86_64__)
    2.16 -/*
    2.17 - * 
    2.18 - */
    2.19 -static inline int is_local_lowmem(unsigned long address)
    2.20 -{
    2.21 -        return 0;
    2.22 -}
    2.23 +
    2.24  #endif
    2.25  
    2.26  /*
    2.27 @@ -142,9 +134,7 @@ void __iomem * __ioremap(unsigned long p
    2.28  	if (direct_remap_area_pages(&init_mm, (unsigned long) addr, phys_addr,
    2.29  				    size, __pgprot(_PAGE_PRESENT | _PAGE_RW |
    2.30  						   _PAGE_DIRTY | _PAGE_ACCESSED
    2.31 -#if defined(__x86_64__)
    2.32                                                     | _PAGE_USER
    2.33 -#endif
    2.34  						   | flags), domid)) {
    2.35  		vunmap((void __force *) addr);
    2.36  		return NULL;
    2.37 @@ -441,7 +431,7 @@ int direct_remap_area_pages(struct mm_st
    2.38  		 * Fill in the machine address: PTE ptr is done later by
    2.39  		 * __direct_remap_area_pages(). 
    2.40  		 */
    2.41 -		v->val = (machine_addr & PAGE_MASK) | pgprot_val(prot);
    2.42 +		v->val = pte_val_ma(pfn_pte_ma(machine_addr >> PAGE_SHIFT, prot));
    2.43  
    2.44  		machine_addr += PAGE_SIZE;
    2.45  		address += PAGE_SIZE; 
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Aug 23 12:30:35 2005 +0000
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Tue Aug 23 13:13:39 2005 +0000
     3.3 @@ -167,7 +167,7 @@ static int privcmd_ioctl(struct inode *i
     3.4              if (ret)
     3.5                  goto batch_err;
     3.6  
     3.7 -            u.val = (mfn << PAGE_SHIFT) | pgprot_val(vma->vm_page_prot);
     3.8 +            u.val = pte_val_ma(pfn_pte_ma(mfn, vma->vm_page_prot));
     3.9              u.ptr = ptep;
    3.10  
    3.11              if ( unlikely(HYPERVISOR_mmu_update(&u, 1, NULL, m.dom) < 0) )
     4.1 --- a/xen/arch/x86/mm.c	Tue Aug 23 12:30:35 2005 +0000
     4.2 +++ b/xen/arch/x86/mm.c	Tue Aug 23 13:13:39 2005 +0000
     4.3 @@ -444,7 +444,7 @@ get_page_from_l1e(
     4.4  
     4.5      if ( unlikely(l1e_get_flags(l1e) & L1_DISALLOW_MASK) )
     4.6      {
     4.7 -        MEM_LOG("Bad L1 flags %x\n", l1e_get_flags(l1e) & L1_DISALLOW_MASK);
     4.8 +        MEM_LOG("Bad L1 flags %x", l1e_get_flags(l1e) & L1_DISALLOW_MASK);
     4.9          return 0;
    4.10      }
    4.11  
    4.12 @@ -490,7 +490,7 @@ get_page_from_l2e(
    4.13  
    4.14      if ( unlikely((l2e_get_flags(l2e) & L2_DISALLOW_MASK)) )
    4.15      {
    4.16 -        MEM_LOG("Bad L2 flags %x\n", l2e_get_flags(l2e) & L2_DISALLOW_MASK);
    4.17 +        MEM_LOG("Bad L2 flags %x", l2e_get_flags(l2e) & L2_DISALLOW_MASK);
    4.18          return 0;
    4.19      }
    4.20  
    4.21 @@ -523,7 +523,7 @@ get_page_from_l3e(
    4.22  
    4.23      if ( unlikely((l3e_get_flags(l3e) & L3_DISALLOW_MASK)) )
    4.24      {
    4.25 -        MEM_LOG("Bad L3 flags %x\n", l3e_get_flags(l3e) & L3_DISALLOW_MASK);
    4.26 +        MEM_LOG("Bad L3 flags %x", l3e_get_flags(l3e) & L3_DISALLOW_MASK);
    4.27          return 0;
    4.28      }
    4.29  
    4.30 @@ -557,7 +557,7 @@ get_page_from_l4e(
    4.31  
    4.32      if ( unlikely((l4e_get_flags(l4e) & L4_DISALLOW_MASK)) )
    4.33      {
    4.34 -        MEM_LOG("Bad L4 flags %x\n", l4e_get_flags(l4e) & L4_DISALLOW_MASK);
    4.35 +        MEM_LOG("Bad L4 flags %x", l4e_get_flags(l4e) & L4_DISALLOW_MASK);
    4.36          return 0;
    4.37      }
    4.38  
    4.39 @@ -1025,7 +1025,7 @@ static inline int update_l1e(l1_pgentry_
    4.40           unlikely(o != l1e_get_intpte(ol1e)) )
    4.41      {
    4.42          MEM_LOG("Failed to update %" PRIpte " -> %" PRIpte
    4.43 -                ": saw %" PRIpte "\n",
    4.44 +                ": saw %" PRIpte,
    4.45                  l1e_get_intpte(ol1e),
    4.46                  l1e_get_intpte(nl1e),
    4.47                  o);
    4.48 @@ -1051,7 +1051,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
    4.49      {
    4.50          if ( unlikely(l1e_get_flags(nl1e) & L1_DISALLOW_MASK) )
    4.51          {
    4.52 -            MEM_LOG("Bad L1 flags %x\n",
    4.53 +            MEM_LOG("Bad L1 flags %x",
    4.54                      l1e_get_flags(nl1e) & L1_DISALLOW_MASK);
    4.55              return 0;
    4.56          }
    4.57 @@ -1113,7 +1113,7 @@ static int mod_l2_entry(l2_pgentry_t *pl
    4.58      {
    4.59          if ( unlikely(l2e_get_flags(nl2e) & L2_DISALLOW_MASK) )
    4.60          {
    4.61 -            MEM_LOG("Bad L2 flags %x\n",
    4.62 +            MEM_LOG("Bad L2 flags %x",
    4.63                      l2e_get_flags(nl2e) & L2_DISALLOW_MASK);
    4.64              return 0;
    4.65          }
    4.66 @@ -1175,7 +1175,7 @@ static int mod_l3_entry(l3_pgentry_t *pl
    4.67      {
    4.68          if ( unlikely(l3e_get_flags(nl3e) & L3_DISALLOW_MASK) )
    4.69          {
    4.70 -            MEM_LOG("Bad L3 flags %x\n",
    4.71 +            MEM_LOG("Bad L3 flags %x",
    4.72                      l3e_get_flags(nl3e) & L3_DISALLOW_MASK);
    4.73              return 0;
    4.74          }
    4.75 @@ -1237,7 +1237,7 @@ static int mod_l4_entry(l4_pgentry_t *pl
    4.76      {
    4.77          if ( unlikely(l4e_get_flags(nl4e) & L4_DISALLOW_MASK) )
    4.78          {
    4.79 -            MEM_LOG("Bad L4 flags %x\n",
    4.80 +            MEM_LOG("Bad L4 flags %x",
    4.81                      l4e_get_flags(nl4e) & L4_DISALLOW_MASK);
    4.82              return 0;
    4.83          }
    4.84 @@ -1598,7 +1598,7 @@ static int set_foreigndom(unsigned int c
    4.85              percpu_info[cpu].foreign = dom_io;
    4.86              break;
    4.87          default:
    4.88 -            MEM_LOG("Dom %u cannot set foreign dom\n", d->domain_id);
    4.89 +            MEM_LOG("Dom %u cannot set foreign dom", d->domain_id);
    4.90              okay = 0;
    4.91              break;
    4.92          }
    4.93 @@ -1831,7 +1831,7 @@ int do_mmuext_op(
    4.94          case MMUEXT_FLUSH_CACHE:
    4.95              if ( unlikely(!IS_CAPABLE_PHYSDEV(d)) )
    4.96              {
    4.97 -                MEM_LOG("Non-physdev domain tried to FLUSH_CACHE.\n");
    4.98 +                MEM_LOG("Non-physdev domain tried to FLUSH_CACHE.");
    4.99                  okay = 0;
   4.100              }
   4.101              else
   4.102 @@ -1845,7 +1845,7 @@ int do_mmuext_op(
   4.103              if ( shadow_mode_external(d) )
   4.104              {
   4.105                  MEM_LOG("ignoring SET_LDT hypercall from external "
   4.106 -                        "domain %u\n", d->domain_id);
   4.107 +                        "domain %u", d->domain_id);
   4.108                  okay = 0;
   4.109                  break;
   4.110              }
   4.111 @@ -1916,7 +1916,7 @@ int do_mmuext_op(
   4.112                   unlikely(IS_XEN_HEAP_FRAME(page)) )
   4.113              {
   4.114                  MEM_LOG("Transferee has no reservation headroom (%d,%d), or "
   4.115 -                        "page is in Xen heap (%lx), or dom is dying (%ld).\n",
   4.116 +                        "page is in Xen heap (%lx), or dom is dying (%ld).",
   4.117                          e->tot_pages, e->max_pages, op.mfn, e->domain_flags);
   4.118                  okay = 0;
   4.119                  goto reassign_fail;
   4.120 @@ -1937,7 +1937,7 @@ int do_mmuext_op(
   4.121                       unlikely(_nd != _d) )
   4.122                  {
   4.123                      MEM_LOG("Bad page values %lx: ed=%p(%u), sd=%p,"
   4.124 -                            " caf=%08x, taf=%" PRtype_info "\n",
   4.125 +                            " caf=%08x, taf=%" PRtype_info,
   4.126                              page_to_pfn(page), d, d->domain_id,
   4.127                              unpickle_domptr(_nd), x, page->u.inuse.type_info);
   4.128                      okay = 0;
   4.129 @@ -2301,7 +2301,7 @@ int update_grant_pte_mapping(
   4.130      if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) ||
   4.131           !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) )
   4.132      {
   4.133 -        DPRINTK("Grant map attempted to update a non-L1 page\n");
   4.134 +        MEM_LOG("Grant map attempted to update a non-L1 page");
   4.135          rc = GNTST_general_error;
   4.136          goto failed;
   4.137      }
   4.138 @@ -2363,7 +2363,7 @@ int clear_grant_pte_mapping(
   4.139      if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) ||
   4.140           !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) )
   4.141      {
   4.142 -        DPRINTK("Grant map attempted to update a non-L1 page\n");
   4.143 +        MEM_LOG("Grant map attempted to update a non-L1 page");
   4.144          rc = GNTST_general_error;
   4.145          goto failed;
   4.146      }
   4.147 @@ -2378,7 +2378,7 @@ int clear_grant_pte_mapping(
   4.148      /* Check that the virtual address supplied is actually mapped to frame. */
   4.149      if ( unlikely((l1e_get_intpte(ol1e) >> PAGE_SHIFT) != frame) )
   4.150      {
   4.151 -        DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n",
   4.152 +        MEM_LOG("PTE entry %lx for address %lx doesn't match frame %lx",
   4.153                  (unsigned long)l1e_get_intpte(ol1e), addr, frame);
   4.154          put_page_type(page);
   4.155          rc = GNTST_general_error;
   4.156 @@ -2388,7 +2388,7 @@ int clear_grant_pte_mapping(
   4.157      /* Delete pagetable entry. */
   4.158      if ( unlikely(__put_user(0, (intpte_t *)va)))
   4.159      {
   4.160 -        DPRINTK("Cannot delete PTE entry at %p.\n", va);
   4.161 +        MEM_LOG("Cannot delete PTE entry at %p", va);
   4.162          put_page_type(page);
   4.163          rc = GNTST_general_error;
   4.164          goto failed;
   4.165 @@ -2452,7 +2452,7 @@ int clear_grant_va_mapping(unsigned long
   4.166  
   4.167      if ( unlikely(__get_user(ol1e.l1, &pl1e->l1) != 0) )
   4.168      {
   4.169 -        DPRINTK("Could not find PTE entry for address %lx\n", addr);
   4.170 +        MEM_LOG("Could not find PTE entry for address %lx", addr);
   4.171          return GNTST_general_error;
   4.172      }
   4.173  
   4.174 @@ -2462,7 +2462,7 @@ int clear_grant_va_mapping(unsigned long
   4.175       */
   4.176      if ( unlikely(l1e_get_pfn(ol1e) != frame) )
   4.177      {
   4.178 -        DPRINTK("PTE entry %lx for address %lx doesn't match frame %lx\n",
   4.179 +        MEM_LOG("PTE entry %lx for address %lx doesn't match frame %lx",
   4.180                  l1e_get_pfn(ol1e), addr, frame);
   4.181          return GNTST_general_error;
   4.182      }
   4.183 @@ -2470,7 +2470,7 @@ int clear_grant_va_mapping(unsigned long
   4.184      /* Delete pagetable entry. */
   4.185      if ( unlikely(__put_user(0, &pl1e->l1)) )
   4.186      {
   4.187 -        DPRINTK("Cannot delete PTE entry at %p.\n", (unsigned long *)pl1e);
   4.188 +        MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e);
   4.189          return GNTST_general_error;
   4.190      }
   4.191      
   4.192 @@ -2930,7 +2930,7 @@ int revalidate_l1(
   4.193  
   4.194          if ( unlikely(!get_page_from_l1e(nl1e, d)) )
   4.195          {
   4.196 -            MEM_LOG("ptwr: Could not re-validate l1 page\n");
   4.197 +            MEM_LOG("ptwr: Could not re-validate l1 page");
   4.198              /*
   4.199               * Make the remaining p.t's consistent before crashing, so the
   4.200               * reference counts are correct.
   4.201 @@ -3056,7 +3056,7 @@ static int ptwr_emulated_update(
   4.202      /* Aligned access only, thank you. */
   4.203      if ( !access_ok(addr, bytes) || ((addr & (bytes-1)) != 0) )
   4.204      {
   4.205 -        MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %lx)\n",
   4.206 +        MEM_LOG("ptwr_emulate: Unaligned or bad size ptwr access (%d, %lx)",
   4.207                  bytes, addr);
   4.208          return X86EMUL_UNHANDLEABLE;
   4.209      }
   4.210 @@ -3089,7 +3089,7 @@ static int ptwr_emulated_update(
   4.211      if (__copy_from_user(&pte, &linear_pg_table[l1_linear_offset(addr)],
   4.212                           sizeof(pte)))
   4.213      {
   4.214 -        MEM_LOG("ptwr_emulate: Cannot read thru linear_pg_table\n");
   4.215 +        MEM_LOG("ptwr_emulate: Cannot read thru linear_pg_table");
   4.216          return X86EMUL_UNHANDLEABLE;
   4.217      }
   4.218  
   4.219 @@ -3102,7 +3102,7 @@ static int ptwr_emulated_update(
   4.220           (page_get_owner(page) != d) )
   4.221      {
   4.222          MEM_LOG("ptwr_emulate: Page is mistyped or bad pte "
   4.223 -                "(%lx, %" PRtype_info ")\n",
   4.224 +                "(%lx, %" PRtype_info ")",
   4.225                  l1e_get_pfn(pte), page->u.inuse.type_info);
   4.226          return X86EMUL_UNHANDLEABLE;
   4.227      }