Files
linux/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c
Denis Kirjanov 39fcfb911c selftests/powerpc: Run EBB tests only on POWER8
EBB (Event Based Branches) are currently only available on POWER8, so we
should skip them on other CPUs.

I've found that at least one test loops forever on 970MP (cycles_with_freeze_test).

Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
[mpe: Minor change log editing, add skip to cpu_event_vs_ebb_test]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2015-10-19 19:42:08 +11:00

42 lines
674 B
C

/*
* 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;
SKIP_IF(!ebb_is_supported());
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");
}