From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMmEF-0006Hd-T4 for qemu-devel@nongnu.org; Wed, 18 May 2011 15:16:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMmED-0003DN-W1 for qemu-devel@nongnu.org; Wed, 18 May 2011 15:16:19 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:53086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMmED-0003D8-Kw for qemu-devel@nongnu.org; Wed, 18 May 2011 15:16:17 -0400 Message-ID: <4DD41AFF.6090604@web.de> Date: Wed, 18 May 2011 21:16:15 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1305722933-28282-1-git-send-email-agraf@suse.de> In-Reply-To: <1305722933-28282-1-git-send-email-agraf@suse.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig9D8BC3706909C96F5B0F4625" Sender: jan.kiszka@web.de Subject: Re: [Qemu-devel] [PATCH] ahci: Fix non-NCQ accesses for LBA > 16bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Kevin Wolf , =?ISO-8859-15?Q?Ren=E9_Rebe?= , "qemu-devel@nongnu.org Developers" , Alexey Zaytsev This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig9D8BC3706909C96F5B0F4625 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable On 2011-05-18 14:48, Alexander Graf wrote: > AHCI provides two ways of reading/writing data: >=20 > 1) NCQ > 2) ATA commands with the LBA in the command FIS >=20 > In the second code path, we didn't handle any LBAs that were bigger tha= n > 16 bits, so whenever a guest that used high LBA numbers wanted to acces= s > data, the LBA got truncated down to 16 bits, giving the guest garbage. >=20 > This patch adds support for LBAs higher than 16 bits. I've tested that = it > works just fine with SeaBIOS and Linux guests. This patch also unbreaks= > the often reported grub errors people have seen with AHCI. Cool! I actually had such a guest as well, but I didn't manage to look closer so far. Now this patch cures it. Jan >=20 > Signed-off-by: Alexander Graf > --- > hw/ide/ahci.c | 9 +++++++-- > 1 files changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c > index c6e0c77..bc5c553 100644 > --- a/hw/ide/ahci.c > +++ b/hw/ide/ahci.c > @@ -884,8 +884,13 @@ static int handle_cmd(AHCIState *s, int port, int = slot) > } > =20 > if (ide_state->drive_kind !=3D IDE_CD) { > - ide_set_sector(ide_state, (cmd_fis[6] << 16) | (cmd_fis[5]= << 8) | > - cmd_fis[4]); > + ide_set_sector(ide_state, ((uint64_t)cmd_fis[10] << 40) > + | ((uint64_t)cmd_fis[9] << 32) > + | ((uint64_t)cmd_fis[8] << 24) > + | ((uint64_t)(cmd_fis[7] & 0xf) <<= 24) > + | ((uint64_t)cmd_fis[6] << 16) > + | ((uint64_t)cmd_fis[5] << 8) > + | cmd_fis[4]); > } > =20 > /* Copy the ACMD field (ATAPI packet, if any) from the AHCI co= mmand --------------enig9D8BC3706909C96F5B0F4625 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk3UGv8ACgkQitSsb3rl5xSX0gCgr+vC8sODIwcXOx1XZip8Wzhu q/kAn2Yd0uXp5JY6t5rujLHyyUEsXRq7 =Eukh -----END PGP SIGNATURE----- --------------enig9D8BC3706909C96F5B0F4625--