From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] scsi-generic: Merge block max xfer len in INQUIRY response
Date: Thu, 26 May 2016 09:59:18 +0200 [thread overview]
Message-ID: <3d76e871-a13f-412c-5cfa-df5e3b0aaef2@redhat.com> (raw)
In-Reply-To: <1464243305-10661-3-git-send-email-famz@redhat.com>
On 26/05/2016 08:15, Fam Zheng wrote:
> The rationale is similar to the above mode sense response interception:
> this is practically the only channel to communicate restraints from
> elsewhere such as host and block driver.
>
> The scsi bus we attach onto can have a larger max xfer len than what is
> accepted by the host file system (guarding between the host scsi LUN and
> QEMU), in which case the SG_IO we generate would get -EINVAL.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
The two patches are pretty much separate, so I'm queuing this myself.
Thanks,
Paolo
> ---
> hw/scsi/scsi-generic.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
> index 7459465..71372a8 100644
> --- a/hw/scsi/scsi-generic.c
> +++ b/hw/scsi/scsi-generic.c
> @@ -222,6 +222,18 @@ static void scsi_read_complete(void * opaque, int ret)
> r->buf[3] |= 0x80;
> }
> }
> + if (s->type == TYPE_DISK &&
> + r->req.cmd.buf[0] == INQUIRY &&
> + r->req.cmd.buf[2] == 0xb0) {
> + uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk);
> + if (max_xfer_len) {
> + stl_be_p(&r->buf[8], max_xfer_len);
> + /* Also take care of the opt xfer len. */
> + if (ldl_be_p(&r->buf[12]) > max_xfer_len) {
> + stl_be_p(&r->buf[12], max_xfer_len);
> + }
> + }
> + }
> scsi_req_data(&r->req, len);
> scsi_req_unref(&r->req);
> }
>
prev parent reply other threads:[~2016-05-26 7:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 6:15 [Qemu-devel] [PATCH 0/2] block: Expose host block dev I/O size limit in scsi-block/scsi-generic Fam Zheng
2016-05-26 6:15 ` [Qemu-devel] [PATCH 1/2] raw-posix: Fetch max sectors for host block device from sysfs Fam Zheng
2016-06-02 6:52 ` Fam Zheng
2016-06-02 12:30 ` Max Reitz
2016-06-02 12:54 ` Kevin Wolf
2016-06-03 1:46 ` Fam Zheng
2016-05-26 6:15 ` [Qemu-devel] [PATCH 2/2] scsi-generic: Merge block max xfer len in INQUIRY response Fam Zheng
2016-05-26 7:59 ` Paolo Bonzini [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=3d76e871-a13f-412c-5cfa-df5e3b0aaef2@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--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).