aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hpet.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2011-03-12 13:19:02 +0000
committerJan Beulich <jbeulich@novell.com>2011-03-12 13:19:02 +0000
commit8fb98708308bec25d9e80c7ebe0360cb95fc11f9 (patch)
tree53ae25881c5b0cf26a1f3a6e69048a16d783793e /xen/arch/x86/hpet.c
parent8d5a53c1fa701556a845c23951840c76d6abe99d (diff)
downloadxen-8fb98708308bec25d9e80c7ebe0360cb95fc11f9.tar.gz
xen-8fb98708308bec25d9e80c7ebe0360cb95fc11f9.tar.bz2
xen-8fb98708308bec25d9e80c7ebe0360cb95fc11f9.zip
x86/HPET: fix initialization order
At least the legacy path can enter its interrupt handler callout while initialization is still in progress - that handler checks whether ->event_handler is non-NULL, and hence all other initialization must happen before setting this field. Do the same to the MSI initialization just in case (and to keep the code in sync). Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/arch/x86/hpet.c')
-rw-r--r--xen/arch/x86/hpet.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c
index af568a3708..6fc7a35586 100644
--- a/xen/arch/x86/hpet.c
+++ b/xen/arch/x86/hpet.c
@@ -597,9 +597,10 @@ void hpet_broadcast_init(void)
1000000000ul, 32);
hpet_events[i].shift = 32;
hpet_events[i].next_event = STIME_MAX;
- hpet_events[i].event_handler = handle_hpet_broadcast;
spin_lock_init(&hpet_events[i].lock);
rwlock_init(&hpet_events[i].cpumask_lock);
+ wmb();
+ hpet_events[i].event_handler = handle_hpet_broadcast;
}
return;
@@ -630,11 +631,12 @@ void hpet_broadcast_init(void)
legacy_hpet_event.mult = div_sc((unsigned long)hpet_rate, 1000000000ul, 32);
legacy_hpet_event.shift = 32;
legacy_hpet_event.next_event = STIME_MAX;
- legacy_hpet_event.event_handler = handle_hpet_broadcast;
legacy_hpet_event.idx = 0;
legacy_hpet_event.flags = 0;
spin_lock_init(&legacy_hpet_event.lock);
rwlock_init(&legacy_hpet_event.cpumask_lock);
+ wmb();
+ legacy_hpet_event.event_handler = handle_hpet_broadcast;
if ( !force_hpet_broadcast )
pv_rtc_handler = handle_rtc_once;