From dc0bbef5e6049920873204d35cd27172b65d204f Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Thu, 16 Nov 2017 18:05:24 +0100 Subject: s390x: fix storing CPU status (again) Looks like the last fix + cleanup introduced another bug. (for now Linux guests don't seem to care) - we store the crs into ars. Fixes: 947a38bd6f13 ("s390x/kvm: fix and cleanup storing CPU status") Signed-off-by: David Hildenbrand Message-Id: <20171116170526.12643-2-david@redhat.com> Reviewed-by: Thomas Huth Reviewed-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- target/s390x/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/helper.c b/target/s390x/helper.c index f78983dd6a..246ba20f0d 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -279,7 +279,7 @@ int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch) sa->ars[i] = cpu_to_be32(cpu->env.aregs[i]); } for (i = 0; i < 16; ++i) { - sa->ars[i] = cpu_to_be64(cpu->env.cregs[i]); + sa->crs[i] = cpu_to_be64(cpu->env.cregs[i]); } cpu_physical_memory_unmap(sa, len, 1, len); -- cgit v1.2.1 From 7337c6eb98786372cdbfe7ebe7affbd166fdc7ca Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Thu, 16 Nov 2017 18:05:26 +0100 Subject: s390x/tcg: fix DIAG 308 with > 1 VCPU (MTTCG) Currently, multi threaded TCG with > 1 VCPU gets stuck during IPL, when the bios tries to switch to the loaded kernel via DIAG 308. As run_on_cpu() is used, we run into a deadlock after handling the reset. We need the iolock (just like KVM). Signed-off-by: David Hildenbrand Message-Id: <20171116170526.12643-4-david@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Cornelia Huck --- target/s390x/misc_helper.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 4afd90b969..d272851e1c 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -103,7 +103,9 @@ void HELPER(diag)(CPUS390XState *env, uint32_t r1, uint32_t r3, uint32_t num) break; case 0x308: /* ipl */ + qemu_mutex_lock_iothread(); handle_diag_308(env, r1, r3); + qemu_mutex_unlock_iothread(); r = 0; break; case 0x288: -- cgit v1.2.1 From 8775d91a0f42d016833330881bb587982db88a3c Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 17 Nov 2017 19:10:28 +0100 Subject: pc-bios/s390-ccw: Fix problem with invalid virtio-scsi LUN when rebooting When rebooting a guest that has a virtio-scsi disk, the s390-ccw bios sometimes bails out with an error message like this: ! SCSI cannot report LUNs: STATUS=02 RSPN=70 KEY=05 CODE=25 QLFR=00, sure ! Enabling the scsi_req* tracing in QEMU shows that the ccw bios is trying to execute the REPORT LUNS SCSI command with a LUN != 0, and this causes the SCSI command to fail. Looks like we neither clear the BSS of the s390-ccw bios during reboot, nor do we explicitly set the default_scsi_device.lun value to 0, so this variable can contain random values from the OS after the reboot. By setting this variable explicitly to 0, the problem is fixed and the reboots always succeed. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1514352 Signed-off-by: Thomas Huth Message-Id: <1510942228-22822-1-git-send-email-thuth@redhat.com> Acked-by: Christian Borntraeger Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- pc-bios/s390-ccw/virtio-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c index c92f5d3fa0..4fe4b9d261 100644 --- a/pc-bios/s390-ccw/virtio-scsi.c +++ b/pc-bios/s390-ccw/virtio-scsi.c @@ -223,7 +223,8 @@ static void virtio_scsi_locate_device(VDev *vdev) for (target = 0; target <= vdev->config.scsi.max_target; target++) { sdev->channel = channel; - sdev->target = target; /* sdev->lun will be 0 here */ + sdev->target = target; + sdev->lun = 0; /* LUN has to be 0 for REPORT LUNS */ if (!scsi_report_luns(vdev, data, sizeof(data))) { if (resp.response == VIRTIO_SCSI_S_BAD_TARGET) { continue; -- cgit v1.2.1 From 6cbf1ec85caf8a7d9f2fd829422c9f0a1c8983e1 Mon Sep 17 00:00:00 2001 From: Cornelia Huck Date: Mon, 20 Nov 2017 10:48:11 +0100 Subject: pc-bios/s390-ccw.img: update image Contains the following commit: - pc-bios/s390-ccw: Fix problem with invalid virtio-scsi LUN when rebooting Signed-off-by: Cornelia Huck --- pc-bios/s390-ccw.img | Bin 30520 -> 26416 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/pc-bios/s390-ccw.img b/pc-bios/s390-ccw.img index 75b604e3ce..7415f1a3e7 100644 Binary files a/pc-bios/s390-ccw.img and b/pc-bios/s390-ccw.img differ -- cgit v1.2.1