From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJMV6-00007S-JG for qemu-devel@nongnu.org; Thu, 05 Feb 2015 08:29:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJMV1-0000sx-HO for qemu-devel@nongnu.org; Thu, 05 Feb 2015 08:29:44 -0500 Received: from mail-wi0-x234.google.com ([2a00:1450:400c:c05::234]:52142) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJMV1-0000sC-0s for qemu-devel@nongnu.org; Thu, 05 Feb 2015 08:29:39 -0500 Received: by mail-wi0-f180.google.com with SMTP id h11so10543096wiw.1 for ; Thu, 05 Feb 2015 05:29:38 -0800 (PST) Date: Thu, 5 Feb 2015 13:29:27 +0000 From: Stefan Hajnoczi Message-ID: <20150205132927.GA19277@stefanha-thinkpad.redhat.com> References: <1422999999-25868-1-git-send-email-jsnow@redhat.com> <1422999999-25868-11-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tKW2IUtsqtDRztdT" Content-Disposition: inline In-Reply-To: <1422999999-25868-11-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 10/19] qtest/ahci: add ahci_write_fis List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: famz@redhat.com, mst@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com --tKW2IUtsqtDRztdT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 03, 2015 at 04:46:30PM -0500, John Snow wrote: > Similar to ahci_set_command_header, add a helper that takes an > in-memory representation of a command FIS and writes it to guest > memory, handling endianness as-needed. >=20 > Signed-off-by: John Snow > --- > tests/ahci-test.c | 2 +- > tests/libqos/ahci.c | 10 ++++++++++ > tests/libqos/ahci.h | 1 + > 3 files changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/tests/ahci-test.c b/tests/ahci-test.c > index 211274e..658956d 100644 > --- a/tests/ahci-test.c > +++ b/tests/ahci-test.c > @@ -728,7 +728,7 @@ static void ahci_test_identify(AHCIQState *ahci) > g_assert_cmphex(ahci_px_rreg(ahci, i, AHCI_PX_IS), =3D=3D, 0); > =20 > /* Commit the Command FIS to the Command Table */ > - memwrite(table, &fis, sizeof(fis)); > + ahci_write_fis(ahci, &fis, table); > =20 > /* Commit the PRD entry to the Command Table */ > memwrite(table + 0x80, &prd, sizeof(prd)); > diff --git a/tests/libqos/ahci.c b/tests/libqos/ahci.c > index ec72627..7336781 100644 > --- a/tests/libqos/ahci.c > +++ b/tests/libqos/ahci.c > @@ -464,6 +464,16 @@ void ahci_destroy_command(AHCIQState *ahci, uint8_t = px, uint8_t cx) > ahci->port[px].prdtl[cx] =3D 0; > } > =20 > +void ahci_write_fis(AHCIQState *ahci, RegH2DFIS *fis, uint64_t addr) > +{ > + RegH2DFIS tmp =3D *fis; > + > + /* All other FIS fields are 8 bit and do not need to be flipped. */ > + tmp.count =3D cpu_to_le16(tmp.count); > + > + memwrite(addr, &tmp, sizeof(tmp)); > +} This patch looks wrong because tmp.count is byteswapped now but not before. It actually works because the value is 0 so we never bothered to assign it explicitly. I do wonder about the 'aux' field in the FIS struct. It's uint32_t. Although the tests never access it, should that field be byteswapped? Stefan --tKW2IUtsqtDRztdT Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJU03A3AAoJEJykq7OBq3PIqyUIALWynPRId6k8EqowadvuUxJQ ozj0E69mbH1FL3GiYVAR0dW1NoezmhYxUEV/XmtTbGyU2+ANdDrsZ98+QmrVW4Ii lctl9OV9j8FsgJ4Yc1VxuPI3CMOBdljylqGd2W3nPvZCJCSerfy6XbSwk97CSKFn rytFR1FoZFA56Zb5jczhaEbsEfaAUH8/AglL6ibRnC81NHlXvkTgQ01Il3LxiBWN WIEOQw8AdowenrkqhL7BDtHY4cuQ/RnBHxyNsES16MnntBuwzMUSO5mYPT1MNv/2 F4oXsL8XQ/CWPhWYmE5H70nsp+YunJdzwjmrkeqJ/xgxLk2bbCAWPhKpWc8+kIg= =8kob -----END PGP SIGNATURE----- --tKW2IUtsqtDRztdT--