qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug)
Date: Wed, 06 Apr 2005 22:25:22 +0200	[thread overview]
Message-ID: <425445B2.7050605@bellard.org> (raw)
In-Reply-To: <4253192C.8070600@win4lin.com>

If other people confirm that this patch is solving the issue, I can try 
to improve it so that it is commitable.

Fabrice.

Leonardo E. Reiter wrote:
> Yes, we did replace the IDE driver with our own implementation.  But you 
> can apply this patch that was posted long ago on the list that takes 
> care of it on regular QEMU.  It will slow things down a bit, so you may 
> want to disable it, so you may want to optimize it or disable it after 
> you get Windows 2000 installed, but it works.  The issue seems to be the 
> fact that the install-time Windows 2000 IDE driver doesn't like write 
> operations generating an interrupt too quickly (i.e. before the "out" or 
> DMA transfer returns).  It doesn't seem to have this issue after the 
> base OS is installed and booted however, but your experience may vary. 
> Attached is the patch that we found on the list.  It applies both to 
> 0.6.1 and 0.6.2, albeit with some possible hunks.
> 
> Best regards,
> 
> Leo Reiter
> 
> Hetz Ben Hamo wrote:
> 
>> Hi Leonardo,
>>
>> I have tried to install win2k from various CD's I have here around and
>> I stumbled on one really weird thing..
>>
>> Disk space issues. I have tried with 1GB, 2GB and 4GB virtual disks,
>> and all of them seems to be quickly filled by the win2k installer and
>> then the install fails..
>>
>> Do you also have the same problem there at win4lin? or is it only
>> happening with QEMU's internal IDE drive emulation? (since I recall
>> that win4lin replaced the IDE driver with their own's one)..
>>
>> Thanks,
>> Hetz
> 
> 
> 
> ------------------------------------------------------------------------
> 
> diff -rbu qemu.orig/hw/ide.c qemu/hw/ide.c
> --- qemu.orig/hw/ide.c	2004-12-02 23:20:21.000000000 +0300
> +++ qemu/hw/ide.c	2004-12-17 14:06:15.000000000 +0300
> @@ -332,8 +332,12 @@
>      uint8_t *data_ptr;
>      uint8_t *data_end;
>      uint8_t io_buffer[MAX_MULT_SECTORS*512 + 4];
> +    int ide_set_irq_from_timer;
>  } IDEState;
>  
> +volatile int ide_set_irq_from_timer;
> +static IDEState *IDEStates[4];
> +
>  #define BM_STATUS_DMAING 0x01
>  #define BM_STATUS_ERROR  0x02
>  #define BM_STATUS_INT    0x04
> @@ -512,6 +516,21 @@
>      }
>  }
>  
> +void make_ide_set_irq(void)
> +{
> +	int i;
> +	IDEState *s;
> +
> +	ide_set_irq_from_timer--;
> +	for(i = 0; (s=IDEStates[i]) != NULL; i++) {
> +		if(s->ide_set_irq_from_timer) {
> +			s->ide_set_irq_from_timer--;
> +			ide_set_irq(s);
> +			break;
> +		}
> +	}
> +}
> +
>  /* prepare data transfer and tell what to do after */
>  static void ide_transfer_start(IDEState *s, uint8_t *buf, int size, 
>                                 EndTransferFunc *end_transfer_func)
> @@ -667,7 +686,11 @@
>          ide_transfer_start(s, s->io_buffer, 512 * n1, ide_sector_write);
>      }
>      ide_set_sector(s, sector_num + n);
> +    if(s->ide_set_irq_from_timer) {
> +	ide_set_irq_from_timer++;
> +    } else {
>      ide_set_irq(s);
> +    }
>  }
>  
>  static int ide_write_dma_cb(IDEState *s, 
> @@ -1511,6 +1534,7 @@
>              s->error = 0;
>              s->status = SEEK_STAT | READY_STAT;
>              s->req_nb_sectors = 1;
> +	    s->ide_set_irq_from_timer = 1;
>              ide_transfer_start(s, s->io_buffer, 512, ide_sector_write);
>              break;
>          case WIN_MULTREAD:
> @@ -1528,6 +1552,7 @@
>              n = s->nsector;
>              if (n > s->req_nb_sectors)
>                  n = s->req_nb_sectors;
> +	    s->ide_set_irq_from_timer = 1;
>              ide_transfer_start(s, s->io_buffer, 512 * n, ide_sector_write);
>              break;
>          case WIN_READDMA:
> @@ -1883,6 +1908,7 @@
>  
>      for(i = 0; i < 2; i++) {
>          s = ide_state + i;
> +	IDEStates[drive_serial-1] = s;
>          if (i == 0)
>              s->bs = hd0;
>          else
> diff -rbu qemu.orig/vl.c qemu/vl.c
> --- qemu.orig/vl.c	2004-12-13 01:20:04.000000000 +0300
> +++ qemu/vl.c	2004-12-17 12:41:16.000000000 +0300
> @@ -911,7 +911,7 @@
>          
>          /* timer signal */
>          sigfillset(&act.sa_mask);
> -        act.sa_flags = 0;
> +	act.sa_flags = SA_RESTART;
>  #if defined (TARGET_I386) && defined(USE_CODE_COPY)
>          act.sa_flags |= SA_ONSTACK;
>  #endif
> @@ -2403,7 +2403,12 @@
>      int n, max_size;
>  #endif
>      int ret;
> +    /* ide.c hack */
> +    extern volatile int ide_set_irq_from_timer;
> +    extern void make_ide_set_irq(void);
>  
> +	if(ide_set_irq_from_timer)
> +		make_ide_set_irq();
>  #ifdef _WIN32
>          if (timeout > 0)
>              Sleep(timeout);
> @@ -2449,8 +2454,6 @@
>                              n = read(ioh->fd, buf, ioh->max_size);
>                              if (n >= 0) {
>                                  ioh->fd_read(ioh->opaque, buf, n);
> -                            } else if (errno != EAGAIN) {
> -                                ioh->fd_read(ioh->opaque, NULL, -errno);
>                              }
>                          }
>                      }
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel

  parent reply	other threads:[~2005-04-06 20:10 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-27  3:49 [Qemu-devel] Suggestion - trap window-close of VM Ryan Rempel
2005-03-27 18:30 ` Struan Bartlett
2005-03-28 11:34   ` [patch] " Struan Bartlett
2005-03-28 12:51     ` Asko Kauppi
2005-03-28 13:04       ` Paul Brook
2005-03-29 22:37     ` [Qemu-devel] " Ryan Rempel
2005-03-29 22:52       ` Paul Brook
2005-03-30  1:17         ` Ryan Rempel
2005-03-30 12:20           ` Struan Bartlett
2005-03-30 12:48             ` Lennert Buytenhek
2005-03-30 13:26               ` Struan Bartlett
2005-03-30 18:22                 ` Lennert Buytenhek
2005-03-30 20:16                   ` Leonardo E. Reiter
2005-03-30 21:22                     ` Lennert Buytenhek
2005-03-30 21:43                     ` Struan Bartlett
2005-03-31  9:32                       ` John R. Hogerhuis
2005-03-31 12:31                         ` Lennert Buytenhek
2005-03-30 13:21         ` APM bug " Struan Bartlett
2005-03-31 10:38           ` Struan Bartlett
2005-03-31 17:56             ` Struan Bartlett
2005-04-03 22:00               ` A Fix " Struan Bartlett
2005-04-04  9:53               ` Struan Bartlett
2005-04-04 17:12               ` Struan Bartlett
2005-04-04 22:26                 ` Iain McFarlane
2005-04-05 16:34                   ` Volker Ruppert
2005-04-05 21:05                     ` Iain McFarlane
2005-04-05 21:33                       ` [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug) Leonardo E. Reiter
2005-04-05 22:57                         ` Hetz Ben Hamo
2005-04-05 23:03                           ` Leonardo E. Reiter
2005-04-05 23:48                             ` Hetz Ben Hamo
2005-04-06  0:28                               ` Leonardo E. Reiter
2005-04-06  0:52                               ` [Qemu-devel] Re: Windows 2000 SP4 Leonardo E. Reiter
2005-04-06 20:25                             ` Fabrice Bellard [this message]
2005-04-06 22:47                               ` [Qemu-devel] Re: Windows 2000 SP4 (was Re: APM bug) Hetz Ben Hamo
2005-04-07  7:17                                 ` Jonas Maebe
2005-04-07 11:56                                   ` Flavio Visentin
2005-04-05 23:40                         ` Derek Fawcus
2005-04-07 16:42                 ` A Fix Re: APM bug Re: [Qemu-devel] Re: Suggestion - trap window-closeof VM Andreas Bollhalder
2005-04-05 13:55             ` APM bug Re: [Qemu-devel] Re: Suggestion - trap window-close of VM Alex Beregszaszi
2005-03-31 16:38           ` Andreas Bollhalder
2005-03-31 17:32             ` Jason Gress
2005-05-07 16:30     ` [patch] on-quit-v0.21 with resume/suspend/power-off dialog Re: [patch] Re: [Qemu-devel] " Struan Bartlett
2005-05-09 15:43       ` Ryan Rempel
2005-05-09 22:25         ` Struan Bartlett
2005-05-09 23:19         ` Flavio Visentin
2005-05-10  8:40           ` Struan Bartlett
2005-07-29  0:07       ` [patch] " Struan Bartlett
2005-03-28 15:04 ` Mark Williamson
2005-03-28 19:13   ` Joshua Kugler

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=425445B2.7050605@bellard.org \
    --to=fabrice@bellard.org \
    --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).