ia64/xen-unstable

changeset 9999:7bba3c5af9a8

[IA64] Fix a vtlb bug and do some cleanup

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author awilliam@xenbuild.aw
date Fri May 12 08:27:51 2006 -0600 (2006-05-12)
parents 07a75bf044b4
children 4fc1110f09c9
files xen/arch/ia64/vmx/vmmu.c xen/arch/ia64/vmx/vtlb.c
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmmu.c	Fri May 12 08:13:18 2006 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vmmu.c	Fri May 12 08:27:51 2006 -0600
     1.3 @@ -138,7 +138,7 @@ static void init_domain_vhpt(struct vcpu
     1.4      }
     1.5      vbase = page_to_virt(page);
     1.6      memset(vbase, 0, VCPU_VHPT_SIZE);
     1.7 -    printk("Allocate domain tlb at 0x%p\n", vbase);
     1.8 +    printk("Allocate domain vhpt at 0x%p\n", vbase);
     1.9      
    1.10      VHPT(v,hash) = vbase;
    1.11      VHPT(v,hash_sz) = VCPU_VHPT_SIZE/2;
    1.12 @@ -161,7 +161,7 @@ void init_domain_tlb(struct vcpu *v)
    1.13      }
    1.14      vbase = page_to_virt(page);
    1.15      memset(vbase, 0, VCPU_VTLB_SIZE);
    1.16 -    printk("Allocate domain tlb at 0x%p\n", vbase);
    1.17 +    printk("Allocate domain vtlb at 0x%p\n", vbase);
    1.18      
    1.19      VTLB(v,hash) = vbase;
    1.20      VTLB(v,hash_sz) = VCPU_VTLB_SIZE/2;
     2.1 --- a/xen/arch/ia64/vmx/vtlb.c	Fri May 12 08:13:18 2006 -0600
     2.2 +++ b/xen/arch/ia64/vmx/vtlb.c	Fri May 12 08:27:51 2006 -0600
     2.3 @@ -274,36 +274,36 @@ thash_data_t * vhpt_lookup(u64 va)
     2.4  static void vtlb_purge(thash_cb_t *hcb, u64 va, u64 ps)
     2.5  {
     2.6      thash_data_t *hash_table, *prev, *next;
     2.7 -    u64 start, end, size, tag, rid;
     2.8 +    u64 start, end, size, tag, rid, def_size;
     2.9      ia64_rr vrr;
    2.10      vcpu_get_rr(current, va, &vrr.rrval);
    2.11      rid = vrr.rid;
    2.12      size = PSIZE(ps);
    2.13      start = va & (-size);
    2.14      end = start + size;
    2.15 +    def_size = PSIZE(vrr.ps);
    2.16      while(start < end){
    2.17          hash_table = vsa_thash(hcb->pta, start, vrr.rrval, &tag);
    2.18 -//	    tag = ia64_ttag(start);
    2.19          if(!INVALID_TLB(hash_table)){
    2.20 -    	if(hash_table->etag == tag){
    2.21 -            __rem_hash_head(hcb, hash_table);
    2.22 -    	}
    2.23 -	    else{
    2.24 -    	    prev=hash_table;
    2.25 -	        next=prev->next;
    2.26 -	        while(next){
    2.27 -        		if(next->etag == tag){
    2.28 -	        	    prev->next=next->next;
    2.29 -		            cch_free(hcb,next);
    2.30 -		            hash_table->len--;
    2.31 -        		    break;
    2.32 -	        	}
    2.33 -		        prev=next;
    2.34 -    		    next=next->next;
    2.35 -    	    }
    2.36 -    	}
    2.37 +            if(hash_table->etag == tag){
    2.38 +                __rem_hash_head(hcb, hash_table);
    2.39 +            }
    2.40 +            else{
    2.41 +                prev=hash_table;
    2.42 +                next=prev->next;
    2.43 +                while(next){
    2.44 +                    if(next->etag == tag){
    2.45 +                        prev->next=next->next;
    2.46 +                        cch_free(hcb,next);
    2.47 +                        hash_table->len--;
    2.48 +                        break;
    2.49 +                    }
    2.50 +                    prev=next;
    2.51 +                    next=next->next;
    2.52 +                }
    2.53 +            }
    2.54          }
    2.55 -	    start += PAGE_SIZE;
    2.56 +        start += def_size;
    2.57      }
    2.58  //    machine_tlb_purge(va, ps);
    2.59  }
    2.60 @@ -319,26 +319,26 @@ static void vhpt_purge(thash_cb_t *hcb, 
    2.61      start = va & (-size);
    2.62      end = start + size;
    2.63      while(start < end){
    2.64 -    	hash_table = (thash_data_t *)ia64_thash(start);
    2.65 -	    tag = ia64_ttag(start);
    2.66 -    	if(hash_table->etag == tag ){
    2.67 +        hash_table = (thash_data_t *)ia64_thash(start);
    2.68 +        tag = ia64_ttag(start);
    2.69 +        if(hash_table->etag == tag ){
    2.70              __rem_hash_head(hcb, hash_table);
    2.71 -    	}
    2.72 -	    else{
    2.73 -    	    prev=hash_table;
    2.74 -	        next=prev->next;
    2.75 -	        while(next){
    2.76 -        		if(next->etag == tag){
    2.77 -	        	    prev->next=next->next;
    2.78 -		            cch_free(hcb,next);
    2.79 -		            hash_table->len--;
    2.80 -        		    break;
    2.81 -	        	}
    2.82 -		        prev=next;
    2.83 -    		    next=next->next;
    2.84 -    	    }
    2.85 -    	}
    2.86 -	    start += PAGE_SIZE;
    2.87 +        }
    2.88 +        else{
    2.89 +            prev=hash_table;
    2.90 +            next=prev->next;
    2.91 +            while(next){
    2.92 +                if(next->etag == tag){
    2.93 +                    prev->next=next->next;
    2.94 +                    cch_free(hcb,next);
    2.95 +                    hash_table->len--;
    2.96 +                    break;
    2.97 +                }
    2.98 +                prev=next;
    2.99 +                next=next->next;
   2.100 +            }
   2.101 +        }
   2.102 +        start += PAGE_SIZE;
   2.103      }
   2.104      machine_tlb_purge(va, ps);
   2.105  }