[SPARC64]: Add initial code to twiddle %gl on trap entry/exit.
[powerpc.git] / arch / sparc64 / kernel / setup.c
index f751d11..aaab319 100644 (file)
@@ -520,6 +520,9 @@ static void __init per_cpu_patch(void)
                        else
                                insns = &p->cheetah_safari[0];
                        break;
+               case hypervisor:
+                       insns = &p->sun4v[0];
+                       break;
                default:
                        prom_printf("Unknown cpu type, halting.\n");
                        prom_halt();
@@ -542,6 +545,24 @@ static void __init per_cpu_patch(void)
 #endif
 }
 
+static void __init gl_patch(void)
+{
+       struct gl_1insn_patch_entry *p;
+
+       if (tlb_type != hypervisor)
+               return;
+
+       p = &__gl_1insn_patch;
+       while (p < &__gl_1insn_patch_end) {
+               unsigned long addr = p->addr;
+
+               *(unsigned int *) (addr +  0) = p->insn;
+               __asm__ __volatile__("flush     %0" : : "r" (addr +  0));
+
+               p++;
+       }
+}
+
 void __init setup_arch(char **cmdline_p)
 {
        /* Initialize PROM console and command line. */
@@ -564,6 +585,8 @@ void __init setup_arch(char **cmdline_p)
         */
        per_cpu_patch();
 
+       gl_patch();
+
        boot_flags_init(*cmdline_p);
 
        idprom_init();