Re: [Qemu-devel] [PATCH] tests/tcg/alpha: add system boot.S

2019-05-04 Thread Alex Bennée


Richard Henderson  writes:

> On 5/3/19 10:07 AM, Alex Bennée wrote:
>> +ldah$sp, $stack_end($gp)!gprelhigh
>> +lda $sp, $stack_end($gp)!gprellow
>
> Bah.    $sp
>
> As is, this works only because the test case is tiny, and this happens to
> evaluate to the middle of the stack allocation.

cool. that fixes the exception I was seeing while running the
cleaned up memory test.

--
Alex Bennée



Re: [Qemu-devel] [PATCH] tests/tcg/alpha: add system boot.S

2019-05-03 Thread Richard Henderson
On 5/3/19 10:07 AM, Alex Bennée wrote:
> + ldah$sp, $stack_end($gp)!gprelhigh
> + lda $sp, $stack_end($gp)!gprellow

Bah.    $sp

As is, this works only because the test case is tiny, and this happens to
evaluate to the middle of the stack allocation.


r~



Re: [Qemu-devel] [PATCH] tests/tcg/alpha: add system boot.S

2019-05-03 Thread Alex Bennée


Richard Henderson  writes:

> This provides the bootstrap and low level helper functions for an
> alpha kernel.  We use direct access to the DP264 serial port for
> test output, and hard machine halt to exit the emulation.

Queued to testing/next, thanks.

I've also added tests/tcg/alpha/system/ to MAINTAINERS

>
> Signed-off-by: Richard Henderson 
> ---
>  tests/tcg/alpha/Makefile.softmmu-target |  32 ++
>  tests/tcg/alpha/system/boot.S   | 511 
>  tests/tcg/alpha/system/kernel.ld|  30 ++
>  3 files changed, 573 insertions(+)
>  create mode 100644 tests/tcg/alpha/Makefile.softmmu-target
>  create mode 100644 tests/tcg/alpha/system/boot.S
>  create mode 100644 tests/tcg/alpha/system/kernel.ld
>
> diff --git a/tests/tcg/alpha/Makefile.softmmu-target 
> b/tests/tcg/alpha/Makefile.softmmu-target
> new file mode 100644
> index 00..9f4b199258
> --- /dev/null
> +++ b/tests/tcg/alpha/Makefile.softmmu-target
> @@ -0,0 +1,32 @@
> +#
> +# Alpha system tests
> +#
> +
> +ALPHA_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/alpha/system
> +VPATH+=$(ALPHA_SYSTEM_SRC)
> +
> +# These objects provide the basic boot code and helper functions for all 
> tests
> +CRT_OBJS=boot.o
> +
> +ALPHA_TEST_SRCS=$(wildcard $(ALPHA_SYSTEM_SRC)/*.c)
> +ALPHA_TESTS = $(patsubst $(ALPHA_SYSTEM_SRC)/%.c, %, $(ALPHA_TEST_SRCS))
> +
> +CRT_PATH=$(ALPHA_SYSTEM_SRC)
> +LINK_SCRIPT=$(ALPHA_SYSTEM_SRC)/kernel.ld
> +LDFLAGS=-Wl,-T$(LINK_SCRIPT)
> +TESTS+=$(ALPHA_TESTS) $(MULTIARCH_TESTS)
> +CFLAGS+=-nostdlib -g -O1 -mcpu=ev6 $(MINILIB_INC)
> +LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
> +
> +# building head blobs
> +.PRECIOUS: $(CRT_OBJS)
> +
> +%.o: $(CRT_PATH)/%.S
> + $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@
> +
> +# Build and link the tests
> +%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
> + $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
> +
> +# Running
> +QEMU_OPTS+=-serial chardev:output -kernel
> diff --git a/tests/tcg/alpha/system/boot.S b/tests/tcg/alpha/system/boot.S
> new file mode 100644
> index 00..6d7fb36e17
> --- /dev/null
> +++ b/tests/tcg/alpha/system/boot.S
> @@ -0,0 +1,511 @@
> +/*
> + * Minimal Alpha system boot code.
> + *
> + * Copyright Linaro Ltd 2019
> + */
> +
> + .setnoat
> + .setnomacro
> + .arch   ev6
> + .text
> +
> +.macro load_pci_io reg
> + /* For typhoon, this is
> +  *   0xfc00  -- kseg identity map
> +  * +  0x100  -- typhoon pio base
> +  * +0x1fc00  -- typhoon pchip0 pci base
> +  * = 0xfd01fc00
> +  */
> + ldah\reg, -3/* ff..fd */
> + lda \reg, 0x1fc(\reg)   /* ff..fd01fc */
> + sll \reg, 24, \reg
> +.endm
> +
> +#define com1Rbr 0x3f8
> +#define com1Thr 0x3f8
> +#define com1Ier 0x3f9
> +#define com1Iir 0x3fa
> +#define com1Lcr 0x3fb
> +#define com1Mcr 0x3fc
> +#define com1Lsr 0x3fd
> +#define com1Msr 0x3fe
> +#define com1Scr 0x3ff
> +#define com1Dll 0x3f8
> +#define com1Dlm 0x3f9
> +
> +#define PAL_halt0
> +#define PAL_wrent  52
> +#define PAL_wrkgp  55
> +
> + .text
> + .p2align 4
> + .globl  _start
> + .ent_start
> +_start:
> + br  $gp, .+4
> + ldah$gp, 0($gp) !gpdisp!1
> + lda $gp, 0($gp) !gpdisp!1
> +
> + ldah$sp, $stack_end($gp)!gprelhigh
> + lda $sp, $stack_end($gp)!gprellow
> +
> + /* Install kernel gp for exception handlers.  */
> + mov $gp, $16
> + call_pal PAL_wrkgp
> +
> + /* Install exception handlers.  */
> + ldah$16, entInt($gp)!gprelhigh
> + lda $16, entInt($16)!gprellow
> + lda $17, 0
> + call_pal PAL_wrent
> +
> + ldah$16, entArith($gp)  !gprelhigh
> + lda $16, entArith($16)  !gprellow
> + lda $17, 1
> + call_pal PAL_wrent
> +
> + ldah$16, entMM($gp) !gprelhigh
> + lda $16, entMM($16) !gprellow
> + lda $17, 2
> + call_pal PAL_wrent
> +
> + ldah$16, entIF($gp) !gprelhigh
> + lda $16, entIF($16) !gprellow
> + lda $17, 3
> + call_pal PAL_wrent
> +
> + ldah$16, entUna($gp)!gprelhigh
> + lda $16, entUna($16)!gprellow
> + lda $17, 4
> + call_pal PAL_wrent
> +
> + ldah$16, entSys($gp)!gprelhigh
> + lda $16, entSys($16)!gprellow
> + lda $17, 5
> + call_pal PAL_wrent
> +
> + /*
> +  * Initialize COM1.
> +  */
> + load_pci_io $1
> + lda $2, 0x87/* outb(0x87, com1Lcr); */
> + stb $2, com1Lcr($1)
> + stb $31, com1Dlm($1)/* outb(0, com1Dlm); */
> + lda $2, 3   /* baudconst 3 => 56000 */
> + stb $2, com1Dll($1) /* outb(baudconst, com1Dll); */
> + lda $2, 0x07
> + stb $2, com1Lcr($1) /* outb(0x07, com1Lcr) */

Re: [Qemu-devel] [PATCH] tests/tcg/alpha: add system boot.S

2019-05-01 Thread no-reply
Patchew URL: 
https://patchew.org/QEMU/20190501184306.15208-1-richard.hender...@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20190501184306.15208-1-richard.hender...@linaro.org
Subject: [Qemu-devel] [PATCH] tests/tcg/alpha: add system boot.S

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]   
patchew/20190501184306.15208-1-richard.hender...@linaro.org -> 
patchew/20190501184306.15208-1-richard.hender...@linaro.org
Switched to a new branch 'test'
9618d83b76 tests/tcg/alpha: add system boot.S

=== OUTPUT BEGIN ===
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#15: 
new file mode 100644

ERROR: trailing whitespace
#208: FILE: tests/tcg/alpha/system/boot.S:151:
+^I/* $

ERROR: trailing whitespace
#233: FILE: tests/tcg/alpha/system/boot.S:176:
+^I/* $

total: 2 errors, 1 warnings, 573 lines checked

Commit 9618d83b764f (tests/tcg/alpha: add system boot.S) has style problems, 
please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190501184306.15208-1-richard.hender...@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-de...@redhat.com

[Qemu-devel] [PATCH] tests/tcg/alpha: add system boot.S

2019-05-01 Thread Richard Henderson
This provides the bootstrap and low level helper functions for an
alpha kernel.  We use direct access to the DP264 serial port for
test output, and hard machine halt to exit the emulation.

Signed-off-by: Richard Henderson 
---
 tests/tcg/alpha/Makefile.softmmu-target |  32 ++
 tests/tcg/alpha/system/boot.S   | 511 
 tests/tcg/alpha/system/kernel.ld|  30 ++
 3 files changed, 573 insertions(+)
 create mode 100644 tests/tcg/alpha/Makefile.softmmu-target
 create mode 100644 tests/tcg/alpha/system/boot.S
 create mode 100644 tests/tcg/alpha/system/kernel.ld

diff --git a/tests/tcg/alpha/Makefile.softmmu-target 
b/tests/tcg/alpha/Makefile.softmmu-target
new file mode 100644
index 00..9f4b199258
--- /dev/null
+++ b/tests/tcg/alpha/Makefile.softmmu-target
@@ -0,0 +1,32 @@
+#
+# Alpha system tests
+#
+
+ALPHA_SYSTEM_SRC=$(SRC_PATH)/tests/tcg/alpha/system
+VPATH+=$(ALPHA_SYSTEM_SRC)
+
+# These objects provide the basic boot code and helper functions for all tests
+CRT_OBJS=boot.o
+
+ALPHA_TEST_SRCS=$(wildcard $(ALPHA_SYSTEM_SRC)/*.c)
+ALPHA_TESTS = $(patsubst $(ALPHA_SYSTEM_SRC)/%.c, %, $(ALPHA_TEST_SRCS))
+
+CRT_PATH=$(ALPHA_SYSTEM_SRC)
+LINK_SCRIPT=$(ALPHA_SYSTEM_SRC)/kernel.ld
+LDFLAGS=-Wl,-T$(LINK_SCRIPT)
+TESTS+=$(ALPHA_TESTS) $(MULTIARCH_TESTS)
+CFLAGS+=-nostdlib -g -O1 -mcpu=ev6 $(MINILIB_INC)
+LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
+
+# building head blobs
+.PRECIOUS: $(CRT_OBJS)
+
+%.o: $(CRT_PATH)/%.S
+   $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@
+
+# Build and link the tests
+%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
+   $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+
+# Running
+QEMU_OPTS+=-serial chardev:output -kernel
diff --git a/tests/tcg/alpha/system/boot.S b/tests/tcg/alpha/system/boot.S
new file mode 100644
index 00..6d7fb36e17
--- /dev/null
+++ b/tests/tcg/alpha/system/boot.S
@@ -0,0 +1,511 @@
+/*
+ * Minimal Alpha system boot code.
+ *
+ * Copyright Linaro Ltd 2019
+ */
+
+   .setnoat
+   .setnomacro
+   .arch   ev6
+   .text
+
+.macro load_pci_io reg
+   /* For typhoon, this is
+*   0xfc00  -- kseg identity map
+* +  0x100  -- typhoon pio base
+* +0x1fc00  -- typhoon pchip0 pci base
+* = 0xfd01fc00
+*/
+   ldah\reg, -3/* ff..fd */
+   lda \reg, 0x1fc(\reg)   /* ff..fd01fc */
+   sll \reg, 24, \reg
+.endm
+
+#define com1Rbr 0x3f8
+#define com1Thr 0x3f8
+#define com1Ier 0x3f9
+#define com1Iir 0x3fa
+#define com1Lcr 0x3fb
+#define com1Mcr 0x3fc
+#define com1Lsr 0x3fd
+#define com1Msr 0x3fe
+#define com1Scr 0x3ff
+#define com1Dll 0x3f8
+#define com1Dlm 0x3f9
+
+#define PAL_halt0
+#define PAL_wrent  52
+#define PAL_wrkgp  55
+
+   .text
+   .p2align 4
+   .globl  _start
+   .ent_start
+_start:
+   br  $gp, .+4
+   ldah$gp, 0($gp) !gpdisp!1
+   lda $gp, 0($gp) !gpdisp!1
+
+   ldah$sp, $stack_end($gp)!gprelhigh
+   lda $sp, $stack_end($gp)!gprellow
+
+   /* Install kernel gp for exception handlers.  */
+   mov $gp, $16
+   call_pal PAL_wrkgp
+
+   /* Install exception handlers.  */
+   ldah$16, entInt($gp)!gprelhigh
+   lda $16, entInt($16)!gprellow
+   lda $17, 0
+   call_pal PAL_wrent
+
+   ldah$16, entArith($gp)  !gprelhigh
+   lda $16, entArith($16)  !gprellow
+   lda $17, 1
+   call_pal PAL_wrent
+
+   ldah$16, entMM($gp) !gprelhigh
+   lda $16, entMM($16) !gprellow
+   lda $17, 2
+   call_pal PAL_wrent
+
+   ldah$16, entIF($gp) !gprelhigh
+   lda $16, entIF($16) !gprellow
+   lda $17, 3
+   call_pal PAL_wrent
+
+   ldah$16, entUna($gp)!gprelhigh
+   lda $16, entUna($16)!gprellow
+   lda $17, 4
+   call_pal PAL_wrent
+
+   ldah$16, entSys($gp)!gprelhigh
+   lda $16, entSys($16)!gprellow
+   lda $17, 5
+   call_pal PAL_wrent
+
+   /*
+* Initialize COM1.
+*/
+   load_pci_io $1
+   lda $2, 0x87/* outb(0x87, com1Lcr); */
+   stb $2, com1Lcr($1)
+   stb $31, com1Dlm($1)/* outb(0, com1Dlm); */
+   lda $2, 3   /* baudconst 3 => 56000 */
+   stb $2, com1Dll($1) /* outb(baudconst, com1Dll); */
+   lda $2, 0x07
+   stb $2, com1Lcr($1) /* outb(0x07, com1Lcr) */
+   lda $2, 0x0f
+   stb $2, com1Mcr($1) /* outb(0x0f, com1Mcr) */
+
+   bsr $26, main   !samegp
+
+   /* fall through to _exit */
+   .end_start
+
+   .globl  _exit
+   .ent_exit
+_exit:
+   .frame  $sp, 0, $26, 0
+   .prologue 0