Skip to contentSkip to conversation

ide:do nothing for identify cmd if no any device attached

PATCH New zhaoxin\RockCuioc 1 participant 1 message Aug 20, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ide:do nothing for identify cmd if no any device attached

v1 -> v2:
fix codestyle checked by checkpatch.pl

This patch is for avoiding win7 IDE driver polling 0x1f7 when
no any device attached. During Win7 VM boot procedure, if use virtio for disk and there is no any device be attached on hda & hdb, the win7 IDE driver would poll 0x1f7 for a while. This action may be stop windows LOGO atomic for a while too on a poor performance CPU.

---
 hw/ide/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/ide/core.c +3 -2
index d997a78e47..26d86f4b40 100644
@@ -2073,8 +2073,9 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
     s = idebus_active_if(bus);
     trace_ide_exec_cmd(bus, s, val);
 
-    /* ignore commands to non existent slave */
-    if (s != bus->ifs && !s->blk) {
+    /* ignore commands if no any device exist or non existent slave */
+    if ((!bus->ifs[0].blk && !bus->ifs[1].blk) ||
+        (s != bus->ifs && !s->blk)) {
         return;
     }
 
Signature · 1 line
2.17.1