diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 12:23:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 12:23:45 -0400 |
commit | 1f0918d03ff4b5c94540c71ce889672abdbc2f4a (patch) | |
tree | ecee710444fb3405da55933501e339e10e4ac880 /Documentation | |
parent | 4266c97a3ef4604561a22212eb0eab8a3c338971 (diff) | |
parent | ca60a42c9be41c07ebcc2ec8c43dd1be53f147bf (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: don't force VIRTIO_F_NOTIFY_ON_EMPTY
lguest: cleanup for map_switcher()
lguest: use PGDIR_SHIFT for PAE code to allow different PAGE_OFFSET
lguest: use set_pte/set_pmd uniformly for real page table entries
lguest: move panic notifier registration to its expected place.
virtio_blk: add support for cache flush
virtio: add virtio IDs file
virtio: get rid of redundant VIRTIO_ID_9P definition
virtio: make add_buf return capacity remaining
virtio_pci: minor MSI-X cleanups
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/lguest/lguest.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 950cde6d6e58..ba9373f82ab5 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <signal.h> | 42 | #include <signal.h> |
43 | #include "linux/lguest_launcher.h" | 43 | #include "linux/lguest_launcher.h" |
44 | #include "linux/virtio_config.h" | 44 | #include "linux/virtio_config.h" |
45 | #include <linux/virtio_ids.h> | ||
45 | #include "linux/virtio_net.h" | 46 | #include "linux/virtio_net.h" |
46 | #include "linux/virtio_blk.h" | 47 | #include "linux/virtio_blk.h" |
47 | #include "linux/virtio_console.h" | 48 | #include "linux/virtio_console.h" |
@@ -133,6 +134,9 @@ struct device { | |||
133 | /* Is it operational */ | 134 | /* Is it operational */ |
134 | bool running; | 135 | bool running; |
135 | 136 | ||
137 | /* Does Guest want an intrrupt on empty? */ | ||
138 | bool irq_on_empty; | ||
139 | |||
136 | /* Device-specific data. */ | 140 | /* Device-specific data. */ |
137 | void *priv; | 141 | void *priv; |
138 | }; | 142 | }; |
@@ -623,10 +627,13 @@ static void trigger_irq(struct virtqueue *vq) | |||
623 | return; | 627 | return; |
624 | vq->pending_used = 0; | 628 | vq->pending_used = 0; |
625 | 629 | ||
626 | /* If they don't want an interrupt, don't send one, unless empty. */ | 630 | /* If they don't want an interrupt, don't send one... */ |
627 | if ((vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) | 631 | if (vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT) { |
628 | && lg_last_avail(vq) != vq->vring.avail->idx) | 632 | /* ... unless they've asked us to force one on empty. */ |
629 | return; | 633 | if (!vq->dev->irq_on_empty |
634 | || lg_last_avail(vq) != vq->vring.avail->idx) | ||
635 | return; | ||
636 | } | ||
630 | 637 | ||
631 | /* Send the Guest an interrupt tell them we used something up. */ | 638 | /* Send the Guest an interrupt tell them we used something up. */ |
632 | if (write(lguest_fd, buf, sizeof(buf)) != 0) | 639 | if (write(lguest_fd, buf, sizeof(buf)) != 0) |
@@ -1042,6 +1049,15 @@ static void create_thread(struct virtqueue *vq) | |||
1042 | close(vq->eventfd); | 1049 | close(vq->eventfd); |
1043 | } | 1050 | } |
1044 | 1051 | ||
1052 | static bool accepted_feature(struct device *dev, unsigned int bit) | ||
1053 | { | ||
1054 | const u8 *features = get_feature_bits(dev) + dev->feature_len; | ||
1055 | |||
1056 | if (dev->feature_len < bit / CHAR_BIT) | ||
1057 | return false; | ||
1058 | return features[bit / CHAR_BIT] & (1 << (bit % CHAR_BIT)); | ||
1059 | } | ||
1060 | |||
1045 | static void start_device(struct device *dev) | 1061 | static void start_device(struct device *dev) |
1046 | { | 1062 | { |
1047 | unsigned int i; | 1063 | unsigned int i; |
@@ -1055,6 +1071,8 @@ static void start_device(struct device *dev) | |||
1055 | verbose(" %02x", get_feature_bits(dev) | 1071 | verbose(" %02x", get_feature_bits(dev) |
1056 | [dev->feature_len+i]); | 1072 | [dev->feature_len+i]); |
1057 | 1073 | ||
1074 | dev->irq_on_empty = accepted_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); | ||
1075 | |||
1058 | for (vq = dev->vq; vq; vq = vq->next) { | 1076 | for (vq = dev->vq; vq; vq = vq->next) { |
1059 | if (vq->service) | 1077 | if (vq->service) |
1060 | create_thread(vq); | 1078 | create_thread(vq); |