summaryrefslogtreecommitdiff
path: root/powerpc/pmu/ebb/reg_access_test.c
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@hackbox.linaro.org>2014-10-01 15:24:10 +0100
committerMilosz Wasilewski <milosz.wasilewski@hackbox.linaro.org>2014-10-01 15:24:10 +0100
commite14eb051ff73ab8692770762adf44045ba092398 (patch)
tree117c21aa0b42865a321b078ddb71c410506c51c9 /powerpc/pmu/ebb/reg_access_test.c
parent6c2a5f64d0517e100c569b59423d5f5abc627a7c (diff)
Update to aad7fb916a10f1065ad23de0c80a4a04bcba8437 from repo git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git branch masterfe82dcec644244676d55a1384c958d5f67979adbaad7fb916a10f1065ad23de0c80a4a04bcba8437
Diffstat (limited to 'powerpc/pmu/ebb/reg_access_test.c')
-rw-r--r--powerpc/pmu/ebb/reg_access_test.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/powerpc/pmu/ebb/reg_access_test.c b/powerpc/pmu/ebb/reg_access_test.c
new file mode 100644
index 0000000..0cae66f
--- /dev/null
+++ b/powerpc/pmu/ebb/reg_access_test.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014, Michael Ellerman, IBM Corp.
+ * Licensed under GPLv2.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "ebb.h"
+#include "reg.h"
+
+
+/*
+ * Test basic access to the EBB regs, they should be user accessible with no
+ * kernel interaction required.
+ */
+int reg_access(void)
+{
+ uint64_t val, expected;
+
+ expected = 0x8000000100000000ull;
+ mtspr(SPRN_BESCR, expected);
+ val = mfspr(SPRN_BESCR);
+
+ FAIL_IF(val != expected);
+
+ expected = 0x0000000001000000ull;
+ mtspr(SPRN_EBBHR, expected);
+ val = mfspr(SPRN_EBBHR);
+
+ FAIL_IF(val != expected);
+
+ return 0;
+}
+
+int main(void)
+{
+ return test_harness(reg_access, "reg_access");
+}