Index: hw/ide.c =================================================================== --- hw/ide.c (revision 4456) +++ hw/ide.c (working copy) @@ -351,6 +351,7 @@ #define ASC_ILLEGAL_OPCODE 0x20 #define ASC_LOGICAL_BLOCK_OOR 0x21 #define ASC_INV_FIELD_IN_CMD_PACKET 0x24 +#define ASC_MEDIUM_MAY_HAVE_CHANGED 0x28 #define ASC_MEDIUM_NOT_PRESENT 0x3a #define ASC_SAVING_PARAMETERS_NOT_SUPPORTED 0x39 @@ -1385,6 +1386,11 @@ switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs)) { + if (s->is_cdrom && s->sense_key == SENSE_NOT_READY) { + ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION, + ASC_MEDIUM_MAY_HAVE_CHANGED); + break; + } ide_atapi_cmd_ok(s); } else { ide_atapi_cmd_error(s, SENSE_NOT_READY,