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
165 */165 */
166 struct virtqueue *c_ivq, *c_ovq;166 struct virtqueue *c_ivq, *c_ovq;
167 167
168 /*
169 * A control packet buffer for guest->host requests, protected
170 * by c_ovq_lock.
171 */
172 struct virtio_console_control cpkt;
173
168 /* Array of per-port IO virtqueues */174 /* Array of per-port IO virtqueues */
169 struct virtqueue **in_vqs, **out_vqs;175 struct virtqueue **in_vqs, **out_vqs;
170 176
@@ -560,28 +566,29 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, · 389 unmodified lines
560 unsigned int event, unsigned int value)566 unsigned int event, unsigned int value)
561{567{
562 struct scatterlist sg[1];568 struct scatterlist sg[1];
563 struct virtio_console_control cpkt;
564 struct virtqueue *vq;569 struct virtqueue *vq;
565 unsigned int len;570 unsigned int len;
566 571
567 if (!use_multiport(portdev))572 if (!use_multiport(portdev))
568 return 0;573 return 0;
569 574
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
574 vq = portdev->c_ovq;575 vq = portdev->c_ovq;
575 576
576 sg_init_one(sg, &cpkt, sizeof(cpkt));
577
578 spin_lock(&portdev->c_ovq_lock);577 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) {
580 virtqueue_kick(vq);586 virtqueue_kick(vq);
581 while (!virtqueue_get_buf(vq, &len)587 while (!virtqueue_get_buf(vq, &len)
582 && !virtqueue_is_broken(vq))588 && !virtqueue_is_broken(vq))
583 cpu_relax();589 cpu_relax();
584 }590 }
591
585 spin_unlock(&portdev->c_ovq_lock);592 spin_unlock(&portdev->c_ovq_lock);
586 return 0;593 return 0;
587}594}
drivers/virtio/virtio_ring.c+1−1
@@ -167,7 +167,7 @@ static bool vring_use_dma_api(struct virtio_device *vdev) · 166 unmodified lines
167 * making all of the arch DMA ops work on the vring device itself167 * making all of the arch DMA ops work on the vring device itself
168 * is a mess. For now, we use the parent device for DMA ops.168 * is a mess. For now, we use the parent device for DMA ops.
169 */169 */
170struct device *vring_dma_dev(const struct vring_virtqueue *vq)170static struct device *vring_dma_dev(const struct vring_virtqueue *vq)
171{171{
172 return vq->vq.vdev->dev.parent;172 return vq->vq.vdev->dev.parent;
173}173}

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