From: Max Filippov <jcmvbkbc@gmail.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Max Filippov <jcmvbkbc@gmail.com>
Subject: [Qemu-devel] [PATCH v2 2/2] tests/tcg/xtensa: add test for failed memory transactions
Date: Tue, 28 Aug 2018 18:16:52 -0700 [thread overview]
Message-ID: <20180829011652.4466-3-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <20180829011652.4466-1-jcmvbkbc@gmail.com>
Failed memory transactions should raise exceptions 14 (for fetch) or 15
(for load/store) with XEA2.
Memory accesses that result in TLB miss followed by an attempt to load
PTE from physical memory which fails should raise InstTLBMiss or
LoadStoreTLBMiss with XEA2.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
Changes v1->v2:
- add tests that attempt TLB autorefill from the physically unmapped
addresses.
tests/tcg/xtensa/Makefile | 1 +
tests/tcg/xtensa/test_phys_mem.S | 124 +++++++++++++++++++++++++++++++++++++++
2 files changed, 125 insertions(+)
create mode 100644 tests/tcg/xtensa/test_phys_mem.S
diff --git a/tests/tcg/xtensa/Makefile b/tests/tcg/xtensa/Makefile
index 091518c05583..2f5691f75b09 100644
--- a/tests/tcg/xtensa/Makefile
+++ b/tests/tcg/xtensa/Makefile
@@ -44,6 +44,7 @@ TESTCASES += test_mmu.tst
TESTCASES += test_mul16.tst
TESTCASES += test_mul32.tst
TESTCASES += test_nsa.tst
+TESTCASES += test_phys_mem.tst
ifdef XT
TESTCASES += test_pipeline.tst
endif
diff --git a/tests/tcg/xtensa/test_phys_mem.S b/tests/tcg/xtensa/test_phys_mem.S
new file mode 100644
index 000000000000..aae0a793a718
--- /dev/null
+++ b/tests/tcg/xtensa/test_phys_mem.S
@@ -0,0 +1,124 @@
+#include "macros.inc"
+
+test_suite phys_mem
+
+.purgem test_init
+
+.macro test_init
+ movi a2, 0xc0000003 /* PPN */
+ movi a3, 0xc0000004 /* VPN */
+ wdtlb a2, a3
+ witlb a2, a3
+ movi a2, 0xc0000000
+ wsr a2, ptevaddr
+.endm
+
+test inst_fetch_get_pte_no_phys
+ set_vector kernel, 2f
+
+ movi a2, 0x20000000
+ jx a2
+2:
+ movi a2, 0x20000000
+ rsr a3, excvaddr
+ assert eq, a2, a3
+ rsr a3, epc1
+ assert eq, a2, a3
+ rsr a3, exccause
+ movi a2, 16
+ assert eq, a2, a3
+test_end
+
+test read_get_pte_no_phys
+ set_vector kernel, 2f
+
+ movi a2, 0x20000000
+1:
+ l32i a3, a2, 0
+ test_fail
+2:
+ movi a2, 0x20000000
+ rsr a3, excvaddr
+ assert eq, a2, a3
+ movi a2, 1b
+ rsr a3, epc1
+ assert eq, a2, a3
+ rsr a3, exccause
+ movi a2, 24
+ assert eq, a2, a3
+test_end
+
+test write_get_pte_no_phys
+ set_vector kernel, 2f
+
+ movi a2, 0x20000000
+1:
+ s32i a3, a2, 0
+ test_fail
+2:
+ movi a2, 0x20000000
+ rsr a3, excvaddr
+ assert eq, a2, a3
+ movi a2, 1b
+ rsr a3, epc1
+ assert eq, a2, a3
+ rsr a3, exccause
+ movi a2, 24
+ assert eq, a2, a3
+test_end
+
+test inst_fetch_no_phys
+ set_vector kernel, 2f
+
+ movi a2, 0xc0000000
+ jx a2
+2:
+ movi a2, 0xc0000000
+ rsr a3, excvaddr
+ assert eq, a2, a3
+ rsr a3, epc1
+ assert eq, a2, a3
+ rsr a3, exccause
+ movi a2, 14
+ assert eq, a2, a3
+test_end
+
+test read_no_phys
+ set_vector kernel, 2f
+
+ movi a2, 0xc0000000
+1:
+ l32i a3, a2, 0
+ test_fail
+2:
+ movi a2, 0xc0000000
+ rsr a3, excvaddr
+ assert eq, a2, a3
+ movi a2, 1b
+ rsr a3, epc1
+ assert eq, a2, a3
+ rsr a3, exccause
+ movi a2, 15
+ assert eq, a2, a3
+test_end
+
+test write_no_phys
+ set_vector kernel, 2f
+
+ movi a2, 0xc0000000
+1:
+ s32i a3, a2, 0
+ test_fail
+2:
+ movi a2, 0xc0000000
+ rsr a3, excvaddr
+ assert eq, a2, a3
+ movi a2, 1b
+ rsr a3, epc1
+ assert eq, a2, a3
+ rsr a3, exccause
+ movi a2, 15
+ assert eq, a2, a3
+test_end
+
+test_suite_end
--
2.11.0
prev parent reply other threads:[~2018-08-29 1:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 1:16 [Qemu-devel] [PATCH v2 0/2] target/xtensa: convert to do_transaction_failed Max Filippov
2018-08-29 1:16 ` [Qemu-devel] [PATCH v2 1/2] " Max Filippov
2018-08-29 1:16 ` Max Filippov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180829011652.4466-3-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.