Received: from eggs.gnu.org ([2001:4830:134:3::10]:51687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z72s5-0004kY-CF for qemu-devel@nongnu.org; Mon, 22 Jun 2015 10:38:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z72s4-0006ii-CD for qemu-devel@nongnu.org; Mon, 22 Jun 2015 10:38:49 -0400 Date: Mon, 22 Jun 2015 15:38:40 +0100 From: Stefan Hajnoczi Message-ID: <20150622143840.GE7136@stefanha-thinkpad.redhat.com> References: <1434765047-29333-1-git-send-email-jsnow@redhat.com> <1434765047-29333-9-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tVmo9FyGdCe4F4YN" Content-Disposition: inline In-Reply-To: <1434765047-29333-9-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH 08/16] ahci: clear error register before NCQ cmd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org --tVmo9FyGdCe4F4YN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 19, 2015 at 09:50:39PM -0400, John Snow wrote: > The legacy ide command execution layer will clear any errors outstanding > before execution, but the NCQ layer doesn't. > Even on success, this register will remain clogged. >=20 > Clear it out before each NCQ command so the guest can tell if the > error code produced after completion is meaningful or not. >=20 > Signed-off-by: John Snow > --- > hw/ide/ahci.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c > index 6bded67..e63ba9b 100644 > --- a/hw/ide/ahci.c > +++ b/hw/ide/ahci.c > @@ -1048,6 +1048,8 @@ static void process_ncq_command(AHCIState *s, int p= ort, uint8_t *cmd_fis, > ncq_tfs->lba, ncq_tfs->lba + ncq_tfs->sector_count - 1, > ide_state->nb_sectors - 1); > =20 > + ide_state->error =3D 0; I'm not sure it makes sense use ide_state at all in NCQ. ide_state is per-port and NCQ can issue multiple asynchronous commands per port. If process_ncq_command() modifies ide_state, it may do that while other commands are still pending or about to be processed. This will clobber ide_state->error. --tVmo9FyGdCe4F4YN Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJViB3wAAoJEJykq7OBq3PIUGcH/3fJ7rW1JN0E25ginxk9RgDd aWpQS60Pb5Xf9TTu4NIZRQXKiLE2r1Ekru/6u1WwoUBQSWpJf4qykbL/gTYq7wVw Ep1uDVYEBULdhUJPpxB4lxOCIvLXYi99JrbrKyBiOmISa9Ua1bxWGk9WS20/O35j Cwavt4seTvuuS5nRK5jIRHtMrR6lGy5svBjW/UgFQ8VdBG4VM37goDrYppJ6dn7x TC22Mifkz6WGMVnzpBYNTpjIVOHKzAsQ449s1LNeSqF+2TKMB81+AYIkxI2kfkv4 LXsmS9QD9esTYnrGVIi878FQwskYeH6VTV52XgfPoNLiMYICVgMk5yviySkMqlw= =DD0i -----END PGP SIGNATURE----- --tVmo9FyGdCe4F4YN--