Skip to contentSkip to conversation

s390x: basic test infrastructure

PATCH In review David Hildenbrand 3 participants 12 messages May 22, 2017 – May 25, 2017 KVM

lore
Share & tools
lore
#0 lore raw

v3 cover s390x: basic test infrastructure

This adds the very basic infrastructure for s390x.

For now, only a basic self test is provided. This one will also run under TCG.

Parts taken from a prototype by Thomas Huth.

v2 -> v3:
- Fixed it up to allow for out-of-tree builds, added it to .travis.yml
- Selftest: removed parameter intendation, dropped a ":" from inline asm

David Hildenbrand (7):
s390x: initial infrastructure
s390x: basic self test
s390x: copy sclp.h and sclp-ascii.c from QEMU
s390x: compile sclp-ascii.c
s390x: wire up sclp console output
.travis.yml: add s390x
MAINTAINERS: add s390x maintainers

 .travis.yml              |   5 +++
 MAINTAINERS              |   7 +++
 lib/s390x/asm/barrier.h  |  16 +++++++
 lib/s390x/asm/io.h       |  18 ++++++++
 lib/s390x/asm/page.h     |  16 +++++++
 lib/s390x/asm/spinlock.h |  16 +++++++
 lib/s390x/asm/stack.h    |  21 +++++++++
 lib/s390x/io.c           |  49 +++++++++++++++++++++
 lib/s390x/sclp-ascii.c   |  68 +++++++++++++++++++++++++++++
 lib/s390x/sclp.h         | 108 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/s390x/stack.c        |  28 ++++++++++++
 s390x/Makefile           |  37 ++++++++++++++++
 s390x/cstart64.S         |  44 +++++++++++++++++++
 s390x/flat.lds           |  42 ++++++++++++++++++
 s390x/run                |  56 ++++++++++++++++++++++++
 s390x/selftest.c         |  41 ++++++++++++++++++
 s390x/unittests.cfg      |  24 +++++++++++
 17 files changed, 596 insertions(+)
 create mode 100644 lib/s390x/asm/barrier.h
 create mode 100644 lib/s390x/asm/io.h
 create mode 100644 lib/s390x/asm/page.h
 create mode 100644 lib/s390x/asm/spinlock.h
 create mode 100644 lib/s390x/asm/stack.h
 create mode 100644 lib/s390x/io.c
 create mode 100644 lib/s390x/sclp-ascii.c
 create mode 100644 lib/s390x/sclp.h
 create mode 100644 lib/s390x/stack.c
 create mode 100644 s390x/Makefile
 create mode 100644 s390x/cstart64.S
 create mode 100644 s390x/flat.lds
 create mode 100755 s390x/run
 create mode 100644 s390x/selftest.c
 create mode 100644 s390x/unittests.cfg
Signature · 1 line
2.9.3
#1 lore raw

PATCH v3 1/7 s390x: initial infrastructure

This adds the very basic infrastructure for s390x. As we compile for z900, also QEMU tcg can be used.

To cross compile:

$./configure --arch=s390x --cross-prefix=/usr/bin/s390x-linux-gnu-

$ make

Please note that for now, nothing will be compiled, as there is no test to compile. A basic self test will be added in the following patches.

smp and stack unwinding is not supported yet. sclp console output will be added in the following patches.

Parts based on a prototype by Thomas Huth.

---
 lib/s390x/asm/barrier.h  | 16 ++++++++++++++
 lib/s390x/asm/io.h       | 18 ++++++++++++++++
 lib/s390x/asm/page.h     | 16 ++++++++++++++
 lib/s390x/asm/spinlock.h | 16 ++++++++++++++
 lib/s390x/asm/stack.h    | 21 ++++++++++++++++++
 lib/s390x/io.c           | 48 +++++++++++++++++++++++++++++++++++++++++
 lib/s390x/stack.c        | 28 ++++++++++++++++++++++++
 s390x/Makefile           | 34 +++++++++++++++++++++++++++++
 s390x/cstart64.S         | 44 +++++++++++++++++++++++++++++++++++++
 s390x/flat.lds           | 42 ++++++++++++++++++++++++++++++++++++
 s390x/run                | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg      | 19 ++++++++++++++++
 12 files changed, 358 insertions(+)
 create mode 100644 lib/s390x/asm/barrier.h
 create mode 100644 lib/s390x/asm/io.h
 create mode 100644 lib/s390x/asm/page.h
 create mode 100644 lib/s390x/asm/spinlock.h
 create mode 100644 lib/s390x/asm/stack.h
 create mode 100644 lib/s390x/io.c
 create mode 100644 lib/s390x/stack.c
 create mode 100644 s390x/Makefile
 create mode 100644 s390x/cstart64.S
 create mode 100644 s390x/flat.lds
 create mode 100755 s390x/run
 create mode 100644 s390x/unittests.cfg
lib/s390x/asm/barrier.h new file +16 -0
new file mode 100644
index 0000000..d862e78
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ *  Thomas Huth <[email protected]>
+ *  David Hildenbrand <[email protected]>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#ifndef _ASM_S390X_BARRIER_H_
+#define _ASM_S390X_BARRIER_H_
+
+#include <asm-generic/barrier.h>
+
+#endif
lib/s390x/asm/io.h new file +18 -0
new file mode 100644
index 0000000..094dace
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ *  Thomas Huth <[email protected]>
+ *  David Hildenbrand <[email protected]>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#ifndef _ASMS390X_IO_H_
+#define _ASMS390X_IO_H_
+
+#define __iomem
+
+#include <asm-generic/io.h>
+
+#endif
lib/s390x/asm/page.h new file +16 -0
new file mode 100644
index 0000000..141a456
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ *  Thomas Huth <[email protected]>
+ *  David Hildenbrand <[email protected]>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#ifndef _ASMS390X_PAGE_H_
+#define _ASMS390X_PAGE_H_
+
+#include <asm-generic/page.h>
+
+#endif
lib/s390x/asm/spinlock.h new file +16 -0
new file mode 100644
index 0000000..f7d3982
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ *  Thomas Huth <[email protected]>
+ *  David Hildenbrand <[email protected]>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#ifndef __ASMS390X_SPINLOCK_H
+#define __ASMS390X_SPINLOCK_H
+
+#include <asm-generic/spinlock.h>
+
+#endif
lib/s390x/asm/stack.h new file +21 -0
new file mode 100644
index 0000000..e36d975
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ *  Thomas Huth <[email protected]>
+ *  David Hildenbrand <[email protected]>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#ifndef _ASMS390X_STACK_H_
+#define _ASMS390X_STACK_H_
+
+#ifndef _STACK_H_
+#error Do not directly include <asm/stack.h>. Just use <stack.h>.
+#endif
+
+#define HAVE_ARCH_BACKTRACE_FRAME
+#define HAVE_ARCH_BACKTRACE
+
+#endif
lib/s390x/io.c new file +48 -0

48 lines not on this page · raw message

lib/s390x/stack.c new file +28 -0
new file mode 100644
index 0000000..cd34b20
@@ -0,0 +1,28 @@
+/*
+ * s390x stack implementation
+ *
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ *  Thomas Huth <[email protected]>
+ *  David Hildenbrand <[email protected]>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#include <libcflat.h>
+#include <stack.h>
+
+int backtrace_frame(const void *frame, const void **return_addrs, int max_depth)
+{
+	printf("TODO: Implement backtrace_frame(%p, %p, %d) function!\n",
+	       frame, return_addrs, max_depth);
+	return 0;
+}
+
+int backtrace(const void **return_addrs, int max_depth)
+{
+	printf("TODO: Implement backtrace(%p, %d) function!\n",
+	       return_addrs, max_depth);
+	return 0;
+}
s390x/Makefile new file +34 -0
new file mode 100644
index 0000000..575956b
@@ -0,0 +1,34 @@
+all: directories test_cases
+
+test_cases: $(tests)
+
+CFLAGS += -std=gnu99
+CFLAGS += -ffreestanding
+CFLAGS += -Wextra
+CFLAGS += -I $(SRCDIR)/lib
+CFLAGS += -O2
+CFLAGS += -march=z900
+LDFLAGS += -nostdlib
+
+# We want to keep intermediate files
+.PRECIOUS: %.o
+
+cflatobjs += lib/util.o
+cflatobjs += lib/alloc.o
+cflatobjs += lib/s390x/io.o
+cflatobjs += lib/s390x/stack.o
+
+OBJDIRS += lib/s390x
+
+cstart.o = $(TEST_DIR)/cstart64.o
+
+FLATLIBS = $(libcflat)
+%.elf: %.o $(FLATLIBS) $(SRCDIR)/s390x/flat.lds $(cstart.o)
+	$(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) \
+		$(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$@\"
+	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds -Ttext=0x10000 \
+		$(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o)
+	$(RM) $(@:.elf=.aux.o)
+
+arch_clean:
+	$(RM) $(TEST_DIR)/*.{o,elf} $(TEST_DIR)/.*.d lib/s390x/.*.d
s390x/cstart64.S new file +44 -0

44 lines not on this page · raw message

s390x/flat.lds new file +42 -0

42 lines not on this page · raw message

s390x/run new file +56 -0

56 lines not on this page · raw message

s390x/unittests.cfg new file +19 -0
new file mode 100644
index 0000000..b1e0b1e
@@ -0,0 +1,19 @@
+##############################################################################
+# unittest configuration
+#
+# [unittest_name]
+# file = <name>.elf		# Name of the elf file to be used.
+# extra_params = -append <params...>	# Additional parameters used.
+# groups = <group_name1> <group_name2> ... # Used to identify test cases
+#					   # with run_tests -g ...
+#					   # Specify group_name=nodefault
+#					   # to have test not run by default
+# accel = kvm|tcg		# Optionally specify if test must run with
+#				# kvm or tcg. If not specified, then kvm will
+#				# be used when available.
+# timeout = <duration>		# Optionally specify a timeout.
+# check = <path>=<value> # check a file for a particular value before running
+#			 # a test. The check line can contain multiple files
+#			 # to check separated by a space but each check
+#			 # parameter needs to be of the form <path>=<value>
+##############################################################################
Signature · 1 line
2.9.3
#2 lore raw

PATCH v3 2/7 s390x: basic self test

In reply to David Hildenbrand

Test if the general infrastructure is working. The test will fail until we have proper sclp console output.

---
 s390x/Makefile      |  2 ++
 s390x/selftest.c    | 41 +++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg |  5 +++++
 3 files changed, 48 insertions(+)
 create mode 100644 s390x/selftest.c
s390x/Makefile +2 -0
index 575956b..d468029 100644
@@ -1,3 +1,5 @@
+tests = $(TEST_DIR)/selftest.elf
+
 all: directories test_cases
 
 test_cases: $(tests)
s390x/selftest.c new file +41 -0

41 lines not on this page · raw message

s390x/unittests.cfg +5 -0
index b1e0b1e..92e01ab 100644
@@ -17,3 +17,8 @@
 #			 # to check separated by a space but each check
 #			 # parameter needs to be of the form <path>=<value>
 ##############################################################################
+
+[selftest-setup]
+file = selftest.elf
+groups = selftest
+extra_params = -append 'test 123'
Signature · 1 line
2.9.3
#4 lore raw

PATCH v3 3/7 s390x: copy sclp.h and sclp-ascii.c from QEMU

In reply to David Hildenbrand

The s390x-ccw pcbios already has what we need to print to the sclp console. Let's copy the files and adjust them to our needs later.

---
 lib/s390x/sclp-ascii.c |  82 +++++++++++++++++++++++++++++++++++++
 lib/s390x/sclp.h       | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 189 insertions(+)
 create mode 100644 lib/s390x/sclp-ascii.c
 create mode 100644 lib/s390x/sclp.h
lib/s390x/sclp-ascii.c new file +82 -0
new file mode 100644
index 0000000..dc1c3e4
@@ -0,0 +1,82 @@
+/*
+ * SCLP ASCII access driver
+ *
+ * Copyright (c) 2013 Alexander Graf <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
+ * your option) any later version. See the COPYING file in the top-level
+ * directory.
+ */
+
+#include "s390-ccw.h"
+#include "sclp.h"
+
+static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));
+
+/* Perform service call. Return 0 on success, non-zero otherwise. */
+static int sclp_service_call(unsigned int command, void *sccb)
+{
+        int cc;
+
+        asm volatile(
+                "       .insn   rre,0xb2200000,%1,%2\n"  /* servc %1,%2 */
+                "       ipm     %0\n"
+                "       srl     %0,28"
+                : "=&d" (cc) : "d" (command), "a" (__pa(sccb))
+                : "cc", "memory");
+        consume_sclp_int();
+        if (cc == 3)
+                return -EIO;
+        if (cc == 2)
+                return -EBUSY;
+        return 0;
+}
+
+static void sclp_set_write_mask(void)
+{
+    WriteEventMask *sccb = (void *)_sccb;
+
+    sccb->h.length = sizeof(WriteEventMask);
+    sccb->mask_length = sizeof(unsigned int);
+    sccb->receive_mask = SCLP_EVENT_MASK_MSG_ASCII;
+    sccb->cp_receive_mask = SCLP_EVENT_MASK_MSG_ASCII;
+    sccb->send_mask = SCLP_EVENT_MASK_MSG_ASCII;
+    sccb->cp_send_mask = SCLP_EVENT_MASK_MSG_ASCII;
+
+    sclp_service_call(SCLP_CMD_WRITE_EVENT_MASK, sccb);
+}
+
+void sclp_setup(void)
+{
+    sclp_set_write_mask();
+}
+
+static int _strlen(const char *str)
+{
+    int i;
+    for (i = 0; *str; i++)
+        str++;
+    return i;
+}
+
+static void _memcpy(char *dest, const char *src, int len)
+{
+    int i;
+    for (i = 0; i < len; i++)
+        dest[i] = src[i];
+}
+
+void sclp_print(const char *str)
+{
+    int len = _strlen(str);
+    WriteEventData *sccb = (void *)_sccb;
+
+    sccb->h.length = sizeof(WriteEventData) + len;
+    sccb->h.function_code = SCLP_FC_NORMAL_WRITE;
+    sccb->ebh.length = sizeof(EventBufferHeader) + len;
+    sccb->ebh.type = SCLP_EVENT_ASCII_CONSOLE_DATA;
+    sccb->ebh.flags = 0;
+    _memcpy(sccb->data, str, len);
+
+    sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb);
+}
lib/s390x/sclp.h new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
2.9.3
#6 lore raw

PATCH v3 4/7 s390x: compile sclp-ascii.c

In reply to David Hildenbrand

We can reuse strlen and memcpy. __pa(x) is already defined in page.h We don't have (and need) defines for error values and consuming sclp irqs is not required, as we won't be passing control to some other OS.

---
 lib/s390x/sclp-ascii.c | 28 +++++++---------------------
 lib/s390x/sclp.h       |  2 --
 s390x/Makefile         |  1 +
 3 files changed, 8 insertions(+), 23 deletions(-)
lib/s390x/sclp-ascii.c +7 -21
index dc1c3e4..dfb9e68 100644
@@ -8,7 +8,9 @@
  * directory.
  */
 
-#include "s390-ccw.h"
+#include <libcflat.h>
+#include <string.h>
+#include <asm/page.h>
 #include "sclp.h"
 
 static char _sccb[PAGE_SIZE] __attribute__((__aligned__(4096)));
@@ -24,11 +26,10 @@ static int sclp_service_call(unsigned int command, void *sccb)
                 "       srl     %0,28"
                 : "=&d" (cc) : "d" (command), "a" (__pa(sccb))
                 : "cc", "memory");
-        consume_sclp_int();
         if (cc == 3)
-                return -EIO;
+                return -1;
         if (cc == 2)
-                return -EBUSY;
+                return -1;
         return 0;
 }
 
@@ -51,24 +52,9 @@ void sclp_setup(void)
     sclp_set_write_mask();
 }
 
-static int _strlen(const char *str)
-{
-    int i;
-    for (i = 0; *str; i++)
-        str++;
-    return i;
-}
-
-static void _memcpy(char *dest, const char *src, int len)
-{
-    int i;
-    for (i = 0; i < len; i++)
-        dest[i] = src[i];
-}
-
 void sclp_print(const char *str)
 {
-    int len = _strlen(str);
+    int len = strlen(str);
     WriteEventData *sccb = (void *)_sccb;
 
     sccb->h.length = sizeof(WriteEventData) + len;
@@ -76,7 +62,7 @@ void sclp_print(const char *str)
     sccb->ebh.length = sizeof(EventBufferHeader) + len;
     sccb->ebh.type = SCLP_EVENT_ASCII_CONSOLE_DATA;
     sccb->ebh.flags = 0;
-    _memcpy(sccb->data, str, len);
+    memcpy(sccb->data, str, len);
 
     sclp_service_call(SCLP_CMD_WRITE_EVENT_DATA, sccb);
 }
lib/s390x/sclp.h +0 -2
index 3cbfb78..c48cc21 100644
@@ -102,6 +102,4 @@ typedef struct ReadEventData {
     uint32_t mask;
 } __attribute__((packed)) ReadEventData;
 
-#define __pa(x) (x)
-
 #endif /* SCLP_H */
s390x/Makefile +1 -0
index d468029..e80add0 100644
@@ -19,6 +19,7 @@ cflatobjs += lib/util.o
 cflatobjs += lib/alloc.o
 cflatobjs += lib/s390x/io.o
 cflatobjs += lib/s390x/stack.o
+cflatobjs += lib/s390x/sclp-ascii.o
 
 OBJDIRS += lib/s390x
 
Signature · 1 line
2.9.3
#8 lore raw

PATCH v3 5/7 s390x: wire up sclp console output

In reply to David Hildenbrand

Now the basics should be working and therefore the self test should pass.

---
 lib/s390x/io.c   | 5 +++--
 lib/s390x/sclp.h | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)
lib/s390x/io.c +3 -2
index a652124..067ecf7 100644
@@ -12,6 +12,7 @@
  */
 #include <libcflat.h>
 #include <asm/spinlock.h>
+#include "sclp.h"
 
 extern void setup_args_progname(const char *args);
 extern char ipl_args[];
@@ -21,8 +22,7 @@ static struct spinlock lock;
 void puts(const char *s)
 {
 	spin_lock(&lock);
-	/* FIXME */
-	(void)s;
+	sclp_print(s);
 	spin_unlock(&lock);
 }
 
@@ -39,6 +39,7 @@ static void sigp_stop()
 void setup()
 {
 	setup_args_progname(ipl_args);
+	sclp_setup();
 }
 
 void exit(int code)
lib/s390x/sclp.h +3 -0
index c48cc21..3f4c138 100644
@@ -102,4 +102,7 @@ typedef struct ReadEventData {
     uint32_t mask;
 } __attribute__((packed)) ReadEventData;
 
+void sclp_setup(void);
+void sclp_print(const char *str);
+
 #endif /* SCLP_H */
Signature · 1 line
2.9.3
#9 lore raw

PATCH v3 6/7 .travis.yml: add s390x

In reply to David Hildenbrand

Let's also add the brand new s390x version.

---
 .travis.yml | 5 +++++
 1 file changed, 5 insertions(+)
.travis.yml +5 -0
index edccfe0..b06c33c 100644
@@ -11,6 +11,7 @@ addons:
       - gcc-arm-linux-gnueabihf
       - gcc-aarch64-linux-gnu
       - gcc-powerpc64le-linux-gnu
+      - gcc-s390x-linux-gnu
       # Run dependencies
       - qemu-system
 git:
@@ -33,6 +34,10 @@ env:
       BUILD_DIR="."
     - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
       BUILD_DIR="ppc64le-buildir"
+    - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
+      BUILD_DIR="."
+    - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
+      BUILD_DIR="s390x-builddir"
 
 before_script:
   - mkdir -p $BUILD_DIR && cd $BUILD_DIR
Signature · 1 line
2.9.3
#10 lore raw

PATCH v3 7/7 MAINTAINERS: add s390x maintainers

In reply to David Hildenbrand

Add Thomas and myself as maintainers for now.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index b86dea7..d07a4cf 100644
@@ -76,6 +76,13 @@ F: powerpc/*
 F: lib/powerpc/*
 F: lib/ppc64/*
 
+S390X
+M: Thomas Huth <[email protected]>
+M: David Hildenbrand <[email protected]>
+L: [email protected]
+F: s390x/*
+F: lib/s390x/*
+
 X86
 M: Paolo Bonzini <[email protected]>
 M: Radim Krčmář <[email protected]>
Signature · 1 line
2.9.3
Reviewed-by on v3 2/7
#3 lore raw

Re: [kvm-unit-tests PATCH v3 2/7] s390x: basic self test

In reply to David Hildenbrand
Quoted 10 lines · David Hildenbrand

Test if the general infrastructure is working. The test will fail until we have proper sclp console output.

---
 s390x/Makefile      |  2 ++
 s390x/selftest.c    | 41 +++++++++++++++++++++++++++++++++++++++++
 s390x/unittests.cfg |  5 +++++
 3 files changed, 48 insertions(+)
 create mode 100644 s390x/selftest.c
Reviewed-by on v3 3/7
#5 lore raw

Re: [kvm-unit-tests PATCH v3 3/7] s390x: copy sclp.h and sclp-ascii.c from QEMU

In reply to David Hildenbrand
Quoted 10 lines · David Hildenbrand

The s390x-ccw pcbios already has what we need to print to the sclp console. Let's copy the files and adjust them to our needs later.

---
 lib/s390x/sclp-ascii.c |  82 +++++++++++++++++++++++++++++++++++++
 lib/s390x/sclp.h       | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 189 insertions(+)
 create mode 100644 lib/s390x/sclp-ascii.c
 create mode 100644 lib/s390x/sclp.h
Reviewed-by on v3 4/7
#7 lore raw

Re: [kvm-unit-tests PATCH v3 4/7] s390x: compile sclp-ascii.c

In reply to David Hildenbrand
Quoted 10 lines · David Hildenbrand

We can reuse strlen and memcpy. __pa(x) is already defined in page.h We don't have (and need) defines for error values and consuming sclp irqs is not required, as we won't be passing control to some other OS.

---
 lib/s390x/sclp-ascii.c | 28 +++++++---------------------
 lib/s390x/sclp.h       |  2 --
 s390x/Makefile         |  1 +
 3 files changed, 8 insertions(+), 23 deletions(-)
maintainer
#11 lore raw
In reply to David Hildenbrand
Quoted 46 lines · David Hildenbrand

This adds the very basic infrastructure for s390x.

For now, only a basic self test is provided. This one will also run under TCG.

Parts taken from a prototype by Thomas Huth.

v2 -> v3:
- Fixed it up to allow for out-of-tree builds, added it to .travis.yml
- Selftest: removed parameter intendation, dropped a ":" from inline asm

David Hildenbrand (7):
s390x: initial infrastructure
s390x: basic self test
s390x: copy sclp.h and sclp-ascii.c from QEMU
s390x: compile sclp-ascii.c
s390x: wire up sclp console output
.travis.yml: add s390x
MAINTAINERS: add s390x maintainers

 .travis.yml              |   5 +++
 MAINTAINERS              |   7 +++
 lib/s390x/asm/barrier.h  |  16 +++++++
 lib/s390x/asm/io.h       |  18 ++++++++
 lib/s390x/asm/page.h     |  16 +++++++
 lib/s390x/asm/spinlock.h |  16 +++++++
 lib/s390x/asm/stack.h    |  21 +++++++++
 lib/s390x/io.c           |  49 +++++++++++++++++++++
 lib/s390x/sclp-ascii.c   |  68 +++++++++++++++++++++++++++++
 lib/s390x/sclp.h         | 108 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/s390x/stack.c        |  28 ++++++++++++
 s390x/Makefile           |  37 ++++++++++++++++
 s390x/cstart64.S         |  44 +++++++++++++++++++
 s390x/flat.lds           |  42 ++++++++++++++++++
 s390x/run                |  56 ++++++++++++++++++++++++
 s390x/selftest.c         |  41 ++++++++++++++++++
 s390x/unittests.cfg      |  24 +++++++++++
 17 files changed, 596 insertions(+)
 create mode 100644 lib/s390x/asm/barrier.h
 create mode 100644 lib/s390x/asm/io.h
 create mode 100644 lib/s390x/asm/page.h
 create mode 100644 lib/s390x/asm/spinlock.h
 create mode 100644 lib/s390x/asm/stack.h
 create mode 100644 lib/s390x/io.c
 create mode 100644 lib/s390x/sclp-ascii.c
Quoted 9 lines
 create mode 100644 lib/s390x/sclp.h
 create mode 100644 lib/s390x/stack.c
 create mode 100644 s390x/Makefile
 create mode 100644 s390x/cstart64.S
 create mode 100644 s390x/flat.lds
 create mode 100755 s390x/run
 create mode 100644 s390x/selftest.c
 create mode 100644 s390x/unittests.cfg

Thanks, didn't have time to test it today. Will push tomorrow.

Paolo