qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@linux.vnet.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Alexander Graf <agraf@suse.de>,
	Markus Armbruster <armbru@redhat.com>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PULL 00/20] s390x/kvm: Features and fixes for 2.3
Date: Wed, 11 Mar 2015 10:00:46 +0100	[thread overview]
Message-ID: <20150311100046.3bdd8f18@oc7435384737.ibm.com> (raw)
In-Reply-To: <54FFF831.8050800@de.ibm.com>

On Wed, 11 Mar 2015 09:09:21 +0100
Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> Am 11.03.2015 um 08:57 schrieb Markus Armbruster:
> > Christian Borntraeger <borntraeger@de.ibm.com> writes:
> > 
> >> Am 10.03.2015 um 19:01 schrieb Peter Maydell:
> >>> On 10 March 2015 at 08:37, Christian Borntraeger
> >>> <borntraeger@de.ibm.com> wrote:
> >>>> Peter,
> >>>>
> >>>> this pull reuqest contains a header sync to 4.0-rc3. This should cause
> >>>> no merge conflicts with other header syncs against 4.0-rc2. So here
> >>>> is the s390 pull request.
> >>>>
> >>>> The following changes since commit 277263e1b320d759a760ba6c5ea75ec268f929e5:
> >>>>
> >>>>   Merge remote-tracking branch
> >>>> remotes/agraf/tags/signed-ppc-for-upstream' into staging
> >>>> (2015-03-09 14:04:14 +0000)
> >>>>
> >>>> are available in the git repository at:
> >>>>
> >>>>   git://github.com/borntraeger/qemu.git tags/s390x-20150310
> >>>>
> >>>> for you to fetch changes up to 6342cb1443b37d249a0e2005128ade07a80a97f5:
> >>>>
> >>>>   s390-ccw: rebuild BIOS (2015-03-10 09:26:33 +0100)
> >>>
> >>> Unfortunately I see build failures on 32 bit hosts:
> >>>
> >>> /root/qemu/hw/s390x/ipl.c: In function ‘bios_translate_addr’:
> >>> /root/qemu/hw/s390x/ipl.c:101:24: error: cast from pointer to integer
> >>> of different size [-Werror=pointer-to-int-cast]
> >>> /root/qemu/hw/s390x/ipl.c: In function ‘s390_ipl_init’:
> >>> /root/qemu/hw/s390x/ipl.c:135:30: error: cast to pointer from integer
> >>> of different size [-Werror=int-to-pointer-cast]
> >>>
> >>
> >> O dear. Seems that every pull request after your vacation is somewhat broken.
> >> I fixed up patch 19 (" s390/bios: Make the s390-ccw.img relocatable") as
> >> such
> >>
> >> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> >> index ab7fd8a..6ed18d3 100644
> >> --- a/hw/s390x/ipl.c
> >> +++ b/hw/s390x/ipl.c
> >> @@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {
> >>  
> >>  static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)
> >>  {
> >> -    uint64_t dstaddr = (uint64_t)opaque;
> >> +    uint64_t dstaddr = (uint64_t) (unsigned long) opaque;
> >>      /*
> >>       * Assuming that our s390-ccw.img was linked for starting at address 0,
> >>       * we can simply add the destination address for the final location
> > 
> > Won't this shift the warning from hosts where sizeof(void *) !=
> > sizeof(uint64_t) to hosts where it's != sizeof(unsigned long)?
> 
> Indeed. I was only thinking about Linux, where sizeof(unsigned long) == sizeof(void*).
> But Windows has a different model. We have to cover all kind of lp64, llp64 and friends.
> 
> > What about using uintptr_t instead?
> 
> Should work. Will have a try on Linux 32bit/64bit..no way to test on windows, though :-(

Thinking about this again, I think the really proper solution is rather
this:

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 437c3ea..2eb55ca 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -98,7 +98,7 @@ static const VMStateDescription vmstate_ipl = {
 
 static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)
 {
-    uint64_t dstaddr = (uint64_t)opaque;
+    uint64_t dstaddr = *(uint64_t*)opaque;
     /*
      * Assuming that our s390-ccw.img was linked for starting at address 0,
      * we can simply add the destination address for the final location
@@ -132,7 +132,7 @@ static int s390_ipl_init(SysBusDevice *dev)
         }
 
         bios_size = load_elf(bios_filename, bios_translate_addr,
-                             (void *)fwbase, &ipl->bios_start_addr,
+                             &fwbase, &ipl->bios_start_addr,
                              NULL, NULL, 1, ELF_MACHINE, 0);
 
         if (bios_size > 0) {

Instead of passing the uint64 value in the pointer, let's rather pass a
pointer to that value instead. Then we can also be sure to get the full
64-bit value in bios_translate_addr().

 Thomas

  reply	other threads:[~2015-03-11  9:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10  8:37 [Qemu-devel] [PULL 00/20] s390x/kvm: Features and fixes for 2.3 Christian Borntraeger
2015-03-10  8:37 ` [Qemu-devel] [PULL 01/20] synchronize Linux headers to 4.0-rc3 Christian Borntraeger
2015-03-10  8:37 ` [Qemu-devel] [PULL 02/20] s390x: introduce defines for SIGP condition codes Christian Borntraeger
2015-03-10  8:37 ` [Qemu-devel] [PULL 03/20] s390x/kvm: more details for SIGP handler with one destination vcpu Christian Borntraeger
2015-03-10  8:37 ` [Qemu-devel] [PULL 04/20] s390x/kvm: pass the SIGP instruction parameter to the SIGP handler Christian Borntraeger
2015-03-10  8:37 ` [Qemu-devel] [PULL 05/20] s390x/kvm: helper to set the SIGP status in SigpInfo Christian Borntraeger
2015-03-10  8:37 ` [Qemu-devel] [PULL 06/20] s390x/kvm: trace all SIGP orders Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 07/20] s390x/kvm: implement handling of new " Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 08/20] s390x/kvm: SIGP START is only applicable when STOPPED Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 09/20] s390x: add function to deliver restart irqs Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 10/20] s390x/kvm: deliver SIGP RESTART directly if stopped Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 11/20] s390x/kvm: enable the new SIGP handling in user space Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 12/20] virtio-s390: s390_virtio_device_init() can't fail, simplify Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 13/20] virtio-s390: Convert to realize() Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 14/20] virtio-ccw: " Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 15/20] s390x/kvm: passing max memory size to accelerator Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 16/20] s390-ccw.img: Allow bigger ramdisk sizes or offsets Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 17/20] s390-ccw.img: Reinitialize guessing on reboot Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 18/20] elf-loader: Provide the possibility to relocate s390 ELF files Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 19/20] s390/bios: Make the s390-ccw.img relocatable Christian Borntraeger
2015-03-10  8:38 ` [Qemu-devel] [PULL 20/20] s390-ccw: rebuild BIOS Christian Borntraeger
2015-03-10 18:01 ` [Qemu-devel] [PULL 00/20] s390x/kvm: Features and fixes for 2.3 Peter Maydell
2015-03-10 22:26   ` Christian Borntraeger
2015-03-11  7:57     ` Markus Armbruster
2015-03-11  8:08       ` Thomas Huth
2015-03-11  8:09       ` Christian Borntraeger
2015-03-11  9:00         ` Thomas Huth [this message]
2015-03-11 10:06           ` Christian Borntraeger

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=20150311100046.3bdd8f18@oc7435384737.ibm.com \
    --to=thuth@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --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).