From: Filip Navara <filip.navara@gmail.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3] make windows notice media change
Date: Wed, 29 Jul 2009 19:10:29 +0200 [thread overview]
Message-ID: <5b31733c0907291010k6ce95d54g6cbaaa954f22409b@mail.gmail.com> (raw)
In-Reply-To: <20090729160902.GG30449@redhat.com>
On Wed, Jul 29, 2009 at 6:09 PM, Gleb Natapov<gleb@redhat.com> wrote:
> @@ -3250,6 +3253,8 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
> /* per IDE drive data */
> for(i = 0; i < 4; i++) {
> ide_load(f, &d->ide_if[i]);
> + if (version_id == 3)
> + qemu_get_8s(f, &d->ide_if[i].cdrom_changed);
> }
> return 0;
> }
I'd prefer passing the version to ide_load and doing the actual load there...
... but the patch is all wrong and based on wrong assumptions, which is
much more fundamental problem. Windows cdrom driver is not that stupid
about the change as you think.
The cdrom driver really has a timer and polls the IDE controller, but it
doesn't require the intermediate ASC_MEDIUM_NOT_PRESENT state
you introduced. It's perfectly ok to return SENSE_UNIT_ATTENTION /
ASC_MEDIUM_MAY_HAVE_CHANGED from GPCMD_TEST_UNIT_READY
and Windows will recognize it as medium change.
Something like this should work:
if (bdrv_is_inserted(s->bs)) {
if (s->cdrom_changed) {
ide_atapi_cmd_error(s, SENSE_UNIT_ATTENTION,
ASC_MEDIUM_MAY_HAVE_CHANGED);
s->cdrom_changed = 0;
} else {
ide_atapi_cmd_ok(s);
}
} else {
ide_atapi_cmd_error(s, SENSE_NOT_READY,
ASC_MEDIUM_NOT_PRESENT);
}
The benefit is that it will not break guests which issue the request only
once.
Best regards,
Filip Navara
next prev parent reply other threads:[~2009-07-29 17:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-29 16:09 [Qemu-devel] [PATCH v3] make windows notice media change Gleb Natapov
2009-07-29 17:10 ` Filip Navara [this message]
2009-07-29 17:38 ` Gleb Natapov
2009-07-29 18:43 ` Filip Navara
2009-07-29 20:12 ` Gleb Natapov
2009-07-29 21:04 ` Filip Navara
2009-07-30 3:51 ` Jamie Lokier
2009-07-30 11:54 ` Gleb Natapov
2009-07-29 19:11 ` Paul Brook
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=5b31733c0907291010k6ce95d54g6cbaaa954f22409b@mail.gmail.com \
--to=filip.navara@gmail.com \
--cc=gleb@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).