History

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio fixes from Michael Tsirkin: "This includes a couple of bugfixs for virtio. The virtio console patch is actually also in x86/tip targeting 4.9 because it helps vmap stacks, but it also fixes IOMMU_PLATFORM which was added in 4.8, and it seems important not to ship that in a broken configuration" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio_console: Stop doing DMA on the stack virtio: mark vring_dma_dev() static

Linus Torvalds committed 10 years ago

Commit d0acc7d2 parents daf6b9b 5e59d9a2 files · +16 −9Browse files

Unified · Split

2 files
  1. drivers/char/virtio_console.c +15 −8
  2. drivers/virtio/virtio_ring.c +1 −1
drivers/char/virtio_console.c+15−8
@@ -165,6 +165,12 @@ struct ports_device { · 164 unmodified lines
165165 */
166166 struct virtqueue *c_ivq, *c_ovq;
167167
168+ /*
169+ * A control packet buffer for guest->host requests, protected
170+ * by c_ovq_lock.
171+ */
172+ struct virtio_console_control cpkt;
173+
168174 /* Array of per-port IO virtqueues */
169175 struct virtqueue **in_vqs, **out_vqs;
170176
@@ -560,28 +566,29 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, · 389 unmodified lines
560566 unsigned int event, unsigned int value)
561567 {
562568 struct scatterlist sg[1];
563− struct virtio_console_control cpkt;
564569 struct virtqueue *vq;
565570 unsigned int len;
566571
567572 if (!use_multiport(portdev))
568573 return 0;
569574
570− cpkt.id = cpu_to_virtio32(portdev->vdev, port_id);
571− cpkt.event = cpu_to_virtio16(portdev->vdev, event);
572− cpkt.value = cpu_to_virtio16(portdev->vdev, value);
573−
574575 vq = portdev->c_ovq;
575576
576− sg_init_one(sg, &cpkt, sizeof(cpkt));
577−
578577 spin_lock(&portdev->c_ovq_lock);
579− if (virtqueue_add_outbuf(vq, sg, 1, &cpkt, GFP_ATOMIC) == 0) {
578+
579+ portdev->cpkt.id = cpu_to_virtio32(portdev->vdev, port_id);
580+ portdev->cpkt.event = cpu_to_virtio16(portdev->vdev, event);
581+ portdev->cpkt.value = cpu_to_virtio16(portdev->vdev, value);
582+
583+ sg_init_one(sg, &portdev->cpkt, sizeof(struct virtio_console_control));
584+
585+ if (virtqueue_add_outbuf(vq, sg, 1, &portdev->cpkt, GFP_ATOMIC) == 0) {
580586 virtqueue_kick(vq);
581587 while (!virtqueue_get_buf(vq, &len)
582588 && !virtqueue_is_broken(vq))
583589 cpu_relax();
584590 }
591+
585592 spin_unlock(&portdev->c_ovq_lock);
586593 return 0;
587594 }
drivers/virtio/virtio_ring.c+1−1
@@ -167,7 +167,7 @@ static bool vring_use_dma_api(struct virtio_device *vdev) · 166 unmodified lines
167167 * making all of the arch DMA ops work on the vring device itself
168168 * is a mess. For now, we use the parent device for DMA ops.
169169 */
170−struct device *vring_dma_dev(const struct vring_virtqueue *vq)
170+static struct device *vring_dma_dev(const struct vring_virtqueue *vq)
171171 {
172172 return vq->vq.vdev->dev.parent;
173173 }

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