diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-30 13:20:03 -0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-30 13:20:03 -0400 | 
| commit | ab8cd81830fef799177740d5ab709c0341e9ba5c (patch) | |
| tree | 40c27d1cd27a436ec195174a105fa27c223ed6dd /Documentation/lguest/lguest.c | |
| parent | f8356ed00ebcdc2f209504c02b4ab8ba9a8a7ebe (diff) | |
| parent | 20887611523e749d99cc7d64ff6c97d27529fbae (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
  lguest: notify on empty
  virtio: force callback on empty.
  virtio_blk: fix endianess annotations
  virtio_config: fix len calculation of config elements
  virtio_net: another race with virtio_net and enable_cb
  virtio: An entropy device, as suggested by hpa.
  virtio_blk: allow read-only disks
  lguest: fix ugly <NULL> in /proc/interrupts
  virtio: set device index in common code.
  virtio: virtio_pci should not set bus_id.
  virtio: bus_id for devices should contain 'virtio'
  Fix crash in virtio_blk during modprobe ; rmmod ; modprobe
  lguest: use ioremap_cache, not ioremap
Diffstat (limited to 'Documentation/lguest/lguest.c')
| -rw-r--r-- | Documentation/lguest/lguest.c | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 3be8ab2a886a..82fafe0429fe 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
| @@ -157,6 +157,9 @@ struct virtqueue | |||
| 157 | 157 | ||
| 158 | /* The routine to call when the Guest pings us. */ | 158 | /* The routine to call when the Guest pings us. */ | 
| 159 | void (*handle_output)(int fd, struct virtqueue *me); | 159 | void (*handle_output)(int fd, struct virtqueue *me); | 
| 160 | |||
| 161 | /* Outstanding buffers */ | ||
| 162 | unsigned int inflight; | ||
| 160 | }; | 163 | }; | 
| 161 | 164 | ||
| 162 | /* Remember the arguments to the program so we can "reboot" */ | 165 | /* Remember the arguments to the program so we can "reboot" */ | 
| @@ -702,6 +705,7 @@ static unsigned get_vq_desc(struct virtqueue *vq, | |||
| 702 | errx(1, "Looped descriptor"); | 705 | errx(1, "Looped descriptor"); | 
| 703 | } while ((i = next_desc(vq, i)) != vq->vring.num); | 706 | } while ((i = next_desc(vq, i)) != vq->vring.num); | 
| 704 | 707 | ||
| 708 | vq->inflight++; | ||
| 705 | return head; | 709 | return head; | 
| 706 | } | 710 | } | 
| 707 | 711 | ||
| @@ -719,6 +723,7 @@ static void add_used(struct virtqueue *vq, unsigned int head, int len) | |||
| 719 | /* Make sure buffer is written before we update index. */ | 723 | /* Make sure buffer is written before we update index. */ | 
| 720 | wmb(); | 724 | wmb(); | 
| 721 | vq->vring.used->idx++; | 725 | vq->vring.used->idx++; | 
| 726 | vq->inflight--; | ||
| 722 | } | 727 | } | 
| 723 | 728 | ||
| 724 | /* This actually sends the interrupt for this virtqueue */ | 729 | /* This actually sends the interrupt for this virtqueue */ | 
| @@ -726,8 +731,9 @@ static void trigger_irq(int fd, struct virtqueue *vq) | |||
| 726 | { | 731 | { | 
| 727 | unsigned long buf[] = { LHREQ_IRQ, vq->config.irq }; | 732 | unsigned long buf[] = { LHREQ_IRQ, vq->config.irq }; | 
| 728 | 733 | ||
| 729 | /* If they don't want an interrupt, don't send one. */ | 734 | /* If they don't want an interrupt, don't send one, unless empty. */ | 
| 730 | if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) | 735 | if ((vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) | 
| 736 | && vq->inflight) | ||
| 731 | return; | 737 | return; | 
| 732 | 738 | ||
| 733 | /* Send the Guest an interrupt tell them we used something up. */ | 739 | /* Send the Guest an interrupt tell them we used something up. */ | 
| @@ -1107,6 +1113,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs, | |||
| 1107 | vq->next = NULL; | 1113 | vq->next = NULL; | 
| 1108 | vq->last_avail_idx = 0; | 1114 | vq->last_avail_idx = 0; | 
| 1109 | vq->dev = dev; | 1115 | vq->dev = dev; | 
| 1116 | vq->inflight = 0; | ||
| 1110 | 1117 | ||
| 1111 | /* Initialize the configuration. */ | 1118 | /* Initialize the configuration. */ | 
| 1112 | vq->config.num = num_descs; | 1119 | vq->config.num = num_descs; | 
| @@ -1368,6 +1375,7 @@ static void setup_tun_net(const char *arg) | |||
| 1368 | 1375 | ||
| 1369 | /* Tell Guest what MAC address to use. */ | 1376 | /* Tell Guest what MAC address to use. */ | 
| 1370 | add_feature(dev, VIRTIO_NET_F_MAC); | 1377 | add_feature(dev, VIRTIO_NET_F_MAC); | 
| 1378 | add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); | ||
| 1371 | set_config(dev, sizeof(conf), &conf); | 1379 | set_config(dev, sizeof(conf), &conf); | 
| 1372 | 1380 | ||
| 1373 | /* We don't need the socket any more; setup is done. */ | 1381 | /* We don't need the socket any more; setup is done. */ | 
