From owner-svn-src-head@FreeBSD.ORG Tue Mar 18 23:25:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42DE6BCC; Tue, 18 Mar 2014 23:25:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2F275DDE; Tue, 18 Mar 2014 23:25:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2INPas1006281; Tue, 18 Mar 2014 23:25:36 GMT (envelope-from tychon@svn.freebsd.org) Received: (from tychon@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2INPaPO006280; Tue, 18 Mar 2014 23:25:36 GMT (envelope-from tychon@svn.freebsd.org) Message-Id: <201403182325.s2INPaPO006280@svn.freebsd.org> From: Tycho Nightingale Date: Tue, 18 Mar 2014 23:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263322 - head/usr.sbin/bhyve X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2014 23:25:36 -0000 Author: tychon Date: Tue Mar 18 23:25:35 2014 New Revision: 263322 URL: http://svnweb.freebsd.org/changeset/base/263322 Log: Don't reissue in-flight commands. Approved by: neel (co-mentor) Modified: head/usr.sbin/bhyve/pci_ahci.c Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Tue Mar 18 22:22:47 2014 (r263321) +++ head/usr.sbin/bhyve/pci_ahci.c Tue Mar 18 23:25:35 2014 (r263322) @@ -134,6 +134,7 @@ struct ahci_port { uint8_t xfermode; uint8_t sense_key; uint8_t asc; + uint32_t pending; uint32_t clb; uint32_t clbu; @@ -471,6 +472,10 @@ ahci_handle_dma(struct ahci_port *p, int if (iovcnt > BLOCKIF_IOV_MAX) { aior->prdtl = iovcnt - BLOCKIF_IOV_MAX; iovcnt = BLOCKIF_IOV_MAX; + /* + * Mark this command in-flight. + */ + p->pending |= 1 << slot; } else aior->prdtl = 0; breq->br_iovcnt = iovcnt; @@ -494,7 +499,7 @@ ahci_handle_dma(struct ahci_port *p, int err = blockif_write(p->bctx, breq); assert(err == 0); - if (!aior->prdtl && ncq) + if (ncq) p->ci &= ~(1 << slot); } @@ -1327,8 +1332,12 @@ ahci_handle_port(struct ahci_port *p) if (!(p->cmd & AHCI_P_CMD_ST)) return; + /* + * Search for any new commands to issue ignoring those that + * are already in-flight. + */ for (i = 0; (i < 32) && p->ci; i++) { - if (p->ci & (1 << i)) + if ((p->ci & (1 << i)) && !(p->pending & (1 << i))) ahci_handle_slot(p, i); } } @@ -1389,6 +1398,11 @@ ata_ioreq_cb(struct blockif_req *br, int p->serr |= (1 << slot); } + /* + * This command is now complete. + */ + p->pending &= ~(1 << slot); + if (ncq) { p->sact &= ~(1 << slot); ahci_write_fis_sdb(p, slot, tfd);