]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
virtio: add API to detect legacy devices
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 4 Dec 2014 16:49:58 +0000 (18:49 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 9 Dec 2014 10:06:33 +0000 (12:06 +0200)
transports need to be able to detect legacy-only
devices (ATM balloon only) to use legacy path
to drive them.

Add a core API to do just that.
The implementation just blacklists balloon:
not too pretty, but let's not over-engineer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
drivers/virtio/virtio.c
include/linux/virtio.h

index fa6b75db5f1fb2d89cb83804e99e2a3317db9f8a..224f85442f3f2c3b9f50439040148bdfe8fcae4c 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/virtio_config.h>
 #include <linux/module.h>
 #include <linux/idr.h>
+#include <uapi/linux/virtio_ids.h>
 
 /* Unique numbering for virtio devices. */
 static DEFINE_IDA(virtio_index_ida);
@@ -267,6 +268,12 @@ static struct bus_type virtio_bus = {
        .remove = virtio_dev_remove,
 };
 
+bool virtio_device_is_legacy_only(struct virtio_device_id id)
+{
+       return id.device == VIRTIO_ID_BALLOON;
+}
+EXPORT_SYMBOL_GPL(virtio_device_is_legacy_only);
+
 int register_virtio_driver(struct virtio_driver *driver)
 {
        /* Catch this early. */
index 2bbf626976718229ce14ea3b64ad09da37f0bd9a..d666bcb57401bf9fbf2b3d1f7887bfd251b9ab40 100644 (file)
@@ -108,6 +108,8 @@ struct virtio_device {
        void *priv;
 };
 
+bool virtio_device_is_legacy_only(struct virtio_device_id id);
+
 static inline struct virtio_device *dev_to_virtio(struct device *_dev)
 {
        return container_of(_dev, struct virtio_device, dev);