* [Qemu-devel] [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
@ 2010-05-31 1:43 Nicholas A. Bellinger
2010-06-04 14:06 ` [Qemu-devel] " Kevin Wolf
0 siblings, 1 reply; 7+ messages in thread
From: Nicholas A. Bellinger @ 2010-05-31 1:43 UTC (permalink / raw)
To: Kevin Wolf, Gerd Hoffmann
Cc: kvm-devel, qemu-devel, Nicholas Bellinger, Paul Brook,
Christoph Hellwig, Hannes Reinecke
From: Nicholas Bellinger <nab@linux-iscsi.org>
This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
set SCSI_XFER_TO_DEV for WRITE data.
Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
---
hw/scsi-bus.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index b8e4b71..75ec74e 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
case INQUIRY:
req->cmd.xfer = cmd[4] | (cmd[3] << 8);
break;
+ case PERSISTENT_RESERVE_OUT:
+ case PERSISTENT_RESERVE_IN:
+ req->cmd.xfer = cmd[8] | (cmd[7] << 8);
+ break;
}
return 0;
}
@@ -389,6 +393,7 @@ static void scsi_req_xfer_mode(SCSIRequest *req)
case MEDIUM_SCAN:
case SEND_VOLUME_TAG:
case WRITE_LONG_2:
+ case PERSISTENT_RESERVE_OUT:
req->cmd.mode = SCSI_XFER_TO_DEV;
break;
default:
--
1.5.6.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
2010-05-31 1:43 [Qemu-devel] [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup Nicholas A. Bellinger
@ 2010-06-04 14:06 ` Kevin Wolf
2010-06-16 12:13 ` Kevin Wolf
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2010-06-04 14:06 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Gerd Hoffmann, kvm-devel, qemu-devel, Hannes Reinecke,
Christoph Hellwig, Paul Brook
Am 31.05.2010 03:43, schrieb Nicholas A. Bellinger:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
>
> This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
> case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
> and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
> set SCSI_XFER_TO_DEV for WRITE data.
>
> Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
>
> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> ---
> hw/scsi-bus.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> index b8e4b71..75ec74e 100644
> --- a/hw/scsi-bus.c
> +++ b/hw/scsi-bus.c
> @@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
> case INQUIRY:
> req->cmd.xfer = cmd[4] | (cmd[3] << 8);
> break;
> + case PERSISTENT_RESERVE_OUT:
> + case PERSISTENT_RESERVE_IN:
> + req->cmd.xfer = cmd[8] | (cmd[7] << 8);
Maybe I'm missing something, but isn't exactly the same value set in the
switch block above? (for cmd[0] >> 5 == 2)
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
2010-06-04 14:06 ` [Qemu-devel] " Kevin Wolf
@ 2010-06-16 12:13 ` Kevin Wolf
2010-06-16 13:03 ` Nicholas A. Bellinger
0 siblings, 1 reply; 7+ messages in thread
From: Kevin Wolf @ 2010-06-16 12:13 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Gerd Hoffmann, kvm-devel, qemu-devel, Hannes Reinecke,
Christoph Hellwig, Paul Brook
Am 04.06.2010 16:06, schrieb Kevin Wolf:
> Am 31.05.2010 03:43, schrieb Nicholas A. Bellinger:
>> From: Nicholas Bellinger <nab@linux-iscsi.org>
>>
>> This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
>> case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
>> and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
>> set SCSI_XFER_TO_DEV for WRITE data.
>>
>> Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
>>
>> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
>> ---
>> hw/scsi-bus.c | 5 +++++
>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>
>> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
>> index b8e4b71..75ec74e 100644
>> --- a/hw/scsi-bus.c
>> +++ b/hw/scsi-bus.c
>> @@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
>> case INQUIRY:
>> req->cmd.xfer = cmd[4] | (cmd[3] << 8);
>> break;
>> + case PERSISTENT_RESERVE_OUT:
>> + case PERSISTENT_RESERVE_IN:
>> + req->cmd.xfer = cmd[8] | (cmd[7] << 8);
>
> Maybe I'm missing something, but isn't exactly the same value set in the
> switch block above? (for cmd[0] >> 5 == 2)
Nicholas? This isn't applied yet because I'm waiting for your answer.
Is there a reason why it makes sense to do it explicitly here instead
using the generic code a few lines above? I think the same applied to
patch 2/2.
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
2010-06-16 12:13 ` Kevin Wolf
@ 2010-06-16 13:03 ` Nicholas A. Bellinger
2010-06-16 13:08 ` Kevin Wolf
2010-06-16 13:09 ` Nicholas A. Bellinger
0 siblings, 2 replies; 7+ messages in thread
From: Nicholas A. Bellinger @ 2010-06-16 13:03 UTC (permalink / raw)
To: Kevin Wolf
Cc: Gerd Hoffmann, kvm-devel, qemu-devel, Hannes Reinecke,
Christoph Hellwig, Paul Brook
On Wed, 2010-06-16 at 14:13 +0200, Kevin Wolf wrote:
> Am 04.06.2010 16:06, schrieb Kevin Wolf:
> > Am 31.05.2010 03:43, schrieb Nicholas A. Bellinger:
> >> From: Nicholas Bellinger <nab@linux-iscsi.org>
> >>
> >> This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
> >> case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
> >> and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
> >> set SCSI_XFER_TO_DEV for WRITE data.
> >>
> >> Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
> >>
> >> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> >> ---
> >> hw/scsi-bus.c | 5 +++++
> >> 1 files changed, 5 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> >> index b8e4b71..75ec74e 100644
> >> --- a/hw/scsi-bus.c
> >> +++ b/hw/scsi-bus.c
> >> @@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
> >> case INQUIRY:
> >> req->cmd.xfer = cmd[4] | (cmd[3] << 8);
> >> break;
> >> + case PERSISTENT_RESERVE_OUT:
> >> + case PERSISTENT_RESERVE_IN:
> >> + req->cmd.xfer = cmd[8] | (cmd[7] << 8);
> >
> > Maybe I'm missing something, but isn't exactly the same value set in the
> > switch block above? (for cmd[0] >> 5 == 2)
>
> Nicholas? This isn't applied yet because I'm waiting for your answer.
>
> Is there a reason why it makes sense to do it explicitly here instead
> using the generic code a few lines above? I think the same applied to
> patch 2/2.
Hi Kevin,
I just tested this again and you are correct, the reassignment of
req->cmd.xfer for PR and Maintence CDBs is unnecessary in
scsi_req_length(). I will go ahead and drop part this from my tree.
Please let me know if you would like me to resend the patch series.
Best,
--nab
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
2010-06-16 13:03 ` Nicholas A. Bellinger
@ 2010-06-16 13:08 ` Kevin Wolf
2010-06-16 13:09 ` Nicholas A. Bellinger
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2010-06-16 13:08 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Gerd Hoffmann, kvm-devel, qemu-devel, Hannes Reinecke,
Christoph Hellwig, Paul Brook
Am 16.06.2010 15:03, schrieb Nicholas A. Bellinger:
> On Wed, 2010-06-16 at 14:13 +0200, Kevin Wolf wrote:
>> Am 04.06.2010 16:06, schrieb Kevin Wolf:
>>> Am 31.05.2010 03:43, schrieb Nicholas A. Bellinger:
>>>> From: Nicholas Bellinger <nab@linux-iscsi.org>
>>>>
>>>> This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
>>>> case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
>>>> and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
>>>> set SCSI_XFER_TO_DEV for WRITE data.
>>>>
>>>> Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
>>>>
>>>> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
>>>> ---
>>>> hw/scsi-bus.c | 5 +++++
>>>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
>>>> index b8e4b71..75ec74e 100644
>>>> --- a/hw/scsi-bus.c
>>>> +++ b/hw/scsi-bus.c
>>>> @@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
>>>> case INQUIRY:
>>>> req->cmd.xfer = cmd[4] | (cmd[3] << 8);
>>>> break;
>>>> + case PERSISTENT_RESERVE_OUT:
>>>> + case PERSISTENT_RESERVE_IN:
>>>> + req->cmd.xfer = cmd[8] | (cmd[7] << 8);
>>>
>>> Maybe I'm missing something, but isn't exactly the same value set in the
>>> switch block above? (for cmd[0] >> 5 == 2)
>>
>> Nicholas? This isn't applied yet because I'm waiting for your answer.
>>
>> Is there a reason why it makes sense to do it explicitly here instead
>> using the generic code a few lines above? I think the same applied to
>> patch 2/2.
>
> Hi Kevin,
>
> I just tested this again and you are correct, the reassignment of
> req->cmd.xfer for PR and Maintence CDBs is unnecessary in
> scsi_req_length(). I will go ahead and drop part this from my tree.
>
> Please let me know if you would like me to resend the patch series.
Sure, taking simpler code is always better, so I'd be happier with a v2.
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
2010-06-16 13:03 ` Nicholas A. Bellinger
2010-06-16 13:08 ` Kevin Wolf
@ 2010-06-16 13:09 ` Nicholas A. Bellinger
2010-06-16 13:23 ` Kevin Wolf
1 sibling, 1 reply; 7+ messages in thread
From: Nicholas A. Bellinger @ 2010-06-16 13:09 UTC (permalink / raw)
To: Kevin Wolf
Cc: Gerd Hoffmann, kvm-devel, qemu-devel, Hannes Reinecke,
Christoph Hellwig, Paul Brook
On Wed, 2010-06-16 at 06:03 -0700, Nicholas A. Bellinger wrote:
> On Wed, 2010-06-16 at 14:13 +0200, Kevin Wolf wrote:
> > Am 04.06.2010 16:06, schrieb Kevin Wolf:
> > > Am 31.05.2010 03:43, schrieb Nicholas A. Bellinger:
> > >> From: Nicholas Bellinger <nab@linux-iscsi.org>
> > >>
> > >> This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
> > >> case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
> > >> and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
> > >> set SCSI_XFER_TO_DEV for WRITE data.
> > >>
> > >> Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
> > >>
> > >> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
> > >> ---
> > >> hw/scsi-bus.c | 5 +++++
> > >> 1 files changed, 5 insertions(+), 0 deletions(-)
> > >>
> > >> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> > >> index b8e4b71..75ec74e 100644
> > >> --- a/hw/scsi-bus.c
> > >> +++ b/hw/scsi-bus.c
> > >> @@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
> > >> case INQUIRY:
> > >> req->cmd.xfer = cmd[4] | (cmd[3] << 8);
> > >> break;
> > >> + case PERSISTENT_RESERVE_OUT:
> > >> + case PERSISTENT_RESERVE_IN:
> > >> + req->cmd.xfer = cmd[8] | (cmd[7] << 8);
> > >
> > > Maybe I'm missing something, but isn't exactly the same value set in the
> > > switch block above? (for cmd[0] >> 5 == 2)
> >
> > Nicholas? This isn't applied yet because I'm waiting for your answer.
> >
> > Is there a reason why it makes sense to do it explicitly here instead
> > using the generic code a few lines above? I think the same applied to
> > patch 2/2.
>
> Hi Kevin,
>
> I just tested this again and you are correct, the reassignment of
> req->cmd.xfer for PR and Maintence CDBs is unnecessary in
> scsi_req_length(). I will go ahead and drop part this from my tree.
>
> Please let me know if you would like me to resend the patch series.
>
Actually, I should mention that I have only tested this with TYPE_DISK
so far. I think we do still need the Maintenance CDBs length
reassignment for MMC and TYPE_ROM from the second patch:
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 75ec74e..7d80405 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -329,6 +329,17 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
case PERSISTENT_RESERVE_IN:
req->cmd.xfer = cmd[8] | (cmd[7] << 8);
break;
+ case MAINTENANCE_OUT:
+ case MAINTENANCE_IN:
+ if (req->dev->type != TYPE_ROM) {
+ /* Used for MI_REPORT_TARGET_PGS, MO_SET_TARGET_PGS et al. */
+ req->cmd.xfer = cmd[9] | (cmd[8] << 8) |
+ (cmd[7] << 16) | (cmd[6] << 24);
+ } else {
+ /* GPCMD_REPORT_KEY and GPCMD_SEND_KEY from multi media commands */
+ req->cmd.xfer = cmd[9] | (cmd[8] << 8);
+ }
+ break;
}
Do you have a problem with leaving this reassignment in for TYPE_ROM..?
Best,
--nab
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] Re: [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup
2010-06-16 13:09 ` Nicholas A. Bellinger
@ 2010-06-16 13:23 ` Kevin Wolf
0 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2010-06-16 13:23 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: Gerd Hoffmann, kvm-devel, qemu-devel, Hannes Reinecke,
Christoph Hellwig, Paul Brook
Am 16.06.2010 15:09, schrieb Nicholas A. Bellinger:
> On Wed, 2010-06-16 at 06:03 -0700, Nicholas A. Bellinger wrote:
>> On Wed, 2010-06-16 at 14:13 +0200, Kevin Wolf wrote:
>>> Am 04.06.2010 16:06, schrieb Kevin Wolf:
>>>> Am 31.05.2010 03:43, schrieb Nicholas A. Bellinger:
>>>>> From: Nicholas Bellinger <nab@linux-iscsi.org>
>>>>>
>>>>> This patch updates hw/scsi-bus.c to add PERSISTENT_RESERVE_OUT and PERSISTENT_RESERVE_IN
>>>>> case in scsi_req_length() to extra the incoming buffer length into SCSIRequest->cmd.xfer,
>>>>> and adds a second PERSISTENT_RESERVE_OUT case in scsi_req_xfer_mode() in order to properly
>>>>> set SCSI_XFER_TO_DEV for WRITE data.
>>>>>
>>>>> Tested with Linux KVM guests and Megasas 8708EM2 HBA emulation and TCM_Loop target ports.
>>>>>
>>>>> Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
>>>>> ---
>>>>> hw/scsi-bus.c | 5 +++++
>>>>> 1 files changed, 5 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
>>>>> index b8e4b71..75ec74e 100644
>>>>> --- a/hw/scsi-bus.c
>>>>> +++ b/hw/scsi-bus.c
>>>>> @@ -325,6 +325,10 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
>>>>> case INQUIRY:
>>>>> req->cmd.xfer = cmd[4] | (cmd[3] << 8);
>>>>> break;
>>>>> + case PERSISTENT_RESERVE_OUT:
>>>>> + case PERSISTENT_RESERVE_IN:
>>>>> + req->cmd.xfer = cmd[8] | (cmd[7] << 8);
>>>>
>>>> Maybe I'm missing something, but isn't exactly the same value set in the
>>>> switch block above? (for cmd[0] >> 5 == 2)
>>>
>>> Nicholas? This isn't applied yet because I'm waiting for your answer.
>>>
>>> Is there a reason why it makes sense to do it explicitly here instead
>>> using the generic code a few lines above? I think the same applied to
>>> patch 2/2.
>>
>> Hi Kevin,
>>
>> I just tested this again and you are correct, the reassignment of
>> req->cmd.xfer for PR and Maintence CDBs is unnecessary in
>> scsi_req_length(). I will go ahead and drop part this from my tree.
>>
>> Please let me know if you would like me to resend the patch series.
>>
>
> Actually, I should mention that I have only tested this with TYPE_DISK
> so far. I think we do still need the Maintenance CDBs length
> reassignment for MMC and TYPE_ROM from the second patch:
>
> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
> index 75ec74e..7d80405 100644
> --- a/hw/scsi-bus.c
> +++ b/hw/scsi-bus.c
> @@ -329,6 +329,17 @@ static int scsi_req_length(SCSIRequest *req, uint8_t *cmd)
> case PERSISTENT_RESERVE_IN:
> req->cmd.xfer = cmd[8] | (cmd[7] << 8);
> break;
> + case MAINTENANCE_OUT:
> + case MAINTENANCE_IN:
> + if (req->dev->type != TYPE_ROM) {
> + /* Used for MI_REPORT_TARGET_PGS, MO_SET_TARGET_PGS et al. */
> + req->cmd.xfer = cmd[9] | (cmd[8] << 8) |
> + (cmd[7] << 16) | (cmd[6] << 24);
> + } else {
> + /* GPCMD_REPORT_KEY and GPCMD_SEND_KEY from multi media commands */
> + req->cmd.xfer = cmd[9] | (cmd[8] << 8);
> + }
> + break;
> }
>
> Do you have a problem with leaving this reassignment in for TYPE_ROM..?
In a place where it's different from what was set above, I'm not against
it. I just wanted to reduce some code duplication.
Kevin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-06-16 13:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 1:43 [Qemu-devel] [PATCH 1/2] [scsi-bus]: Add PR-OUT and PR-IN case for SCSIRequest xfer and xfer_mode setup Nicholas A. Bellinger
2010-06-04 14:06 ` [Qemu-devel] " Kevin Wolf
2010-06-16 12:13 ` Kevin Wolf
2010-06-16 13:03 ` Nicholas A. Bellinger
2010-06-16 13:08 ` Kevin Wolf
2010-06-16 13:09 ` Nicholas A. Bellinger
2010-06-16 13:23 ` Kevin Wolf
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).