xref: /openbmc/qemu/tests/tcg/xtensa/test_phys_mem.S (revision 7d87775f)
1#include "macros.inc"
2
3test_suite phys_mem
4
5#if XCHAL_HAVE_PTP_MMU
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#if XCHAL_HAVE_SPANNING_WAY
17    movi    a2, 0xc0000000 | XCHAL_SPANNING_WAY
18    idtlb   a2
19    iitlb   a2
20    movi    a2, 0x20000000 | XCHAL_SPANNING_WAY
21    idtlb   a2
22    iitlb   a2
23#endif
24.endm
25
26test inst_fetch_get_pte_no_phys
27    set_vector kernel, 2f
28
29    movi    a2, 0x20000000
30    jx      a2
312:
32    movi    a2, 0x20000000
33    rsr     a3, excvaddr
34    assert  eq, a2, a3
35    rsr     a3, epc1
36    assert  eq, a2, a3
37    rsr     a3, exccause
38    movi    a2, 16
39    assert  eq, a2, a3
40test_end
41
42test read_get_pte_no_phys
43    set_vector kernel, 2f
44
45    movi    a2, 0x20000000
461:
47    l32i    a3, a2, 0
48    test_fail
492:
50    movi    a2, 0x20000000
51    rsr     a3, excvaddr
52    assert  eq, a2, a3
53    movi    a2, 1b
54    rsr     a3, epc1
55    assert  eq, a2, a3
56    rsr     a3, exccause
57    movi    a2, 24
58    assert  eq, a2, a3
59test_end
60
61test write_get_pte_no_phys
62    set_vector kernel, 2f
63
64    movi    a2, 0x20000000
651:
66    s32i    a3, a2, 0
67    test_fail
682:
69    movi    a2, 0x20000000
70    rsr     a3, excvaddr
71    assert  eq, a2, a3
72    movi    a2, 1b
73    rsr     a3, epc1
74    assert  eq, a2, a3
75    rsr     a3, exccause
76    movi    a2, 24
77    assert  eq, a2, a3
78test_end
79
80#endif
81
82test inst_fetch_no_phys
83    set_vector kernel, 2f
84
85    movi    a2, 0xc0000000
86    jx      a2
872:
88    movi    a2, 0xc0000000
89    rsr     a3, excvaddr
90    assert  eq, a2, a3
91    rsr     a3, epc1
92    assert  eq, a2, a3
93    rsr     a3, exccause
94    movi    a2, 14
95    assert  eq, a2, a3
96test_end
97
98test read_no_phys
99    set_vector kernel, 2f
100
101    movi    a2, 0xc0000000
1021:
103    l32i    a3, a2, 0
104    test_fail
1052:
106    movi    a2, 0xc0000000
107    rsr     a3, excvaddr
108    assert  eq, a2, a3
109    movi    a2, 1b
110    rsr     a3, epc1
111    assert  eq, a2, a3
112    rsr     a3, exccause
113    movi    a2, 15
114    assert  eq, a2, a3
115test_end
116
117test write_no_phys
118    set_vector kernel, 2f
119
120    movi    a2, 0xc0000000
1211:
122    s32i    a3, a2, 0
123    test_fail
1242:
125    movi    a2, 0xc0000000
126    rsr     a3, excvaddr
127    assert  eq, a2, a3
128    movi    a2, 1b
129    rsr     a3, epc1
130    assert  eq, a2, a3
131    rsr     a3, exccause
132    movi    a2, 15
133    assert  eq, a2, a3
134test_end
135
136test_suite_end
137