summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu/ebb/ebb.c')
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/ebb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
index d7a72ce696b5..9729d9f90218 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/ebb.c
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
+#include <linux/auxvec.h>
#include "trace.h"
#include "reg.h"
@@ -319,6 +320,16 @@ void ebb_global_disable(void)
mb();
}
+bool ebb_is_supported(void)
+{
+#ifdef PPC_FEATURE2_EBB
+ /* EBB requires at least POWER8 */
+ return ((long)get_auxv_entry(AT_HWCAP2) & PPC_FEATURE2_EBB);
+#else
+ return false;
+#endif
+}
+
void event_ebb_init(struct event *e)
{
e->attr.config |= (1ull << 63);