qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Alexander Bezzubikov <zuban32s@gmail.com>, qemu-devel@nongnu.org
Cc: jsnow@redhat.com, abezzubikov@ispras.ru
Subject: Re: [Qemu-devel] [PATCH RFC 04/11] scsi: Added function to enable ATAPI-SCSI bridge send SCSI requests
Date: Tue, 18 Aug 2015 08:10:21 +0200	[thread overview]
Message-ID: <55D2CC4D.7060908@suse.de> (raw)
In-Reply-To: <1439854945-5597-5-git-send-email-abezzubikov@ispras.ru>

On 08/18/2015 01:42 AM, Alexander Bezzubikov wrote:
> Signed-off-by: Alexander Bezzubikov <abezzubikov@ispras.ru>
> ---
>  hw/ide/internal.h      |  2 +-
>  hw/scsi/scsi-disk.c    | 43 +++++++++++++++++++++++++++++++++++++++++++
>  include/hw/scsi/scsi.h |  3 +++
>  3 files changed, 47 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/ide/internal.h b/hw/ide/internal.h
> index 3ebc63c..fd385bc 100644
> --- a/hw/ide/internal.h
> +++ b/hw/ide/internal.h
> @@ -495,7 +495,7 @@ struct IDEDevice {
>      char *serial;
>      char *model;
>      uint64_t wwn;
> -    SCSIBus *scsi_bus;
> +    SCSIBus scsi_bus;
>  };
>  
>  /* These are used for the error_status field of IDEBus */
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index 64f0694..f67d816 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -2440,6 +2440,49 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
>      return req;
>  }
>  
> +SCSIRequest *scsi_new_request_from_bridge(SCSIDevice *d, uint32_t tag,
> +                                          uint32_t lun, uint8_t *buf,
> +                                          void *hba_private)
> +{
> +    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, d);
> +    SCSIDeviceClass *sc = SCSI_DEVICE_GET_CLASS(d);
> +    SCSIRequest *req;
> +    const SCSIReqOps *ops;
> +    uint8_t command;
> +
> +    command = buf[0];
> +    ops = scsi_disk_reqops_dispatch[command];
> +    if (!ops) {
> +        ops = &scsi_disk_emulate_reqops;
> +    }
> +    req = scsi_req_alloc(ops, &s->qdev, tag, lun, hba_private);
> +    memcpy(req->cmd.buf, buf, 16);
> +
> +    SCSICommand cmd = { .len = 0 };
> +
> +    if (ops != NULL || !sc->parse_cdb) {
> +        scsi_req_parse_cdb(d, &cmd, buf);
> +    } else {
> +        sc->parse_cdb(d, &cmd, buf, hba_private);
> +    }
> +
> +    req->cmd = cmd;
> +    req->resid = req->cmd.xfer;
> +
> +    #ifdef DEBUG_SCSI
> +    DPRINTF("Command: lun=%d tag=0x%x data=0x%02x", lun, tag, buf[0]);
> +    {
> +        int i;
> +        for (i = 1; i < scsi_cdb_length(buf); i++) {
> +            printf(" 0x%02x", buf[i]);
> +        }
> +        printf("\n");
> +    }
> +    #endif
> +
> +    return req;
> +}
> +
>  #ifdef __linux__
>  static int get_device_type(SCSIDiskState *s)
>  {
> diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
> index cdaf0f8..881ed23 100644
> --- a/include/hw/scsi/scsi.h
> +++ b/include/hw/scsi/scsi.h
> @@ -249,6 +249,9 @@ SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d,
>                              uint32_t tag, uint32_t lun, void *hba_private);
>  SCSIRequest *scsi_req_new(SCSIDevice *d, uint32_t tag, uint32_t lun,
>                            uint8_t *buf, void *hba_private);
> +SCSIRequest *scsi_new_request_from_bridge(SCSIDevice *d, uint32_t tag,
> +                                          uint32_t lun, uint8_t *buf,
> +                                          void *hba_private);
>  int32_t scsi_req_enqueue(SCSIRequest *req);
>  void scsi_req_free(SCSIRequest *req);
>  SCSIRequest *scsi_req_ref(SCSIRequest *req);
> 
Again, I would merge it with the latter patch where the function is
actually used.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

  reply	other threads:[~2015-08-18  6:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-17 23:42 [Qemu-devel] [PATCH RFC 00/11] QEMU ATAPI-SCSI bridge GSoC project Alexander Bezzubikov
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 01/11] ide: ATAPI-SCSI bridge TypeInfo and init function created Alexander Bezzubikov
2015-08-18  6:07   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 02/11] ide: necessary fields for ATAPI-SCSI bridge added Alexander Bezzubikov
2015-08-18  6:08   ` Hannes Reinecke
2015-08-18 23:50   ` Thomas Huth
2015-08-19  5:56     ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 03/11] ide: necessary checks corrected to treat ATAPI-SCSI bridge as CDROM Alexander Bezzubikov
2015-08-18  6:09   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 04/11] scsi: Added function to enable ATAPI-SCSI bridge send SCSI requests Alexander Bezzubikov
2015-08-18  6:10   ` Hannes Reinecke [this message]
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 05/11] ide: bridge 'transfer' and 'complete' functions added Alexander Bezzubikov
2015-08-18  6:11   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 06/11] ide: ATAPI-SCSI bridge can now forward requests to SCSI Alexander Bezzubikov
2015-08-18  6:12   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 07/11] ide: Makefile corrected due to bridge creation Alexander Bezzubikov
2015-08-18  6:13   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 08/11] scsi: SCSIDiskReq declaration moved to header Alexander Bezzubikov
2015-08-18  6:17   ` Hannes Reinecke
2015-08-25  0:31     ` John Snow
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 09/11] ide: ide_bridge_do_transfer is treated as PIO transfer Alexander Bezzubikov
2015-08-18  6:18   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 10/11] ide: corrected ATAPI checks to be ignored by ATAPI-SCSI bridge Alexander Bezzubikov
2015-08-18  6:19   ` Hannes Reinecke
2015-08-17 23:42 ` [Qemu-devel] [PATCH RFC 11/11] ide: bridge functions assigned to SCSIBusInfo, bridge is OK now Alexander Bezzubikov
2015-08-18  6:19   ` Hannes Reinecke
2015-08-18  6:21 ` [Qemu-devel] [PATCH RFC 00/11] QEMU ATAPI-SCSI bridge GSoC project Hannes Reinecke

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=55D2CC4D.7060908@suse.de \
    --to=hare@suse.de \
    --cc=abezzubikov@ispras.ru \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zuban32s@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).