ia64/xen-unstable

changeset 19388:f68c081bfe0b

x86: Change the mod_lx_entry to accept the vcpu parameter

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 18 11:50:16 2009 +0000 (2009-03-18)
parents a5f497f02e34
children c1aa7b9d4842
files xen/arch/x86/mm.c
line diff
     1.1 --- a/xen/arch/x86/mm.c	Wed Mar 18 11:49:26 2009 +0000
     1.2 +++ b/xen/arch/x86/mm.c	Wed Mar 18 11:50:16 2009 +0000
     1.3 @@ -1657,12 +1657,12 @@ static inline int update_intpte(intpte_t
     1.4                    (_m), (_v), (_ad))
     1.5  
     1.6  /* Update the L1 entry at pl1e to new value nl1e. */
     1.7 -static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e, 
     1.8 -                        unsigned long gl1mfn, int preserve_ad)
     1.9 +static int mod_l1_entry(l1_pgentry_t *pl1e, l1_pgentry_t nl1e,
    1.10 +                        unsigned long gl1mfn, int preserve_ad,
    1.11 +                        struct vcpu *vcpu)
    1.12  {
    1.13      l1_pgentry_t ol1e;
    1.14 -    struct vcpu *curr = current;
    1.15 -    struct domain *d = curr->domain;
    1.16 +    struct domain *d = vcpu->domain;
    1.17      unsigned long mfn;
    1.18      p2m_type_t p2mt;
    1.19      int rc = 1;
    1.20 @@ -1672,7 +1672,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
    1.21  
    1.22      if ( unlikely(paging_mode_refcounts(d)) )
    1.23      {
    1.24 -        rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr, preserve_ad);
    1.25 +        rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, vcpu, preserve_ad);
    1.26          return rc;
    1.27      }
    1.28  
    1.29 @@ -1696,7 +1696,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
    1.30          if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) )
    1.31          {
    1.32              adjust_guest_l1e(nl1e, d);
    1.33 -            rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
    1.34 +            rc = UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, vcpu,
    1.35                                preserve_ad);
    1.36              return rc;
    1.37          }
    1.38 @@ -1705,14 +1705,14 @@ static int mod_l1_entry(l1_pgentry_t *pl
    1.39              return 0;
    1.40          
    1.41          adjust_guest_l1e(nl1e, d);
    1.42 -        if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
    1.43 +        if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, vcpu,
    1.44                                      preserve_ad)) )
    1.45          {
    1.46              ol1e = nl1e;
    1.47              rc = 0;
    1.48          }
    1.49      }
    1.50 -    else if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr,
    1.51 +    else if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, vcpu,
    1.52                                       preserve_ad)) )
    1.53      {
    1.54          return 0;
    1.55 @@ -1727,11 +1727,11 @@ static int mod_l1_entry(l1_pgentry_t *pl
    1.56  static int mod_l2_entry(l2_pgentry_t *pl2e, 
    1.57                          l2_pgentry_t nl2e, 
    1.58                          unsigned long pfn,
    1.59 -                        int preserve_ad)
    1.60 +                        int preserve_ad,
    1.61 +                        struct vcpu *vcpu)
    1.62  {
    1.63      l2_pgentry_t ol2e;
    1.64 -    struct vcpu *curr = current;
    1.65 -    struct domain *d = curr->domain;
    1.66 +    struct domain *d = vcpu->domain;
    1.67      struct page_info *l2pg = mfn_to_page(pfn);
    1.68      unsigned long type = l2pg->u.inuse.type_info;
    1.69      int rc = 1;
    1.70 @@ -1758,7 +1758,7 @@ static int mod_l2_entry(l2_pgentry_t *pl
    1.71          if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT) )
    1.72          {
    1.73              adjust_guest_l2e(nl2e, d);
    1.74 -            rc = UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr, preserve_ad);
    1.75 +            rc = UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu, preserve_ad);
    1.76              return rc;
    1.77          }
    1.78  
    1.79 @@ -1766,14 +1766,14 @@ static int mod_l2_entry(l2_pgentry_t *pl
    1.80              return 0;
    1.81  
    1.82          adjust_guest_l2e(nl2e, d);
    1.83 -        if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr,
    1.84 +        if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu,
    1.85                                      preserve_ad)) )
    1.86          {
    1.87              ol2e = nl2e;
    1.88              rc = 0;
    1.89          }
    1.90      }
    1.91 -    else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr,
    1.92 +    else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, vcpu,
    1.93                                       preserve_ad)) )
    1.94      {
    1.95          return 0;
    1.96 @@ -1788,11 +1788,11 @@ static int mod_l3_entry(l3_pgentry_t *pl
    1.97                          l3_pgentry_t nl3e, 
    1.98                          unsigned long pfn,
    1.99                          int preserve_ad,
   1.100 -                        int preemptible)
   1.101 +                        int preemptible,
   1.102 +                        struct vcpu *vcpu)
   1.103  {
   1.104      l3_pgentry_t ol3e;
   1.105 -    struct vcpu *curr = current;
   1.106 -    struct domain *d = curr->domain;
   1.107 +    struct domain *d = vcpu->domain;
   1.108      int rc = 0;
   1.109  
   1.110      if ( unlikely(!is_guest_l3_slot(pgentry_ptr_to_slot(pl3e))) )
   1.111 @@ -1824,7 +1824,7 @@ static int mod_l3_entry(l3_pgentry_t *pl
   1.112          if ( !l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT) )
   1.113          {
   1.114              adjust_guest_l3e(nl3e, d);
   1.115 -            rc = UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr, preserve_ad);
   1.116 +            rc = UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, vcpu, preserve_ad);
   1.117              return rc ? 0 : -EFAULT;
   1.118          }
   1.119  
   1.120 @@ -1834,14 +1834,14 @@ static int mod_l3_entry(l3_pgentry_t *pl
   1.121          rc = 0;
   1.122  
   1.123          adjust_guest_l3e(nl3e, d);
   1.124 -        if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr,
   1.125 +        if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, vcpu,
   1.126                                      preserve_ad)) )
   1.127          {
   1.128              ol3e = nl3e;
   1.129              rc = -EFAULT;
   1.130          }
   1.131      }
   1.132 -    else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr,
   1.133 +    else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, vcpu,
   1.134                                       preserve_ad)) )
   1.135      {
   1.136          return -EFAULT;
   1.137 @@ -1866,10 +1866,10 @@ static int mod_l4_entry(l4_pgentry_t *pl
   1.138                          l4_pgentry_t nl4e, 
   1.139                          unsigned long pfn,
   1.140                          int preserve_ad,
   1.141 -                        int preemptible)
   1.142 +                        int preemptible,
   1.143 +                        struct vcpu *vcpu)
   1.144  {
   1.145 -    struct vcpu *curr = current;
   1.146 -    struct domain *d = curr->domain;
   1.147 +    struct domain *d = vcpu->domain;
   1.148      l4_pgentry_t ol4e;
   1.149      int rc = 0;
   1.150  
   1.151 @@ -1895,7 +1895,7 @@ static int mod_l4_entry(l4_pgentry_t *pl
   1.152          if ( !l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT) )
   1.153          {
   1.154              adjust_guest_l4e(nl4e, d);
   1.155 -            rc = UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr, preserve_ad);
   1.156 +            rc = UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, vcpu, preserve_ad);
   1.157              return rc ? 0 : -EFAULT;
   1.158          }
   1.159  
   1.160 @@ -1905,14 +1905,14 @@ static int mod_l4_entry(l4_pgentry_t *pl
   1.161          rc = 0;
   1.162  
   1.163          adjust_guest_l4e(nl4e, d);
   1.164 -        if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr,
   1.165 +        if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, vcpu,
   1.166                                      preserve_ad)) )
   1.167          {
   1.168              ol4e = nl4e;
   1.169              rc = -EFAULT;
   1.170          }
   1.171      }
   1.172 -    else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr,
   1.173 +    else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, vcpu,
   1.174                                       preserve_ad)) )
   1.175      {
   1.176          return -EFAULT;
   1.177 @@ -2422,7 +2422,7 @@ int new_guest_cr3(unsigned long mfn)
   1.178                      l4e_from_pfn(
   1.179                          mfn,
   1.180                          (_PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED)),
   1.181 -                    pagetable_get_pfn(curr->arch.guest_table), 0, 0) == 0;
   1.182 +                    pagetable_get_pfn(curr->arch.guest_table), 0, 0, curr) == 0;
   1.183          if ( unlikely(!okay) )
   1.184          {
   1.185              MEM_LOG("Error while installing new compat baseptr %lx", mfn);
   1.186 @@ -3057,21 +3057,24 @@ int do_mmu_update(
   1.187                  {
   1.188                      l1_pgentry_t l1e = l1e_from_intpte(req.val);
   1.189                      okay = mod_l1_entry(va, l1e, mfn,
   1.190 -                                        cmd == MMU_PT_UPDATE_PRESERVE_AD);
   1.191 +                                        cmd == MMU_PT_UPDATE_PRESERVE_AD,
   1.192 +                                        current);
   1.193                  }
   1.194                  break;
   1.195                  case PGT_l2_page_table:
   1.196                  {
   1.197                      l2_pgentry_t l2e = l2e_from_intpte(req.val);
   1.198                      okay = mod_l2_entry(va, l2e, mfn,
   1.199 -                                        cmd == MMU_PT_UPDATE_PRESERVE_AD);
   1.200 +                                        cmd == MMU_PT_UPDATE_PRESERVE_AD,
   1.201 +                                        current);
   1.202                  }
   1.203                  break;
   1.204                  case PGT_l3_page_table:
   1.205                  {
   1.206                      l3_pgentry_t l3e = l3e_from_intpte(req.val);
   1.207                      rc = mod_l3_entry(va, l3e, mfn,
   1.208 -                                      cmd == MMU_PT_UPDATE_PRESERVE_AD, 1);
   1.209 +                                      cmd == MMU_PT_UPDATE_PRESERVE_AD, 1,
   1.210 +                                      current);
   1.211                      okay = !rc;
   1.212                  }
   1.213                  break;
   1.214 @@ -3080,7 +3083,8 @@ int do_mmu_update(
   1.215                  {
   1.216                      l4_pgentry_t l4e = l4e_from_intpte(req.val);
   1.217                      rc = mod_l4_entry(va, l4e, mfn,
   1.218 -                                      cmd == MMU_PT_UPDATE_PRESERVE_AD, 1);
   1.219 +                                      cmd == MMU_PT_UPDATE_PRESERVE_AD, 1,
   1.220 +                                      current);
   1.221                      okay = !rc;
   1.222                  }
   1.223                  break;
   1.224 @@ -3605,7 +3609,7 @@ int do_update_va_mapping(unsigned long v
   1.225          goto out;
   1.226      }
   1.227  
   1.228 -    rc = mod_l1_entry(pl1e, val, gl1mfn, 0) ? 0 : -EINVAL;
   1.229 +    rc = mod_l1_entry(pl1e, val, gl1mfn, 0, v) ? 0 : -EINVAL;
   1.230  
   1.231      page_unlock(gl1pg);
   1.232      put_page(gl1pg);