Browse Source
Similar to other archs, build a custom bios memory updater. Running the test with OF code is a cool trick, but SLOF takes a long time to boot. This reduces test time by around 3x (150s to 50s). Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>pull/268/head
committed by
Fabiano Rosas
6 changed files with 131 additions and 32 deletions
@ -0,0 +1,15 @@ |
|||
.PHONY: all clean |
|||
all: a-b-kernel.h |
|||
|
|||
a-b-kernel.h: ppc64.kernel |
|||
echo "$$__note" > $@ |
|||
xxd -i $< | sed -e 's/.*int.*//' >> $@ |
|||
|
|||
ppc64.kernel: ppc64.elf |
|||
$(CROSS_PREFIX)objcopy -O binary -S $< $@ |
|||
|
|||
ppc64.elf: a-b-kernel.S |
|||
$(CROSS_PREFIX)gcc -static -o $@ -nostdlib -Wl,--build-id=none $< |
|||
|
|||
clean: |
|||
$(RM) *.kernel *.elf |
|||
@ -0,0 +1,66 @@ |
|||
# |
|||
# Copyright (c) 2024 IBM, Inc |
|||
# |
|||
# This work is licensed under the terms of the GNU GPL, version 2 or later. |
|||
# See the COPYING file in the top-level directory. |
|||
|
|||
#include "../migration-test.h" |
|||
|
|||
.section .text |
|||
|
|||
.macro print ch |
|||
li %r3,PPC_H_PUT_TERM_CHAR |
|||
li %r4,0 |
|||
li %r5,1 |
|||
li %r6,\ch |
|||
sldi %r6,%r6,56 |
|||
sc 1 |
|||
.endm |
|||
|
|||
.globl _start |
|||
_start: |
|||
. = 0x100 |
|||
/* |
|||
* Enter 64-bit mode. Not necessary because the test uses 32-bit |
|||
* addresses, but those constants could easily be changed and break |
|||
* in 32-bit mode. |
|||
*/ |
|||
mfmsr %r9 |
|||
li %r10,-1 |
|||
rldimi %r9,%r10,63,0 |
|||
mtmsrd %r9 |
|||
|
|||
/* |
|||
* Set up test memory region. Non-volatiles are used because the |
|||
* hcall can clobber regs. |
|||
* r20 - start address |
|||
* r21 - number of pages |
|||
*/ |
|||
lis %r20,PPC_TEST_MEM_START@h |
|||
ori %r20,%r20,PPC_TEST_MEM_START@l |
|||
lis %r9,PPC_TEST_MEM_END@h |
|||
ori %r9,%r9,PPC_TEST_MEM_END@l |
|||
subf %r21,%r20,%r9 |
|||
li %r10,TEST_MEM_PAGE_SIZE |
|||
divd %r21,%r21,%r10 |
|||
|
|||
print 'A' |
|||
|
|||
li %r3,0 |
|||
mr %r9,%r20 |
|||
mtctr %r21 |
|||
1: stb %r3,0(%r9) |
|||
addi %r9,%r9,TEST_MEM_PAGE_SIZE |
|||
bdnz 1b |
|||
|
|||
loop: |
|||
mr %r9,%r20 |
|||
mtctr %r21 |
|||
1: lbz %r3,0(%r9) |
|||
addi %r3,%r3,1 |
|||
stb %r3,0(%r9) |
|||
addi %r9,%r9,TEST_MEM_PAGE_SIZE |
|||
bdnz 1b |
|||
|
|||
print 'B' |
|||
b loop |
|||
@ -0,0 +1,42 @@ |
|||
/* This file is automatically generated from the assembly file in
|
|||
* tests/migration/ppc64. Edit that file and then run "make all" |
|||
* inside tests/migration to update, and then remember to send both |
|||
* the header and the assembler differences in your patch submission. |
|||
*/ |
|||
unsigned char ppc64_kernel[] = { |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|||
0x00, 0x00, 0x00, 0x00, 0x7d, 0x20, 0x00, 0xa6, 0x39, 0x40, 0xff, 0xff, |
|||
0x79, 0x49, 0xf8, 0x0e, 0x7d, 0x20, 0x01, 0x64, 0x3e, 0x80, 0x00, 0x10, |
|||
0x62, 0x94, 0x00, 0x00, 0x3d, 0x20, 0x06, 0x40, 0x61, 0x29, 0x00, 0x00, |
|||
0x7e, 0xb4, 0x48, 0x50, 0x39, 0x40, 0x10, 0x00, 0x7e, 0xb5, 0x53, 0xd2, |
|||
0x38, 0x60, 0x00, 0x58, 0x38, 0x80, 0x00, 0x00, 0x38, 0xa0, 0x00, 0x01, |
|||
0x38, 0xc0, 0x00, 0x41, 0x78, 0xc6, 0xc1, 0xc6, 0x44, 0x00, 0x00, 0x22, |
|||
0x38, 0x60, 0x00, 0x00, 0x7e, 0x89, 0xa3, 0x78, 0x7e, 0xa9, 0x03, 0xa6, |
|||
0x98, 0x69, 0x00, 0x00, 0x39, 0x29, 0x10, 0x00, 0x42, 0x00, 0xff, 0xf8, |
|||
0x7e, 0x89, 0xa3, 0x78, 0x7e, 0xa9, 0x03, 0xa6, 0x88, 0x69, 0x00, 0x00, |
|||
0x38, 0x63, 0x00, 0x01, 0x98, 0x69, 0x00, 0x00, 0x39, 0x29, 0x10, 0x00, |
|||
0x42, 0x00, 0xff, 0xf0, 0x38, 0x60, 0x00, 0x58, 0x38, 0x80, 0x00, 0x00, |
|||
0x38, 0xa0, 0x00, 0x01, 0x38, 0xc0, 0x00, 0x42, 0x78, 0xc6, 0xc1, 0xc6, |
|||
0x44, 0x00, 0x00, 0x22, 0x4b, 0xff, 0xff, 0xcc |
|||
}; |
|||
|
|||
Loading…
Reference in new issue