qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@linux.vnet.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	"Chen, Tiejun" <tiejun.chen@intel.com>,
	Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH v3 10/17] virtio-scsi: use standard-headers
Date: Tue, 17 Feb 2015 15:13:35 +0100	[thread overview]
Message-ID: <54E34C8F.3080004@redhat.com> (raw)
In-Reply-To: <1424122283-12521-11-git-send-email-mst@redhat.com>



On 16/02/2015 22:36, Michael S. Tsirkin wrote:
> Drop duplicated code.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  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
> @@ -14,6 +14,7 @@
>  #ifndef _QEMU_VIRTIO_SCSI_H
>  #define _QEMU_VIRTIO_SCSI_H
>  
> +#include "standard-headers/linux/virtio_scsi.h"

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

>  #include "hw/virtio/virtio.h"
>  #include "hw/pci/pci.h"
>  #include "hw/scsi/scsi.h"
> @@ -28,15 +29,6 @@
>  #define VIRTIO_SCSI(obj) \
>          OBJECT_CHECK(VirtIOSCSI, (obj), TYPE_VIRTIO_SCSI)
>  
> -
> -/* The ID for virtio_scsi */
> -#define VIRTIO_ID_SCSI  8
> -
> -/* Feature Bits */
> -#define VIRTIO_SCSI_F_INOUT                    0
> -#define VIRTIO_SCSI_F_HOTPLUG                  1
> -#define VIRTIO_SCSI_F_CHANGE                   2
> -
>  #define VIRTIO_SCSI_VQ_SIZE     128
>  #define VIRTIO_SCSI_CDB_SIZE    32
>  #define VIRTIO_SCSI_SENSE_SIZE  96
> @@ -44,108 +36,14 @@
>  #define VIRTIO_SCSI_MAX_TARGET  255
>  #define VIRTIO_SCSI_MAX_LUN     16383
>  
> -/* Response codes */
> -#define VIRTIO_SCSI_S_OK                       0
> -#define VIRTIO_SCSI_S_OVERRUN                  1
> -#define VIRTIO_SCSI_S_ABORTED                  2
> -#define VIRTIO_SCSI_S_BAD_TARGET               3
> -#define VIRTIO_SCSI_S_RESET                    4
> -#define VIRTIO_SCSI_S_BUSY                     5
> -#define VIRTIO_SCSI_S_TRANSPORT_FAILURE        6
> -#define VIRTIO_SCSI_S_TARGET_FAILURE           7
> -#define VIRTIO_SCSI_S_NEXUS_FAILURE            8
> -#define VIRTIO_SCSI_S_FAILURE                  9
> -#define VIRTIO_SCSI_S_FUNCTION_SUCCEEDED       10
> -#define VIRTIO_SCSI_S_FUNCTION_REJECTED        11
> -#define VIRTIO_SCSI_S_INCORRECT_LUN            12
> -
> -/* Controlq type codes.  */
> -#define VIRTIO_SCSI_T_TMF                      0
> -#define VIRTIO_SCSI_T_AN_QUERY                 1
> -#define VIRTIO_SCSI_T_AN_SUBSCRIBE             2
> -
> -/* Valid TMF subtypes.  */
> -#define VIRTIO_SCSI_T_TMF_ABORT_TASK           0
> -#define VIRTIO_SCSI_T_TMF_ABORT_TASK_SET       1
> -#define VIRTIO_SCSI_T_TMF_CLEAR_ACA            2
> -#define VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET       3
> -#define VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET      4
> -#define VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET   5
> -#define VIRTIO_SCSI_T_TMF_QUERY_TASK           6
> -#define VIRTIO_SCSI_T_TMF_QUERY_TASK_SET       7
> -
> -/* Events.  */
> -#define VIRTIO_SCSI_T_EVENTS_MISSED            0x80000000
> -#define VIRTIO_SCSI_T_NO_EVENT                 0
> -#define VIRTIO_SCSI_T_TRANSPORT_RESET          1
> -#define VIRTIO_SCSI_T_ASYNC_NOTIFY             2
> -#define VIRTIO_SCSI_T_PARAM_CHANGE             3
> -
> -/* Reasons for transport reset event */
> -#define VIRTIO_SCSI_EVT_RESET_HARD             0
> -#define VIRTIO_SCSI_EVT_RESET_RESCAN           1
> -#define VIRTIO_SCSI_EVT_RESET_REMOVED          2
> -
> -/* 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;
> -
> -/* 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"
> 

  reply	other threads:[~2015-02-17 14:13 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 [this message]
2015-03-11 10:54   ` Nikunj A Dadhania
2015-03-11 12:03     ` Michael S. Tsirkin
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=54E34C8F.3080004@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=mst@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).