From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1baPp6-0008MP-HM for qemu-devel@nongnu.org; Thu, 18 Aug 2016 12:05:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1baPot-0003zf-Qj for qemu-devel@nongnu.org; Thu, 18 Aug 2016 12:05:40 -0400 References: <1471513714-11709-1-git-send-email-hpoussin@reactos.org> From: John Snow Message-ID: <463189a1-4c10-672c-6697-1673e1044fae@redhat.com> Date: Thu, 18 Aug 2016 12:05:07 -0400 MIME-Version: 1.0 In-Reply-To: <1471513714-11709-1-git-send-email-hpoussin@reactos.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] atapi: allow 0 transfer bytes for read_cd command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Herv=c3=a9_Poussineau?= , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Kevin Wolf On 08/18/2016 05:48 AM, Herv=C3=A9 Poussineau wrote: > This fixes Windows NT4 startup when a cdrom is inserted. > > Fixes: 9ef2e93f9b1888c7d0deb4a105149138e6ad2e98 > Signed-off-by: Herv=C3=A9 Poussineau > --- > hw/ide/atapi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c > index 6189675..63312f2 100644 > --- a/hw/ide/atapi.c > +++ b/hw/ide/atapi.c > @@ -1289,7 +1289,7 @@ static const struct AtapiCmd { > [ 0xad ] =3D { cmd_read_dvd_structure, CHECK_READY }, > [ 0xbb ] =3D { cmd_set_speed, NONDATA }, > [ 0xbd ] =3D { cmd_mechanism_status, 0 }, > - [ 0xbe ] =3D { cmd_read_cd, CHECK_READY }, > + [ 0xbe ] =3D { cmd_read_cd, CHECK_READY | NO= NDATA }, > /* [1] handler detects and reports not ready condition itself */ > }; > > What's the exact nature of the problem? I intended the "NONDATA" flag to=20 be used exclusively for commands that do not return ANY information=20 except for status return codes: /* * Commands flagged with NONDATA do not in any circumstances return * any data via ide_atapi_cmd_reply. These commands are exempt from * the normal byte_count_limit constraints. * See ATA8-ACS3 "7.21.5 Byte Count Limit" */ NONDATA =3D 0x04, I wouldn't be comfortable applying it to a command that DID indeed=20 return data under some circumstances... though you're right that if the=20 command as delivered returns no data, the ATAPI layer is allowed to=20 process that request absent byte_count_limit being programmed. You may need to adjust near this line in ide_atapi_cmd: if (cmd->handler && !(cmd->flags & NONDATA)) { to allow or disallow more commands as appropriate. It looks to me sadly=20 as if there is no hard and fast rule available to tell which commands=20 must set the BCL mandatorily ... and putting the check in the data=20 transfer itself puts us at risk for not aborting the command early enough= . I'll try to address this post-KVM forum, if you don't solve it by then. --js