tests/misc: Add an icbi test
authorAnton Blanchard <anton@linux.ibm.com>
Thu, 23 Sep 2021 02:23:22 +0000 (12:23 +1000)
committerAnton Blanchard <anton@ozlabs.org>
Mon, 27 Sep 2021 05:30:41 +0000 (15:30 +1000)
We have a bug where an icbi can cause an instruction to execute twice.
Add a test case for this.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
tests/misc/head.S
tests/misc/misc.c
tests/test_misc.bin
tests/test_misc.console_out

index 9044c519dfbb71df3ad86030be5f47c48cb56d63..025f2266f5dbe2ef50f569180a45fea27111253a 100644 (file)
@@ -185,3 +185,33 @@ test_loadhitstore:
        or      %r7,%r6,%r7
        subf    %r3,%r0,%r7
        blr
+
+/* Test for double execution of addi */
+.balign 64
+       .global test_icbi
+test_icbi:
+1:     li      %r3,0
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       icbi    0,%r0
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       nop
+       addi    %r3,%r3,1
+       blr
index 3cc030070b569c6c59b6aa3ce58b01de71b4249b..d5eb12e77a00ba4aef7e22e8a26d16098b9140c2 100644 (file)
@@ -16,6 +16,7 @@ extern long test_mfpvr(void);
 extern long test_mtpvr(void);
 extern long test_bdnzl(void);
 extern long test_loadhitstore(void);
+extern long test_icbi(void);
 
 // i < 100
 void print_test_number(int i)
@@ -74,5 +75,12 @@ int main(void)
        } else
                puts(PASS);
 
+       print_test_number(7);
+       if (test_icbi() != 1) {
+               fail = 1;
+               puts(FAIL);
+       } else
+               puts(PASS);
+
        return fail;
 }
index 648ab184ab362a9a3c1ba0c554df4f1ceb96bb3e..0897d85a4404b8e19b81011c15c2d1870f58a218 100755 (executable)
Binary files a/tests/test_misc.bin and b/tests/test_misc.bin differ
index 5296101d5c1830bf45bd3ea3ea08d8f8176038c1..041accfdeae74ad0196d16948bdf57af25be6392 100644 (file)
@@ -4,3 +4,4 @@ Test 03:PASS
 Test 04:PASS\r
 Test 05:PASS\r
 Test 06:PASS\r
+Test 07:PASS\r