2 * POWER Data Stream Control Register (DSCR) SPR test
4 * This test modifies the DSCR value through both the SPR number
5 * based mtspr instruction and then makes sure that the same is
6 * reflected through mfspr instruction using either of the SPR
9 * When using the privilege state SPR, the instructions such as
10 * mfspr or mtspr are priviledged and the kernel emulates them
11 * for us. Instructions using problem state SPR can be exuecuted
12 * directly without any emulation if the HW supports them. Else
13 * they also get emulated by the kernel.
15 * Copyright 2013, Anton Blanchard, IBM Corporation.
16 * Copyright 2015, Anshuman Khandual, IBM Corporation.
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License version 2 as published
20 * by the Free Software Foundation.
24 static int check_dscr(char *str
)
26 unsigned long cur_dscr
, cur_dscr_usr
;
28 cur_dscr
= get_dscr();
29 cur_dscr_usr
= get_dscr_usr();
30 if (cur_dscr
!= cur_dscr_usr
) {
31 printf("%s set, kernel get %lx != user get %lx\n",
32 str
, cur_dscr
, cur_dscr_usr
);
44 for (i
= 0; i
< COUNT
; i
++) {
46 if (check_dscr("kernel"))
50 for (i
= 0; i
< COUNT
; i
++) {
52 if (check_dscr("user"))
58 int main(int argc
, char *argv
[])
60 return test_harness(dscr_user
, "dscr_user_test");