xref: /openbmc/qemu/tests/tcg/xtensa/test_phys_mem.S (revision a68694cd)
1#include "macros.inc"
2
3test_suite phys_mem
4
5#if XCHAL_HAVE_PTP_MMU && !XCHAL_HAVE_SPANNING_WAY
6
7.purgem test_init
8
9.macro test_init
10    movi    a2, 0xc0000003 /* PPN */
11    movi    a3, 0xc0000004 /* VPN */
12    wdtlb   a2, a3
13    witlb   a2, a3
14    movi    a2, 0xc0000000
15    wsr     a2, ptevaddr
16.endm
17
18test inst_fetch_get_pte_no_phys
19    set_vector kernel, 2f
20
21    movi    a2, 0x20000000
22    jx      a2
232:
24    movi    a2, 0x20000000
25    rsr     a3, excvaddr
26    assert  eq, a2, a3
27    rsr     a3, epc1
28    assert  eq, a2, a3
29    rsr     a3, exccause
30    movi    a2, 16
31    assert  eq, a2, a3
32test_end
33
34test read_get_pte_no_phys
35    set_vector kernel, 2f
36
37    movi    a2, 0x20000000
381:
39    l32i    a3, a2, 0
40    test_fail
412:
42    movi    a2, 0x20000000
43    rsr     a3, excvaddr
44    assert  eq, a2, a3
45    movi    a2, 1b
46    rsr     a3, epc1
47    assert  eq, a2, a3
48    rsr     a3, exccause
49    movi    a2, 24
50    assert  eq, a2, a3
51test_end
52
53test write_get_pte_no_phys
54    set_vector kernel, 2f
55
56    movi    a2, 0x20000000
571:
58    s32i    a3, a2, 0
59    test_fail
602:
61    movi    a2, 0x20000000
62    rsr     a3, excvaddr
63    assert  eq, a2, a3
64    movi    a2, 1b
65    rsr     a3, epc1
66    assert  eq, a2, a3
67    rsr     a3, exccause
68    movi    a2, 24
69    assert  eq, a2, a3
70test_end
71
72#endif
73
74test inst_fetch_no_phys
75    set_vector kernel, 2f
76
77    movi    a2, 0xc0000000
78    jx      a2
792:
80    movi    a2, 0xc0000000
81    rsr     a3, excvaddr
82    assert  eq, a2, a3
83    rsr     a3, epc1
84    assert  eq, a2, a3
85    rsr     a3, exccause
86    movi    a2, 14
87    assert  eq, a2, a3
88test_end
89
90test read_no_phys
91    set_vector kernel, 2f
92
93    movi    a2, 0xc0000000
941:
95    l32i    a3, a2, 0
96    test_fail
972:
98    movi    a2, 0xc0000000
99    rsr     a3, excvaddr
100    assert  eq, a2, a3
101    movi    a2, 1b
102    rsr     a3, epc1
103    assert  eq, a2, a3
104    rsr     a3, exccause
105    movi    a2, 15
106    assert  eq, a2, a3
107test_end
108
109test write_no_phys
110    set_vector kernel, 2f
111
112    movi    a2, 0xc0000000
1131:
114    s32i    a3, a2, 0
115    test_fail
1162:
117    movi    a2, 0xc0000000
118    rsr     a3, excvaddr
119    assert  eq, a2, a3
120    movi    a2, 1b
121    rsr     a3, epc1
122    assert  eq, a2, a3
123    rsr     a3, exccause
124    movi    a2, 15
125    assert  eq, a2, a3
126test_end
127
128test_suite_end
129