Re: [Qemu-devel] [PATCH v3 1/2] cdrom: Allow the TEST_UNIT_READY command after a cdrom change

2011-04-08 Thread Ryan Harper
* Amit Shah  [2011-04-07 03:53]:
> We restrict the commands that a guest can send us after a cdrom change
> event.  The current list includes REQUEST_SENSE and INQUIRY commands.
> Guests can also issue TEST_UNIT_READY to inquire for the status, so
> allow this command as well.
> 
> This also gets rid of one cause of the HSM violation errors in Linux
> guests.  Those errors came up because we had the UNIT_ATTENTION event
> pending and we replied with an error message to a command that should be
> allowed in such a condition.  The guest then did a soft reset to get to
> a sane state.
> 
> Signed-off-by: Amit Shah 
> ---
>  hw/ide/core.c |9 +
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index 007a4ee..d55d804 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -1105,10 +1105,11 @@ static void ide_atapi_cmd(IDEState *s)
>  /* If there's a UNIT_ATTENTION condition pending, only
> REQUEST_SENSE and INQUIRY commands are allowed to complete. */

Wasn't this comment going to get updated to be more generic (ie more
than just the 3 commands below may be needed?)

>  if (s->sense_key == SENSE_UNIT_ATTENTION &&
> - s->io_buffer[0] != GPCMD_REQUEST_SENSE &&
> - s->io_buffer[0] != GPCMD_INQUIRY) {
> - ide_atapi_cmd_check_status(s);
> - return;
> +s->io_buffer[0] != GPCMD_REQUEST_SENSE &&
> +s->io_buffer[0] != GPCMD_INQUIRY &&
> +s->io_buffer[0] != GPCMD_TEST_UNIT_READY) {
> +ide_atapi_cmd_check_status(s);
> +return;
>  }
>  switch(s->io_buffer[0]) {
>  case GPCMD_TEST_UNIT_READY:
> -- 
> 1.7.4
> 

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ry...@us.ibm.com



[Qemu-devel] [PATCH v3 1/2] cdrom: Allow the TEST_UNIT_READY command after a cdrom change

2011-04-07 Thread Amit Shah
We restrict the commands that a guest can send us after a cdrom change
event.  The current list includes REQUEST_SENSE and INQUIRY commands.
Guests can also issue TEST_UNIT_READY to inquire for the status, so
allow this command as well.

This also gets rid of one cause of the HSM violation errors in Linux
guests.  Those errors came up because we had the UNIT_ATTENTION event
pending and we replied with an error message to a command that should be
allowed in such a condition.  The guest then did a soft reset to get to
a sane state.

Signed-off-by: Amit Shah 
---
 hw/ide/core.c |9 +
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index 007a4ee..d55d804 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1105,10 +1105,11 @@ static void ide_atapi_cmd(IDEState *s)
 /* If there's a UNIT_ATTENTION condition pending, only
REQUEST_SENSE and INQUIRY commands are allowed to complete. */
 if (s->sense_key == SENSE_UNIT_ATTENTION &&
-   s->io_buffer[0] != GPCMD_REQUEST_SENSE &&
-   s->io_buffer[0] != GPCMD_INQUIRY) {
-   ide_atapi_cmd_check_status(s);
-   return;
+s->io_buffer[0] != GPCMD_REQUEST_SENSE &&
+s->io_buffer[0] != GPCMD_INQUIRY &&
+s->io_buffer[0] != GPCMD_TEST_UNIT_READY) {
+ide_atapi_cmd_check_status(s);
+return;
 }
 switch(s->io_buffer[0]) {
 case GPCMD_TEST_UNIT_READY:
-- 
1.7.4