All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
	cornelia.huck@de.ibm.com, rusty@au1.ibm.com, nab@linux-iscsi.org,
	pbonzini@redhat.com, thuth@linux.vnet.ibm.com,
	dahi@linux.vnet.ibm.com, Rusty Russell <rusty@rustcorp.com.au>,
	virtualization@lists.linux-foundation.org,
	linux-api@vger.kernel.org
Subject: [PATCH v8 49/50] virtio: make VIRTIO_F_VERSION_1 a transport bit
Date: Mon, 1 Dec 2014 18:06:55 +0200	[thread overview]
Message-ID: <1417449619-24896-50-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1417449619-24896-1-git-send-email-mst@redhat.com>

Activate VIRTIO_F_VERSION_1 automatically unless legacy_only
is set.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/uapi/linux/virtio_config.h | 4 ++--
 drivers/virtio/virtio.c            | 6 +++++-
 drivers/virtio/virtio_ring.c       | 2 ++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 4d05671..a6d0cde 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -43,11 +43,11 @@
 /* We've given up on this device. */
 #define VIRTIO_CONFIG_S_FAILED		0x80
 
-/* Some virtio feature bits (currently bits 28 through 31) are reserved for the
+/* Some virtio feature bits (currently bits 28 through 32) are reserved for the
  * transport being used (eg. virtio_ring), the rest are per-device feature
  * bits. */
 #define VIRTIO_TRANSPORT_F_START	28
-#define VIRTIO_TRANSPORT_F_END		32
+#define VIRTIO_TRANSPORT_F_END		33
 
 /* Do we get callbacks when the ring is completely used, even if we've
  * suppressed them? */
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index f9ad99c..fa6b75d 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -197,7 +197,11 @@ static int virtio_dev_probe(struct device *_d)
 		driver_features_legacy = driver_features;
 	}
 
-	if (driver_features & device_features & (1ULL << VIRTIO_F_VERSION_1))
+	/* Detect legacy-only drivers and disable VIRTIO_F_VERSION_1. */
+	if (drv->legacy_only)
+		device_features &= ~(1ULL << VIRTIO_F_VERSION_1);
+
+	if (device_features & (1ULL << VIRTIO_F_VERSION_1))
 		dev->features = driver_features & device_features;
 	else
 		dev->features = driver_features_legacy & device_features;
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 55532a4..00ec6b3 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -780,6 +780,8 @@ void vring_transport_features(struct virtio_device *vdev)
 			break;
 		case VIRTIO_RING_F_EVENT_IDX:
 			break;
+		case VIRTIO_F_VERSION_1:
+			break;
 		default:
 			/* We don't understand this bit. */
 			__virtio_clear_bit(vdev, i);
-- 
MST


WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: thuth@linux.vnet.ibm.com, rusty@au1.ibm.com,
	linux-api@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	dahi@linux.vnet.ibm.com, pbonzini@redhat.com,
	David Miller <davem@davemloft.net>
Subject: [PATCH v8 49/50] virtio: make VIRTIO_F_VERSION_1 a transport bit
Date: Mon, 1 Dec 2014 18:06:55 +0200	[thread overview]
Message-ID: <1417449619-24896-50-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1417449619-24896-1-git-send-email-mst@redhat.com>

Activate VIRTIO_F_VERSION_1 automatically unless legacy_only
is set.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/uapi/linux/virtio_config.h | 4 ++--
 drivers/virtio/virtio.c            | 6 +++++-
 drivers/virtio/virtio_ring.c       | 2 ++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
index 4d05671..a6d0cde 100644
--- a/include/uapi/linux/virtio_config.h
+++ b/include/uapi/linux/virtio_config.h
@@ -43,11 +43,11 @@
 /* We've given up on this device. */
 #define VIRTIO_CONFIG_S_FAILED		0x80
 
-/* Some virtio feature bits (currently bits 28 through 31) are reserved for the
+/* Some virtio feature bits (currently bits 28 through 32) are reserved for the
  * transport being used (eg. virtio_ring), the rest are per-device feature
  * bits. */
 #define VIRTIO_TRANSPORT_F_START	28
-#define VIRTIO_TRANSPORT_F_END		32
+#define VIRTIO_TRANSPORT_F_END		33
 
 /* Do we get callbacks when the ring is completely used, even if we've
  * suppressed them? */
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index f9ad99c..fa6b75d 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -197,7 +197,11 @@ static int virtio_dev_probe(struct device *_d)
 		driver_features_legacy = driver_features;
 	}
 
-	if (driver_features & device_features & (1ULL << VIRTIO_F_VERSION_1))
+	/* Detect legacy-only drivers and disable VIRTIO_F_VERSION_1. */
+	if (drv->legacy_only)
+		device_features &= ~(1ULL << VIRTIO_F_VERSION_1);
+
+	if (device_features & (1ULL << VIRTIO_F_VERSION_1))
 		dev->features = driver_features & device_features;
 	else
 		dev->features = driver_features_legacy & device_features;
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 55532a4..00ec6b3 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -780,6 +780,8 @@ void vring_transport_features(struct virtio_device *vdev)
 			break;
 		case VIRTIO_RING_F_EVENT_IDX:
 			break;
+		case VIRTIO_F_VERSION_1:
+			break;
 		default:
 			/* We don't understand this bit. */
 			__virtio_clear_bit(vdev, i);
-- 
MST

  parent reply	other threads:[~2014-12-01 16:08 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 16:02 [PATCH v8 00/50] linux: towards virtio-1 guest support Michael S. Tsirkin
2014-12-01 16:02 ` [PATCH v8 01/50] virtio: add low-level APIs for feature bits Michael S. Tsirkin
2014-12-01 16:02 ` Michael S. Tsirkin
2014-12-01 16:02 ` [PATCH v8 02/50] virtio: use u32, not bitmap for features Michael S. Tsirkin
2014-12-01 16:02   ` Michael S. Tsirkin
2014-12-01 16:02 ` [PATCH v8 03/50] mic_virtio: robust feature array size calculation Michael S. Tsirkin
2014-12-02 10:13   ` Thomas Huth
2014-12-01 16:03 ` [PATCH v8 04/50] virtio: add support for 64 bit features Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 05/50] virtio: assert 32 bit features in transports Michael S. Tsirkin
2014-12-01 16:03 ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 06/50] virtio_ccw: add support for 64 bit features Michael S. Tsirkin
2014-12-02 11:14   ` Thomas Huth
2014-12-01 16:03 ` [PATCH v8 07/50] virtio: add virtio 1.0 feature bit Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 08/50] virtio: memory access APIs Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-03  0:48   ` Prabhakar Lad
2014-12-03  0:48     ` Prabhakar Lad
2014-12-01 16:03 ` [PATCH v8 09/50] virtio_ring: switch to new " Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 10/50] virtio_config: endian conversion for v1.0 Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 11/50] virtio: allow transports to get avail/used addresses Michael S. Tsirkin
2014-12-01 16:03 ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 12/50] virtio: set FEATURES_OK Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 13/50] virtio: simplify feature bit handling Michael S. Tsirkin
2014-12-01 16:03   ` Michael S. Tsirkin
2014-12-01 16:03 ` [PATCH v8 14/50] virtio: add legacy feature table support Michael S. Tsirkin
2014-12-01 16:03 ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 15/50] virtio_net: v1.0 endianness Michael S. Tsirkin
2014-12-01 16:04   ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 16/50] virtio_blk: v1.0 support Michael S. Tsirkin
2014-12-01 16:04 ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 17/50] KVM: s390: Set virtio-ccw transport revision Michael S. Tsirkin
2014-12-04 16:10   ` Michael S. Tsirkin
2014-12-04 16:19     ` Cornelia Huck
2014-12-01 16:04 ` [PATCH v8 18/50] KVM: s390: virtio-ccw revision 1 SET_VQ Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 19/50] KVM: s390 allow virtio_ccw status writes to fail Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 20/50] KVM: s390: enable virtio-ccw revision 1 Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 21/50] virtio_blk: make serial attribute static Michael S. Tsirkin
2014-12-01 16:04   ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 22/50] virtio_blk: fix race at module removal Michael S. Tsirkin
2014-12-01 16:04   ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 23/50] virtio_net: pass vi around Michael S. Tsirkin
2014-12-01 16:04   ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 24/50] virtio_net: get rid of virtio_net_hdr/skb_vnet_hdr Michael S. Tsirkin
2014-12-01 16:04   ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 25/50] virtio_net: stricter short buffer length checks Michael S. Tsirkin
2014-12-01 16:04 ` Michael S. Tsirkin
2014-12-01 16:04 ` [PATCH v8 26/50] virtio_net: bigger header when VERSION_1 is set Michael S. Tsirkin
2014-12-01 16:04   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 27/50] virtio_net: disable mac write for virtio 1.0 Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 28/50] virtio_net: enable v1.0 support Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 29/50] vhost: make features 64 bit Michael S. Tsirkin
2014-12-01 16:05 ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 30/50] vhost: add memory access wrappers Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 31/50] vhost/net: force len for TX to host endian Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 32/50] vhost: switch to __get/__put_user exclusively Michael S. Tsirkin
2014-12-01 16:05 ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 33/50] vhost: virtio 1.0 endian-ness support Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 34/50] vhost/net: virtio 1.0 byte swap Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2015-01-06 23:55   ` Alex Williamson
2015-01-06 23:55   ` Alex Williamson
2015-01-07  8:31     ` Greg Kurz
2015-01-07  8:31       ` Greg Kurz
2015-01-07  8:57       ` Michael S. Tsirkin
2015-01-07  8:57       ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 35/50] vhost/net: larger header for virtio 1.0 Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 36/50] vhost/net: enable " Michael S. Tsirkin
2014-12-01 16:05   ` Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 37/50] tun: move internal flag defines out of uapi Michael S. Tsirkin
2014-12-01 16:05 ` [PATCH v8 38/50] tun: drop most type defines Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 39/50] tun: add VNET_LE flag Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 40/50] tun: TUN_VNET_LE support, fix sparse warnings for virtio headers Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 41/50] macvtap: TUN_VNET_LE support Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 42/50] virtio_scsi: v1.0 support Michael S. Tsirkin
2014-12-01 16:06   ` Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 43/50] virtio_scsi: move to uapi Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 44/50] virtio_scsi: export to userspace Michael S. Tsirkin
2014-12-01 16:06   ` Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 45/50] vhost/scsi: partial virtio 1.0 support Michael S. Tsirkin
2014-12-01 16:06 ` Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 46/50] af_packet: virtio 1.0 stubs Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 47/50] virtio_console: virtio 1.0 support Michael S. Tsirkin
2014-12-01 16:06   ` Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 48/50] virtio_balloon: add legacy_only flag Michael S. Tsirkin
2014-12-01 16:06   ` Michael S. Tsirkin
2014-12-01 16:06 ` Michael S. Tsirkin [this message]
2014-12-01 16:06   ` [PATCH v8 49/50] virtio: make VIRTIO_F_VERSION_1 a transport bit Michael S. Tsirkin
2014-12-01 16:06 ` [PATCH v8 50/50] virtio: drop VIRTIO_F_VERSION_1 from drivers Michael S. Tsirkin
2014-12-01 16:06 ` Michael S. Tsirkin
2014-12-08  8:58 ` [PATCH v8 00/50] linux: towards virtio-1 guest support Michael S. Tsirkin
2014-12-09  0:33   ` David Miller
2014-12-10 23:09     ` Rusty Russell
2014-12-10 19:14 ` Michael S. Tsirkin
2014-12-12 23:48   ` Nicholas A. Bellinger

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=1417449619-24896-50-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=pbonzini@redhat.com \
    --cc=rusty@au1.ibm.com \
    --cc=rusty@rustcorp.com.au \
    --cc=thuth@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.