ia64/xen-unstable

changeset 16777:db81d2f94866

[IA64] domheap: Allocate shared_info page from domain heap

Hyperprivops were accessing shared_info page with psr.ic = 0.
They are accessing the page via current_psr_i_addr.
We can set it to shared_info_va which is mapped by IA64_TR_SHARED_INFO.
Thus we can allocate the page form domain heap

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Thu Jan 17 12:05:43 2008 -0700 (2008-01-17)
parents 0246cca2544e
children 851c52be63df
files xen/arch/ia64/xen/domain.c
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Thu Jan 17 12:05:43 2008 -0700
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Thu Jan 17 12:05:43 2008 -0700
     1.3 @@ -211,8 +211,9 @@ void schedule_tail(struct vcpu *prev)
     1.4  		load_region_regs(current);
     1.5  		ia64_set_pta(vcpu_pta(current));
     1.6  		vcpu_load_kernel_regs(current);
     1.7 -		__ia64_per_cpu_var(current_psr_i_addr) = &current->domain->
     1.8 -		  shared_info->vcpu_info[current->vcpu_id].evtchn_upcall_mask;
     1.9 +		__ia64_per_cpu_var(current_psr_i_addr) =
    1.10 +			(uint8_t*)(current->domain->arch.shared_info_va +
    1.11 +				   INT_ENABLE_OFFSET(current));
    1.12  		__ia64_per_cpu_var(current_psr_ic_addr) = (int *)
    1.13  		  (current->domain->arch.shared_info_va + XSI_PSR_IC_OFS);
    1.14  		migrate_timer(&current->arch.hlt_timer, current->processor);
    1.15 @@ -279,8 +280,9 @@ void context_switch(struct vcpu *prev, s
    1.16              vcpu_set_next_timer(current);
    1.17              if (vcpu_timer_expired(current))
    1.18                  vcpu_pend_timer(current);
    1.19 -            __ia64_per_cpu_var(current_psr_i_addr) = &nd->shared_info->
    1.20 -                vcpu_info[current->vcpu_id].evtchn_upcall_mask;
    1.21 +	    __ia64_per_cpu_var(current_psr_i_addr) =
    1.22 +		    (uint8_t*)(nd->arch.shared_info_va +
    1.23 +			       INT_ENABLE_OFFSET(current));
    1.24              __ia64_per_cpu_var(current_psr_ic_addr) =
    1.25                  (int *)(nd->arch.shared_info_va + XSI_PSR_IC_OFS);
    1.26              /* steal time accounting */
    1.27 @@ -556,6 +558,7 @@ integer_param("pervcpu_vhpt", opt_pervcp
    1.28  int arch_domain_create(struct domain *d)
    1.29  {
    1.30  	int i;
    1.31 +	struct page_info *page = NULL;
    1.32  	
    1.33  	// the following will eventually need to be negotiated dynamically
    1.34  	d->arch.shared_info_va = DEFAULT_SHAREDINFO_ADDR;
    1.35 @@ -575,9 +578,11 @@ int arch_domain_create(struct domain *d)
    1.36  #endif
    1.37  	if (tlb_track_create(d) < 0)
    1.38  		goto fail_nomem1;
    1.39 -	d->shared_info = alloc_xenheap_pages(get_order_from_shift(XSI_SHIFT));
    1.40 -	if (d->shared_info == NULL)
    1.41 -	    goto fail_nomem;
    1.42 +	page = alloc_domheap_pages(NULL, get_order_from_shift(XSI_SHIFT), 0);
    1.43 +	if (page == NULL)
    1.44 +		goto fail_nomem;
    1.45 +	d->shared_info = page_to_virt(page);
    1.46 +	BUG_ON(d->shared_info == NULL);
    1.47  	memset(d->shared_info, 0, XSI_SIZE);
    1.48  	for (i = 0; i < XSI_SIZE; i += PAGE_SIZE)
    1.49  	    share_xen_page_with_guest(virt_to_page((char *)d->shared_info + i),
    1.50 @@ -619,8 +624,8 @@ fail_nomem:
    1.51  fail_nomem1:
    1.52  	if (d->arch.mm.pgd != NULL)
    1.53  	    pgd_free(d->arch.mm.pgd);
    1.54 -	if (d->shared_info != NULL)
    1.55 -	    free_xenheap_pages(d->shared_info, get_order_from_shift(XSI_SHIFT));
    1.56 +	if (page != NULL)
    1.57 +	    free_domheap_pages(page, get_order_from_shift(XSI_SHIFT));
    1.58  	return -ENOMEM;
    1.59  }
    1.60  
    1.61 @@ -629,7 +634,8 @@ void arch_domain_destroy(struct domain *
    1.62  	mm_final_teardown(d);
    1.63  
    1.64  	if (d->shared_info != NULL)
    1.65 -	    free_xenheap_pages(d->shared_info, get_order_from_shift(XSI_SHIFT));
    1.66 +		free_domheap_pages(virt_to_page(d->shared_info),
    1.67 +				   get_order_from_shift(XSI_SHIFT));
    1.68  
    1.69  	tlb_track_destroy(d);
    1.70  
    1.71 @@ -1700,6 +1706,8 @@ domain_set_shared_info_va (unsigned long
    1.72  	VCPU(v, interrupt_mask_addr) = (unsigned char *)va +
    1.73  	                               INT_ENABLE_OFFSET(v);
    1.74  
    1.75 +	__ia64_per_cpu_var(current_psr_i_addr) =
    1.76 +		(uint8_t*)(va + INT_ENABLE_OFFSET(current));
    1.77  	__ia64_per_cpu_var(current_psr_ic_addr) = (int *)(va + XSI_PSR_IC_OFS);
    1.78  
    1.79  	/* Remap the shared pages.  */