[1/1] atapi: reset cdrom tray statuses on ide_reset

Submitted by Pavel Hrdina on Dec. 11, 2012, 7:55 a.m.

Details

Message ID 6a624c962a5e9dbd00271be1c5fd719d1dd338af.1355212056.git.phrdina@redhat.com
State New
Headers show

Commit Message

Pavel Hrdina Dec. 11, 2012, 7:55 a.m.
Tray statuses should be also reseted. Some guests may lock the tray
and after reset before any kernel is loaded the tray should be unlocked.

Also if you reset the real computer the tray is closed. We should
do the same in qemu.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 hw/ide/core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kevin Wolf Dec. 13, 2012, 10:18 a.m.
Am 11.12.2012 08:55, schrieb Pavel Hrdina:
> Tray statuses should be also reseted. Some guests may lock the tray
> and after reset before any kernel is loaded the tray should be unlocked.
> 
> Also if you reset the real computer the tray is closed. We should
> do the same in qemu.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>

Thanks, applied to the block branch.

Do we need to reset more fields, like s->events?

Kevin
Pavel Hrdina Dec. 13, 2012, 10:44 a.m.
On Thu, 2012-12-13 at 11:18 +0100, Kevin Wolf wrote:
> Am 11.12.2012 08:55, schrieb Pavel Hrdina:
> > Tray statuses should be also reseted. Some guests may lock the tray
> > and after reset before any kernel is loaded the tray should be unlocked.
> > 
> > Also if you reset the real computer the tray is closed. We should
> > do the same in qemu.
> > 
> > Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> 
> Thanks, applied to the block branch.
> 
> Do we need to reset more fields, like s->events?
> 
> Kevin

Good point, I'll check that.

Pavel

Patch hide | download patch | download mbox

diff --git a/hw/ide/core.c b/hw/ide/core.c
index c4f93d0..1235612 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1869,6 +1869,8 @@  static void ide_reset(IDEState *s)
     s->io_buffer_index = 0;
     s->cd_sector_size = 0;
     s->atapi_dma = 0;
+    s->tray_locked = 0;
+    s->tray_open = 0;
     /* ATA DMA state */
     s->io_buffer_size = 0;
     s->req_nb_sectors = 0;