Skip to contentSkip to conversation

s390x/ipl: Fix boot if no bootindex was specified

Qemu-devel Applied Christian Borntraeger 3 participants 3 messages Jun 18, 2015 – Jun 30, 2015

lore
Share & tools
lore
#0 lore raw

commit fa92e218df1d ("s390x/ipl: avoid sign extension") introduced a regression:

qemu-system-s390x -drive file=/home/cborntra/image.zhyp409,format=qcow2 does not boot, the bios states
"No virtio-blk device found!"

adding bootindex=1 does boot.

The reason is that the uint32_t as return value will not do the right thing for the return -1 (default without bootindex).
The bios itself, will interpret a 64bit -1 as autodetect (but it will interpret 32bit -1 as ccw device address ff.ff.ffff)

Cc Paolo Bonzini <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc [email protected] # v2.3.0
---
 hw/s390x/ipl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/s390x/ipl.c +2 -2
index 132004a..2e0a8b6 100644
@@ -218,7 +218,7 @@ static Property s390_ipl_properties[] = {
  * - -1 if no valid boot device was found
  * - ccw id of the boot device otherwise
  */
-static uint32_t s390_update_iplstate(CPUS390XState *env, S390IPLState *ipl)
+static uint64_t s390_update_iplstate(CPUS390XState *env, S390IPLState *ipl)
 {
     DeviceState *dev_st;
 
@@ -248,7 +248,7 @@ static uint32_t s390_update_iplstate(CPUS390XState *env, S390IPLState *ipl)
 
     return -1;
 out:
-    return ipl->cssid << 24 | ipl->ssid << 16 | ipl->devno;
+    return (uint32_t) (ipl->cssid << 24 | ipl->ssid << 16 | ipl->devno);
 }
 
 int s390_ipl_update_diag308(IplParameterBlock *iplb)
Signature · 1 line
2.3.0
Tested-by Reviewed-by
#1 lore raw
Quoted 14 lines · Christian Borntraeger

commit fa92e218df1d ("s390x/ipl: avoid sign extension") introduced a regression:

qemu-system-s390x -drive file=/home/cborntra/image.zhyp409,format=qcow2 does not boot, the bios states
"No virtio-blk device found!"

adding bootindex=1 does boot.

The reason is that the uint32_t as return value will not do the right thing for the return -1 (default without bootindex).
The bios itself, will interpret a 64bit -1 as autodetect (but it will interpret 32bit -1 as ccw device address ff.ff.ffff)

Quoted 7 lines
Cc Paolo Bonzini <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc [email protected] # v2.3.0
---
 hw/s390x/ipl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Thanks for the quick patch, I confirmed it works.

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net
#2 lore raw
In reply to Christian Borntraeger
Quoted 14 lines · On Thu, 18 Jun 2015 17:54:28 +0200 Christian Borntraeger…

commit fa92e218df1d ("s390x/ipl: avoid sign extension") introduced a regression:

qemu-system-s390x -drive file=/home/cborntra/image.zhyp409,format=qcow2 does not boot, the bios states
"No virtio-blk device found!"

adding bootindex=1 does boot.

The reason is that the uint32_t as return value will not do the right thing for the return -1 (default without bootindex).
The bios itself, will interpret a 64bit -1 as autodetect (but it will interpret 32bit -1 as ccw device address ff.ff.ffff)

Quoted 8 lines
Cc Paolo Bonzini <[email protected]>
Cc Cornelia Huck <[email protected]>
Cc [email protected] # v2.3.0
---
 hw/s390x/ipl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to my s390-next branch.