From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWnmb-0005zk-Ne for qemu-devel@nongnu.org; Tue, 22 May 2012 08:01:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWnmR-0005NB-4Q for qemu-devel@nongnu.org; Tue, 22 May 2012 08:01:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51725) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWnmQ-0005KO-R5 for qemu-devel@nongnu.org; Tue, 22 May 2012 08:01:34 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4MC1X97016188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 May 2012 08:01:33 -0400 Message-ID: <4FBB801B.4010401@redhat.com> Date: Tue, 22 May 2012 14:01:31 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <32c32f56ba695401f1357dff7935b9ace76c1ebf.1337683541.git.phrdina@redhat.com> In-Reply-To: <32c32f56ba695401f1357dff7935b9ace76c1ebf.1337683541.git.phrdina@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/2] fdc: fix media detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: qemu-devel@nongnu.org Am 22.05.2012 12:59, schrieb Pavel Hrdina: > We have to set up 'media_changed' after guest start so floppy driver > could detect that there is no media in drive. For this purpose we call > 'fdctrl_change_cb' instead of 'fd_revalidate' in 'fdctrl_connect_drives'. > 'fd_revalidate' is called inside 'fdctrl_change_cb'. > > In 'fdctrl_handle_seek' we always set current track because we don't care > if there is media inserted or not. > > Signed-off-by: Pavel Hrdina Can you please add a qtest case that shows the problems that you're fixing in this series? > diff --git a/hw/fdc.c b/hw/fdc.c > index cb4cd25..337b35a 100644 > --- a/hw/fdc.c > +++ b/hw/fdc.c > @@ -1617,11 +1617,7 @@ static void fdctrl_handle_seek(FDCtrl *fdctrl, int direction) > /* The seek command just sends step pulses to the drive and doesn't care if > * there is a medium inserted of if it's banging the head against the drive. > */ > - if (fdctrl->fifo[2] > cur_drv->max_track) { > - cur_drv->track = cur_drv->max_track; > - } else { > - cur_drv->track = fdctrl->fifo[2]; > - } > + cur_drv->track = fdctrl->fifo[2]; Why is it okay to have cur_drv->track point outside the floppy? Won't it mess up future calculations? Not all other places check it again cur_drv->max_track. Kevin