__entry->addr, __entry->access, __entry->trap)
 );
 
+
+TRACE_EVENT(tlbie,
+
+       TP_PROTO(unsigned long lpid, unsigned long local, unsigned long rb,
+               unsigned long rs, unsigned long ric, unsigned long prs,
+               unsigned long r),
+       TP_ARGS(lpid, local, rb, rs, ric, prs, r),
+       TP_STRUCT__entry(
+               __field(unsigned long, lpid)
+               __field(unsigned long, local)
+               __field(unsigned long, rb)
+               __field(unsigned long, rs)
+               __field(unsigned long, ric)
+               __field(unsigned long, prs)
+               __field(unsigned long, r)
+               ),
+
+       TP_fast_assign(
+               __entry->lpid = lpid;
+               __entry->local = local;
+               __entry->rb = rb;
+               __entry->rs = rs;
+               __entry->ric = ric;
+               __entry->prs = prs;
+               __entry->r = r;
+               ),
+
+       TP_printk("lpid=%ld, local=%ld, rb=0x%lx, rs=0x%lx, ric=0x%lx, "
+               "prs=0x%lx, r=0x%lx", __entry->lpid, __entry->local,
+               __entry->rb, __entry->rs, __entry->ric, __entry->prs,
+               __entry->r)
+);
+
 #endif /* _TRACE_POWERPC_H */
 
 #undef TRACE_INCLUDE_PATH
 
 #include <linux/log2.h>
 
 #include <asm/tlbflush.h>
+#include <asm/trace.h>
 #include <asm/kvm_ppc.h>
 #include <asm/kvm_book3s.h>
 #include <asm/book3s/64/mmu-hash.h>
                        cpu_relax();
                if (need_sync)
                        asm volatile("ptesync" : : : "memory");
-               for (i = 0; i < npages; ++i)
+               for (i = 0; i < npages; ++i) {
                        asm volatile(PPC_TLBIE_5(%0,%1,0,0,0) : :
                                     "r" (rbvalues[i]), "r" (kvm->arch.lpid));
+                       trace_tlbie(kvm->arch.lpid, 0, rbvalues[i],
+                               kvm->arch.lpid, 0, 0, 0);
+               }
                asm volatile("eieio; tlbsync; ptesync" : : : "memory");
                kvm->arch.tlbie_lock = 0;
        } else {
                if (need_sync)
                        asm volatile("ptesync" : : : "memory");
-               for (i = 0; i < npages; ++i)
+               for (i = 0; i < npages; ++i) {
                        asm volatile(PPC_TLBIEL(%0,%1,0,0,0) : :
                                     "r" (rbvalues[i]), "r" (0));
+                       trace_tlbie(kvm->arch.lpid, 1, rbvalues[i],
+                               0, 0, 0, 0);
+               }
                asm volatile("ptesync" : : : "memory");
        }
 }
 
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
+#include <asm/trace.h>
 #include <asm/tlb.h>
 #include <asm/cputable.h>
 #include <asm/udbg.h>
                             : "memory");
                break;
        }
+       trace_tlbie(0, 0, va, 0, 0, 0, 0);
 }
 
 static inline void __tlbiel(unsigned long vpn, int psize, int apsize, int ssize)
                             : "memory");
                break;
        }
+       trace_tlbie(0, 1, va, 0, 0, 0, 0);
 
 }
 
 
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(0), "i"(0), "i"(2), "r"(0) : "memory");
        asm volatile("eieio; tlbsync; ptesync; isync; slbia": : :"memory");
+       trace_tlbie(0, 0, rb, 0, 2, 0, 0);
+
        /*
         * now switch the HID
         */
 
 #include <asm/firmware.h>
 #include <asm/powernv.h>
 #include <asm/sections.h>
+#include <asm/trace.h>
 
 #include <trace/events/thp.h>
 
        asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : :
                     "r" (TLBIEL_INVAL_SET_LPID), "r" (0));
        asm volatile("eieio; tlbsync; ptesync" : : : "memory");
+       trace_tlbie(0, 0, TLBIEL_INVAL_SET_LPID, 0, 2, 1, 1);
 }
 
 static void __init radix_init_partition_table(void)
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(1), "i"(1), "i"(2), "r"(0) : "memory");
        asm volatile("eieio; tlbsync; ptesync; isync; slbia": : :"memory");
+       trace_tlbie(0, 0, rb, 0, 2, 0, 1);
+       trace_tlbie(0, 0, rb, 0, 2, 1, 1);
+
        /*
         * now switch the HID
         */
 
 #include <asm/smp.h>
 #include <asm/machdep.h>
 #include <asm/tlb.h>
+#include <asm/trace.h>
 #include <asm/processor.h>
 #include <asm/cputable.h>
 #include <asm/sections.h>
         * use of this partition ID was, not the new use.
         */
        asm volatile("ptesync" : : : "memory");
-       if (old & PATB_HR)
+       if (old & PATB_HR) {
                asm volatile(PPC_TLBIE_5(%0,%1,2,0,1) : :
                             "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
-       else
+               trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 1);
+       } else {
                asm volatile(PPC_TLBIE_5(%0,%1,2,0,0) : :
                             "r" (TLBIEL_INVAL_SET_LPID), "r" (lpid));
+               trace_tlbie(lpid, 0, TLBIEL_INVAL_SET_LPID, lpid, 2, 0, 0);
+       }
        asm volatile("eieio; tlbsync; ptesync" : : : "memory");
 }
 EXPORT_SYMBOL_GPL(mmu_partition_table_set_entry);
 
 
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
+#include <asm/trace.h>
 
 
 #define RIC_FLUSH_TLB 0
 
        asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
+       trace_tlbie(0, 1, rb, rs, ric, prs, r);
 }
 
 /*
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(0, 0, rb, rs, ric, prs, r);
 }
 
 static inline void _tlbiel_va(unsigned long va, unsigned long pid,
        asm volatile(PPC_TLBIEL(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("ptesync": : :"memory");
+       trace_tlbie(0, 1, rb, rs, ric, prs, r);
 }
 
 static inline void _tlbie_va(unsigned long va, unsigned long pid,
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(0, 0, rb, rs, ric, prs, r);
 }
 
 /*
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(lpid, 0, rb, rs, ric, prs, r);
 }
 EXPORT_SYMBOL(radix__flush_tlb_lpid_va);
 
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(rs) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(lpid, 0, rb, rs, ric, prs, r);
 }
 EXPORT_SYMBOL(radix__flush_tlb_lpid);
 
         */
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(1), "i"(ric), "r"(rs) : "memory");
+       trace_tlbie(0, 0, rb, rs, ric, prs, r);
        /*
         * now flush host entires by passing PRS = 0 and LPID == 0
         */
        asm volatile(PPC_TLBIE_5(%0, %4, %3, %2, %1)
                     : : "r"(rb), "i"(r), "i"(prs), "i"(ric), "r"(0) : "memory");
        asm volatile("eieio; tlbsync; ptesync": : :"memory");
+       trace_tlbie(0, 0, rb, 0, ric, prs, r);
 }
 
 void radix__flush_tlb_pte_p9_dd1(unsigned long old_pte, struct mm_struct *mm,