qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Schmitt" <scdbackup@gmx.net>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@gmail.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] Do you have a use for a tester of virtio-scsi with CD drives ?
Date: Wed, 02 Nov 2011 22:22:23 +0100	[thread overview]
Message-ID: <9744301311355@192.168.2.69> (raw)
In-Reply-To: <j8s6uv$jik$1@dough.gmane.org>

Hi,

i wrote:
> > So how is this altered to 0x12 in the further course of processing ?

Paolo Bonzini wrote:
> Because you're using an *IDE* (ATAPI) CD-ROM, not SCSI.  See hw/ide/atapi.c.

You convinced me.
But this does not explain yet the difference in behavior of
both groups of IDE DVD-ROMs. Why are those of -drive if=scsi empty ?


> Ok, in your counting I should have written 20 for IDE (0x12 + page number +
> page size) and 22 for SCSI (0x14 + page number + page size).

Why the distinction by transport bus ? Mode page 2Ah is a matter
of the drive alone. MMC is independent of the bus.

MMC-1 prescribes Page Length 0x14 = 20.
This counts the bytes after byte 1 of the mode page.
So the page size is 22 bytes.
The last byte is the LSB of Current Write Speed (MMC-1 table 103).

SPC-1 prescribes to prefix the result of MODE SENSE(10) with 8 bytes
of Mode Parameter Header.
The first two are MSB and LSB of Mode Data Length.
  Mode Data Length = 8 + Page Length = 28 = 0x1c
The total size of the reply should be 30 bytes.
Like
  00 1c xx xx xx xx xx xx 2a 14 xx ... up to 30 bytes ...
 
The history of mode page 2Ah is colorful.
In MMC-2, the mode page has 26 bytes rather than 22.
In MMC-3, the length is variable. At least 32 bytes, with the
number of 4-byte write speed descriptors in bytes 30 and 31.
In MMC-4 to MMC-6 it is only briefly mentioned as legacy feature.

Since all MMC drivers have to be aware of MMC-1 compliant drives,
it is well ok to stay with MMC-1, although DVD drives appear first
in MMC-2.

So i would propose to replace 28 by 30, and set buf[28], buf[29] to 0
in hw/ide/atapi.c , cmd_mode_sense() , case MODE_PAGE_CAPABILITIES

I tried to check whether buf[] is large enough in the callers.
With some fgrepping i finally end up in hw/ide/core.c:ide_init1()
    s->io_buffer_total_len = IDE_DMA_BUF_SECTORS*512 + 4;
    s->io_buffer = qemu_memalign(2048, s->io_buffer_total_len);
So roughly this should be ok ... if qemu_memalign() has the job to
allocate at least s->io_buffer_total_len bytes.

I did not yet find out, why the IDE drive emulation emits a Mode Data
Length of 0x22. With Page Length 0x12 it should have been 0x1a.
8 too many.


Have a nice day :)

Thomas

  reply	other threads:[~2011-11-02 21:22 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01 17:27 [Qemu-devel] Do you have a use for a tester of virtio-scsi with CD drives ? Thomas Schmitt
2011-11-01 21:03 ` Thomas Schmitt
2011-11-02 11:25   ` Stefan Hajnoczi
2011-11-02 12:08     ` Paolo Bonzini
2011-11-02 16:26       ` Thomas Schmitt
2011-11-02 16:34         ` Paolo Bonzini
2011-11-02 18:05           ` Thomas Schmitt
2011-11-02 19:50             ` Paolo Bonzini
2011-11-02 21:22               ` Thomas Schmitt [this message]
2011-11-02 22:08                 ` Thomas Schmitt
2011-11-02 22:16                   ` [Qemu-devel] Compile error Frans de Boer
2011-11-02 22:19                     ` Anthony Liguori
2011-11-02 22:31                       ` Frans de Boer
2011-11-03  7:49                 ` [Qemu-devel] Do you have a use for a tester of virtio-scsi with CD drives ? Paolo Bonzini
2011-11-03  9:15                   ` Thomas Schmitt
2011-11-03  9:36                     ` Paolo Bonzini
2011-11-03 13:10                   ` Thomas Schmitt
2011-11-03 22:30                     ` Thomas Schmitt
2011-11-04  9:18                       ` Thomas Schmitt
2011-11-04  9:38                         ` Paolo Bonzini
2011-11-04 11:09                           ` Thomas Schmitt
2011-11-04 11:31                             ` Paolo Bonzini
2011-11-04 13:03                               ` Thomas Schmitt
2011-11-04 20:28                                 ` Thomas Schmitt
2011-11-05  8:33                                   ` Paolo Bonzini
2011-11-05 13:00                                     ` Thomas Schmitt
2011-11-05 14:37                                   ` Thomas Schmitt
2011-11-05 15:53                                     ` Paolo Bonzini
2011-11-05 16:38                                       ` Thomas Schmitt
2011-11-05 20:47                                     ` Thomas Schmitt
2011-11-06  8:17                                       ` Paolo Bonzini
2011-11-06 10:35                                         ` Thomas Schmitt
2011-11-06 20:14                                         ` Thomas Schmitt
2011-11-07  8:02                                           ` Paolo Bonzini
2011-11-07 10:04                                             ` Thomas Schmitt
2011-11-07 11:13                                               ` Paolo Bonzini
2011-11-07 11:24                                                 ` Zhi Yong Wu
2011-11-07 11:29                                                   ` Paolo Bonzini
2011-11-07 11:40                                                     ` Zhi Yong Wu
2011-11-06  9:31                                       ` Thomas Schmitt
2011-11-04 13:26                       ` Andreas Färber
2011-11-04 14:46                         ` Thomas Schmitt
2011-11-07  8:48             ` Zhi Yong Wu
2011-11-02 15:15     ` Thomas Schmitt
2011-11-02 16:22       ` Paolo Bonzini

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=9744301311355@192.168.2.69 \
    --to=scdbackup@gmx.net \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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 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).