Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99262a3d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'virtio-for-linus' of...

Merge tag 'virtio-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus

Pull virtio updates from Rusty Russell.

* tag 'virtio-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
  virtio: fix typo in comment
  virtio-mmio: Devices parameter parsing
  virtio_blk: Drop unused request tracking list
  virtio-blk: Fix hot-unplug race in remove method
  virtio: Use ida to allocate virtio index
  virtio: balloon: separate out common code between remove and freeze functions
  virtio: balloon: drop restore_common()
  9p: disconnect channel when PCI device is removed
  virtio: update documentation to v0.9.5 of spec
parents bf67f3a5 c6190804
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ parameter is applicable:
	USB	USB support is enabled.
	USBHID	USB Human Interface Device support is enabled.
	V4L	Video For Linux support is enabled.
	VMMIO   Driver for memory mapped virtio devices is enabled.
	VGA	The VGA console has been enabled.
	VT	Virtual terminal support is enabled.
	WDT	Watchdog support is enabled.
@@ -2932,6 +2933,22 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
	video=		[FB] Frame buffer configuration
			See Documentation/fb/modedb.txt.

	virtio_mmio.device=
			[VMMIO] Memory mapped virtio (platform) device.

				<size>@<baseaddr>:<irq>[:<id>]
			where:
				<size>     := size (can use standard suffixes
						like K, M and G)
				<baseaddr> := physical base address
				<irq>      := interrupt number (as passed to
						request_irq())
				<id>       := (optional) platform device id
			example:
				virtio_mmio.device=1K@0x100b0000:48:7

			Can be used multiple times for multiple devices.

	vga=		[BOOT,X86-32] Select a particular video mode
			See Documentation/x86/boot.txt and
			Documentation/svga.txt.
+1087 −77

File changed.

Preview size limit exceeded, changes collapsed.

+11 −10
Original line number Diff line number Diff line
@@ -29,9 +29,6 @@ struct virtio_blk
	/* The disk structure for the kernel. */
	struct gendisk *disk;

	/* Request tracking. */
	struct list_head reqs;

	mempool_t *pool;

	/* Process context for config space updates */
@@ -55,7 +52,6 @@ struct virtio_blk

struct virtblk_req
{
	struct list_head list;
	struct request *req;
	struct virtio_blk_outhdr out_hdr;
	struct virtio_scsi_inhdr in_hdr;
@@ -99,7 +95,6 @@ static void blk_done(struct virtqueue *vq)
		}

		__blk_end_request_all(vbr->req, error);
		list_del(&vbr->list);
		mempool_free(vbr, vblk->pool);
	}
	/* In case queue is stopped waiting for more buffers. */
@@ -184,7 +179,6 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
		return false;
	}

	list_add_tail(&vbr->list, &vblk->reqs);
	return true;
}

@@ -437,7 +431,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
		goto out_free_index;
	}

	INIT_LIST_HEAD(&vblk->reqs);
	spin_lock_init(&vblk->lock);
	vblk->vdev = vdev;
	vblk->sg_elems = sg_elems;
@@ -583,21 +576,29 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
{
	struct virtio_blk *vblk = vdev->priv;
	int index = vblk->index;
	struct virtblk_req *vbr;
	unsigned long flags;

	/* Prevent config work handler from accessing the device. */
	mutex_lock(&vblk->config_lock);
	vblk->config_enable = false;
	mutex_unlock(&vblk->config_lock);

	/* Nothing should be pending. */
	BUG_ON(!list_empty(&vblk->reqs));

	/* Stop all the virtqueues. */
	vdev->config->reset(vdev);

	flush_work(&vblk->config_work);

	del_gendisk(vblk->disk);

	/* Abort requests dispatched to driver. */
	spin_lock_irqsave(&vblk->lock, flags);
	while ((vbr = virtqueue_detach_unused_buf(vblk->vq))) {
		__blk_end_request_all(vbr->req, -EIO);
		mempool_free(vbr, vblk->pool);
	}
	spin_unlock_irqrestore(&vblk->lock, flags);

	blk_cleanup_queue(vblk->disk->queue);
	put_disk(vblk->disk);
	mempool_destroy(vblk->pool);
+11 −0
Original line number Diff line number Diff line
@@ -46,4 +46,15 @@ config VIRTIO_BALLOON

 	 If unsure, say N.

config VIRTIO_MMIO_CMDLINE_DEVICES
	bool "Memory mapped virtio devices parameter parsing"
	depends on VIRTIO_MMIO
	---help---
	 Allow virtio-mmio devices instantiation via the kernel command line
	 or module parameters. Be aware that using incorrect parameters (base
	 address in particular) can crash your system - you have been warned.
	 See Documentation/kernel-parameters.txt for details.

	 If unsure, say 'N'.

endmenu
+9 −2
Original line number Diff line number Diff line
@@ -2,9 +2,10 @@
#include <linux/spinlock.h>
#include <linux/virtio_config.h>
#include <linux/module.h>
#include <linux/idr.h>

/* Unique numbering for virtio devices. */
static unsigned int dev_index;
static DEFINE_IDA(virtio_index_ida);

static ssize_t device_show(struct device *_d,
			   struct device_attribute *attr, char *buf)
@@ -193,7 +194,11 @@ int register_virtio_device(struct virtio_device *dev)
	dev->dev.bus = &virtio_bus;

	/* Assign a unique device index and hence name. */
	dev->index = dev_index++;
	err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
	if (err < 0)
		goto out;

	dev->index = err;
	dev_set_name(&dev->dev, "virtio%u", dev->index);

	/* We always start by resetting the device, in case a previous
@@ -208,6 +213,7 @@ int register_virtio_device(struct virtio_device *dev)
	/* device_register() causes the bus infrastructure to look for a
	 * matching driver. */
	err = device_register(&dev->dev);
out:
	if (err)
		add_status(dev, VIRTIO_CONFIG_S_FAILED);
	return err;
@@ -217,6 +223,7 @@ EXPORT_SYMBOL_GPL(register_virtio_device);
void unregister_virtio_device(struct virtio_device *dev)
{
	device_unregister(&dev->dev);
	ida_simple_remove(&virtio_index_ida, dev->index);
}
EXPORT_SYMBOL_GPL(unregister_virtio_device);

Loading