On 18.05.2017 13:34, David Hildenbrand wrote: > 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. > > Signed-off-by: David Hildenbrand <david@xxxxxxxxxx> > --- > configure | 2 +- > 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 | 31 +++++++++++++++++++++++++++ > s390x/cstart64.S | 44 +++++++++++++++++++++++++++++++++++++ > s390x/flat.lds | 42 ++++++++++++++++++++++++++++++++++++ > s390x/run | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ > s390x/unittests.cfg | 19 ++++++++++++++++ > 13 files changed, 356 insertions(+), 1 deletion(-) > 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 > > diff --git a/configure b/configure > index d152414..3690041 100755 > --- a/configure > +++ b/configure > @@ -7,7 +7,7 @@ objcopy=objcopy > objdump=objdump > ar=ar > addr2line=addr2line > -arch=`uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/'` > +arch=`uname -m | sed -e 's/i.86/i386/;s/arm.*/arm/;s/ppc64.*/ppc64/;s/s390x.*/s390x/'` > host=$arch > cross_prefix= > endian="" I think we likely do not need this hunk on s390x, since we do not got something like ppc64le there...? [...] > diff --git a/s390x/run b/s390x/run > new file mode 100755 > index 0000000..cf333de > --- /dev/null > +++ b/s390x/run > @@ -0,0 +1,56 @@ > +#!/usr/bin/env bash > + > +if [ -z "$STANDALONE" ]; then > + if [ ! -f config.mak ]; then > + echo "run ./configure && make first. See ./configure -h" > + exit 2 > + fi > + source config.mak > + source scripts/arch-run.bash > +fi > + > +if [ -c /dev/kvm ]; then > + if [ "$HOST" = "s390x" ] && [ "$ARCH" = "s390x" ]; then > + kvm_available=yes > + fi > +fi > + > +if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ]; then > + echo "KVM is needed, but not available on this host" > + exit 2 > +fi > + > +if [ -z "$ACCEL" ]; then > + if [ "$kvm_available" = "yes" ]; then > + ACCEL="kvm" > + else > + ACCEL="tcg" > + fi > +fi > + > +qemu=$(search_qemu_binary) > + > +M='-machine s390-ccw-virtio' > +M+=",accel=$ACCEL" I'd maybe put the two above lines into one line only: M="-M s390-ccw-virtio,accel=$ACCEL" > +command="$qemu -nodefaults -nographic $M" > +command+=" -chardev stdio,id=con0 -device sclpconsole,chardev=con0" > +[ -f "$ENV" ] && command+=" -initrd $ENV" > +command+=" -kernel" > +command="$(timeout_cmd) $command" > +echo $command "$@" > + > +# We return the exit code via stdout, not via the QEMU return code > +lines=$(run_qemu $command "$@") > +ret=$? > +echo "$lines" > +if [ $ret -eq 1 ]; then > + testret=$(grep '^EXIT: ' <<<"$lines" | sed 's/.*STATUS=\([0-9][0-9]*\).*/\1/') > + if [ "$testret" ]; then > + if [ $testret -eq 1 ]; then > + ret=0 > + else > + ret=$testret > + fi > + fi > +fi > +exit $ret Apart from the two nits, patch looks fine to me, so feel free to add my: Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>