[SPARC64]: Do not try to write to %tick or %stick on SUN4V.
authorDavid S. Miller <davem@sunset.davemloft.net>
Sun, 12 Feb 2006 07:14:59 +0000 (23:14 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 20 Mar 2006 09:12:27 +0000 (01:12 -0800)
Writes by privileged code are disallowed.  The hypervisor manages
the non-privileged bit.

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc64/kernel/time.c

index 24681b9b4426417605c500b42732c6584142fb36..7041146f86f02b7f71bb5a107b40c0145e89d75f 100644 (file)
@@ -193,16 +193,22 @@ struct sparc64_tick_ops *tick_ops __read_mostly = &tick_operations;
 
 static void stick_init_tick(unsigned long offset)
 {
-       tick_disable_protection();
-
-       /* Let the user get at STICK too. */
-       __asm__ __volatile__(
-       "       rd      %%asr24, %%g2\n"
-       "       andn    %%g2, %0, %%g2\n"
-       "       wr      %%g2, 0, %%asr24"
-       : /* no outputs */
-       : "r" (TICK_PRIV_BIT)
-       : "g1", "g2");
+       /* Writes to the %tick and %stick register are not
+        * allowed on sun4v.  The Hypervisor controls that
+        * bit, per-strand.
+        */
+       if (tlb_type != hypervisor) {
+               tick_disable_protection();
+
+               /* Let the user get at STICK too. */
+               __asm__ __volatile__(
+               "       rd      %%asr24, %%g2\n"
+               "       andn    %%g2, %0, %%g2\n"
+               "       wr      %%g2, 0, %%asr24"
+               : /* no outputs */
+               : "r" (TICK_PRIV_BIT)
+               : "g1", "g2");
+       }
 
        __asm__ __volatile__(
        "       rd      %%asr24, %%g1\n"