qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] fdc: fix media detection


From: Pavel Hrdina
Subject: Re: [Qemu-devel] [PATCH 2/2] fdc: fix media detection
Date: Tue, 22 May 2012 15:56:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

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<address@hidden>
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 via email to

[Prev in Thread] Current Thread [Next in Thread]