From nobody Thu May 2 05:28:31 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1510942308948882.2441957501751; Fri, 17 Nov 2017 10:11:48 -0800 (PST) Received: from localhost ([::1]:47200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFl6q-00076g-Tb for importer@patchew.org; Fri, 17 Nov 2017 13:11:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eFl64-0006nz-Hj for qemu-devel@nongnu.org; Fri, 17 Nov 2017 13:10:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eFl61-00055p-Bu for qemu-devel@nongnu.org; Fri, 17 Nov 2017 13:10:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53644) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eFl60-00054j-Qp; Fri, 17 Nov 2017 13:10:33 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E81F2356CC; Fri, 17 Nov 2017 18:10:30 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-158.ams2.redhat.com [10.36.116.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id A21E011A4D6; Fri, 17 Nov 2017 18:10:29 +0000 (UTC) From: Thomas Huth To: qemu-s390x@nongnu.org, Cornelia Huck , Christian Borntraeger Date: Fri, 17 Nov 2017 19:10:28 +0100 Message-Id: <1510942228-22822-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 17 Nov 2017 18:10:30 +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] [PATCH for-2.11] 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: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Christian Borntraeger Reviewed-by: David Hildenbrand --- 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 c92f5d3..4fe4b9d 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 1.8.3.1