From: Cornelia Huck <cohuck@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
Alexander Graf <agraf@suse.de>,
Richard Henderson <rth@twiddle.net>,
David Hildenbrand <david@redhat.com>,
Thomas Huth <thuth@redhat.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Cornelia Huck <cohuck@redhat.com>
Subject: [Qemu-devel] [PULL 04/12] s390x/ipl: Try to detect Linux vs non Linux for initial IPL PSW
Date: Tue, 19 Jun 2018 14:04:26 +0200 [thread overview]
Message-ID: <20180619120434.25062-5-cohuck@redhat.com> (raw)
In-Reply-To: <20180619120434.25062-1-cohuck@redhat.com>
From: Christian Borntraeger <borntraeger@de.ibm.com>
Right now the IPL device always starts from address 0x10000 (the usual
Linux entry point). To run other guests (e.g. test programs) it is
useful to use the IPL PSW from address 0. We can use the Linux magic
at 0x10008 to decide.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Message-Id: <20180612125933.262679-1-borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
hw/s390x/ipl.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 04245b5258..0d67349004 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -29,6 +29,7 @@
#include "exec/exec-all.h"
#define KERN_IMAGE_START 0x010000UL
+#define LINUX_MAGIC_ADDR 0x010008UL
#define KERN_PARM_AREA 0x010480UL
#define INITRD_START 0x800000UL
#define INITRD_PARM_START 0x010408UL
@@ -105,7 +106,9 @@ static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)
static void s390_ipl_realize(DeviceState *dev, Error **errp)
{
S390IPLState *ipl = S390_IPL(dev);
- uint64_t pentry = KERN_IMAGE_START;
+ uint32_t *ipl_psw;
+ uint64_t pentry;
+ char *magic;
int kernel_size;
Error *err = NULL;
@@ -157,10 +160,24 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
NULL, 1, EM_S390, 0, 0);
if (kernel_size < 0) {
kernel_size = load_image_targphys(ipl->kernel, 0, ram_size);
- }
- if (kernel_size < 0) {
- error_setg(&err, "could not load kernel '%s'", ipl->kernel);
- goto error;
+ if (kernel_size < 0) {
+ error_setg(&err, "could not load kernel '%s'", ipl->kernel);
+ goto error;
+ }
+ /* if this is Linux use KERN_IMAGE_START */
+ magic = rom_ptr(LINUX_MAGIC_ADDR);
+ if (magic && !memcmp(magic, "S390EP", 6)) {
+ pentry = KERN_IMAGE_START;
+ } else {
+ /* if not Linux load the address of the (short) IPL PSW */
+ ipl_psw = rom_ptr(4);
+ if (ipl_psw) {
+ pentry = be32_to_cpu(*ipl_psw) & 0x7fffffffUL;
+ } else {
+ error_setg(&err, "Could not get IPL PSW");
+ goto error;
+ }
+ }
}
/*
* Is it a Linux kernel (starting at 0x10000)? If yes, we fill in the
--
2.14.4
next prev parent reply other threads:[~2018-06-19 12:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 12:04 [Qemu-devel] [PULL 00/12] next round of s390x patches Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 01/12] virtio-ccw: clean up notify Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 02/12] vfio-ccw: add force unlimited prefetch property Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 03/12] vfio-ccw: remove orb.c64 (64 bit data addresses) check Cornelia Huck
2018-06-19 12:04 ` Cornelia Huck [this message]
2018-06-19 12:04 ` [Qemu-devel] [PULL 05/12] s390x/cpumodels: add z14 Model ZR1 Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 06/12] pc-bios/s390-ccw: define loadparm length Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 07/12] roms: Update SLOF submodule to current status Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 08/12] pc-bios/s390-ccw/net: Update code for the latest changes in SLOF Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 09/12] pc-bios/s390-ccw/net: Add support for pxelinux-style config files Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 10/12] pc-bios/s390-ccw/net: Try to load pxelinux.cfg file accoring to the UUID Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 11/12] pc-bios/s390-ccw: Optimize the s390-netboot.img for size Cornelia Huck
2018-06-19 12:04 ` [Qemu-devel] [PULL 12/12] pc-bios/s390-ccw: Update the s390-netboot.img binary Cornelia Huck
2018-06-20 9:52 ` [Qemu-devel] [PULL 00/12] next round of s390x patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180619120434.25062-5-cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).