From: Kevin Wolf <kwolf@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Ronnie Sahlberg <ronniesahlberg@gmail.com>
Subject: Re: [Qemu-devel] [PATCH] ATAPI: Add support for ASCQ in sense codes
Date: Mon, 27 Aug 2012 12:37:15 +0200 [thread overview]
Message-ID: <503B4DDB.5070702@redhat.com> (raw)
In-Reply-To: <501785F0.8050607@redhat.com>
Am 31.07.2012 09:14, schrieb Paolo Bonzini:
> Il 31/07/2012 04:07, Ronnie Sahlberg ha scritto:
>> Add support for setting the ASCQ for SCSI sense codes in the ATAPI driver.
>> Use this to set ASCQ==2 for the medium removal prevention that is recommended in MMC for this condition.
>>
>> asc:0x53 ascq:0x02 is the recommended error for MEDIUM_REMOVAL_PREVENTED and is listed in Annex F in MMC
>
> You also need to cover migration.
>
> You could either add a subsection, or something like this:
>
> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index f7f714c..89c0157 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -1143,3 +1143,20 @@ void ide_atapi_cmd(IDEState *s)
>
> ide_atapi_cmd_error(s, ILLEGAL_REQUEST, ASC_ILLEGAL_OPCODE);
> }
> +
> +void ide_atapi_post_load(IDEState *s, int version_id)
> +{
> + if (version_id < 3) {
> + if (s->sense_key == UNIT_ATTENTION &&
> + s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED) {
> + s->cdrom_changed = 1;
> + }
> + }
> +
> + /* This is simpler than adding a subsection just for the ascq. */
> + if (s->asc == ASC_MEDIA_REMOVAL_PREVENTED) {
> + s->ascq = 2;
> + } else {
> + s->ascq = 0;
> + }
> +}
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index cb5ca4b..959ac48 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -2154,12 +2154,7 @@ static int ide_drive_post_load(void *opaque, int version_id)
> {
> IDEState *s = opaque;
>
> - if (version_id < 3) {
> - if (s->sense_key == UNIT_ATTENTION &&
> - s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED) {
> - s->cdrom_changed = 1;
> - }
> - }
> + ide_atapi_post_load(s, version_id);
> if (s->identify_set) {
> bdrv_set_enable_write_cache(s->bs, !!(s->identify_data[85] & (1 << 5)));
> }
> diff --git a/hw/ide/internal.h b/hw/ide/internal.h
> index 7170bd9..2572461 100644
> --- a/hw/ide/internal.h
> +++ b/hw/ide/internal.h
> @@ -572,6 +572,7 @@ BlockDriverAIOCB *ide_issue_trim(BlockDriverState *bs,
> /* hw/ide/atapi.c */
> void ide_atapi_cmd(IDEState *s);
> void ide_atapi_cmd_reply_end(IDEState *s);
> +void ide_atapi_post_load(IDEState *s, int version_id);
>
> /* hw/ide/qdev.c */
> void ide_bus_new(IDEBus *idebus, DeviceState *dev, int bus_id);
>
>
> In fact, I wonder if it is simpler to "make up" the ascq directly in
> cmd_request_sense, instead of changing all invocations of
> ide_atapi_cmd_error. Kevin, any preferences?
Oh, I missed this question and wondered why there was no v2... I'd
prefer this patch with migration support added.
Kevin
prev parent reply other threads:[~2012-08-27 10:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 2:07 [Qemu-devel] [PATCH] ATAPI: Add support for ASCQ and improve a medium removal sense code Ronnie Sahlberg
2012-07-31 2:07 ` [Qemu-devel] [PATCH] ATAPI: Add support for ASCQ in sense codes Ronnie Sahlberg
2012-07-31 7:14 ` Paolo Bonzini
2012-08-27 10:37 ` Kevin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=503B4DDB.5070702@redhat.com \
--to=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.