From patchwork Fri Jun 17 09:40:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 9183159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9DB1A60573 for ; Fri, 17 Jun 2016 09:40:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EBF92835E for ; Fri, 17 Jun 2016 09:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83A1228396; Fri, 17 Jun 2016 09:40:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 022A72835E for ; Fri, 17 Jun 2016 09:40:56 +0000 (UTC) Received: from localhost ([::1]:55246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDqGl-0005zx-79 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 17 Jun 2016 05:40:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDqGR-0005uk-Cr for qemu-devel@nongnu.org; Fri, 17 Jun 2016 05:40:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDqGK-00006M-6c for qemu-devel@nongnu.org; Fri, 17 Jun 2016 05:40:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDqGJ-00006B-UE for qemu-devel@nongnu.org; Fri, 17 Jun 2016 05:40:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57095C0799A2; Fri, 17 Jun 2016 09:40:27 +0000 (UTC) Received: from javelin (vpn1-6-5.sin2.redhat.com [10.67.6.5]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5H9eNEL007631 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 17 Jun 2016 05:40:25 -0400 Date: Fri, 17 Jun 2016 15:10:21 +0530 (IST) From: P J P X-X-Sender: pjp@javelin To: Paolo Bonzini In-Reply-To: <1466151557-12676-1-git-send-email-pbonzini@redhat.com> Message-ID: References: <1466151557-12676-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 17 Jun 2016 09:40:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH] scsi: esp: remove handling of SATN/STOP 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: amit.shah@redhat.com, =?ISO-8859-15?Q?Herv=E9_Poussineau?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP +-- On Fri, 17 Jun 2016, Paolo Bonzini wrote --+ | diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c | index baa0a2c..d11151f 100644 | --- a/hw/scsi/esp.c | +++ b/hw/scsi/esp.c | @@ -192,23 +192,6 @@ static void handle_s_without_atn(ESPState *s) | } | } | | -static void handle_satn_stop(ESPState *s) | -{ | - if (s->dma && !s->dma_enabled) { | - s->dma_cb = handle_satn_stop; | - return; | - } | - s->cmdlen = get_cmd(s, s->cmdbuf, sizeof(s->cmdbuf)); | - if (s->cmdlen) { | - trace_esp_handle_satn_stop(s->cmdlen); | - s->do_cmd = 1; | - s->rregs[ESP_RSTAT] = STAT_TC | STAT_CD; | - s->rregs[ESP_RINTR] = INTR_BS | INTR_FC; | - s->rregs[ESP_RSEQ] = SEQ_CD; | - esp_raise_irq(s); | - } | -} | - | static void write_response(ESPState *s) | { | trace_esp_write_response(s->status); | @@ -246,13 +229,6 @@ static void esp_do_dma(ESPState *s) | int to_device; | | len = s->dma_left; | - if (s->do_cmd) { | - trace_esp_do_dma(s->cmdlen, len); | - assert (s->cmdlen <= sizeof(s->cmdbuf) && | - len <= sizeof(s->cmdbuf) - s->cmdlen); | - s->dma_memory_read(s->dma_opaque, &s->cmdbuf[s->cmdlen], len); | - return; | - } | if (s->async_len == 0) { | /* Defer until data is available. */ | return; | @@ -316,7 +292,6 @@ void esp_transfer_data(SCSIRequest *req, uint32_t len) | { | ESPState *s = req->hba_private; | | - assert(!s->do_cmd); | trace_esp_transfer_data(s->dma_left, s->ti_size); | s->async_len = len; | s->async_buf = scsi_req_get_buf(req); | @@ -346,9 +321,7 @@ static void handle_ti(ESPState *s) | } | s->dma_counter = dmalen; | | - if (s->do_cmd) | - minlen = (dmalen < ESP_CMDBUF_SZ) ? dmalen : ESP_CMDBUF_SZ; | - else if (s->ti_size < 0) | + if (s->ti_size < 0) | minlen = (dmalen < -s->ti_size) ? dmalen : -s->ti_size; | else | minlen = (dmalen < s->ti_size) ? dmalen : s->ti_size; | @@ -358,13 +331,6 @@ static void handle_ti(ESPState *s) | s->rregs[ESP_RSTAT] &= ~STAT_TC; | esp_do_dma(s); | } | - if (s->do_cmd) { | - trace_esp_handle_ti_cmd(s->cmdlen); | - s->ti_size = 0; | - s->cmdlen = 0; | - s->do_cmd = 0; | - do_cmd(s, s->cmdbuf); | - } | } | | void esp_hard_reset(ESPState *s) | @@ -376,7 +342,6 @@ void esp_hard_reset(ESPState *s) | s->ti_rptr = 0; | s->ti_wptr = 0; | s->dma = 0; | - s->do_cmd = 0; | s->dma_cb = NULL; | | s->rregs[ESP_CFG1] = 7; | @@ -450,13 +415,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) | s->rregs[ESP_RSTAT] &= ~STAT_TC; | break; | case ESP_FIFO: | - if (s->do_cmd) { | - if (s->cmdlen < ESP_CMDBUF_SZ) { | - s->cmdbuf[s->cmdlen++] = val & 0xff; | - } else { | - trace_esp_error_fifo_overrun(); | - } | - } else if (s->ti_wptr == TI_BUFSZ - 1) { | + if (s->ti_wptr == TI_BUFSZ - 1) { | trace_esp_error_fifo_overrun(); | } else { | s->ti_size++; | @@ -534,8 +493,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) | break; | case CMD_SELATNS: | trace_esp_mem_writeb_cmd_selatns(val); | - handle_satn_stop(s); | - break; | + goto unhandled; | case CMD_ENSEL: | trace_esp_mem_writeb_cmd_ensel(val); | s->rregs[ESP_RINTR] = 0; | @@ -546,6 +504,7 @@ void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) | esp_raise_irq(s); | break; | default: | + unhandled: | trace_esp_error_unhandled_command(val); | break; | } | @@ -585,9 +544,12 @@ const VMStateDescription vmstate_esp = { | VMSTATE_BUFFER(ti_buf, ESPState), | VMSTATE_UINT32(status, ESPState), | VMSTATE_UINT32(dma, ESPState), | - VMSTATE_BUFFER(cmdbuf, ESPState), | - VMSTATE_UINT32(cmdlen, ESPState), | - VMSTATE_UINT32(do_cmd, ESPState), | + /* Used to be cmdbuf, cmdlen, do_cmd, but the implementation | + * of "Select with ATN and stop" was totally busted. | + */ | + VMSTATE_UNUSED(16), | + VMSTATE_UNUSED(4), | + VMSTATE_UNUSED(1), | VMSTATE_UINT32(dma_left, ESPState), | VMSTATE_END_OF_LIST() | } Looks okay. | diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h | index d2c4886..8967167 100644 | --- a/include/hw/scsi/esp.h | +++ b/include/hw/scsi/esp.h | @@ -32,9 +32,6 @@ struct ESPState { | SCSIBus bus; | SCSIDevice *current_dev; | SCSIRequest *current_req; | - uint8_t cmdbuf[ESP_CMDBUF_SZ]; | - uint32_t cmdlen; | - uint32_t do_cmd; The macro 'ESP_CMDBUF_SZ' can be removed. --- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index d2c4886..61cb8b4 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -14,7 +14,6 @@ void esp_init(hwaddr espaddr, int it_shift, #define ESP_REGS 16 #define TI_BUFSZ 16 -#define ESP_CMDBUF_SZ 32 Thank you.