From patchwork Wed Oct 29 07:53:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 404458 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3C0AF140077 for ; Wed, 29 Oct 2014 18:58:45 +1100 (AEDT) Received: from localhost ([::1]:43753 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjO9T-0000MD-FH for incoming@patchwork.ozlabs.org; Wed, 29 Oct 2014 03:58:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjO50-0000Pt-HC for qemu-devel@nongnu.org; Wed, 29 Oct 2014 03:54:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjO4q-0008WD-H1 for qemu-devel@nongnu.org; Wed, 29 Oct 2014 03:54:06 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56464 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjO4q-0008V4-AW for qemu-devel@nongnu.org; Wed, 29 Oct 2014 03:53:56 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7B9F5ADCC; Wed, 29 Oct 2014 07:53:54 +0000 (UTC) From: Hannes Reinecke To: qemu-devel@nongnu.org Date: Wed, 29 Oct 2014 08:53:48 +0100 Message-Id: <1414569232-21357-14-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1414569232-21357-1-git-send-email-hare@suse.de> References: <1414569232-21357-1-git-send-email-hare@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Hannes Reinecke , Paolo Bonzini , Nic Bellinger , Andreas Faerber , Alexander Graf Subject: [Qemu-devel] [PATCH 13/17] megasas: Ignore duplicate init_firmware commands X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The windows driver is sending several init_firmware commands when in MSI-X mode. It is, however, using only the first queue. So disregard any additional init_firmware commands until the HBA is reset. Signed-off-by: Hannes Reinecke --- hw/scsi/megasas.c | 9 ++++++--- trace-events | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 7a6c94f..c1bc563 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -609,16 +609,19 @@ static int megasas_init_firmware(MegasasState *s, MegasasCmd *cmd) { PCIDevice *pcid = PCI_DEVICE(s); uint32_t pa_hi, pa_lo; - hwaddr iq_pa, initq_size; - struct mfi_init_qinfo *initq; + hwaddr iq_pa, initq_size = sizeof(struct mfi_init_qinfo); + struct mfi_init_qinfo *initq = NULL; uint32_t flags; int ret = MFI_STAT_OK; + if (s->reply_queue_pa) { + trace_megasas_initq_mapped(s->reply_queue_pa); + goto out; + } pa_lo = le32_to_cpu(cmd->frame->init.qinfo_new_addr_lo); pa_hi = le32_to_cpu(cmd->frame->init.qinfo_new_addr_hi); iq_pa = (((uint64_t) pa_hi << 32) | pa_lo); trace_megasas_init_firmware((uint64_t)iq_pa); - initq_size = sizeof(*initq); initq = pci_dma_map(pcid, iq_pa, &initq_size, 0); if (!initq || initq_size != sizeof(*initq)) { trace_megasas_initq_map_failed(cmd->index); diff --git a/trace-events b/trace-events index 11cfc44..62f04da 100644 --- a/trace-events +++ b/trace-events @@ -697,6 +697,7 @@ lm32_uart_irq_state(int level) "irq state %d" megasas_init_firmware(uint64_t pa) "pa %" PRIx64 " " megasas_init_queue(uint64_t queue_pa, int queue_len, uint64_t head, uint64_t tail, uint32_t flags) "queue at %" PRIx64 " len %d head %" PRIx64 " tail %" PRIx64 " flags %x" megasas_initq_map_failed(int frame) "scmd %d: failed to map queue" +megasas_initq_mapped(uint64_t pa) "queue already mapped at %" PRIx64 "" megasas_initq_mismatch(int queue_len, int fw_cmds) "queue size %d max fw cmds %d" megasas_qf_found(unsigned int index, uint64_t pa) "mapped frame %x pa %" PRIx64 "" megasas_qf_new(unsigned int index, void *cmd) "return new frame %x cmd %p"