ia64/xen-unstable

changeset 12390:e28beea6d228

[IA64] Fix time services of EFI emulation

This patch serializes the execution of following efi.runtimes.
- GetTime
- SetTime
- GetWakeTime
- SetWakeTime

Linux/ia64 uses similar spinlocks in the EFI RTC driver.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author awilliam@xenbuild.aw
date Fri Nov 10 12:03:19 2006 -0700 (2006-11-10)
parents 3ac52066af81
children 881f5b951553
files xen/arch/ia64/xen/fw_emul.c
line diff
     1.1 --- a/xen/arch/ia64/xen/fw_emul.c	Fri Nov 10 11:44:38 2006 -0700
     1.2 +++ b/xen/arch/ia64/xen/fw_emul.c	Fri Nov 10 12:03:19 2006 -0700
     1.3 @@ -32,6 +32,8 @@
     1.4  #include <xen/console.h>
     1.5  #include <xen/hypercall.h>
     1.6  
     1.7 +static DEFINE_SPINLOCK(efi_time_services_lock);
     1.8 +
     1.9  extern unsigned long running_on_sim;
    1.10  
    1.11  struct sal_ret_values
    1.12 @@ -445,7 +447,6 @@ efi_emulate_get_time(
    1.13  	struct page_info *tc_page = NULL;
    1.14  	efi_status_t status = 0;
    1.15  
    1.16 -	//printk("efi_get_time(%016lx,%016lx) called\n", tv_addr, tc_addr);
    1.17  	tv = efi_translate_domain_addr(tv_addr, fault, &tv_page);
    1.18  	if (*fault != IA64_NO_FAULT)
    1.19  		goto errout;
    1.20 @@ -455,9 +456,9 @@ efi_emulate_get_time(
    1.21  			goto errout;
    1.22  	}
    1.23  
    1.24 -	//printk("efi_get_time(%016lx,%016lx) translated to xen virtual address\n", tv, tc);
    1.25 +	spin_lock(&efi_time_services_lock);
    1.26  	status = (*efi.get_time)((efi_time_t *) tv, (efi_time_cap_t *) tc);
    1.27 -	//printk("efi_get_time returns %lx\n", status);
    1.28 +	spin_unlock(&efi_time_services_lock);
    1.29  
    1.30  errout:
    1.31  	if (tc_page != NULL)
    1.32 @@ -483,7 +484,9 @@ efi_emulate_set_time(
    1.33  	if (*fault != IA64_NO_FAULT)
    1.34  		goto errout;
    1.35  
    1.36 +	spin_lock(&efi_time_services_lock);
    1.37  	status = (*efi.set_time)((efi_time_t *)tv);
    1.38 +	spin_unlock(&efi_time_services_lock);
    1.39  
    1.40  errout:
    1.41  	if (tv_page != NULL)
    1.42 @@ -518,9 +521,11 @@ efi_emulate_get_wakeup_time(
    1.43  	if (*fault != IA64_NO_FAULT)
    1.44  		goto errout;
    1.45  
    1.46 +	spin_lock(&efi_time_services_lock);
    1.47  	status = (*efi.get_wakeup_time)((efi_bool_t *)enabled,
    1.48  	                                (efi_bool_t *)pending,
    1.49  	                                (efi_time_t *)tv);
    1.50 +	spin_unlock(&efi_time_services_lock);
    1.51  
    1.52  errout:
    1.53  	if (e_page != NULL)
    1.54 @@ -551,8 +556,10 @@ efi_emulate_set_wakeup_time(
    1.55  			goto errout;
    1.56  	}
    1.57  
    1.58 +	spin_lock(&efi_time_services_lock);
    1.59  	status = (*efi.set_wakeup_time)((efi_bool_t)enabled,
    1.60  	                                (efi_time_t *)tv);
    1.61 +	spin_unlock(&efi_time_services_lock);
    1.62  
    1.63  errout:
    1.64  	if (tv_page != NULL)