From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16508191624311016.6078034837333; Sun, 24 Apr 2022 09:52:42 -0700 (PDT) Received: from localhost ([::1]:40328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifTV-0004sW-EH for importer2@patchew.org; Sun, 24 Apr 2022 12:52:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifQr-0001yn-J1; Sun, 24 Apr 2022 12:50:00 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifQq-0000rD-4U; Sun, 24 Apr 2022 12:49:57 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifPq-000BIt-Vw; Sun, 24 Apr 2022 17:48:59 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:25 +0100 Message-Id: <20220424164935.7339-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 01/11] scsi-disk: add FORMAT UNIT command X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819164624100001 Content-Type: text/plain; charset="utf-8" When initialising a drive ready to install MacOS, Apple HD SC Setup first a= ttempts to format the drive. Add a simple FORMAT UNIT command which simply returns = success to allow the format to succeed. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/scsi/scsi-disk.c | 4 ++++ hw/scsi/trace-events | 1 + 2 files changed, 5 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 072686ed58..090679f3b5 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2127,6 +2127,9 @@ static int32_t scsi_disk_emulate_command(SCSIRequest = *req, uint8_t *buf) trace_scsi_disk_emulate_command_WRITE_SAME( req->cmd.buf[0] =3D=3D WRITE_SAME_10 ? 10 : 16, r->req.cmd= .xfer); break; + case FORMAT_UNIT: + trace_scsi_disk_emulate_command_FORMAT_UNIT(r->req.cmd.xfer); + break; default: trace_scsi_disk_emulate_command_UNKNOWN(buf[0], scsi_command_name(buf[0])); @@ -2533,6 +2536,7 @@ static const SCSIReqOps *const scsi_disk_reqops_dispa= tch[256] =3D { [VERIFY_10] =3D &scsi_disk_emulate_reqops, [VERIFY_12] =3D &scsi_disk_emulate_reqops, [VERIFY_16] =3D &scsi_disk_emulate_reqops, + [FORMAT_UNIT] =3D &scsi_disk_emulate_reqops, =20 [READ_6] =3D &scsi_disk_dma_reqops, [READ_10] =3D &scsi_disk_dma_reqops, diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 20fb0dc162..e91b55a961 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -334,6 +334,7 @@ scsi_disk_emulate_command_UNMAP(size_t xfer) "Unmap (le= n %zd)" scsi_disk_emulate_command_VERIFY(int bytchk) "Verify (bytchk %d)" scsi_disk_emulate_command_WRITE_SAME(int cmd, size_t xfer) "WRITE SAME %d = (len %zd)" scsi_disk_emulate_command_UNKNOWN(int cmd, const char *name) "Unknown SCSI= command (0x%2.2x=3D%s)" +scsi_disk_emulate_command_FORMAT_UNIT(size_t xfer) "Format Unit (len %zd)" scsi_disk_dma_command_READ(uint64_t lba, uint32_t len) "Read (sector %" PR= Id64 ", count %u)" scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba, int len) "Write= %s(sector %" PRId64 ", count %u)" scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Comma= nd: lun=3D%d tag=3D0x%x data=3D%s" --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819161204837.3669566857724; Sun, 24 Apr 2022 09:52:41 -0700 (PDT) Received: from localhost ([::1]:40342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifTU-0004t6-43 for importer2@patchew.org; Sun, 24 Apr 2022 12:52:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifQu-000208-SE; Sun, 24 Apr 2022 12:50:00 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifQt-0000rZ-E6; Sun, 24 Apr 2022 12:50:00 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifPv-000BIt-7k; Sun, 24 Apr 2022 17:49:03 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:26 +0100 Message-Id: <20220424164935.7339-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 02/11] scsi-disk: add new quirks bitmap to SCSIDiskState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819162373100001 Content-Type: text/plain; charset="utf-8" Since the MacOS SCSI implementation is quite old (and Apple added some firm= ware customisations to their drives for m68k Macs) there is need to add a mechan= ism to correctly handle Apple-specific quirks. Add a new quirks bitmap to SCSIDiskState that can be used to enable these features as required. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 090679f3b5..d89cdd4e4a 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -94,6 +94,7 @@ struct SCSIDiskState { uint16_t port_index; uint64_t max_unmap_size; uint64_t max_io_size; + uint32_t quirks; QEMUBH *bh; char *version; char *serial; --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819445047732.1342778547807; Sun, 24 Apr 2022 09:57:25 -0700 (PDT) Received: from localhost ([::1]:52924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifY3-0005CE-T8 for importer2@patchew.org; Sun, 24 Apr 2022 12:57:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifQz-000294-PW; Sun, 24 Apr 2022 12:50:05 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifQy-0000zb-8H; Sun, 24 Apr 2022 12:50:05 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifPz-000BIt-Fo; Sun, 24 Apr 2022 17:49:07 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:27 +0100 Message-Id: <20220424164935.7339-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 03/11] scsi-disk: add MODE_PAGE_APPLE_VENDOR quirk for Macintosh X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819445725100001 Content-Type: text/plain; charset="utf-8" One of the mechanisms MacOS uses to identify drives compatible with MacOS i= s to send a custom MODE SELECT command for page 0x30 to the drive. The response = to this is a hard-coded manufacturer string which must match in order for the drive to be usable within MacOS. Add an implementation of the MODE SELECT page 0x30 response guarded by a ne= wly defined SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR quirk bit so that drives att= ached to non-Apple machines function exactly as before. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/scsi/scsi-disk.c | 17 +++++++++++++++++ include/hw/scsi/scsi.h | 3 +++ include/scsi/constants.h | 1 + 3 files changed, 21 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index d89cdd4e4a..5de4506b97 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1085,6 +1085,7 @@ static int mode_sense_page(SCSIDiskState *s, int page= , uint8_t **p_outbuf, [MODE_PAGE_R_W_ERROR] =3D (1 << TYPE_DISK) | (1 << TY= PE_ROM), [MODE_PAGE_AUDIO_CTL] =3D (1 << TYPE_ROM), [MODE_PAGE_CAPABILITIES] =3D (1 << TYPE_ROM), + [MODE_PAGE_APPLE_VENDOR] =3D (1 << TYPE_ROM), }; =20 uint8_t *p =3D *p_outbuf + 2; @@ -1229,6 +1230,20 @@ static int mode_sense_page(SCSIDiskState *s, int pag= e, uint8_t **p_outbuf, p[19] =3D (16 * 176) & 0xff; break; =20 + case MODE_PAGE_APPLE_VENDOR: + if (s->quirks & (1 << SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR)) { + length =3D 0x24; + if (page_control =3D=3D 1) { /* Changeable Values */ + break; + } + + memset(p, 0, length); + strcpy((char *)p + 8, "APPLE COMPUTER, INC "); + break; + } else { + return -1; + } + default: return -1; } @@ -3042,6 +3057,8 @@ static Property scsi_hd_properties[] =3D { DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0), DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_ver= sion, 5), + DEFINE_PROP_BIT("quirk_mode_page_apple_vendor", SCSIDiskState, quirks, + SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR, 0), DEFINE_BLOCK_CHS_PROPERTIES(SCSIDiskState, qdev.conf), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 1ffb367f94..975d462347 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -226,4 +226,7 @@ SCSIDevice *scsi_device_get(SCSIBus *bus, int channel, = int target, int lun); /* scsi-generic.c. */ extern const SCSIReqOps scsi_generic_req_ops; =20 +/* scsi-disk.c */ +#define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0 + #endif diff --git a/include/scsi/constants.h b/include/scsi/constants.h index 2a32c08b5e..891aa0f45c 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -234,6 +234,7 @@ #define MODE_PAGE_FAULT_FAIL 0x1c #define MODE_PAGE_TO_PROTECT 0x1d #define MODE_PAGE_CAPABILITIES 0x2a +#define MODE_PAGE_APPLE_VENDOR 0x30 #define MODE_PAGE_ALLS 0x3f /* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor * of MODE_PAGE_SENSE_POWER */ --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819552347657.0506863515762; Sun, 24 Apr 2022 09:59:12 -0700 (PDT) Received: from localhost ([::1]:58438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifZm-0000fa-VT for importer2@patchew.org; Sun, 24 Apr 2022 12:59:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR6-0002At-V8; Sun, 24 Apr 2022 12:50:13 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR2-00013S-2d; Sun, 24 Apr 2022 12:50:09 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQ3-000BIt-N2; Sun, 24 Apr 2022 17:49:11 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:28 +0100 Message-Id: <20220424164935.7339-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 04/11] q800: implement compat_props to enable quirk_mode_page_apple_vendor for scsi-hd devices X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819553267100001 Content-Type: text/plain; charset="utf-8" By default quirk_mode_page_apple_vendor should be enabled for all scsi-hd d= evices connected to the q800 machine to enable MacOS to detect and use them. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 099a758c6f..42bf7bb4f0 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -686,6 +686,11 @@ static void q800_init(MachineState *machine) } } =20 +static GlobalProperty hw_compat_q800[] =3D { + { "scsi-hd", "quirk_mode_page_apple_vendor", "on"}, +}; +static const size_t hw_compat_q800_len =3D G_N_ELEMENTS(hw_compat_q800); + static void q800_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -695,6 +700,7 @@ static void q800_machine_class_init(ObjectClass *oc, vo= id *data) mc->max_cpus =3D 1; mc->block_default_type =3D IF_SCSI; mc->default_ram_id =3D "m68k_mac.ram"; + compat_props_add(mc->compat_props, hw_compat_q800, hw_compat_q800_len); } =20 static const TypeInfo q800_machine_typeinfo =3D { --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165081935161877.83847425473584; Sun, 24 Apr 2022 09:55:51 -0700 (PDT) Received: from localhost ([::1]:48918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifWY-0002V4-KX for importer2@patchew.org; Sun, 24 Apr 2022 12:55:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR7-0002Au-01; Sun, 24 Apr 2022 12:50:13 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR2-00013V-3G; Sun, 24 Apr 2022 12:50:09 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQ8-000BIt-01; Sun, 24 Apr 2022 17:49:12 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:29 +0100 Message-Id: <20220424164935.7339-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 05/11] scsi-disk: add SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD quirk for Macintosh X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819353326100001 Content-Type: text/plain; charset="utf-8" During SCSI bus enumeration A/UX sends a MODE SENSE command to the CDROM and expects the response to include a block descriptor. As per the latest SCSI documentation, QEMU currently force-disables the block descriptor for CDROM devices but the A/UX driver expects the block descriptor to always be returned. If the block descriptor is not returned in the response then A/UX becomes confused, since the block descriptor returned in the MODE SENSE response is used to generate a subsequent MODE SELECT command which is then invalid. Add a new SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD to allow this behaviour to be enabled as required. Signed-off-by: Mark Cave-Ayland --- hw/scsi/scsi-disk.c | 18 +++++++++++++----- include/hw/scsi/scsi.h | 1 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 5de4506b97..71fdf132c1 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1279,10 +1279,17 @@ static int scsi_disk_emulate_mode_sense(SCSIDiskReq= *r, uint8_t *outbuf) dev_specific_param |=3D 0x80; /* Readonly. */ } } else { - /* MMC prescribes that CD/DVD drives have no block descriptors, - * and defines no device-specific parameter. */ - dev_specific_param =3D 0x00; - dbd =3D true; + if (s->quirks & (1 << SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD)) { + dev_specific_param =3D 0x00; + dbd =3D false; + } else { + /* + * MMC prescribes that CD/DVD drives have no block descriptors, + * and defines no device-specific parameter. + */ + dev_specific_param =3D 0x00; + dbd =3D true; + } } =20 if (r->req.cmd.buf[0] =3D=3D MODE_SENSE) { @@ -1578,7 +1585,6 @@ static void scsi_disk_emulate_mode_select(SCSIDiskReq= *r, uint8_t *inbuf) /* Ensure no change is made if there is an error! */ for (pass =3D 0; pass < 2; pass++) { if (mode_select_pages(r, p, len, pass =3D=3D 1) < 0) { - assert(pass =3D=3D 0); return; } } @@ -3107,6 +3113,8 @@ static Property scsi_cd_properties[] =3D { DEFAULT_MAX_IO_SIZE), DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_ver= sion, 5), + DEFINE_PROP_BIT("quirk_mode_sense_rom_force_dbd", SCSIDiskState, quirk= s, + SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD, 0), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 975d462347..a9e657e03c 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -228,5 +228,6 @@ extern const SCSIReqOps scsi_generic_req_ops; =20 /* scsi-disk.c */ #define SCSI_DISK_QUIRK_MODE_PAGE_APPLE_VENDOR 0 +#define SCSI_DISK_QUIRK_MODE_SENSE_ROM_FORCE_DBD 1 =20 #endif --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819364185487.5871284784033; Sun, 24 Apr 2022 09:56:04 -0700 (PDT) Received: from localhost ([::1]:50020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifWl-0003Ex-65 for importer2@patchew.org; Sun, 24 Apr 2022 12:56:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR6-0002Aw-Vc; Sun, 24 Apr 2022 12:50:13 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR2-00013X-3I; Sun, 24 Apr 2022 12:50:09 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQ8-000BIt-Je; Sun, 24 Apr 2022 17:49:12 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:30 +0100 Message-Id: <20220424164935.7339-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 06/11] q800: implement compat_props to enable quirk_mode_sense_rom_force_dbd for scsi-cd devices X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819365273100001 Content-Type: text/plain; charset="utf-8" By default quirk_mode_sense_rom_force_dbd should be enabled for all scsi-cd= devices connected to the q800 machine to correctly report the CDROM block descripto= r back to A/UX. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 42bf7bb4f0..f27ed01785 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -688,6 +688,7 @@ static void q800_init(MachineState *machine) =20 static GlobalProperty hw_compat_q800[] =3D { { "scsi-hd", "quirk_mode_page_apple_vendor", "on"}, + { "scsi-cd", "quirk_mode_sense_rom_force_dbd", "on"}, }; static const size_t hw_compat_q800_len =3D G_N_ELEMENTS(hw_compat_q800); =20 --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819189418840.2175152973995; Sun, 24 Apr 2022 09:53:09 -0700 (PDT) Received: from localhost ([::1]:42084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifTv-00063B-U3 for importer2@patchew.org; Sun, 24 Apr 2022 12:53:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR8-0002CR-KT; Sun, 24 Apr 2022 12:50:15 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36154) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifR7-000140-0g; Sun, 24 Apr 2022 12:50:14 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQ9-000BIt-31; Sun, 24 Apr 2022 17:49:17 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:31 +0100 Message-Id: <20220424164935.7339-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 07/11] scsi-disk: allow truncated MODE SELECT requests X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819190654100001 Content-Type: text/plain; charset="utf-8" When A/UX configures the CDROM device it sends a truncated MODE SELECT requ= est for page 1 (MODE_PAGE_R_W_ERROR) which is only 6 bytes in length rather than 10. This seems to be due to bug in Apple's code which calculates the CDB me= ssage length incorrectly. According to [1] this truncated request is accepted on real hardware wherea= s in QEMU it generates an INVALID_PARAM_LEN sense code which causes A/UX to get = stuck in a loop retrying the command in an attempt to succeed. Alter the mode page request length check so that truncated requests are all= owed as per real hardware, adding a trace event to enable the condition to be de= tected. [1] https://68kmla.org/bb/index.php?threads/scsi2sd-project-anyone-interest= ed.29040/page-7#post-316444 Signed-off-by: Mark Cave-Ayland --- hw/scsi/scsi-disk.c | 2 +- hw/scsi/trace-events | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 71fdf132c1..c657e4f5da 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1525,7 +1525,7 @@ static int mode_select_pages(SCSIDiskReq *r, uint8_t = *p, int len, bool change) goto invalid_param; } if (page_len > len) { - goto invalid_param_len; + trace_scsi_disk_mode_select_page_truncated(page, page_len, len= ); } =20 if (!change) { diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index e91b55a961..25eae9f307 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -339,6 +339,7 @@ scsi_disk_dma_command_READ(uint64_t lba, uint32_t len) = "Read (sector %" PRId64 " scsi_disk_dma_command_WRITE(const char *cmd, uint64_t lba, int len) "Write= %s(sector %" PRId64 ", count %u)" scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Comma= nd: lun=3D%d tag=3D0x%x data=3D%s" scsi_disk_aio_sgio_command(uint32_t tag, uint8_t cmd, uint64_t lba, int le= n, uint32_t timeout) "disk aio sgio: tag=3D0x%x cmd=3D0x%x (sector %" PRId6= 4 ", count %d) timeout=3D%u" +scsi_disk_mode_select_page_truncated(int page, int len, int page_len) "pag= e %d expected length %d but received length %d" =20 # scsi-generic.c scsi_generic_command_complete_noio(void *req, uint32_t tag, int statuc) "C= ommand complete %p tag=3D0x%x status=3D%d" --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819638721350.3399798050125; Sun, 24 Apr 2022 10:00:38 -0700 (PDT) Received: from localhost ([::1]:34644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifbB-0003eE-9i for importer2@patchew.org; Sun, 24 Apr 2022 13:00:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRD-0002Jr-PD; Sun, 24 Apr 2022 12:50:24 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRC-00016K-0M; Sun, 24 Apr 2022 12:50:19 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQD-000BIt-EN; Sun, 24 Apr 2022 17:49:21 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:32 +0100 Message-Id: <20220424164935.7339-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 08/11] scsi-disk: allow the MODE_PAGE_R_W_ERROR AWRE bit to be changeable for CDROM drives X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819640106100001 Content-Type: text/plain; charset="utf-8" A/UX sends a MODE_PAGE_R_W_ERROR command with the AWRE bit set to 0 when en= umerating CDROM drives. Since the bit is currently hardcoded to 1 then indicate that = the AWRE bit can be changed (even though we don't care about the value) so that the MODE_PAGE_R_W_ERROR page can be set successfully. Signed-off-by: Mark Cave-Ayland --- hw/scsi/scsi-disk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index c657e4f5da..6991493cf4 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1187,6 +1187,10 @@ static int mode_sense_page(SCSIDiskState *s, int pag= e, uint8_t **p_outbuf, case MODE_PAGE_R_W_ERROR: length =3D 10; if (page_control =3D=3D 1) { /* Changeable Values */ + if (s->qdev.type =3D=3D TYPE_ROM) { + /* Automatic Write Reallocation Enabled */ + p[0] =3D 0x80; + } break; } p[0] =3D 0x80; /* Automatic Write Reallocation Enabled */ --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819697197171.14312172841085; Sun, 24 Apr 2022 10:01:37 -0700 (PDT) Received: from localhost ([::1]:37746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifc8-0005uD-8V for importer2@patchew.org; Sun, 24 Apr 2022 13:01:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRC-0002Ji-NG; Sun, 24 Apr 2022 12:50:20 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36174) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRB-00016P-7j; Sun, 24 Apr 2022 12:50:18 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQH-000BIt-QP; Sun, 24 Apr 2022 17:49:22 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:33 +0100 Message-Id: <20220424164935.7339-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 09/11] scsi-disk: allow MODE SELECT block descriptor to set the ROM device block size X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819698382100001 Content-Type: text/plain; charset="utf-8" Whilst CDROM drives usually have a 2048 byte sector size, older drives have= the ability to switch between 2048 byte and 512 byte sector sizes by specifying= a block descriptor in the MODE SELECT command. If a MODE SELECT block descriptor is provided, update the scsi-cd device bl= ock size with the provided value accordingly. This allows CDROMs to be used with A/UX whose driver only works with a 512 = byte sector size. Signed-off-by: Mark Cave-Ayland --- hw/scsi/scsi-disk.c | 7 +++++++ hw/scsi/trace-events | 1 + 2 files changed, 8 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 6991493cf4..41ebbe3045 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1583,6 +1583,13 @@ static void scsi_disk_emulate_mode_select(SCSIDiskRe= q *r, uint8_t *inbuf) goto invalid_param; } =20 + /* Allow changing the block size of ROM devices */ + if (s->qdev.type =3D=3D TYPE_ROM && bd_len && + p[6] !=3D (s->qdev.blocksize >> 8)) { + s->qdev.blocksize =3D p[6] << 8; + trace_scsi_disk_mode_select_rom_set_blocksize(s->qdev.blocksiz= e); + } + len -=3D bd_len; p +=3D bd_len; =20 diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 25eae9f307..1a021ddae9 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -340,6 +340,7 @@ scsi_disk_dma_command_WRITE(const char *cmd, uint64_t l= ba, int len) "Write %s(se scsi_disk_new_request(uint32_t lun, uint32_t tag, const char *line) "Comma= nd: lun=3D%d tag=3D0x%x data=3D%s" scsi_disk_aio_sgio_command(uint32_t tag, uint8_t cmd, uint64_t lba, int le= n, uint32_t timeout) "disk aio sgio: tag=3D0x%x cmd=3D0x%x (sector %" PRId6= 4 ", count %d) timeout=3D%u" scsi_disk_mode_select_page_truncated(int page, int len, int page_len) "pag= e %d expected length %d but received length %d" +scsi_disk_mode_select_rom_set_blocksize(int blocksize) "set ROM block size= to %d" =20 # scsi-generic.c scsi_generic_command_complete_noio(void *req, uint32_t tag, int statuc) "C= ommand complete %p tag=3D0x%x status=3D%d" --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819559727626.158754666332; Sun, 24 Apr 2022 09:59:19 -0700 (PDT) Received: from localhost ([::1]:59044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nifZt-00014d-Sy for importer2@patchew.org; Sun, 24 Apr 2022 12:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRJ-0002M7-NG; Sun, 24 Apr 2022 12:50:26 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36184) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRI-00017z-Bf; Sun, 24 Apr 2022 12:50:25 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQI-000BIt-93; Sun, 24 Apr 2022 17:49:26 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:34 +0100 Message-Id: <20220424164935.7339-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 10/11] q800: add default vendor and product information for scsi-hd devices X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819561212100001 Content-Type: text/plain; charset="utf-8" The Apple HD SC Setup program uses a SCSI INQUIRY command to check that any= SCSI hard disks detected match a whitelist of vendors and products before allowi= ng the "Initialise" button to prepare an empty disk. Add known-good default vendor and product information using the existing compat_prop mechanism so the user doesn't have to use long command lines to= set the qdev properties manually. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index f27ed01785..abb549f8d8 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -688,6 +688,9 @@ static void q800_init(MachineState *machine) =20 static GlobalProperty hw_compat_q800[] =3D { { "scsi-hd", "quirk_mode_page_apple_vendor", "on"}, + { "scsi-hd", "vendor", " SEAGATE" }, + { "scsi-hd", "product", " ST225N" }, + { "scsi-hd", "ver", "1.0 " }, { "scsi-cd", "quirk_mode_sense_rom_force_dbd", "on"}, }; static const size_t hw_compat_q800_len =3D G_N_ELEMENTS(hw_compat_q800); --=20 2.20.1 From nobody Sun May 5 03:36:16 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1650819819534100.10937587089154; Sun, 24 Apr 2022 10:03:39 -0700 (PDT) Received: from localhost ([::1]:42342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nife6-0000us-Gf for importer2@patchew.org; Sun, 24 Apr 2022 13:03:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRK-0002P3-W3; Sun, 24 Apr 2022 12:50:27 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:36192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nifRJ-0001AF-HH; Sun, 24 Apr 2022 12:50:26 -0400 Received: from [2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c] (helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nifQM-000BIt-Fp; Sun, 24 Apr 2022 17:49:30 +0100 From: Mark Cave-Ayland To: pbonzini@redhat.com, laurent@vivier.eu, fam@euphon.net, qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Sun, 24 Apr 2022 17:49:35 +0100 Message-Id: <20220424164935.7339-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> References: <20220424164935.7339-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8ba2:c800:3cf5:fb4b:b388:106c X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v2 11/11] q800: add default vendor and product information for scsi-cd devices X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.ilande.co.uk X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1650819821272100001 Content-Type: text/plain; charset="utf-8" The MacOS CDROM driver uses a SCSI INQUIRY command to check that any SCSI C= DROMs detected match a whitelist of vendors and products before adding them to the list of available devices. Add known-good default vendor and product information using the existing compat_prop mechanism so the user doesn't have to use long command lines to= set the qdev properties manually. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index abb549f8d8..8b34776c8e 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -692,6 +692,9 @@ static GlobalProperty hw_compat_q800[] =3D { { "scsi-hd", "product", " ST225N" }, { "scsi-hd", "ver", "1.0 " }, { "scsi-cd", "quirk_mode_sense_rom_force_dbd", "on"}, + { "scsi-cd", "vendor", "MATSHITA" }, + { "scsi-cd", "product", "CD-ROM CR-8005" }, + { "scsi-cd", "ver", "1.0k" }, }; static const size_t hw_compat_q800_len =3D G_N_ELEMENTS(hw_compat_q800); =20 --=20 2.20.1