qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "Alexander Graf" <agraf@suse.de>,
	"Dominik Dingel" <dingel@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH for-1.7] s390x: fix flat rom load on 32 bit systems
Date: Thu, 21 Nov 2013 13:24:13 +0100	[thread overview]
Message-ID: <20131121132413.0af9a66d@gondolin> (raw)
In-Reply-To: <20131121120822.GA23602@redhat.com>

On Thu, 21 Nov 2013 14:08:22 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> pc-bios/s390-zipl.rom is a flat image so it's expected that
> loading it as elf will fail.
> It should fall back on loading a flat file, but doesn't
> on 32 bit systems, instead it fails printing:
>     qemu: hardware error: could not load bootloader 's390-zipl.rom'
> 
> The result is boot failure.
> 
> The reason is that a 64 bit unsigned interger which is set
> to -1 on error is compared to -1UL which on a 32 bit system
> with gcc is a 32 bit unsigned interger.
> Since both are unsigned, no sign extension takes place and
> comparison evaluates to non-equal.
> 
> There's no reason to do clever tricks: -1 will cause
> sign extension to happen correctly automatically.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/s390x/ipl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index d69adb2..88115e9 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -80,7 +80,7 @@ static int s390_ipl_init(SysBusDevice *dev)
> 
>          bios_size = load_elf(bios_filename, NULL, NULL, &ipl->start_addr, NULL,
>                               NULL, 1, ELF_MACHINE, 0);
> -        if (bios_size == -1UL) {
> +        if (bios_size == -1) {
>              bios_size = load_image_targphys(bios_filename, ZIPL_IMAGE_START,
>                                              4096);
>              ipl->start_addr = ZIPL_IMAGE_START;

Makes sense, but doesn't the kernel loader just below suffer from just
the same problem?

  parent reply	other threads:[~2013-11-21 12:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 12:08 [Qemu-devel] [PATCH for-1.7] s390x: fix flat rom load on 32 bit systems Michael S. Tsirkin
2013-11-21 12:20 ` Alexander Graf
2013-11-21 12:24 ` Cornelia Huck [this message]
2013-11-21 12:25   ` Alexander Graf
2013-11-21 13:00   ` Michael S. Tsirkin

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=20131121132413.0af9a66d@gondolin \
    --to=cornelia.huck@de.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=dingel@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).