Patchwork s390x: fix -initrd in virtio machine

login
register
mail settings
Submitter Alexander Graf
Date Sept. 19, 2012, 3:29 p.m.
Message ID <1348068578-24375-1-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/185084/
State New
Headers show

Comments

Alexander Graf - Sept. 19, 2012, 3:29 p.m.
When using -initrd in the virtio machine, we need to indicate the initrd
start and size inside the kernel image. These parameters need to be stored
in native endianness.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/s390-virtio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Christian Borntraeger - Sept. 19, 2012, 4:31 p.m.
On 19/09/12 17:29, Alexander Graf wrote:
> When using -initrd in the virtio machine, we need to indicate the initrd
> start and size inside the kernel image. These parameters need to be stored
> in native endianness.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Richard Henderson - Sept. 19, 2012, 4:43 p.m.
On 09/19/2012 08:29 AM, Alexander Graf wrote:
> When using -initrd in the virtio machine, we need to indicate the initrd
> start and size inside the kernel image. These parameters need to be stored
> in native endianness.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

Tested-by: Richard Henderson <rth@twiddle.net>


r~

Patch

diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index 47eed35..12ae612 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -284,8 +284,8 @@  static void s390_init(ram_addr_t my_ram_size,
         }
 
         /* we have to overwrite values in the kernel image, which are "rom" */
-        memcpy(rom_ptr(INITRD_PARM_START), &initrd_offset, 8);
-        memcpy(rom_ptr(INITRD_PARM_SIZE), &initrd_size, 8);
+        stq_p(rom_ptr(INITRD_PARM_START), initrd_offset);
+        stq_p(rom_ptr(INITRD_PARM_SIZE), initrd_size);
     }
 
     if (rom_ptr(KERN_PARM_AREA)) {