From 8ff8b2f25649d6660eca01b33da9add4bb929123 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 4 May 2020 08:57:05 +1000 Subject: [PATCH] tests/mmu: Add a test for dcbz with translation on Signed-off-by: Paul Mackerras --- tests/mmu/head.S | 14 ++++++++++++++ tests/mmu/mmu.c | 21 +++++++++++++++++++++ tests/test_mmu.bin | Bin 20496 -> 20496 bytes tests/test_mmu.console_out | 1 + 4 files changed, 36 insertions(+) diff --git a/tests/mmu/head.S b/tests/mmu/head.S index 083b1c5..824ad67 100644 --- a/tests/mmu/head.S +++ b/tests/mmu/head.S @@ -80,6 +80,20 @@ test_write: mtmsrd %r9,0 blr + /* Do a dcbz with translation on */ + .globl test_dcbz +test_dcbz: + mfmsr %r9 + ori %r8,%r9,0x10 /* set MSR_DR */ + mtmsrd %r8,0 + mr %r6,%r3 + li %r3,0 + dcbz 0,%r6 + li %r3,1 + /* land here if DSI occurred */ + mtmsrd %r9,0 + blr + .globl test_exec test_exec: mtsrr0 %r4 diff --git a/tests/mmu/mmu.c b/tests/mmu/mmu.c index a44c79d..994ffe3 100644 --- a/tests/mmu/mmu.c +++ b/tests/mmu/mmu.c @@ -9,6 +9,7 @@ extern int test_read(long *addr, long *ret, long init); extern int test_write(long *addr, long val); +extern int test_dcbz(long *addr); extern int test_exec(int testno, unsigned long pc, unsigned long msr); static inline void do_tlbie(unsigned long rb, unsigned long rs) @@ -579,6 +580,25 @@ int mmu_test_17(void) return 0; } +int mmu_test_18(void) +{ + long *mem = (long *) 0x8000; + long *ptr = (long *) 0x124000; + long *ptr2 = (long *) 0x1124000; + + /* create PTE */ + map(ptr, mem, DFLT_PERM); + /* this should succeed and be a cache miss */ + if (!test_dcbz(&ptr[129])) + return 1; + /* create a second PTE */ + map(ptr2, mem, DFLT_PERM); + /* this should succeed and be a cache hit */ + if (!test_dcbz(&ptr2[130])) + return 2; + return 0; +} + int fail = 0; void do_test(int num, int (*test)(void)) @@ -633,6 +653,7 @@ int main(void) do_test(15, mmu_test_15); do_test(16, mmu_test_16); do_test(17, mmu_test_17); + do_test(18, mmu_test_18); return fail; } diff --git a/tests/test_mmu.bin b/tests/test_mmu.bin index afae999223bcb15bede8df58d6abc88bc7ea06dc..416ae706ac754e79daab704110bf8e4c8379c8f6 100755 GIT binary patch delta 1155 zcmZ9Ke@t6d6vywmbO@awvn^IOpunILx>*>52W$IUDD(Bl2xi2kY}00)3I4H#uxX4b zKZ8c&Ff_*{%Q6+rSh7EKvXaFm;y|-xGn;_~7d4x4#zYp1c5@nZ%dY3P^$$IHC->gZ z`JQvnz4wic!x()>czs*!l^0@D23?|&MW-$s`MIp4o4L`9@7SB67O&Xf&JI4oG*cmV z)piwMFfolW7JeYqrUxR|HvNd&cU26#?W|0>iVL+*x0_#$CD-yA(2*R7+F3-AtSQ5qSyL;&W|#IMidYX62v! zf;+SlFyf1vmCz`m=n|gSs!a1sLL8+Blx87MkZX8HtKiYwSm>(*4ShZI; zC)-4RgxDB{0@liLnvMJ^#E&xMOJ#Ten=O^I6!+p}z`7tob03>Kj zpE&;AlZ9!Q$(z)imRKh{YsLCis;G^y(*H{wvx016%p*1+EQT(E~f LW|7-SOOO8mjc|aI delta 1006 zcmZ9LT})G15Xa9P6fA;Puxda`TUIJi+=>bpq`fT#Y(AUQMDtmv~dwn*EqX~ZaE1|oP?_Y`M>}8OOBlh1D2Uaj|vjH2{H)QDy%*z;S z{36uSFG6PWvo$YpO58r(N2SuuZ}f{)8S!Gh@6 z=EVSd954R~BDl#>0tfN1;~4)ij18(4b1`q4-o|=zArwt16vhy0W<8F03 zMjAxp2BxSe&xCmi8(Q%`2uHieyXOI?U`Unhlj zi609(NGn+vv57c48qAw#VPaiE7~_H-N=D*>lR@3Qpr6IxB>1SX#UTTHk-i>WQU%5~5s+$fT}?d?RkHNrzq7TvGtSXm3rc P{Er_lHOZ@_&8^=6h`vx~ diff --git a/tests/test_mmu.console_out b/tests/test_mmu.console_out index a8e2dcb..a5c08ea 100644 --- a/tests/test_mmu.console_out +++ b/tests/test_mmu.console_out @@ -15,3 +15,4 @@ test 14:PASS test 15:PASS test 16:PASS test 17:PASS +test 18:PASS -- 2.30.2