Merge pull request #334 from antonblanchard/icbi-issue

Add a test for icbi and dcbz issues
boxarty-20211011
Michael Neuling 3 years ago committed by GitHub
commit 9cbe1f4a17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -185,3 +185,75 @@ test_loadhitstore:
or %r7,%r6,%r7 or %r7,%r6,%r7
subf %r3,%r0,%r7 subf %r3,%r0,%r7
blr 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

.global test_dcbz_near_store
test_dcbz_near_store:
li %r0,-1
addi %r10,%r1,-64
# cacheline align stack pointer
srdi %r10,%r10,6
sldi %r10,%r10,6

std %r0,0(%r10)
std %r0,8(%r10)
std %r0,16(%r10)
std %r0,24(%r10)
std %r0,32(%r10)
std %r0,40(%r10)
std %r0,48(%r10)
std %r0,56(%r10)

li %r3,0xa5
# Store to same cacheline as dcbz, although it doesn't seem
# necessary to hit the issue.
std %r3,0(%r10)
dcbz 0,%r10

ld %r0,0(%r10)
ld %r3,8(%r10)
ld %r4,16(%r10)
ld %r5,24(%r10)
ld %r6,32(%r10)
ld %r7,40(%r10)
ld %r8,48(%r10)
ld %r9,56(%r10)

or %r3,%r3,%r0
or %r3,%r3,%r4
or %r3,%r3,%r5
or %r3,%r3,%r6
or %r3,%r3,%r7
or %r3,%r3,%r8
or %r3,%r3,%r9

blr

@ -16,6 +16,8 @@ extern long test_mfpvr(void);
extern long test_mtpvr(void); extern long test_mtpvr(void);
extern long test_bdnzl(void); extern long test_bdnzl(void);
extern long test_loadhitstore(void); extern long test_loadhitstore(void);
extern long test_icbi(void);
extern long test_dcbz_near_store(void);


// i < 100 // i < 100
void print_test_number(int i) void print_test_number(int i)
@ -74,5 +76,19 @@ int main(void)
} else } else
puts(PASS); puts(PASS);


print_test_number(7);
if (test_icbi() != 1) {
fail = 1;
puts(FAIL);
} else
puts(PASS);

print_test_number(8);
if (test_dcbz_near_store() != 0) {
fail = 1;
puts(FAIL);
} else
puts(PASS);

return fail; return fail;
} }

Binary file not shown.

@ -4,3 +4,5 @@ Test 03:PASS
Test 04:PASS Test 04:PASS
Test 05:PASS Test 05:PASS
Test 06:PASS Test 06:PASS
Test 07:PASS
Test 08:PASS

Loading…
Cancel
Save