From nobody Tue Feb 10 19:14:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151119156459623.542666822917226; Mon, 20 Nov 2017 07:26:04 -0800 (PST) Received: from localhost ([::1]:57921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGnxR-0000Ir-N2 for importer@patchew.org; Mon, 20 Nov 2017 10:26:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eGntl-00068R-Az for qemu-devel@nongnu.org; Mon, 20 Nov 2017 10:22:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eGntf-00010s-6G for qemu-devel@nongnu.org; Mon, 20 Nov 2017 10:22:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59894) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eGntf-00010X-13; Mon, 20 Nov 2017 10:22:07 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 16601FC7D2; Mon, 20 Nov 2017 15:22:06 +0000 (UTC) Received: from localhost (ovpn-117-61.ams2.redhat.com [10.36.117.61]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71AEE6A821; Mon, 20 Nov 2017 15:22:02 +0000 (UTC) From: Cornelia Huck To: peter.maydell@linaro.org Date: Mon, 20 Nov 2017 16:21:44 +0100 Message-Id: <20171120152145.25853-4-cohuck@redhat.com> In-Reply-To: <20171120152145.25853-1-cohuck@redhat.com> References: <20171120152145.25853-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 20 Nov 2017 15:22:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL for-2.11 3/4] pc-bios/s390-ccw: Fix problem with invalid virtio-scsi LUN when rebooting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thuth@redhat.com, david@redhat.com, Cornelia Huck , agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth 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=3D02 RSPN=3D70 KEY=3D05 CODE=3D25 QLFR=3D= 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 !=3D 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=3D1514352 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) =20 for (target =3D 0; target <=3D vdev->config.scsi.max_target; target++)= { sdev->channel =3D channel; - sdev->target =3D target; /* sdev->lun will be 0 here */ + sdev->target =3D target; + sdev->lun =3D 0; /* LUN has to be 0 for REPORT LUNS */ if (!scsi_report_luns(vdev, data, sizeof(data))) { if (resp.response =3D=3D VIRTIO_SCSI_S_BAD_TARGET) { continue; --=20 2.13.6