oprofile-$(CONFIG_CPU_MIPS64)          += op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_R10000)          += op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_SB1)             += op_model_mipsxx.o
+oprofile-$(CONFIG_CPU_XLR)             += op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_RM9000)          += op_model_rm9000.o
 oprofile-$(CONFIG_CPU_LOONGSON2)       += op_model_loongson2.o
 
 
 #define M_COUNTER_OVERFLOW             (1UL      << 31)
 
+/* Netlogic XLR specific, count events in all threads in a core */
+#define M_PERFCTL_COUNT_ALL_THREADS    (1UL      << 13)
+
 static int (*save_perf_irq)(void);
 
+/*
+ * XLR has only one set of counters per core. Designate the
+ * first hardware thread in the core for setup and init.
+ * Skip CPUs with non-zero hardware thread id (4 hwt per core)
+ */
+#ifdef CONFIG_CPU_XLR
+#define oprofile_skip_cpu(c)   ((cpu_logical_map(c) & 0x3) != 0)
+#else
+#define oprofile_skip_cpu(c)   0
+#endif
+
 #ifdef CONFIG_MIPS_MT_SMP
 static int cpu_has_mipsmt_pertccounters;
 #define WHAT           (M_TC_EN_VPE | \
                        reg.control[i] |= M_PERFCTL_USER;
                if (ctr[i].exl)
                        reg.control[i] |= M_PERFCTL_EXL;
+               if (current_cpu_type() == CPU_XLR)
+                       reg.control[i] |= M_PERFCTL_COUNT_ALL_THREADS;
                reg.counter[i] = 0x80000000 - ctr[i].count;
        }
 }
 {
        unsigned int counters = op_model_mipsxx_ops.num_counters;
 
+       if (oprofile_skip_cpu(smp_processor_id()))
+               return;
+
        switch (counters) {
        case 4:
                w_c0_perfctrl3(0);
 {
        unsigned int counters = op_model_mipsxx_ops.num_counters;
 
+       if (oprofile_skip_cpu(smp_processor_id()))
+               return;
+
        switch (counters) {
        case 4:
                w_c0_perfctrl3(WHAT | reg.control[3]);
 {
        unsigned int counters = op_model_mipsxx_ops.num_counters;
 
+       if (oprofile_skip_cpu(smp_processor_id()))
+               return;
+
        switch (counters) {
        case 4:
                w_c0_perfctrl3(0);
                op_model_mipsxx_ops.cpu_type = "mips/loongson1";
                break;
 
+       case CPU_XLR:
+               op_model_mipsxx_ops.cpu_type = "mips/xlr";
+               break;
+
        default:
                printk(KERN_ERR "Profiling unsupported for this CPU\n");