summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc/pmu/ebb/reg_access_test.c
blob: 0cae66f659a375b9071e66d812c01819a3ee4d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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");
}
OpenPOWER on IntegriCloud