Merge branch 'hid-suspend' into picolcd
[pandora-kernel.git] / arch / x86 / kernel / uv_time.c
index 3c84aa0..56e421b 100644 (file)
@@ -19,6 +19,7 @@
  *  Copyright (c) Dimitri Sivanich
  */
 #include <linux/clockchips.h>
+#include <linux/slab.h>
 
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
@@ -282,10 +283,21 @@ static int uv_rtc_unset_timer(int cpu, int force)
 
 /*
  * Read the RTC.
+ *
+ * Starting with HUB rev 2.0, the UV RTC register is replicated across all
+ * cachelines of it's own page.  This allows faster simultaneous reads
+ * from a given socket.
  */
 static cycle_t uv_read_rtc(struct clocksource *cs)
 {
-       return (cycle_t)uv_read_local_mmr(UVH_RTC);
+       unsigned long offset;
+
+       if (uv_get_min_hub_revision_id() == 1)
+               offset = 0;
+       else
+               offset = (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE;
+
+       return (cycle_t)uv_read_local_mmr(UVH_RTC | offset);
 }
 
 /*