]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/mm/pgtable_64.c
powerpc/64: Make type of partition table flush depend on partition type
[karo-tx-linux.git] / arch / powerpc / mm / pgtable_64.c
index 8bca7f58afc4678a167fb05ff00b6874c062c1fd..d6b5e5cde4127ea639fae8937c0cabba5b8d435a 100644 (file)
@@ -454,13 +454,23 @@ void __init mmu_partition_table_init(void)
 void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
                                   unsigned long dw1)
 {
+       unsigned long old = be64_to_cpu(partition_tb[lpid].patb0);
+
        partition_tb[lpid].patb0 = cpu_to_be64(dw0);
        partition_tb[lpid].patb1 = cpu_to_be64(dw1);
 
-       /* Global flush of TLBs and partition table caches for this lpid */
+       /*
+        * Global flush of TLBs and partition table caches for this lpid.
+        * The type of flush (hash or radix) depends on what the previous
+        * use of this partition ID was, not the new use.
+        */
        asm volatile("ptesync" : : : "memory");
-       asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :
-                    "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+       if (old & PATB_HR)
+               asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
+                            "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+       else
+               asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :
+                            "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
        asm volatile("eieio; tlbsync; ptesync" : : : "memory");
 }
 EXPORT_SYMBOL_GPL(mmu_partition_table_set_entry);