History

virtio_config: introduce a new .enable_cbs method

This patch introduces a new method to enable the callbacks for config and virtqueues. This will be used for making sure the virtqueue callbacks are only enabled after virtio_device_ready() if transport implements this method.

Jason Wang committed 5 years ago

Commit d50497e1 parent 28962ec1 file · +6 −0Browse files

Unified · Split

include/linux/virtio_config.h+6−0
@@ -23,6 +23,8 @@ struct virtio_shm_region { · 22 unmodified lines
2323 * any of @get/@set, @get_status/@set_status, or @get_features/
2424 * @finalize_features are NOT safe to be called from an atomic
2525 * context.
26+ * @enable_cbs: enable the callbacks
27+ * vdev: the virtio_device
2628 * @get: read the value of a configuration field
2729 * vdev: the virtio_device
2830 * offset: the offset of the configuration field
@@ -75,6 +77,7 @@ struct virtio_shm_region { · 46 unmodified lines
7577 */
7678 typedef void vq_callback_t(struct virtqueue *);
7779 struct virtio_config_ops {
80+ void (*enable_cbs)(struct virtio_device *vdev);
7881 void (*get)(struct virtio_device *vdev, unsigned offset,
7982 void *buf, unsigned len);
8083 void (*set)(struct virtio_device *vdev, unsigned offset,
@@ -229,6 +232,9 @@ void virtio_device_ready(struct virtio_device *dev) · 148 unmodified lines
229232 {
230233 unsigned status = dev->config->get_status(dev);
231234
235+ if (dev->config->enable_cbs)
236+ dev->config->enable_cbs(dev);
237+
232238 BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK);
233239 dev->config->set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK);
234240 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t