From nobody Fri May 17 05:50:13 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621373199; cv=none; d=zohomail.com; s=zohoarc; b=iLth/cd/0ZrmEqD2Nrgk1BShJWIDM5dX3BeLIPgMizzr8ke5bP2pFFiwEN5fko18p3NQuDfdRwvc9hMldyCjRSeaJ3yI9IIpmgyERPWSkZDPGb1df6hmLEydxdYk5F+luzjMkky+ZIGELjURYSNijLKSjUcQziJUvNR5UFO/rhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621373199; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EGKT88tBc8MOZ/8OqmtFfDPXSw0uMEXnRPy3SIosvR4=; b=V73mS5/p2G45qewKm3UPNkM2HTlDyC3T5Lo5YvOaSTXp5EZrGOyTvnzDszM5P6h47jaCWRPH00Sg+EXg27oAf1GcjJkntlw+3ylXNIwdJRGLqWlYFWaNogG/yqC1SK697x3ckYo47OCaPTboHkNhhLiHTZV51BZcmYULe/OYztE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1621373199384957.3391787849835; Tue, 18 May 2021 14:26:39 -0700 (PDT) Received: from localhost ([::1]:52610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lj7Ec-0002NA-5A for importer@patchew.org; Tue, 18 May 2021 17:26:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj7DP-00009y-Bi; Tue, 18 May 2021 17:25:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49856 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj7DM-0001Sx-VO; Tue, 18 May 2021 17:25:23 -0400 Received: from host217-39-58-213.range217-39.btcentralplus.com ([217.39.58.213] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lj7DO-0002vs-7w; Tue, 18 May 2021 22:25:22 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-stable@nongnu.org, pbonzini@redhat.com, fam@euphon.net, laurent@vivier.eu Date: Tue, 18 May 2021 22:25:10 +0100 Message-Id: <20210518212511.21688-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210518212511.21688-1-mark.cave-ayland@ilande.co.uk> References: <20210518212511.21688-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 217.39.58.213 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 1/2] esp: only assert INTR_DC interrupt flag if selection fails X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) 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+importer=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.default.ilande.uk0.bigv.io 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The datasheet sequence tables confirm that when a target selection fails, o= nly the INTR_DC interrupt flag should be asserted. Signed-off-by: Mark Cave-Ayland Fixes: cf47a41e05 ("esp: latch individual bits in ESP_RINTR register") --- hw/scsi/esp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index b668acef82..000e45a624 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -213,7 +213,7 @@ static int esp_select(ESPState *s) if (!s->current_dev) { /* No such drive */ s->rregs[ESP_RSTAT] =3D 0; - s->rregs[ESP_RINTR] |=3D INTR_DC; + s->rregs[ESP_RINTR] =3D INTR_DC; s->rregs[ESP_RSEQ] =3D SEQ_0; esp_raise_irq(s); return -1; --=20 2.20.1 From nobody Fri May 17 05:50:13 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1621373332; cv=none; d=zohomail.com; s=zohoarc; b=iJ1Ybhkz01QUBSbfQVuG6VUN7QYwumBKW86RQfBXF8NFco90zOTcuHflVaSD9ySqqJaNIs6rD0liroTcyM2XD4ScIN4VYlX0K7pjJrSIMZkxnMybbI+mWIi2lMIjP1LortsiLA6RgX5arobal1z4amqeznrBiTcGo8PXLconuFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621373332; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3zdyoXr3/6Q0QUSc89ulOPBdrAo7OIOHnFS3cV/qiUw=; b=m+dW0jtRNDThJL6ott/irhwuEGv8iSsCumgsgtx1tYkhWkF/xMxO9e+IzMy8WHFteFe9sDf/33mA1qzGyHHqSvLSQCf0SG3sFIJtEVfG0iLPkgJrTTaveVrzlrWC3WTawwwhAo0X7f2OfQ9UE0RXiHVy/Eyy2dIrnRA/FtyINhM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=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 1621373332979920.987377418767; Tue, 18 May 2021 14:28:52 -0700 (PDT) Received: from localhost ([::1]:56830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lj7Gl-0005Dq-TS for importer@patchew.org; Tue, 18 May 2021 17:28:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj7DP-0000BH-Vc; Tue, 18 May 2021 17:25:23 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49852 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lj7DN-0001Tt-0K; Tue, 18 May 2021 17:25:23 -0400 Received: from host217-39-58-213.range217-39.btcentralplus.com ([217.39.58.213] helo=kentang.home) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lj7DO-0002vs-Mp; Tue, 18 May 2021 22:25:23 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-stable@nongnu.org, pbonzini@redhat.com, fam@euphon.net, laurent@vivier.eu Date: Tue, 18 May 2021 22:25:11 +0100 Message-Id: <20210518212511.21688-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210518212511.21688-1-mark.cave-ayland@ilande.co.uk> References: <20210518212511.21688-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 217.39.58.213 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 2/2] esp: only set ESP_RSEQ at the start of the select sequence X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) 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+importer=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.default.ilande.uk0.bigv.io 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" When processing a command to select a target and send a CDB, the ESP device maintains a sequence step register so that if an error occurs the host can determine which part of the selection/CDB submission sequence failed. The old Linux 2.6 driver is really pedantic here: it checks the sequence st= ep register even if a command succeeds and complains loudly on the console if = the sequence step register doesn't match the expected bus phase and interrupt f= lags. This reason this mismatch occurs is because the ESP emulation currently doe= sn't update the bus phase until the next TI (Transfer Information) command and s= o the cleared sequence step register is considered invalid for the stale bus phas= e. Normally this isn't an issue as the host only checks the sequence step regi= ster if an error occurs but the old Linux 2.6 driver does this in several places causing a large stream of "esp0: STEP_ASEL for tgt 0" messages to appear on= the console during the boot process. Fix this by not clearing the sequence step register when reading the interr= upt register and clearing the DMA status, so the guest sees a valid sequence st= ep and bus phase combination at the end of the command phase. No other change = is required since the sequence step register is correctly updated throughout t= he selection/CDB submission sequence once one of the select commands is issued. Signed-off-by: Mark Cave-Ayland Fixes: 1b9e48a5bd ("esp: implement non-DMA transfers in PDMA mode") --- hw/scsi/esp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 000e45a624..18d4d56392 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -481,7 +481,6 @@ static void esp_dma_done(ESPState *s) { s->rregs[ESP_RSTAT] |=3D STAT_TC; s->rregs[ESP_RINTR] |=3D INTR_BS; - s->rregs[ESP_RSEQ] =3D 0; s->rregs[ESP_RFLAGS] =3D 0; esp_set_tc(s, 0); esp_raise_irq(s); @@ -917,7 +916,15 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) val =3D s->rregs[ESP_RINTR]; s->rregs[ESP_RINTR] =3D 0; s->rregs[ESP_RSTAT] &=3D ~STAT_TC; - s->rregs[ESP_RSEQ] =3D SEQ_0; + /* + * According to the datasheet ESP_RSEQ should be cleared, but as t= he + * emulation currently defers information transfers to the next TI + * command leave it for now so that pedantic guests such as the old + * Linux 2.6 driver see the correct flags before the next SCSI pha= se + * transition. + * + * s->rregs[ESP_RSEQ] =3D SEQ_0; + */ esp_lower_irq(s); break; case ESP_TCHI: --=20 2.20.1