From patchwork Mon Jan 21 10:45:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10773539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C798713B4 for ; Mon, 21 Jan 2019 10:46:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B759F29E32 for ; Mon, 21 Jan 2019 10:46:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB2CC29E36; Mon, 21 Jan 2019 10:46:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CA3829E34 for ; Mon, 21 Jan 2019 10:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbfAUKqN (ORCPT ); Mon, 21 Jan 2019 05:46:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42738 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726837AbfAUKqM (ORCPT ); Mon, 21 Jan 2019 05:46:12 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E80980508; Mon, 21 Jan 2019 10:46:12 +0000 (UTC) Received: from thuth.com (ovpn-116-152.ams2.redhat.com [10.36.116.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4258068360; Mon, 21 Jan 2019 10:46:11 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?b?UmFk?= =?utf-8?b?aW0gS3LEjW3DocWZ?= Cc: David Hildenbrand , Janosch Frank Subject: [kvm-unit-tests PULL 05/10] s390x: Make tests bootable from disk Date: Mon, 21 Jan 2019 11:45:50 +0100 Message-Id: <1548067555-15766-6-git-send-email-thuth@redhat.com> In-Reply-To: <1548067555-15766-1-git-send-email-thuth@redhat.com> References: <1548067555-15766-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 21 Jan 2019 10:46:12 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Janosch Frank Currently tests are run with the --kernel option of Qemu, which will load the ELF file and jump to the start address. When booting from disk, we need to specify a start address. This is done by setting the initial short PSW at 0x0. .text was moved to 0x11000 because the bootloader can write from 0x10480 until 0x11000 if it has a lot to write. 0x10480 to 0x10600 was not enough safe space. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Reviewed-by: David Hildenbrand Signed-off-by: Thomas Huth --- s390x/Makefile | 2 +- s390x/cstart64.S | 8 +++++++- s390x/flat.lds | 13 ++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/s390x/Makefile b/s390x/Makefile index ede2961..ed6ef0b 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -50,7 +50,7 @@ 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 \ + $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \ $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o) $(RM) $(@:.elf=.aux.o) @chmod a-x $@ diff --git a/s390x/cstart64.S b/s390x/cstart64.S index dc7ddd6..385915e 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -14,7 +14,13 @@ .section .init -/* entry point - for KVM + TCG we directly start in 64 bit mode */ +/* + * Short init between 0x10000 and 0x10480 and then jump to 0x11000. + * 0x10480 - 0x11000 are written to by bootloader. + * + * For KVM and TCG kernel boot we are in 64 bit z/Arch mode. + * When booting from disk the initial short psw is in 31 bit mode. + */ .globl start start: /* setup stack */ diff --git a/s390x/flat.lds b/s390x/flat.lds index b6e2172..977af7c 100644 --- a/s390x/flat.lds +++ b/s390x/flat.lds @@ -1,10 +1,21 @@ SECTIONS { + /* + * Initial short psw for disk boot, with 31 bit addressing for + * non z/Arch environment compatibility and the instruction + * address 0x10000 (cstart64.S .init). + */ + .lowcore : { + . = 0; + LONG(0x00080000) + LONG(0x80010000) + } + . = 0x10000; .text : { *(.init) . = 0x480; ipl_args = .; - . = 0x600; + . = 0x1000; *(.text) *(.text.*) }