diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2014-06-10 12:23:10 (GMT) |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-06-11 07:03:58 (GMT) |
commit | 3752e453f6bafd78e5586cc2b2e33ee4b6e1566d (patch) | |
tree | 2c5d88b6d9f759844249a36ce8b729dcb5c274ad /tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c | |
parent | 33b4819f3b93bbcb934e02cbc64ff3c5e9d0149b (diff) | |
download | linux-3752e453f6bafd78e5586cc2b2e33ee4b6e1566d.tar.xz |
selftests/powerpc: Add tests of PMU EBBs
The Power8 Performance Monitor Unit (PMU) has a new feature called Event
Based Branches (EBB). This commit adds tests of the kernel API for using
EBBs.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c')
-rw-r--r-- | tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c b/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c new file mode 100644 index 0000000..0cae66f --- /dev/null +++ b/tools/testing/selftests/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"); +} |