qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Pavel Hrdina <phrdina@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] fdc: fix media detection
Date: Tue, 22 May 2012 15:42:20 +0200	[thread overview]
Message-ID: <4FBB97BC.4020205@redhat.com> (raw)
In-Reply-To: <4FBB946E.4000601@redhat.com>

Am 22.05.2012 15:28, schrieb Pavel Hrdina:
> On 05/22/2012 02:01 PM, Kevin Wolf wrote:
>> 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<phrdina@redhat.com>
>> Can you please add a qtest case that shows the problems that you're
>> fixing in this series?
> I'm new to qemu. By "add a qtest case" you mean update tests/fdc-test.c ?

Sorry, I should have been more specific. Yes, that's what I mean.

>>> 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
> Well, you are right. Than we have to set 'max_track' even if there is no 
> media. I tested this on bare-metal without media and where floppy driver 
> ask to seek to specific track, it ends good and return specific track 
> position as actual.
> I'll rewrite this behavior and send patch v2.

You mean max_track = 0 isn't a good value to work with? How can a real
drive position the head correctly when it doesn't have a media (and
therefore doesn't know its geometry)?

But if you have a good default value for max_track that we should use
when no medium is present, go ahead.

Kevin

  reply	other threads:[~2012-05-22 13:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 10:59 [Qemu-devel] [PATCH 0/2] fdc: fix media handling Pavel Hrdina
2012-05-22 10:59 ` [Qemu-devel] [PATCH 1/2] fdc: floppy drive should be visible after start without media Pavel Hrdina
2012-05-22 10:59 ` [Qemu-devel] [PATCH 2/2] fdc: fix media detection Pavel Hrdina
2012-05-22 12:01   ` Kevin Wolf
2012-05-22 13:28     ` Pavel Hrdina
2012-05-22 13:42       ` Kevin Wolf [this message]
2012-05-22 13:56         ` Pavel Hrdina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FBB97BC.4020205@redhat.com \
    --to=kwolf@redhat.com \
    --cc=phrdina@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).