diff mbox

[1/5] atapi: Allow GET_EVENT_STATUS_NOTIFICATION after media change

Message ID 7dad199c525d4b2079658b090b210472f433e1c9.1302246567.git.amit.shah@redhat.com
State New
Headers show

Commit Message

Amit Shah April 8, 2011, 7:15 a.m. UTC
After a media change, the only commands allowed from the guest were
REQUEST_SENSE and INQUIRY.  The guest may also issue
GET_EVENT_STATUS_NOTIFICATION commands to get media
changed notification.

After this, the HSM violation messages from Linux guests aren't seen.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/ide/core.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Comments

Amit Shah April 8, 2011, 7:25 a.m. UTC | #1
On (Fri) 08 Apr 2011 [12:45:15], Amit Shah wrote:
> After a media change, the only commands allowed from the guest were
> REQUEST_SENSE and INQUIRY.  The guest may also issue
> GET_EVENT_STATUS_NOTIFICATION commands to get media
> changed notification.
> 
> After this, the HSM violation messages from Linux guests aren't seen.

This isn't true -- the messages go only if TEST_UNIT_READY is also
added to the list.  Removed this statement from local copy.

> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index c11d457..327f703 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. */

And updated this comment locally as well.

		Amit
Markus Armbruster April 8, 2011, 10:54 a.m. UTC | #2
Amit Shah <amit.shah@redhat.com> writes:

> After a media change, the only commands allowed from the guest were
> REQUEST_SENSE and INQUIRY.  The guest may also issue
> GET_EVENT_STATUS_NOTIFICATION commands to get media
> changed notification.
>
> After this, the HSM violation messages from Linux guests aren't seen.
>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  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 c11d457..327f703 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. */

Comment is now stale.  I doubt it's terribly useful for anyone capable
of reading C, but as long as it's there, it better be accurate.

>      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_GET_EVENT_STATUS_NOTIFICATION) {
> +        ide_atapi_cmd_check_status(s);
> +        return;
>      }
>      switch(s->io_buffer[0]) {
>      case GPCMD_TEST_UNIT_READY:
Kevin Wolf April 8, 2011, 11:03 a.m. UTC | #3
Am 08.04.2011 12:54, schrieb Markus Armbruster:
> Amit Shah <amit.shah@redhat.com> writes:
> 
>> After a media change, the only commands allowed from the guest were
>> REQUEST_SENSE and INQUIRY.  The guest may also issue
>> GET_EVENT_STATUS_NOTIFICATION commands to get media
>> changed notification.
>>
>> After this, the HSM violation messages from Linux guests aren't seen.
>>
>> Signed-off-by: Amit Shah <amit.shah@redhat.com>
>> ---
>>  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 c11d457..327f703 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. */
> 
> Comment is now stale.  I doubt it's terribly useful for anyone capable
> of reading C, but as long as it's there, it better be accurate.

You can make it useful by pointing to the right section in MMC (and
listing the commands that should be allowed according to the standard as
long as it differs from what we implement today).

Kevin
diff mbox

Patch

diff --git a/hw/ide/core.c b/hw/ide/core.c
index c11d457..327f703 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_GET_EVENT_STATUS_NOTIFICATION) {
+        ide_atapi_cmd_check_status(s);
+        return;
     }
     switch(s->io_buffer[0]) {
     case GPCMD_TEST_UNIT_READY: