Patchwork [v4,1/3] fdc: floppy drive should be visible after start without media

login
register
mail settings
Submitter Pavel Hrdina
Date May 24, 2012, 9:02 a.m.
Message ID <1cab04f5945f130fad0d576378d71acd36c0c13e.1337849630.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/161080/
State New
Headers show

Comments

Pavel Hrdina - May 24, 2012, 9:02 a.m.
If you start guest with floppy drive but without media inserted, guest
still should see floppy drive pressent.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 hw/pc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Marcelo Tosatti - June 5, 2012, 2:54 a.m.
On Thu, May 24, 2012 at 11:02:28AM +0200, Pavel Hrdina wrote:
> If you start guest with floppy drive but without media inserted, guest
> still should see floppy drive pressent.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  hw/pc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pc.c b/hw/pc.c
> index 4d34a33..967c17a 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>      if (floppy) {
>          fdc_get_bs(fd, floppy);
>          for (i = 0; i < 2; i++) {
> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
> +            if (fd[i]) {
>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
>                                                &last_sect, FDRIVE_DRV_NONE,
>                                                &fd_type[i], &rate);
> -- 

This commit breaks WinXP.32 installation. It crashes during early setup 
stage, without a floppy disk specified.

Specifying a floppy disk with -fda fixes the problem.
Markus Armbruster - June 5, 2012, 6:23 a.m.
Marcelo Tosatti <mtosatti@redhat.com> writes:

> On Thu, May 24, 2012 at 11:02:28AM +0200, Pavel Hrdina wrote:
>> If you start guest with floppy drive but without media inserted, guest
>> still should see floppy drive pressent.
>> 
>> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>> ---
>>  hw/pc.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> 
>> diff --git a/hw/pc.c b/hw/pc.c
>> index 4d34a33..967c17a 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>>      if (floppy) {
>>          fdc_get_bs(fd, floppy);
>>          for (i = 0; i < 2; i++) {
>> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
>> +            if (fd[i]) {
>>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
>>                                                &last_sect, FDRIVE_DRV_NONE,
>>                                                &fd_type[i], &rate);
>> -- 
>
> This commit breaks WinXP.32 installation. It crashes during early setup 
> stage, without a floppy disk specified.
>
> Specifying a floppy disk with -fda fixes the problem.

Backtrace?
Marcelo Tosatti - June 5, 2012, 10:05 a.m.
On Tue, Jun 05, 2012 at 08:23:53AM +0200, Markus Armbruster wrote:
> Marcelo Tosatti <mtosatti@redhat.com> writes:
> 
> > On Thu, May 24, 2012 at 11:02:28AM +0200, Pavel Hrdina wrote:
> >> If you start guest with floppy drive but without media inserted, guest
> >> still should see floppy drive pressent.
> >> 
> >> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> >> ---
> >>  hw/pc.c |    2 +-
> >>  1 files changed, 1 insertions(+), 1 deletions(-)
> >> 
> >> diff --git a/hw/pc.c b/hw/pc.c
> >> index 4d34a33..967c17a 100644
> >> --- a/hw/pc.c
> >> +++ b/hw/pc.c
> >> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
> >>      if (floppy) {
> >>          fdc_get_bs(fd, floppy);
> >>          for (i = 0; i < 2; i++) {
> >> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
> >> +            if (fd[i]) {
> >>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
> >>                                                &last_sect, FDRIVE_DRV_NONE,
> >>                                                &fd_type[i], &rate);
> >> -- 
> >
> > This commit breaks WinXP.32 installation. It crashes during early setup 
> > stage, without a floppy disk specified.
> >
> > Specifying a floppy disk with -fda fixes the problem.
> 
> Backtrace?

None, WinXP is spinning (presumably the floppy driver).
Markus Armbruster - June 5, 2012, 12:05 p.m.
Marcelo Tosatti <mtosatti@redhat.com> writes:

> On Tue, Jun 05, 2012 at 08:23:53AM +0200, Markus Armbruster wrote:
>> Marcelo Tosatti <mtosatti@redhat.com> writes:
>> 
>> > On Thu, May 24, 2012 at 11:02:28AM +0200, Pavel Hrdina wrote:
>> >> If you start guest with floppy drive but without media inserted, guest
>> >> still should see floppy drive pressent.
>> >> 
>> >> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>> >> ---
>> >>  hw/pc.c |    2 +-
>> >>  1 files changed, 1 insertions(+), 1 deletions(-)
>> >> 
>> >> diff --git a/hw/pc.c b/hw/pc.c
>> >> index 4d34a33..967c17a 100644
>> >> --- a/hw/pc.c
>> >> +++ b/hw/pc.c
>> >> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>> >>      if (floppy) {
>> >>          fdc_get_bs(fd, floppy);
>> >>          for (i = 0; i < 2; i++) {
>> >> -            if (fd[i] && bdrv_is_inserted(fd[i])) {
>> >> +            if (fd[i]) {
>> >>                  bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
>> >>                                                &last_sect, FDRIVE_DRV_NONE,
>> >>                                                &fd_type[i], &rate);
>> >> -- 
>> >
>> > This commit breaks WinXP.32 installation. It crashes during early setup 
>> > stage, without a floppy disk specified.
>> >
>> > Specifying a floppy disk with -fda fixes the problem.
>> 
>> Backtrace?
>
> None, WinXP is spinning (presumably the floppy driver).

Bummer.  Pavel, can you look into this?
Pavel Hrdina - June 5, 2012, 12:32 p.m.
On 06/05/2012 02:05 PM, Markus Armbruster wrote:
> Marcelo Tosatti<mtosatti@redhat.com>  writes:
>
>> On Tue, Jun 05, 2012 at 08:23:53AM +0200, Markus Armbruster wrote:
>>> Marcelo Tosatti<mtosatti@redhat.com>  writes:
>>>
>>>> On Thu, May 24, 2012 at 11:02:28AM +0200, Pavel Hrdina wrote:
>>>>> If you start guest with floppy drive but without media inserted, guest
>>>>> still should see floppy drive pressent.
>>>>>
>>>>> Signed-off-by: Pavel Hrdina<phrdina@redhat.com>
>>>>> ---
>>>>>   hw/pc.c |    2 +-
>>>>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>>>>
>>>>> diff --git a/hw/pc.c b/hw/pc.c
>>>>> index 4d34a33..967c17a 100644
>>>>> --- a/hw/pc.c
>>>>> +++ b/hw/pc.c
>>>>> @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
>>>>>       if (floppy) {
>>>>>           fdc_get_bs(fd, floppy);
>>>>>           for (i = 0; i<  2; i++) {
>>>>> -            if (fd[i]&&  bdrv_is_inserted(fd[i])) {
>>>>> +            if (fd[i]) {
>>>>>                   bdrv_get_floppy_geometry_hint(fd[i],&nb_heads,&max_track,
>>>>>                                                 &last_sect, FDRIVE_DRV_NONE,
>>>>>                                                 &fd_type[i],&rate);
>>>>> -- 
>>>> This commit breaks WinXP.32 installation. It crashes during early setup
>>>> stage, without a floppy disk specified.
>>>>
>>>> Specifying a floppy disk with -fda fixes the problem.
>>> Backtrace?
>> None, WinXP is spinning (presumably the floppy driver).
> Bummer.  Pavel, can you look into this?
Hi, I have just read this issue. Sure, I will look into.

Patch

diff --git a/hw/pc.c b/hw/pc.c
index 4d34a33..967c17a 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -382,7 +382,7 @@  void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
     if (floppy) {
         fdc_get_bs(fd, floppy);
         for (i = 0; i < 2; i++) {
-            if (fd[i] && bdrv_is_inserted(fd[i])) {
+            if (fd[i]) {
                 bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
                                               &last_sect, FDRIVE_DRV_NONE,
                                               &fd_type[i], &rate);