qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@linux.vnet.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	"Chen, Tiejun" <tiejun.chen@intel.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH v3 10/17] virtio-scsi: use standard-headers
Date: Wed, 11 Mar 2015 13:03:21 +0100	[thread overview]
Message-ID: <20150311130254-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <87pp8fdcsg.fsf@abhimanyu.in.ibm.com>

On Wed, Mar 11, 2015 at 04:24:55PM +0530, Nikunj A Dadhania wrote:
> 
> Hi Michael,
> 
> "Michael S. Tsirkin" <mst@redhat.com> writes:
> > Drop duplicated code.
> >
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> This patch is breaking SLOF. Reason below:

Can you please try out this patch:
mid.gmane.org/20150311101858-mutt-send-email-mst@redhat.com

Thanks!


> > ---
> >  include/hw/virtio/virtio-scsi.h | 120 +++-------------------------------------
> >  hw/scsi/virtio-scsi.c           |   1 +
> >  2 files changed, 10 insertions(+), 111 deletions(-)
> >
> > diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
> > index bf17cc9..864070d 100644
> > --- a/include/hw/virtio/virtio-scsi.h
> > +++ b/include/hw/virtio/virtio-scsi.h
> 
> For instance:
> 
> > -
> > -/* SCSI command request, followed by CDB and data-out */
> > -typedef struct {
> > -    uint8_t lun[8];              /* Logical Unit Number */
> > -    uint64_t tag;                /* Command identifier */
> > -    uint8_t task_attr;           /* Task attribute */
> > -    uint8_t prio;
> > -    uint8_t crn;
> > -} QEMU_PACKED VirtIOSCSICmdReq;
> 
> in include/standard-headers/linux/virtio_scsi.h
> 
> 	#define VIRTIO_SCSI_CDB_SIZE   32
> 	#define VIRTIO_SCSI_SENSE_SIZE 96
> 	
> 	/* SCSI command request, followed by data-out */
> 	struct virtio_scsi_cmd_req {
> 	        uint8_t lun[8]; 	/* Logical Unit Number */
> 	        __virtio64 tag;         /* Command identifier */
> 	        uint8_t task_attr;              /* Task attribute */
> 		uint8_t prio;           /* SAM command priority field */
> 	        uint8_t crn;
> 	        uint8_t cdb[VIRTIO_SCSI_CDB_SIZE];
> 	} QEMU_PACKED;
> 
> 
> Here the structure is changed having cdb as extra member. Moreover, we
> have checks like below in hw/scsi/virtio-scsi.c
> 
>     rc = virtio_scsi_parse_req(req, sizeof(VirtIOSCSICmdReq) + vs->cdb_size,
>                                sizeof(VirtIOSCSICmdResp) + vs->sense_size);
> 
> Now that the size of CmdReq structure is not the same as
> earlier. Similarly for CmdResp structure.
> 
> SLOF has these headers replicated, IMHO, we should be changing the structure size.
> 
> > -
> > -/* Response, followed by sense data and data-in */
> > -typedef struct {
> > -    uint32_t sense_len;          /* Sense data length */
> > -    uint32_t resid;              /* Residual bytes in data buffer */
> > -    uint16_t status_qualifier;   /* Status qualifier */
> > -    uint8_t status;              /* Command completion status */
> > -    uint8_t response;            /* Response values */
> > -} QEMU_PACKED VirtIOSCSICmdResp;
> > -
> > -/* Task Management Request */
> > -typedef struct {
> > -    uint32_t type;
> > -    uint32_t subtype;
> > -    uint8_t lun[8];
> > -    uint64_t tag;
> > -} QEMU_PACKED VirtIOSCSICtrlTMFReq;
> > -
> > -typedef struct {
> > -    uint8_t response;
> > -} QEMU_PACKED VirtIOSCSICtrlTMFResp;
> > -
> > -/* Asynchronous notification query/subscription */
> > -typedef struct {
> > -    uint32_t type;
> > -    uint8_t lun[8];
> > -    uint32_t event_requested;
> > -} QEMU_PACKED VirtIOSCSICtrlANReq;
> > -
> > -typedef struct {
> > -    uint32_t event_actual;
> > -    uint8_t response;
> > -} QEMU_PACKED VirtIOSCSICtrlANResp;
> > -
> > -typedef struct {
> > -    uint32_t event;
> > -    uint8_t lun[8];
> > -    uint32_t reason;
> > -} QEMU_PACKED VirtIOSCSIEvent;
> > -
> > -typedef struct {
> > -    uint32_t num_queues;
> > -    uint32_t seg_max;
> > -    uint32_t max_sectors;
> > -    uint32_t cmd_per_lun;
> > -    uint32_t event_info_size;
> > -    uint32_t sense_size;
> > -    uint32_t cdb_size;
> > -    uint16_t max_channel;
> > -    uint16_t max_target;
> > -    uint32_t max_lun;
> > -} QEMU_PACKED VirtIOSCSIConfig;
> > +typedef struct virtio_scsi_cmd_req VirtIOSCSICmdReq;
> > +typedef struct virtio_scsi_cmd_resp VirtIOSCSICmdResp;
> > +typedef struct virtio_scsi_ctrl_tmf_req VirtIOSCSICtrlTMFReq;
> > +typedef struct virtio_scsi_ctrl_tmf_resp VirtIOSCSICtrlTMFResp;
> > +typedef struct virtio_scsi_ctrl_an_req VirtIOSCSICtrlANReq;
> > +typedef struct virtio_scsi_ctrl_an_resp VirtIOSCSICtrlANResp;
> > +typedef struct virtio_scsi_event VirtIOSCSIEvent;
> > +typedef struct virtio_scsi_config VirtIOSCSIConfig;
> >  
> >  struct VirtIOSCSIConf {
> >      uint32_t num_queues;
> > diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> > index 9e2c718..d18654e 100644
> > --- a/hw/scsi/virtio-scsi.c
> > +++ b/hw/scsi/virtio-scsi.c
> > @@ -13,6 +13,7 @@
> >   *
> >   */
> >  
> > +#include "standard-headers/linux/virtio_ids.h"
> >  #include "hw/virtio/virtio-scsi.h"
> >  #include "qemu/error-report.h"
> >  #include "qemu/iov.h"
> > -- 
> > MST
> 
> Thanks
> Nikunj

  reply	other threads:[~2015-03-11 12:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 21:35 [Qemu-devel] [PATCH v3 00/17] virtio: pull headers from linux Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 01/17] scripts/update-linux-headers.sh: pull virtio hdrs Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 02/17] include: import virtio headers from linux 4.0 Michael S. Tsirkin
2015-02-17 12:45   ` Thomas Huth
2015-02-18 15:01     ` Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 03/17] virtio: use standard virtio_ring.h Michael S. Tsirkin
2015-02-17 12:44   ` Thomas Huth
2015-02-18 14:59     ` Michael S. Tsirkin
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 04/17] virtio: use standard-headers Michael S. Tsirkin
2015-02-17 13:16   ` Thomas Huth
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 05/17] virtio-balloon: use standard headers Michael S. Tsirkin
2015-02-17 13:25   ` Thomas Huth
2015-02-16 21:35 ` [Qemu-devel] [PATCH v3 06/17] virtio-9p: " Michael S. Tsirkin
2015-02-17 13:42   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 07/17] virtio-blk: switch to standard-headers Michael S. Tsirkin
2015-02-18  9:19   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 08/17] virtio-net, tap: use standard-headers Michael S. Tsirkin
2015-02-18  9:30   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 09/17] virtio-rng: " Michael S. Tsirkin
2015-02-18  9:32   ` Thomas Huth
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 10/17] virtio-scsi: " Michael S. Tsirkin
2015-02-17 14:13   ` Paolo Bonzini
2015-03-11 10:54   ` Nikunj A Dadhania
2015-03-11 12:03     ` Michael S. Tsirkin [this message]
2015-03-11 13:06       ` Nikunj A Dadhania
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 11/17] virtio-serial: switch to standard-headers Michael S. Tsirkin
2015-02-18 14:34   ` Thomas Huth
2015-02-18 14:55     ` Michael S. Tsirkin
2015-02-18 15:36       ` Thomas Huth
2015-02-18 15:41         ` Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 12/17] update-linux-headers: use standard-headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 13/17] linux-headers: " Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 14/17] virtio-pci: use standard headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 15/17] scripts: add arch specific standard-headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 16/17] standard-headers: add s390 virtio headers Michael S. Tsirkin
2015-02-16 21:36 ` [Qemu-devel] [PATCH v3 17/17] s390: use standard headers Michael S. Tsirkin

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=20150311130254-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=tiejun.chen@intel.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).