|
@@ -1824,6 +1824,75 @@ static int ebb_set(struct task_struct *target,
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
+static int pmu_active(struct task_struct *target,
|
|
|
|
+ const struct user_regset *regset)
|
|
|
|
+{
|
|
|
|
+ if (!cpu_has_feature(CPU_FTR_ARCH_207S))
|
|
|
|
+ return -ENODEV;
|
|
|
|
+
|
|
|
|
+ return regset->n;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int pmu_get(struct task_struct *target,
|
|
|
|
+ const struct user_regset *regset,
|
|
|
|
+ unsigned int pos, unsigned int count,
|
|
|
|
+ void *kbuf, void __user *ubuf)
|
|
|
|
+{
|
|
|
|
+ /* Build tests */
|
|
|
|
+ BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
|
|
|
|
+ BUILD_BUG_ON(TSO(sdar) + sizeof(unsigned long) != TSO(sier));
|
|
|
|
+ BUILD_BUG_ON(TSO(sier) + sizeof(unsigned long) != TSO(mmcr2));
|
|
|
|
+ BUILD_BUG_ON(TSO(mmcr2) + sizeof(unsigned long) != TSO(mmcr0));
|
|
|
|
+
|
|
|
|
+ if (!cpu_has_feature(CPU_FTR_ARCH_207S))
|
|
|
|
+ return -ENODEV;
|
|
|
|
+
|
|
|
|
+ return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
|
|
|
|
+ &target->thread.siar, 0,
|
|
|
|
+ 5 * sizeof(unsigned long));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int pmu_set(struct task_struct *target,
|
|
|
|
+ const struct user_regset *regset,
|
|
|
|
+ unsigned int pos, unsigned int count,
|
|
|
|
+ const void *kbuf, const void __user *ubuf)
|
|
|
|
+{
|
|
|
|
+ int ret = 0;
|
|
|
|
+
|
|
|
|
+ /* Build tests */
|
|
|
|
+ BUILD_BUG_ON(TSO(siar) + sizeof(unsigned long) != TSO(sdar));
|
|
|
|
+ BUILD_BUG_ON(TSO(sdar) + sizeof(unsigned long) != TSO(sier));
|
|
|
|
+ BUILD_BUG_ON(TSO(sier) + sizeof(unsigned long) != TSO(mmcr2));
|
|
|
|
+ BUILD_BUG_ON(TSO(mmcr2) + sizeof(unsigned long) != TSO(mmcr0));
|
|
|
|
+
|
|
|
|
+ if (!cpu_has_feature(CPU_FTR_ARCH_207S))
|
|
|
|
+ return -ENODEV;
|
|
|
|
+
|
|
|
|
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
|
|
|
|
+ &target->thread.siar, 0,
|
|
|
|
+ sizeof(unsigned long));
|
|
|
|
+
|
|
|
|
+ if (!ret)
|
|
|
|
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
|
|
|
|
+ &target->thread.sdar, sizeof(unsigned long),
|
|
|
|
+ 2 * sizeof(unsigned long));
|
|
|
|
+
|
|
|
|
+ if (!ret)
|
|
|
|
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
|
|
|
|
+ &target->thread.sier, 2 * sizeof(unsigned long),
|
|
|
|
+ 3 * sizeof(unsigned long));
|
|
|
|
+
|
|
|
|
+ if (!ret)
|
|
|
|
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
|
|
|
|
+ &target->thread.mmcr2, 3 * sizeof(unsigned long),
|
|
|
|
+ 4 * sizeof(unsigned long));
|
|
|
|
+
|
|
|
|
+ if (!ret)
|
|
|
|
+ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
|
|
|
|
+ &target->thread.mmcr0, 4 * sizeof(unsigned long),
|
|
|
|
+ 5 * sizeof(unsigned long));
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
#endif
|
|
#endif
|
|
/*
|
|
/*
|
|
* These are our native regset flavors.
|
|
* These are our native regset flavors.
|
|
@@ -1857,6 +1926,7 @@ enum powerpc_regset {
|
|
#ifdef CONFIG_PPC_BOOK3S_64
|
|
#ifdef CONFIG_PPC_BOOK3S_64
|
|
REGSET_TAR, /* TAR register */
|
|
REGSET_TAR, /* TAR register */
|
|
REGSET_EBB, /* EBB registers */
|
|
REGSET_EBB, /* EBB registers */
|
|
|
|
+ REGSET_PMR, /* Performance Monitor Registers */
|
|
#endif
|
|
#endif
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1957,6 +2027,11 @@ static const struct user_regset native_regsets[] = {
|
|
.size = sizeof(u64), .align = sizeof(u64),
|
|
.size = sizeof(u64), .align = sizeof(u64),
|
|
.active = ebb_active, .get = ebb_get, .set = ebb_set
|
|
.active = ebb_active, .get = ebb_get, .set = ebb_set
|
|
},
|
|
},
|
|
|
|
+ [REGSET_PMR] = {
|
|
|
|
+ .core_note_type = NT_PPC_PMU, .n = ELF_NPMU,
|
|
|
|
+ .size = sizeof(u64), .align = sizeof(u64),
|
|
|
|
+ .active = pmu_active, .get = pmu_get, .set = pmu_set
|
|
|
|
+ },
|
|
#endif
|
|
#endif
|
|
};
|
|
};
|
|
|
|
|