From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E0C78899B for ; Mon, 6 Mar 2023 08:42:13 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C604D2DD46 for ; Mon, 6 Mar 2023 08:41:43 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 6 Mar 2023 08:41:41 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8024641989 for ; Mon, 6 Mar 2023 08:41:41 +0100 (CET) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 6 Mar 2023 08:41:37 +0100 Message-Id: <20230306074137.4223-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.003 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu] add patch fixing Linux boot failures with megasas SCSI X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2023 07:42:13 -0000 A regression in 7.2 and easily reproduced. Signed-off-by: Fiona Ebner --- ...as-Internal-cdbs-have-16-byte-length.patch | 69 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 70 insertions(+) create mode 100644 debian/patches/extra/0010-scsi-megasas-Internal-cdbs-have-16-byte-length.patch diff --git a/debian/patches/extra/0010-scsi-megasas-Internal-cdbs-have-16-byte-length.patch b/debian/patches/extra/0010-scsi-megasas-Internal-cdbs-have-16-byte-length.patch new file mode 100644 index 0000000..20ec053 --- /dev/null +++ b/debian/patches/extra/0010-scsi-megasas-Internal-cdbs-have-16-byte-length.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Guenter Roeck +Date: Tue, 28 Feb 2023 09:11:29 -0800 +Subject: [PATCH] scsi: megasas: Internal cdbs have 16-byte length +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Host drivers do not necessarily set cdb_len in megasas io commands. +With commits 6d1511cea0 ("scsi: Reject commands if the CDB length +exceeds buf_len") and fe9d8927e2 ("scsi: Add buf_len parameter to +scsi_req_new()"), this results in failures to boot Linux from affected +SCSI drives because cdb_len is set to 0 by the host driver. +Set the cdb length to its actual size to solve the problem. + +Signed-off-by: Guenter Roeck +Reviewed-by: Philippe Mathieu-Daudé +(picked-up from https://lists.nongnu.org/archive/html/qemu-devel/2023-02/msg08653.html) +Signed-off-by: Fiona Ebner +--- + hw/scsi/megasas.c | 14 ++------------ + 1 file changed, 2 insertions(+), 12 deletions(-) + +diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c +index 9cbbb16121..d624866bb6 100644 +--- a/hw/scsi/megasas.c ++++ b/hw/scsi/megasas.c +@@ -1780,7 +1780,7 @@ static int megasas_handle_io(MegasasState *s, MegasasCmd *cmd, int frame_cmd) + uint8_t cdb[16]; + int len; + struct SCSIDevice *sdev = NULL; +- int target_id, lun_id, cdb_len; ++ int target_id, lun_id; + + lba_count = le32_to_cpu(cmd->frame->io.header.data_len); + lba_start_lo = le32_to_cpu(cmd->frame->io.lba_lo); +@@ -1789,7 +1789,6 @@ static int megasas_handle_io(MegasasState *s, MegasasCmd *cmd, int frame_cmd) + + target_id = cmd->frame->header.target_id; + lun_id = cmd->frame->header.lun_id; +- cdb_len = cmd->frame->header.cdb_len; + + if (target_id < MFI_MAX_LD && lun_id == 0) { + sdev = scsi_device_find(&s->bus, 0, target_id, lun_id); +@@ -1804,15 +1803,6 @@ static int megasas_handle_io(MegasasState *s, MegasasCmd *cmd, int frame_cmd) + return MFI_STAT_DEVICE_NOT_FOUND; + } + +- if (cdb_len > 16) { +- trace_megasas_scsi_invalid_cdb_len( +- mfi_frame_desc(frame_cmd), 1, target_id, lun_id, cdb_len); +- megasas_write_sense(cmd, SENSE_CODE(INVALID_OPCODE)); +- cmd->frame->header.scsi_status = CHECK_CONDITION; +- s->event_count++; +- return MFI_STAT_SCSI_DONE_WITH_ERROR; +- } +- + cmd->iov_size = lba_count * sdev->blocksize; + if (megasas_map_sgl(s, cmd, &cmd->frame->io.sgl)) { + megasas_write_sense(cmd, SENSE_CODE(TARGET_FAILURE)); +@@ -1823,7 +1813,7 @@ static int megasas_handle_io(MegasasState *s, MegasasCmd *cmd, int frame_cmd) + + megasas_encode_lba(cdb, lba_start, lba_count, is_write); + cmd->req = scsi_req_new(sdev, cmd->index, +- lun_id, cdb, cdb_len, cmd); ++ lun_id, cdb, sizeof(cdb), cmd); + if (!cmd->req) { + trace_megasas_scsi_req_alloc_failed( + mfi_frame_desc(frame_cmd), target_id, lun_id); diff --git a/debian/patches/series b/debian/patches/series index 7a85c63..c1d23b5 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -7,6 +7,7 @@ extra/0006-virtio-rng-pci-fix-migration-compat-for-vectors.patch extra/0007-block-fix-detect-zeroes-with-BDRV_REQ_REGISTERED_BUF.patch extra/0008-memory-prevent-dma-reentracy-issues.patch extra/0009-block-iscsi-fix-double-free-on-BUSY-or-similar-statu.patch +extra/0010-scsi-megasas-Internal-cdbs-have-16-byte-length.patch bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch -- 2.30.2