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

On 05/22/2012 03:42 PM, Kevin Wolf wrote:
> 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
When you try mount floppy in linux while there is no media then a floppy 
driver tries to seek on track 1. Virtual guest always get actual track 
position 0 so tries to seek again and stuck in loop which cause kernel 
panic. On bare-metal floppy driver gets actual track position 1 and stop 
seeking.

I thing, that a real drive ignore geometry and just seeks to specific 
position.

Pavel

      reply	other threads:[~2012-05-22 13:56 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
2012-05-22 13:56         ` Pavel Hrdina [this message]

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=4FBB9B11.2030501@redhat.com \
    --to=phrdina@redhat.com \
    --cc=kwolf@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.