* [Patch][Fix win2k install] Add delay between dma issue & result.
@ 2007-11-07 16:48 ` Dor Laor
0 siblings, 0 replies; 2+ messages in thread
From: Dor Laor @ 2007-11-07 16:48 UTC (permalink / raw)
To: qemu-devel-qX2TKyscuCcdnm+yROfE0A, kvm-devel
Fix win2k install] Add delay between dma issue & result.
Using synchonous io leads the guest to unexplored places:
If it issues a dma command, it goes to qemu and executed
synchrnously and return with irq for data ready.
This is not real world scenario and happens when not using asyncio.
This fix adds a delay of 1msec once every 8 dma writes.
Signed-off-by: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
btw: It also applies against qemu cvs head.
diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index 329d053..da972c8 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -366,6 +366,8 @@ typedef struct IDEState {
uint32_t mdata_size;
uint8_t *mdata_storage;
int media_changed;
+
+ QEMUTimer *dma_write_timer; /* only used for win2k instal hack */
} IDEState;
#define BM_STATUS_DMAING 0x01
@@ -862,9 +864,21 @@ static void ide_sector_read_dma(IDEState *s)
static void ide_sector_write_timer_cb(void *opaque)
{
IDEState *s = opaque;
+
ide_set_irq(s);
}
+static void ide_write_dma_cb(void *opaque, int ret);
+static void ide_dma_write_timer_cb(void *opaque)
+{
+ IDEState *s = opaque;
+
+ s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
+ s->io_buffer_index = 0;
+ s->io_buffer_size = 0;
+ ide_dma_start(s, ide_write_dma_cb);
+}
+
static void ide_sector_write_aio_cb(void *opaque, int ret)
{
BMDMAState *bm = opaque;
@@ -975,10 +989,19 @@ static void ide_write_dma_cb(void *opaque, int ret)
static void ide_sector_write_dma(IDEState *s)
{
- s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
- s->io_buffer_index = 0;
- s->io_buffer_size = 0;
- ide_dma_start(s, ide_write_dma_cb);
+ #ifdef TARGET_I386
+ if (win2k_install_hack && ((++s->irq_count % 8) == 0)) {
+ /* It seems there is a bug in the Windows 2000 installer HDD
+ IDE driver which fills the disk with empty logs when the
+ IDE write IRQ comes too early. This hack tries to correct
+ that at the expense of slower write performances. Use this
+ option _only_ to install Windows 2000. You must disable it
+ for normal use. */
+ qemu_mod_timer(s->dma_write_timer,
+ qemu_get_clock(vm_clock) + (ticks_per_sec /
1000));
+ } else
+ #endif
+ ide_dma_write_timer_cb(s);
}
static void ide_atapi_cmd_ok(IDEState *s)
@@ -2497,6 +2520,8 @@ static void ide_init2(IDEState *ide_state,
s->irq = irq;
s->sector_write_timer = qemu_new_timer(vm_clock,
ide_sector_write_timer_cb, s);
+ s->dma_write_timer = qemu_new_timer(vm_clock,
+ ide_dma_write_timer_cb, s);
ide_reset(s);
}
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Qemu-devel] [Patch][Fix win2k install] Add delay between dma issue & result.
@ 2007-11-07 16:48 ` Dor Laor
0 siblings, 0 replies; 2+ messages in thread
From: Dor Laor @ 2007-11-07 16:48 UTC (permalink / raw)
To: qemu-devel, kvm-devel
Fix win2k install] Add delay between dma issue & result.
Using synchonous io leads the guest to unexplored places:
If it issues a dma command, it goes to qemu and executed
synchrnously and return with irq for data ready.
This is not real world scenario and happens when not using asyncio.
This fix adds a delay of 1msec once every 8 dma writes.
Signed-off-by: Dor Laor <dor.laor@qumranet.com>
btw: It also applies against qemu cvs head.
diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index 329d053..da972c8 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -366,6 +366,8 @@ typedef struct IDEState {
uint32_t mdata_size;
uint8_t *mdata_storage;
int media_changed;
+
+ QEMUTimer *dma_write_timer; /* only used for win2k instal hack */
} IDEState;
#define BM_STATUS_DMAING 0x01
@@ -862,9 +864,21 @@ static void ide_sector_read_dma(IDEState *s)
static void ide_sector_write_timer_cb(void *opaque)
{
IDEState *s = opaque;
+
ide_set_irq(s);
}
+static void ide_write_dma_cb(void *opaque, int ret);
+static void ide_dma_write_timer_cb(void *opaque)
+{
+ IDEState *s = opaque;
+
+ s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
+ s->io_buffer_index = 0;
+ s->io_buffer_size = 0;
+ ide_dma_start(s, ide_write_dma_cb);
+}
+
static void ide_sector_write_aio_cb(void *opaque, int ret)
{
BMDMAState *bm = opaque;
@@ -975,10 +989,19 @@ static void ide_write_dma_cb(void *opaque, int ret)
static void ide_sector_write_dma(IDEState *s)
{
- s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
- s->io_buffer_index = 0;
- s->io_buffer_size = 0;
- ide_dma_start(s, ide_write_dma_cb);
+ #ifdef TARGET_I386
+ if (win2k_install_hack && ((++s->irq_count % 8) == 0)) {
+ /* It seems there is a bug in the Windows 2000 installer HDD
+ IDE driver which fills the disk with empty logs when the
+ IDE write IRQ comes too early. This hack tries to correct
+ that at the expense of slower write performances. Use this
+ option _only_ to install Windows 2000. You must disable it
+ for normal use. */
+ qemu_mod_timer(s->dma_write_timer,
+ qemu_get_clock(vm_clock) + (ticks_per_sec /
1000));
+ } else
+ #endif
+ ide_dma_write_timer_cb(s);
}
static void ide_atapi_cmd_ok(IDEState *s)
@@ -2497,6 +2520,8 @@ static void ide_init2(IDEState *ide_state,
s->irq = irq;
s->sector_write_timer = qemu_new_timer(vm_clock,
ide_sector_write_timer_cb, s);
+ s->dma_write_timer = qemu_new_timer(vm_clock,
+ ide_dma_write_timer_cb, s);
ide_reset(s);
}
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-07 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 16:48 [Patch][Fix win2k install] Add delay between dma issue & result Dor Laor
2007-11-07 16:48 ` [Qemu-devel] " Dor Laor
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.