From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel <qemu-devel@nongnu.org>,
qemu-s390x <qemu-s390x@nongnu.org>,
Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>,
David Hildenbrand <david@redhat.com>,
Halil Pasic <pasic@linux.vnet.ibm.com>,
Janosch Frank <frankja@linux.vnet.ibm.com>,
Alexander Graf <agraf@suse.de>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] s390x/ipl: Try to detect Linux vs non Linux for initial IPL PSW
Date: Tue, 8 May 2018 18:47:48 +0200 [thread overview]
Message-ID: <ef140802-cfbe-1ea8-d26f-50c26b7a09f3@de.ibm.com> (raw)
In-Reply-To: <20180508141506.56480-1-borntraeger@de.ibm.com>
On 05/08/2018 04:15 PM, Christian Borntraeger wrote:
> 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>
> Acked-by: Jason J. Herne <jjherne@linux.ibm.com>
> ---
> hw/s390x/ipl.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 150f6c0582..c0fed26f03 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -104,7 +104,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;
> + uint64_t *iplpsw;
> + uint64_t pentry;
> + char *magic;
> int kernel_size;
> Error *err = NULL;
>
> @@ -156,6 +158,17 @@ 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 this is Linux use KERN_IMAGE_START */
> + magic = rom_ptr(0x10008);
> + if (magic && !memcmp(magic, "S390EP", 6)) {
> + pentry = KERN_IMAGE_START;
> + } else {
> + /* if not Linux use the IPL PSW */
> + iplpsw = rom_ptr(0);
> + if (iplpsw) {
> + pentry = *iplpsw & 0x7fffffffUL;
I forgot endianess conversion here.
> + }
> + }
> }
> if (kernel_size < 0) {
> error_setg(&err, "could not load kernel '%s'", ipl->kernel);
>
prev parent reply other threads:[~2018-05-08 16:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-08 14:15 [Qemu-devel] [PATCH] s390x/ipl: Try to detect Linux vs non Linux for initial IPL PSW Christian Borntraeger
2018-05-08 14:24 ` Thomas Huth
2018-05-08 16:46 ` Christian Borntraeger
2018-05-08 16:47 ` Christian Borntraeger [this message]
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=ef140802-cfbe-1ea8-d26f-50c26b7a09f3@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=agraf@suse.de \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.vnet.ibm.com \
--cc=pasic@linux.vnet.ibm.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).