* [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space
@ 2014-03-06 10:27 Paolo Bonzini
2014-03-07 7:40 ` Fam Zheng
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Paolo Bonzini @ 2014-03-06 10:27 UTC (permalink / raw)
To: qemu-devel; +Cc: famz
We were always truncating the sense size to 96 bytes.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/scsi/virtio-scsi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 6610b3a..b0d7517 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
size_t resid)
{
VirtIOSCSIReq *req = r->hba_private;
+ VirtIOSCSI *s = req->dev;
+ VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
uint32_t sense_len;
if (r->io_canceled) {
@@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
} else {
req->resp.cmd->resid = 0;
sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
- VIRTIO_SCSI_SENSE_SIZE);
+ vs->sense_size);
req->resp.cmd->sense_len = tswap32(sense_len);
}
virtio_scsi_complete_req(req);
--
1.8.5.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space
2014-03-06 10:27 [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space Paolo Bonzini
@ 2014-03-07 7:40 ` Fam Zheng
2014-03-07 8:40 ` Paolo Bonzini
2014-03-14 5:45 ` Fam Zheng
2014-03-14 5:52 ` Fam Zheng
2 siblings, 1 reply; 5+ messages in thread
From: Fam Zheng @ 2014-03-07 7:40 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Thu, 03/06 11:27, Paolo Bonzini wrote:
> We were always truncating the sense size to 96 bytes.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/scsi/virtio-scsi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 6610b3a..b0d7517 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
> size_t resid)
> {
> VirtIOSCSIReq *req = r->hba_private;
> + VirtIOSCSI *s = req->dev;
> + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
> uint32_t sense_len;
>
> if (r->io_canceled) {
> @@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
> } else {
> req->resp.cmd->resid = 0;
> sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
> - VIRTIO_SCSI_SENSE_SIZE);
> + vs->sense_size);
> req->resp.cmd->sense_len = tswap32(sense_len);
> }
> virtio_scsi_complete_req(req);
Do we need to increase VIRTIO_SCSI_SENSE_SIZE as well?
$ git grep -n VIRTIO_SCSI_SENSE_SIZE
hw/scsi/virtio-scsi.c:463: vs->sense_size = VIRTIO_SCSI_SENSE_SIZE;
hw/scsi/virtio-scsi.c:609: s->sense_size = VIRTIO_SCSI_SENSE_SIZE;
include/hw/virtio/virtio-scsi.h:40:#define VIRTIO_SCSI_SENSE_SIZE 96
Fam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space
2014-03-07 7:40 ` Fam Zheng
@ 2014-03-07 8:40 ` Paolo Bonzini
0 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2014-03-07 8:40 UTC (permalink / raw)
To: Fam Zheng; +Cc: qemu-devel
Il 07/03/2014 08:40, Fam Zheng ha scritto:
> On Thu, 03/06 11:27, Paolo Bonzini wrote:
>> We were always truncating the sense size to 96 bytes.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>> hw/scsi/virtio-scsi.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
>> index 6610b3a..b0d7517 100644
>> --- a/hw/scsi/virtio-scsi.c
>> +++ b/hw/scsi/virtio-scsi.c
>> @@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
>> size_t resid)
>> {
>> VirtIOSCSIReq *req = r->hba_private;
>> + VirtIOSCSI *s = req->dev;
>> + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
>> uint32_t sense_len;
>>
>> if (r->io_canceled) {
>> @@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
>> } else {
>> req->resp.cmd->resid = 0;
>> sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
>> - VIRTIO_SCSI_SENSE_SIZE);
>> + vs->sense_size);
>> req->resp.cmd->sense_len = tswap32(sense_len);
>> }
>> virtio_scsi_complete_req(req);
>
>
> Do we need to increase VIRTIO_SCSI_SENSE_SIZE as well?
>
> $ git grep -n VIRTIO_SCSI_SENSE_SIZE
> hw/scsi/virtio-scsi.c:463: vs->sense_size = VIRTIO_SCSI_SENSE_SIZE;
> hw/scsi/virtio-scsi.c:609: s->sense_size = VIRTIO_SCSI_SENSE_SIZE;
> include/hw/virtio/virtio-scsi.h:40:#define VIRTIO_SCSI_SENSE_SIZE 96
No, that's the default value and it's defined by the spec to be 96.
The OS can change it if they want.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space
2014-03-06 10:27 [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space Paolo Bonzini
2014-03-07 7:40 ` Fam Zheng
@ 2014-03-14 5:45 ` Fam Zheng
2014-03-14 5:52 ` Fam Zheng
2 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2014-03-14 5:45 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Thu, 03/06 11:27, Paolo Bonzini wrote:
> We were always truncating the sense size to 96 bytes.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/scsi/virtio-scsi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 6610b3a..b0d7517 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
> size_t resid)
> {
> VirtIOSCSIReq *req = r->hba_private;
> + VirtIOSCSI *s = req->dev;
> + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
> uint32_t sense_len;
>
> if (r->io_canceled) {
> @@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
> } else {
> req->resp.cmd->resid = 0;
> sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
> - VIRTIO_SCSI_SENSE_SIZE);
> + vs->sense_size);
> req->resp.cmd->sense_len = tswap32(sense_len);
> }
> virtio_scsi_complete_req(req);
> --
> 1.8.5.3
>
Reviewed-by: Fam Zheng <famz@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space
2014-03-06 10:27 [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space Paolo Bonzini
2014-03-07 7:40 ` Fam Zheng
2014-03-14 5:45 ` Fam Zheng
@ 2014-03-14 5:52 ` Fam Zheng
2 siblings, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2014-03-14 5:52 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Thu, 03/06 11:27, Paolo Bonzini wrote:
> We were always truncating the sense size to 96 bytes.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/scsi/virtio-scsi.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 6610b3a..b0d7517 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -304,6 +304,8 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
> size_t resid)
> {
> VirtIOSCSIReq *req = r->hba_private;
> + VirtIOSCSI *s = req->dev;
> + VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
> uint32_t sense_len;
>
> if (r->io_canceled) {
> @@ -317,7 +319,7 @@ static void virtio_scsi_command_complete(SCSIRequest *r, uint32_t status,
> } else {
> req->resp.cmd->resid = 0;
> sense_len = scsi_req_get_sense(r, req->resp.cmd->sense,
> - VIRTIO_SCSI_SENSE_SIZE);
> + vs->sense_size);
> req->resp.cmd->sense_len = tswap32(sense_len);
> }
> virtio_scsi_complete_req(req);
> --
> 1.8.5.3
>
With a modified kernel that increased the sense buffer size to 252 in
configuration, this code actually returns 252.
Reviewed-by: Fam Zheng <famz@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-14 5:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 10:27 [Qemu-devel] [PATCH] virtio-scsi: actually honor sense_size from configuration space Paolo Bonzini
2014-03-07 7:40 ` Fam Zheng
2014-03-07 8:40 ` Paolo Bonzini
2014-03-14 5:45 ` Fam Zheng
2014-03-14 5:52 ` Fam Zheng
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).