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.
Signed-off-by: zhaoxin\RockCuioc <rockcui...@zhaoxin.com> --- hw/ide/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/ide/core.c b/hw/ide/core.c index d997a78e47..26d86f4b40 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -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; } -- 2.17.1