Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755674AbbBHLBX (ORCPT ); Sun, 8 Feb 2015 06:01:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59130 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755001AbbBHLBW (ORCPT ); Sun, 8 Feb 2015 06:01:22 -0500 Date: Sun, 8 Feb 2015 12:01:17 +0100 From: "Michael S. Tsirkin" To: Rusty Russell Cc: lkml Subject: Re: [PATCH 2/5] virtio: Don't expose legacy block features when VIRTIO_BLK_NO_LEGACY defined. Message-ID: <20150208110117.GK3185@redhat.com> References: <1423199216-2094-1-git-send-email-rusty@rustcorp.com.au> <1423199216-2094-3-git-send-email-rusty@rustcorp.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1423199216-2094-3-git-send-email-rusty@rustcorp.com.au> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3441 Lines: 90 On Fri, Feb 06, 2015 at 03:36:53PM +1030, Rusty Russell wrote: > This allows modern implementations to ensure they don't use legacy > feature bits or SCSI commands (which are not used in v1.0 non-legacy). > > Signed-off-by: Rusty Russell Acked-by: Michael S. Tsirkin > --- > include/uapi/linux/virtio_blk.h | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h > index 247c8ba8544a..3c53eec4ae22 100644 > --- a/include/uapi/linux/virtio_blk.h > +++ b/include/uapi/linux/virtio_blk.h > @@ -31,22 +31,25 @@ > #include > > /* Feature bits */ > -#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ > #define VIRTIO_BLK_F_SIZE_MAX 1 /* Indicates maximum segment size */ > #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ > #define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ > #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ > #define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ > -#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ > -#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ > #define VIRTIO_BLK_F_TOPOLOGY 10 /* Topology information is available */ > -#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ > #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */ > > +/* Legacy feature bits */ > +#ifndef VIRTIO_BLK_NO_LEGACY > +#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ > +#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */ > +#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ > +#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in config */ > #ifndef __KERNEL__ > /* Old (deprecated) name for VIRTIO_BLK_F_WCE. */ > #define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE > #endif > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > > #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ > > @@ -100,8 +103,10 @@ struct virtio_blk_config { > #define VIRTIO_BLK_T_IN 0 > #define VIRTIO_BLK_T_OUT 1 > > +#ifndef VIRTIO_BLK_NO_LEGACY > /* This bit says it's a scsi command, not an actual read or write. */ > #define VIRTIO_BLK_T_SCSI_CMD 2 > +#endif /* VIRTIO_BLK_NO_LEGACY */ > > /* Cache flush command */ > #define VIRTIO_BLK_T_FLUSH 4 > @@ -109,8 +114,10 @@ struct virtio_blk_config { > /* Get device ID command */ > #define VIRTIO_BLK_T_GET_ID 8 > > +#ifndef VIRTIO_BLK_NO_LEGACY > /* Barrier before this op. */ > #define VIRTIO_BLK_T_BARRIER 0x80000000 > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > > /* This is the first element of the read scatter-gather list. */ > struct virtio_blk_outhdr { > @@ -122,12 +129,14 @@ struct virtio_blk_outhdr { > __virtio64 sector; > }; > > +#ifndef VIRTIO_BLK_NO_LEGACY > struct virtio_scsi_inhdr { > __virtio32 errors; > __virtio32 data_len; > __virtio32 sense_len; > __virtio32 residual; > }; > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > > /* And this is the final byte of the write scatter-gather list. */ > #define VIRTIO_BLK_S_OK 0 > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/