mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	virtualization@lists.linux-foundation.org,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH pre-squash 11/14] virtio_pci: add an option to disable legacy driver
Date: Wed, 21 Jan 2015 17:00:39 +0200	[thread overview]
Message-ID: <1421852375-22604-12-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1421852375-22604-1-git-send-email-mst@redhat.com>

Useful for testing device virtio 1 compatibility.
Based on patch by Rusty - couldn't resist putting
that flying car joke in there!

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/virtio/virtio_pci_common.h | 10 ++++++++++
 drivers/virtio/Kconfig             | 19 +++++++++++++++++++
 drivers/virtio/Makefile            |  3 ++-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_pci_common.h b/drivers/virtio/virtio_pci_common.h
index d391805..28ee4e5 100644
--- a/drivers/virtio/virtio_pci_common.h
+++ b/drivers/virtio/virtio_pci_common.h
@@ -147,8 +147,18 @@ const char *vp_bus_name(struct virtio_device *vdev);
  */
 int vp_set_vq_affinity(struct virtqueue *vq, int cpu);
 
+#if IS_ENABLED(CONFIG_VIRTIO_PCI_LEGACY)
 int virtio_pci_legacy_probe(struct virtio_pci_device *);
 void virtio_pci_legacy_remove(struct virtio_pci_device *);
+#else
+static inline int virtio_pci_legacy_probe(struct virtio_pci_device *vp_dev)
+{
+	return -ENODEV;
+}
+static inline void virtio_pci_legacy_remove(struct virtio_pci_device *vp_dev)
+{
+}
+#endif
 int virtio_pci_modern_probe(struct virtio_pci_device *);
 void virtio_pci_modern_remove(struct virtio_pci_device *);
 
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 083fb45..b546da5 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -19,6 +19,25 @@ config VIRTIO_PCI
 
 	  If unsure, say M.
 
+config VIRTIO_PCI_LEGACY
+	bool "Support for legacy virtio draft 0.9.X and older devices"
+	default y
+	depends on VIRTIO_PCI
+	---help---
+          Virtio PCI Card 0.9.X Draft (circa 2014) and older device support.
+
+	  This option enables building a transitional driver, supporting
+	  both devices conforming to Virtio 1 specification, and legacy devices.
+	  If disabled, you get a slightly smaller, non-transitional driver,
+	  with no legacy compatibility.
+
+          So look out into your driveway.  Do you have a flying car?  If
+          so, you can happily disable this option and virtio will not
+          break.  Otherwise, leave it set.  Unless you're testing what
+          life will be like in The Future.
+
+	  If unsure, say Y.
+
 config VIRTIO_BALLOON
 	tristate "Virtio balloon driver"
 	depends on VIRTIO
diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile
index bd230d1..d85565b 100644
--- a/drivers/virtio/Makefile
+++ b/drivers/virtio/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_VIRTIO) += virtio.o virtio_ring.o
 obj-$(CONFIG_VIRTIO_MMIO) += virtio_mmio.o
 obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o
-virtio_pci-y := virtio_pci_modern.o virtio_pci_legacy.o virtio_pci_common.o
+virtio_pci-y := virtio_pci_modern.o virtio_pci_common.o
+virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o
 obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o
-- 
MST


  parent reply	other threads:[~2015-01-21 15:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 15:00 [PATCH pre-squash 00/14] virtio 1.0: virtio-pci fixup Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 01/14] virtio_pci: move probe/remove code to common Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 02/14] virtio-pci: define layout for virtio 1.0 Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 03/14] fixup! " Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 04/14] virtio_pci: modern driver Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 05/14] fixup! " Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 06/14] " Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 07/14] virtio_pci: macros for PCI layout offsets Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 08/14] fixup! " Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 09/14] virtio_pci_modern: reduce number of mappings Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 10/14] virtio_pci_modern: support devices with no config Michael S. Tsirkin
2015-01-21 15:00 ` Michael S. Tsirkin [this message]
2015-01-21 15:00 ` [PATCH pre-squash 12/14] virtio_pci: add module param to force legacy mode Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 13/14] fixup! " Michael S. Tsirkin
2015-01-21 15:00 ` [PATCH pre-squash 14/14] virtio_pci_modern: drop an unused function 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=1421852375-22604-12-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome