aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/SubmittingPatches26
-rw-r--r--Documentation/arm/Interrupts10
-rw-r--r--Documentation/feature-removal-schedule.txt24
-rw-r--r--Documentation/i2c/upgrading-clients281
-rw-r--r--Documentation/kdump/kdump.txt20
-rw-r--r--Documentation/lguest/lguest.c519
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt1
-rw-r--r--Documentation/sparse.txt8
-rw-r--r--Documentation/video4linux/CARDLIST.au08281
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx45
-rw-r--r--Documentation/video4linux/gspca.txt2
11 files changed, 778 insertions, 159 deletions
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
index 118ca6e9404f..f79ad9ff6031 100644
--- a/Documentation/SubmittingPatches
+++ b/Documentation/SubmittingPatches
@@ -528,7 +528,33 @@ See more details on the proper patch format in the following
528references. 528references.
529 529
530 530
53116) Sending "git pull" requests (from Linus emails)
531 532
533Please write the git repo address and branch name alone on the same line
534so that I can't even by mistake pull from the wrong branch, and so
535that a triple-click just selects the whole thing.
536
537So the proper format is something along the lines of:
538
539 "Please pull from
540
541 git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus
542
543 to get these changes:"
544
545so that I don't have to hunt-and-peck for the address and inevitably
546get it wrong (actually, I've only gotten it wrong a few times, and
547checking against the diffstat tells me when I get it wrong, but I'm
548just a lot more comfortable when I don't have to "look for" the right
549thing to pull, and double-check that I have the right branch-name).
550
551
552Please use "git diff -M --stat --summary" to generate the diffstat:
553the -M enables rename detection, and the summary enables a summary of
554new/deleted or renamed files.
555
556With rename detection, the statistics are rather different [...]
557because git will notice that a fair number of the changes are renames.
532 558
533----------------------------------- 559-----------------------------------
534SECTION 2 - HINTS, TIPS, AND TRICKS 560SECTION 2 - HINTS, TIPS, AND TRICKS
diff --git a/Documentation/arm/Interrupts b/Documentation/arm/Interrupts
index 0d3dbf1099bc..c202ed35d7d6 100644
--- a/Documentation/arm/Interrupts
+++ b/Documentation/arm/Interrupts
@@ -138,14 +138,8 @@ So, what's changed?
138 138
139 Set active the IRQ edge(s)/level. This replaces the 139 Set active the IRQ edge(s)/level. This replaces the
140 SA1111 INTPOL manipulation, and the set_GPIO_IRQ_edge() 140 SA1111 INTPOL manipulation, and the set_GPIO_IRQ_edge()
141 function. Type should be one of the following: 141 function. Type should be one of IRQ_TYPE_xxx defined in
142 142 <linux/irq.h>
143 #define IRQT_NOEDGE (0)
144 #define IRQT_RISING (__IRQT_RISEDGE)
145 #define IRQT_FALLING (__IRQT_FALEDGE)
146 #define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE)
147 #define IRQT_LOW (__IRQT_LOWLVL)
148 #define IRQT_HIGH (__IRQT_HIGHLVL)
149 143
1503. set_GPIO_IRQ_edge() is obsolete, and should be replaced by set_irq_type. 1443. set_GPIO_IRQ_edge() is obsolete, and should be replaced by set_irq_type.
151 145
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 721c71b86e06..c23955404bf5 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -47,6 +47,30 @@ Who: Mauro Carvalho Chehab <mchehab@infradead.org>
47 47
48--------------------------- 48---------------------------
49 49
50What: old tuner-3036 i2c driver
51When: 2.6.28
52Why: This driver is for VERY old i2c-over-parallel port teletext receiver
53 boxes. Rather then spending effort on converting this driver to V4L2,
54 and since it is extremely unlikely that anyone still uses one of these
55 devices, it was decided to drop it.
56Who: Hans Verkuil <hverkuil@xs4all.nl>
57 Mauro Carvalho Chehab <mchehab@infradead.org>
58
59 ---------------------------
60
61What: V4L2 dpc7146 driver
62When: 2.6.28
63Why: Old driver for the dpc7146 demonstration board that is no longer
64 relevant. The last time this was tested on actual hardware was
65 probably around 2002. Since this is a driver for a demonstration
66 board the decision was made to remove it rather than spending a
67 lot of effort continually updating this driver to stay in sync
68 with the latest internal V4L2 or I2C API.
69Who: Hans Verkuil <hverkuil@xs4all.nl>
70 Mauro Carvalho Chehab <mchehab@infradead.org>
71
72---------------------------
73
50What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl]) 74What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl])
51When: November 2005 75When: November 2005
52Files: drivers/pcmcia/: pcmcia_ioctl.c 76Files: drivers/pcmcia/: pcmcia_ioctl.c
diff --git a/Documentation/i2c/upgrading-clients b/Documentation/i2c/upgrading-clients
new file mode 100644
index 000000000000..9a45f9bb6a25
--- /dev/null
+++ b/Documentation/i2c/upgrading-clients
@@ -0,0 +1,281 @@
1Upgrading I2C Drivers to the new 2.6 Driver Model
2=================================================
3
4Ben Dooks <ben-linux@fluff.org>
5
6Introduction
7------------
8
9This guide outlines how to alter existing Linux 2.6 client drivers from
10the old to the new new binding methods.
11
12
13Example old-style driver
14------------------------
15
16
17struct example_state {
18 struct i2c_client client;
19 ....
20};
21
22static struct i2c_driver example_driver;
23
24static unsigned short ignore[] = { I2C_CLIENT_END };
25static unsigned short normal_addr[] = { OUR_ADDR, I2C_CLIENT_END };
26
27I2C_CLIENT_INSMOD;
28
29static int example_attach(struct i2c_adapter *adap, int addr, int kind)
30{
31 struct example_state *state;
32 struct device *dev = &adap->dev; /* to use for dev_ reports */
33 int ret;
34
35 state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
36 if (state == NULL) {
37 dev_err(dev, "failed to create our state\n");
38 return -ENOMEM;
39 }
40
41 example->client.addr = addr;
42 example->client.flags = 0;
43 example->client.adapter = adap;
44
45 i2c_set_clientdata(&state->i2c_client, state);
46 strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE);
47
48 ret = i2c_attach_client(&state->i2c_client);
49 if (ret < 0) {
50 dev_err(dev, "failed to attach client\n");
51 kfree(state);
52 return ret;
53 }
54
55 dev = &state->i2c_client.dev;
56
57 /* rest of the initialisation goes here. */
58
59 dev_info(dev, "example client created\n");
60
61 return 0;
62}
63
64static int __devexit example_detach(struct i2c_client *client)
65{
66 struct example_state *state = i2c_get_clientdata(client);
67
68 i2c_detach_client(client);
69 kfree(state);
70 return 0;
71}
72
73static int example_attach_adapter(struct i2c_adapter *adap)
74{
75 return i2c_probe(adap, &addr_data, example_attach);
76}
77
78static struct i2c_driver example_driver = {
79 .driver = {
80 .owner = THIS_MODULE,
81 .name = "example",
82 },
83 .attach_adapter = example_attach_adapter,
84 .detach_client = __devexit_p(example_detach),
85 .suspend = example_suspend,
86 .resume = example_resume,
87};
88
89
90Updating the client
91-------------------
92
93The new style binding model will check against a list of supported
94devices and their associated address supplied by the code registering
95the busses. This means that the driver .attach_adapter and
96.detach_adapter methods can be removed, along with the addr_data,
97as follows:
98
99- static struct i2c_driver example_driver;
100
101- static unsigned short ignore[] = { I2C_CLIENT_END };
102- static unsigned short normal_addr[] = { OUR_ADDR, I2C_CLIENT_END };
103
104- I2C_CLIENT_INSMOD;
105
106- static int example_attach_adapter(struct i2c_adapter *adap)
107- {
108- return i2c_probe(adap, &addr_data, example_attach);
109- }
110
111 static struct i2c_driver example_driver = {
112- .attach_adapter = example_attach_adapter,
113- .detach_client = __devexit_p(example_detach),
114 }
115
116Add the probe and remove methods to the i2c_driver, as so:
117
118 static struct i2c_driver example_driver = {
119+ .probe = example_probe,
120+ .remove = __devexit_p(example_remove),
121 }
122
123Change the example_attach method to accept the new parameters
124which include the i2c_client that it will be working with:
125
126- static int example_attach(struct i2c_adapter *adap, int addr, int kind)
127+ static int example_probe(struct i2c_client *client,
128+ const struct i2c_device_id *id)
129
130Change the name of example_attach to example_probe to align it with the
131i2c_driver entry names. The rest of the probe routine will now need to be
132changed as the i2c_client has already been setup for use.
133
134The necessary client fields have already been setup before
135the probe function is called, so the following client setup
136can be removed:
137
138- example->client.addr = addr;
139- example->client.flags = 0;
140- example->client.adapter = adap;
141-
142- strlcpy(client->i2c_client.name, "example", I2C_NAME_SIZE);
143
144The i2c_set_clientdata is now:
145
146- i2c_set_clientdata(&state->client, state);
147+ i2c_set_clientdata(client, state);
148
149The call to i2c_attach_client is no longer needed, if the probe
150routine exits successfully, then the driver will be automatically
151attached by the core. Change the probe routine as so:
152
153- ret = i2c_attach_client(&state->i2c_client);
154- if (ret < 0) {
155- dev_err(dev, "failed to attach client\n");
156- kfree(state);
157- return ret;
158- }
159
160
161Remove the storage of 'struct i2c_client' from the 'struct example_state'
162as we are provided with the i2c_client in our example_probe. Instead we
163store a pointer to it for when it is needed.
164
165struct example_state {
166- struct i2c_client client;
167+ struct i2c_client *client;
168
169the new i2c client as so:
170
171- struct device *dev = &adap->dev; /* to use for dev_ reports */
172+ struct device *dev = &i2c_client->dev; /* to use for dev_ reports */
173
174And remove the change after our client is attached, as the driver no
175longer needs to register a new client structure with the core:
176
177- dev = &state->i2c_client.dev;
178
179In the probe routine, ensure that the new state has the client stored
180in it:
181
182static int example_probe(struct i2c_client *i2c_client,
183 const struct i2c_device_id *id)
184{
185 struct example_state *state;
186 struct device *dev = &i2c_client->dev;
187 int ret;
188
189 state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
190 if (state == NULL) {
191 dev_err(dev, "failed to create our state\n");
192 return -ENOMEM;
193 }
194
195+ state->client = i2c_client;
196
197Update the detach method, by changing the name to _remove and
198to delete the i2c_detach_client call. It is possible that you
199can also remove the ret variable as it is not not needed for
200any of the core functions.
201
202- static int __devexit example_detach(struct i2c_client *client)
203+ static int __devexit example_remove(struct i2c_client *client)
204{
205 struct example_state *state = i2c_get_clientdata(client);
206
207- i2c_detach_client(client);
208
209And finally ensure that we have the correct ID table for the i2c-core
210and other utilities:
211
212+ struct i2c_device_id example_idtable[] = {
213+ { "example", 0 },
214+ { }
215+};
216+
217+MODULE_DEVICE_TABLE(i2c, example_idtable);
218
219static struct i2c_driver example_driver = {
220 .driver = {
221 .owner = THIS_MODULE,
222 .name = "example",
223 },
224+ .id_table = example_ids,
225
226
227Our driver should now look like this:
228
229struct example_state {
230 struct i2c_client *client;
231 ....
232};
233
234static int example_probe(struct i2c_client *client,
235 const struct i2c_device_id *id)
236{
237 struct example_state *state;
238 struct device *dev = &client->dev;
239
240 state = kzalloc(sizeof(struct example_state), GFP_KERNEL);
241 if (state == NULL) {
242 dev_err(dev, "failed to create our state\n");
243 return -ENOMEM;
244 }
245
246 state->client = client;
247 i2c_set_clientdata(client, state);
248
249 /* rest of the initialisation goes here. */
250
251 dev_info(dev, "example client created\n");
252
253 return 0;
254}
255
256static int __devexit example_remove(struct i2c_client *client)
257{
258 struct example_state *state = i2c_get_clientdata(client);
259
260 kfree(state);
261 return 0;
262}
263
264static struct i2c_device_id example_idtable[] = {
265 { "example", 0 },
266 { }
267};
268
269MODULE_DEVICE_TABLE(i2c, example_idtable);
270
271static struct i2c_driver example_driver = {
272 .driver = {
273 .owner = THIS_MODULE,
274 .name = "example",
275 },
276 .id_table = example_idtable,
277 .probe = example_probe,
278 .remove = __devexit_p(example_remove),
279 .suspend = example_suspend,
280 .resume = example_resume,
281};
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 9691c7f5166c..0705040531a5 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -65,26 +65,26 @@ Install kexec-tools
65 65
662) Download the kexec-tools user-space package from the following URL: 662) Download the kexec-tools user-space package from the following URL:
67 67
68http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools-testing.tar.gz 68http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/kexec-tools.tar.gz
69 69
70This is a symlink to the latest version, which at the time of writing is 70This is a symlink to the latest version.
7120061214, the only release of kexec-tools-testing so far. As other versions
72are released, the older ones will remain available at
73http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
74 71
75Note: Latest kexec-tools-testing git tree is available at 72The latest kexec-tools git tree is available at:
76 73
77git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools-testing.git 74git://git.kernel.org/pub/scm/linux/kernel/git/horms/kexec-tools.git
78or 75or
79http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools-testing.git;a=summary 76http://www.kernel.org/git/?p=linux/kernel/git/horms/kexec-tools.git
77
78More information about kexec-tools can be found at
79http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/README.html
80 80
813) Unpack the tarball with the tar command, as follows: 813) Unpack the tarball with the tar command, as follows:
82 82
83 tar xvpzf kexec-tools-testing.tar.gz 83 tar xvpzf kexec-tools.tar.gz
84 84
854) Change to the kexec-tools directory, as follows: 854) Change to the kexec-tools directory, as follows:
86 86
87 cd kexec-tools-testing-VERSION 87 cd kexec-tools-VERSION
88 88
895) Configure the package, as follows: 895) Configure the package, as follows:
90 90
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 82fafe0429fe..b88b0ea54e90 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -36,11 +36,13 @@
36#include <sched.h> 36#include <sched.h>
37#include <limits.h> 37#include <limits.h>
38#include <stddef.h> 38#include <stddef.h>
39#include <signal.h>
39#include "linux/lguest_launcher.h" 40#include "linux/lguest_launcher.h"
40#include "linux/virtio_config.h" 41#include "linux/virtio_config.h"
41#include "linux/virtio_net.h" 42#include "linux/virtio_net.h"
42#include "linux/virtio_blk.h" 43#include "linux/virtio_blk.h"
43#include "linux/virtio_console.h" 44#include "linux/virtio_console.h"
45#include "linux/virtio_rng.h"
44#include "linux/virtio_ring.h" 46#include "linux/virtio_ring.h"
45#include "asm-x86/bootparam.h" 47#include "asm-x86/bootparam.h"
46/*L:110 We can ignore the 39 include files we need for this program, but I do 48/*L:110 We can ignore the 39 include files we need for this program, but I do
@@ -64,8 +66,8 @@ typedef uint8_t u8;
64#endif 66#endif
65/* We can have up to 256 pages for devices. */ 67/* We can have up to 256 pages for devices. */
66#define DEVICE_PAGES 256 68#define DEVICE_PAGES 256
67/* This will occupy 2 pages: it must be a power of 2. */ 69/* This will occupy 3 pages: it must be a power of 2. */
68#define VIRTQUEUE_NUM 128 70#define VIRTQUEUE_NUM 256
69 71
70/*L:120 verbose is both a global flag and a macro. The C preprocessor allows 72/*L:120 verbose is both a global flag and a macro. The C preprocessor allows
71 * this, and although I wouldn't recommend it, it works quite nicely here. */ 73 * this, and although I wouldn't recommend it, it works quite nicely here. */
@@ -74,12 +76,19 @@ static bool verbose;
74 do { if (verbose) printf(args); } while(0) 76 do { if (verbose) printf(args); } while(0)
75/*:*/ 77/*:*/
76 78
77/* The pipe to send commands to the waker process */ 79/* File descriptors for the Waker. */
78static int waker_fd; 80struct {
81 int pipe[2];
82 int lguest_fd;
83} waker_fds;
84
79/* The pointer to the start of guest memory. */ 85/* The pointer to the start of guest memory. */
80static void *guest_base; 86static void *guest_base;
81/* The maximum guest physical address allowed, and maximum possible. */ 87/* The maximum guest physical address allowed, and maximum possible. */
82static unsigned long guest_limit, guest_max; 88static unsigned long guest_limit, guest_max;
89/* The pipe for signal hander to write to. */
90static int timeoutpipe[2];
91static unsigned int timeout_usec = 500;
83 92
84/* a per-cpu variable indicating whose vcpu is currently running */ 93/* a per-cpu variable indicating whose vcpu is currently running */
85static unsigned int __thread cpu_id; 94static unsigned int __thread cpu_id;
@@ -155,11 +164,14 @@ struct virtqueue
155 /* Last available index we saw. */ 164 /* Last available index we saw. */
156 u16 last_avail_idx; 165 u16 last_avail_idx;
157 166
158 /* The routine to call when the Guest pings us. */ 167 /* The routine to call when the Guest pings us, or timeout. */
159 void (*handle_output)(int fd, struct virtqueue *me); 168 void (*handle_output)(int fd, struct virtqueue *me, bool timeout);
160 169
161 /* Outstanding buffers */ 170 /* Outstanding buffers */
162 unsigned int inflight; 171 unsigned int inflight;
172
173 /* Is this blocked awaiting a timer? */
174 bool blocked;
163}; 175};
164 176
165/* Remember the arguments to the program so we can "reboot" */ 177/* Remember the arguments to the program so we can "reboot" */
@@ -190,6 +202,9 @@ static void *_convert(struct iovec *iov, size_t size, size_t align,
190 return iov->iov_base; 202 return iov->iov_base;
191} 203}
192 204
205/* Wrapper for the last available index. Makes it easier to change. */
206#define lg_last_avail(vq) ((vq)->last_avail_idx)
207
193/* The virtio configuration space is defined to be little-endian. x86 is 208/* The virtio configuration space is defined to be little-endian. x86 is
194 * little-endian too, but it's nice to be explicit so we have these helpers. */ 209 * little-endian too, but it's nice to be explicit so we have these helpers. */
195#define cpu_to_le16(v16) (v16) 210#define cpu_to_le16(v16) (v16)
@@ -199,6 +214,33 @@ static void *_convert(struct iovec *iov, size_t size, size_t align,
199#define le32_to_cpu(v32) (v32) 214#define le32_to_cpu(v32) (v32)
200#define le64_to_cpu(v64) (v64) 215#define le64_to_cpu(v64) (v64)
201 216
217/* Is this iovec empty? */
218static bool iov_empty(const struct iovec iov[], unsigned int num_iov)
219{
220 unsigned int i;
221
222 for (i = 0; i < num_iov; i++)
223 if (iov[i].iov_len)
224 return false;
225 return true;
226}
227
228/* Take len bytes from the front of this iovec. */
229static void iov_consume(struct iovec iov[], unsigned num_iov, unsigned len)
230{
231 unsigned int i;
232
233 for (i = 0; i < num_iov; i++) {
234 unsigned int used;
235
236 used = iov[i].iov_len < len ? iov[i].iov_len : len;
237 iov[i].iov_base += used;
238 iov[i].iov_len -= used;
239 len -= used;
240 }
241 assert(len == 0);
242}
243
202/* The device virtqueue descriptors are followed by feature bitmasks. */ 244/* The device virtqueue descriptors are followed by feature bitmasks. */
203static u8 *get_feature_bits(struct device *dev) 245static u8 *get_feature_bits(struct device *dev)
204{ 246{
@@ -254,6 +296,7 @@ static void *map_zeroed_pages(unsigned int num)
254 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0); 296 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, fd, 0);
255 if (addr == MAP_FAILED) 297 if (addr == MAP_FAILED)
256 err(1, "Mmaping %u pages of /dev/zero", num); 298 err(1, "Mmaping %u pages of /dev/zero", num);
299 close(fd);
257 300
258 return addr; 301 return addr;
259} 302}
@@ -540,69 +583,64 @@ static void add_device_fd(int fd)
540 * watch, but handing a file descriptor mask through to the kernel is fairly 583 * watch, but handing a file descriptor mask through to the kernel is fairly
541 * icky. 584 * icky.
542 * 585 *
543 * Instead, we fork off a process which watches the file descriptors and writes 586 * Instead, we clone off a thread which watches the file descriptors and writes
544 * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host 587 * the LHREQ_BREAK command to the /dev/lguest file descriptor to tell the Host
545 * stop running the Guest. This causes the Launcher to return from the 588 * stop running the Guest. This causes the Launcher to return from the
546 * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset 589 * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset
547 * the LHREQ_BREAK and wake us up again. 590 * the LHREQ_BREAK and wake us up again.
548 * 591 *
549 * This, of course, is merely a different *kind* of icky. 592 * This, of course, is merely a different *kind* of icky.
593 *
594 * Given my well-known antipathy to threads, I'd prefer to use processes. But
595 * it's easier to share Guest memory with threads, and trivial to share the
596 * devices.infds as the Launcher changes it.
550 */ 597 */
551static void wake_parent(int pipefd, int lguest_fd) 598static int waker(void *unused)
552{ 599{
553 /* Add the pipe from the Launcher to the fdset in the device_list, so 600 /* Close the write end of the pipe: only the Launcher has it open. */
554 * we watch it, too. */ 601 close(waker_fds.pipe[1]);
555 add_device_fd(pipefd);
556 602
557 for (;;) { 603 for (;;) {
558 fd_set rfds = devices.infds; 604 fd_set rfds = devices.infds;
559 unsigned long args[] = { LHREQ_BREAK, 1 }; 605 unsigned long args[] = { LHREQ_BREAK, 1 };
606 unsigned int maxfd = devices.max_infd;
607
608 /* We also listen to the pipe from the Launcher. */
609 FD_SET(waker_fds.pipe[0], &rfds);
610 if (waker_fds.pipe[0] > maxfd)
611 maxfd = waker_fds.pipe[0];
560 612
561 /* Wait until input is ready from one of the devices. */ 613 /* Wait until input is ready from one of the devices. */
562 select(devices.max_infd+1, &rfds, NULL, NULL, NULL); 614 select(maxfd+1, &rfds, NULL, NULL, NULL);
563 /* Is it a message from the Launcher? */ 615
564 if (FD_ISSET(pipefd, &rfds)) { 616 /* Message from Launcher? */
565 int fd; 617 if (FD_ISSET(waker_fds.pipe[0], &rfds)) {
566 /* If read() returns 0, it means the Launcher has 618 char c;
567 * exited. We silently follow. */ 619 /* If this fails, then assume Launcher has exited.
568 if (read(pipefd, &fd, sizeof(fd)) == 0) 620 * Don't do anything on exit: we're just a thread! */
569 exit(0); 621 if (read(waker_fds.pipe[0], &c, 1) != 1)
570 /* Otherwise it's telling us to change what file 622 _exit(0);
571 * descriptors we're to listen to. Positive means 623 continue;
572 * listen to a new one, negative means stop 624 }
573 * listening. */ 625
574 if (fd >= 0) 626 /* Send LHREQ_BREAK command to snap the Launcher out of it. */
575 FD_SET(fd, &devices.infds); 627 pwrite(waker_fds.lguest_fd, args, sizeof(args), cpu_id);
576 else
577 FD_CLR(-fd - 1, &devices.infds);
578 } else /* Send LHREQ_BREAK command. */
579 pwrite(lguest_fd, args, sizeof(args), cpu_id);
580 } 628 }
629 return 0;
581} 630}
582 631
583/* This routine just sets up a pipe to the Waker process. */ 632/* This routine just sets up a pipe to the Waker process. */
584static int setup_waker(int lguest_fd) 633static void setup_waker(int lguest_fd)
585{ 634{
586 int pipefd[2], child; 635 /* This pipe is closed when Launcher dies, telling Waker. */
587 636 if (pipe(waker_fds.pipe) != 0)
588 /* We create a pipe to talk to the Waker, and also so it knows when the 637 err(1, "Creating pipe for Waker");
589 * Launcher dies (and closes pipe). */
590 pipe(pipefd);
591 child = fork();
592 if (child == -1)
593 err(1, "forking");
594
595 if (child == 0) {
596 /* We are the Waker: close the "writing" end of our copy of the
597 * pipe and start waiting for input. */
598 close(pipefd[1]);
599 wake_parent(pipefd[0], lguest_fd);
600 }
601 /* Close the reading end of our copy of the pipe. */
602 close(pipefd[0]);
603 638
604 /* Here is the fd used to talk to the waker. */ 639 /* Waker also needs to know the lguest fd */
605 return pipefd[1]; 640 waker_fds.lguest_fd = lguest_fd;
641
642 if (clone(waker, malloc(4096) + 4096, CLONE_VM | SIGCHLD, NULL) == -1)
643 err(1, "Creating Waker");
606} 644}
607 645
608/* 646/*
@@ -661,19 +699,22 @@ static unsigned get_vq_desc(struct virtqueue *vq,
661 unsigned int *out_num, unsigned int *in_num) 699 unsigned int *out_num, unsigned int *in_num)
662{ 700{
663 unsigned int i, head; 701 unsigned int i, head;
702 u16 last_avail;
664 703
665 /* Check it isn't doing very strange things with descriptor numbers. */ 704 /* Check it isn't doing very strange things with descriptor numbers. */
666 if ((u16)(vq->vring.avail->idx - vq->last_avail_idx) > vq->vring.num) 705 last_avail = lg_last_avail(vq);
706 if ((u16)(vq->vring.avail->idx - last_avail) > vq->vring.num)
667 errx(1, "Guest moved used index from %u to %u", 707 errx(1, "Guest moved used index from %u to %u",
668 vq->last_avail_idx, vq->vring.avail->idx); 708 last_avail, vq->vring.avail->idx);
669 709
670 /* If there's nothing new since last we looked, return invalid. */ 710 /* If there's nothing new since last we looked, return invalid. */
671 if (vq->vring.avail->idx == vq->last_avail_idx) 711 if (vq->vring.avail->idx == last_avail)
672 return vq->vring.num; 712 return vq->vring.num;
673 713
674 /* Grab the next descriptor number they're advertising, and increment 714 /* Grab the next descriptor number they're advertising, and increment
675 * the index we've seen. */ 715 * the index we've seen. */
676 head = vq->vring.avail->ring[vq->last_avail_idx++ % vq->vring.num]; 716 head = vq->vring.avail->ring[last_avail % vq->vring.num];
717 lg_last_avail(vq)++;
677 718
678 /* If their number is silly, that's a fatal mistake. */ 719 /* If their number is silly, that's a fatal mistake. */
679 if (head >= vq->vring.num) 720 if (head >= vq->vring.num)
@@ -821,8 +862,8 @@ static bool handle_console_input(int fd, struct device *dev)
821 unsigned long args[] = { LHREQ_BREAK, 0 }; 862 unsigned long args[] = { LHREQ_BREAK, 0 };
822 /* Close the fd so Waker will know it has to 863 /* Close the fd so Waker will know it has to
823 * exit. */ 864 * exit. */
824 close(waker_fd); 865 close(waker_fds.pipe[1]);
825 /* Just in case waker is blocked in BREAK, send 866 /* Just in case Waker is blocked in BREAK, send
826 * unbreak now. */ 867 * unbreak now. */
827 write(fd, args, sizeof(args)); 868 write(fd, args, sizeof(args));
828 exit(2); 869 exit(2);
@@ -839,7 +880,7 @@ static bool handle_console_input(int fd, struct device *dev)
839 880
840/* Handling output for console is simple: we just get all the output buffers 881/* Handling output for console is simple: we just get all the output buffers
841 * and write them to stdout. */ 882 * and write them to stdout. */
842static void handle_console_output(int fd, struct virtqueue *vq) 883static void handle_console_output(int fd, struct virtqueue *vq, bool timeout)
843{ 884{
844 unsigned int head, out, in; 885 unsigned int head, out, in;
845 int len; 886 int len;
@@ -854,6 +895,21 @@ static void handle_console_output(int fd, struct virtqueue *vq)
854 } 895 }
855} 896}
856 897
898static void block_vq(struct virtqueue *vq)
899{
900 struct itimerval itm;
901
902 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
903 vq->blocked = true;
904
905 itm.it_interval.tv_sec = 0;
906 itm.it_interval.tv_usec = 0;
907 itm.it_value.tv_sec = 0;
908 itm.it_value.tv_usec = timeout_usec;
909
910 setitimer(ITIMER_REAL, &itm, NULL);
911}
912
857/* 913/*
858 * The Network 914 * The Network
859 * 915 *
@@ -861,22 +917,34 @@ static void handle_console_output(int fd, struct virtqueue *vq)
861 * and write them (ignoring the first element) to this device's file descriptor 917 * and write them (ignoring the first element) to this device's file descriptor
862 * (/dev/net/tun). 918 * (/dev/net/tun).
863 */ 919 */
864static void handle_net_output(int fd, struct virtqueue *vq) 920static void handle_net_output(int fd, struct virtqueue *vq, bool timeout)
865{ 921{
866 unsigned int head, out, in; 922 unsigned int head, out, in, num = 0;
867 int len; 923 int len;
868 struct iovec iov[vq->vring.num]; 924 struct iovec iov[vq->vring.num];
925 static int last_timeout_num;
869 926
870 /* Keep getting output buffers from the Guest until we run out. */ 927 /* Keep getting output buffers from the Guest until we run out. */
871 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { 928 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
872 if (in) 929 if (in)
873 errx(1, "Input buffers in output queue?"); 930 errx(1, "Input buffers in output queue?");
874 /* Check header, but otherwise ignore it (we told the Guest we 931 len = writev(vq->dev->fd, iov, out);
875 * supported no features, so it shouldn't have anything 932 if (len < 0)
876 * interesting). */ 933 err(1, "Writing network packet to tun");
877 (void)convert(&iov[0], struct virtio_net_hdr);
878 len = writev(vq->dev->fd, iov+1, out-1);
879 add_used_and_trigger(fd, vq, head, len); 934 add_used_and_trigger(fd, vq, head, len);
935 num++;
936 }
937
938 /* Block further kicks and set up a timer if we saw anything. */
939 if (!timeout && num)
940 block_vq(vq);
941
942 if (timeout) {
943 if (num < last_timeout_num)
944 timeout_usec += 10;
945 else if (timeout_usec > 1)
946 timeout_usec--;
947 last_timeout_num = num;
880 } 948 }
881} 949}
882 950
@@ -887,7 +955,6 @@ static bool handle_tun_input(int fd, struct device *dev)
887 unsigned int head, in_num, out_num; 955 unsigned int head, in_num, out_num;
888 int len; 956 int len;
889 struct iovec iov[dev->vq->vring.num]; 957 struct iovec iov[dev->vq->vring.num];
890 struct virtio_net_hdr *hdr;
891 958
892 /* First we need a network buffer from the Guests's recv virtqueue. */ 959 /* First we need a network buffer from the Guests's recv virtqueue. */
893 head = get_vq_desc(dev->vq, iov, &out_num, &in_num); 960 head = get_vq_desc(dev->vq, iov, &out_num, &in_num);
@@ -896,25 +963,23 @@ static bool handle_tun_input(int fd, struct device *dev)
896 * early, the Guest won't be ready yet. Wait until the device 963 * early, the Guest won't be ready yet. Wait until the device
897 * status says it's ready. */ 964 * status says it's ready. */
898 /* FIXME: Actually want DRIVER_ACTIVE here. */ 965 /* FIXME: Actually want DRIVER_ACTIVE here. */
899 if (dev->desc->status & VIRTIO_CONFIG_S_DRIVER_OK) 966
900 warn("network: no dma buffer!"); 967 /* Now tell it we want to know if new things appear. */
968 dev->vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
969 wmb();
970
901 /* We'll turn this back on if input buffers are registered. */ 971 /* We'll turn this back on if input buffers are registered. */
902 return false; 972 return false;
903 } else if (out_num) 973 } else if (out_num)
904 errx(1, "Output buffers in network recv queue?"); 974 errx(1, "Output buffers in network recv queue?");
905 975
906 /* First element is the header: we set it to 0 (no features). */
907 hdr = convert(&iov[0], struct virtio_net_hdr);
908 hdr->flags = 0;
909 hdr->gso_type = VIRTIO_NET_HDR_GSO_NONE;
910
911 /* Read the packet from the device directly into the Guest's buffer. */ 976 /* Read the packet from the device directly into the Guest's buffer. */
912 len = readv(dev->fd, iov+1, in_num-1); 977 len = readv(dev->fd, iov, in_num);
913 if (len <= 0) 978 if (len <= 0)
914 err(1, "reading network"); 979 err(1, "reading network");
915 980
916 /* Tell the Guest about the new packet. */ 981 /* Tell the Guest about the new packet. */
917 add_used_and_trigger(fd, dev->vq, head, sizeof(*hdr) + len); 982 add_used_and_trigger(fd, dev->vq, head, len);
918 983
919 verbose("tun input packet len %i [%02x %02x] (%s)\n", len, 984 verbose("tun input packet len %i [%02x %02x] (%s)\n", len,
920 ((u8 *)iov[1].iov_base)[0], ((u8 *)iov[1].iov_base)[1], 985 ((u8 *)iov[1].iov_base)[0], ((u8 *)iov[1].iov_base)[1],
@@ -927,11 +992,18 @@ static bool handle_tun_input(int fd, struct device *dev)
927/*L:215 This is the callback attached to the network and console input 992/*L:215 This is the callback attached to the network and console input
928 * virtqueues: it ensures we try again, in case we stopped console or net 993 * virtqueues: it ensures we try again, in case we stopped console or net
929 * delivery because Guest didn't have any buffers. */ 994 * delivery because Guest didn't have any buffers. */
930static void enable_fd(int fd, struct virtqueue *vq) 995static void enable_fd(int fd, struct virtqueue *vq, bool timeout)
931{ 996{
932 add_device_fd(vq->dev->fd); 997 add_device_fd(vq->dev->fd);
933 /* Tell waker to listen to it again */ 998 /* Snap the Waker out of its select loop. */
934 write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd)); 999 write(waker_fds.pipe[1], "", 1);
1000}
1001
1002static void net_enable_fd(int fd, struct virtqueue *vq, bool timeout)
1003{
1004 /* We don't need to know again when Guest refills receive buffer. */
1005 vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
1006 enable_fd(fd, vq, timeout);
935} 1007}
936 1008
937/* When the Guest tells us they updated the status field, we handle it. */ 1009/* When the Guest tells us they updated the status field, we handle it. */
@@ -951,7 +1023,7 @@ static void update_device_status(struct device *dev)
951 for (vq = dev->vq; vq; vq = vq->next) { 1023 for (vq = dev->vq; vq; vq = vq->next) {
952 memset(vq->vring.desc, 0, 1024 memset(vq->vring.desc, 0,
953 vring_size(vq->config.num, getpagesize())); 1025 vring_size(vq->config.num, getpagesize()));
954 vq->last_avail_idx = 0; 1026 lg_last_avail(vq) = 0;
955 } 1027 }
956 } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) { 1028 } else if (dev->desc->status & VIRTIO_CONFIG_S_FAILED) {
957 warnx("Device %s configuration FAILED", dev->name); 1029 warnx("Device %s configuration FAILED", dev->name);
@@ -960,10 +1032,10 @@ static void update_device_status(struct device *dev)
960 1032
961 verbose("Device %s OK: offered", dev->name); 1033 verbose("Device %s OK: offered", dev->name);
962 for (i = 0; i < dev->desc->feature_len; i++) 1034 for (i = 0; i < dev->desc->feature_len; i++)
963 verbose(" %08x", get_feature_bits(dev)[i]); 1035 verbose(" %02x", get_feature_bits(dev)[i]);
964 verbose(", accepted"); 1036 verbose(", accepted");
965 for (i = 0; i < dev->desc->feature_len; i++) 1037 for (i = 0; i < dev->desc->feature_len; i++)
966 verbose(" %08x", get_feature_bits(dev) 1038 verbose(" %02x", get_feature_bits(dev)
967 [dev->desc->feature_len+i]); 1039 [dev->desc->feature_len+i]);
968 1040
969 if (dev->ready) 1041 if (dev->ready)
@@ -1000,7 +1072,7 @@ static void handle_output(int fd, unsigned long addr)
1000 if (strcmp(vq->dev->name, "console") != 0) 1072 if (strcmp(vq->dev->name, "console") != 0)
1001 verbose("Output to %s\n", vq->dev->name); 1073 verbose("Output to %s\n", vq->dev->name);
1002 if (vq->handle_output) 1074 if (vq->handle_output)
1003 vq->handle_output(fd, vq); 1075 vq->handle_output(fd, vq, false);
1004 return; 1076 return;
1005 } 1077 }
1006 } 1078 }
@@ -1014,6 +1086,29 @@ static void handle_output(int fd, unsigned long addr)
1014 strnlen(from_guest_phys(addr), guest_limit - addr)); 1086 strnlen(from_guest_phys(addr), guest_limit - addr));
1015} 1087}
1016 1088
1089static void handle_timeout(int fd)
1090{
1091 char buf[32];
1092 struct device *i;
1093 struct virtqueue *vq;
1094
1095 /* Clear the pipe */
1096 read(timeoutpipe[0], buf, sizeof(buf));
1097
1098 /* Check each device and virtqueue: flush blocked ones. */
1099 for (i = devices.dev; i; i = i->next) {
1100 for (vq = i->vq; vq; vq = vq->next) {
1101 if (!vq->blocked)
1102 continue;
1103
1104 vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
1105 vq->blocked = false;
1106 if (vq->handle_output)
1107 vq->handle_output(fd, vq, true);
1108 }
1109 }
1110}
1111
1017/* This is called when the Waker wakes us up: check for incoming file 1112/* This is called when the Waker wakes us up: check for incoming file
1018 * descriptors. */ 1113 * descriptors. */
1019static void handle_input(int fd) 1114static void handle_input(int fd)
@@ -1024,16 +1119,20 @@ static void handle_input(int fd)
1024 for (;;) { 1119 for (;;) {
1025 struct device *i; 1120 struct device *i;
1026 fd_set fds = devices.infds; 1121 fd_set fds = devices.infds;
1122 int num;
1027 1123
1124 num = select(devices.max_infd+1, &fds, NULL, NULL, &poll);
1125 /* Could get interrupted */
1126 if (num < 0)
1127 continue;
1028 /* If nothing is ready, we're done. */ 1128 /* If nothing is ready, we're done. */
1029 if (select(devices.max_infd+1, &fds, NULL, NULL, &poll) == 0) 1129 if (num == 0)
1030 break; 1130 break;
1031 1131
1032 /* Otherwise, call the device(s) which have readable file 1132 /* Otherwise, call the device(s) which have readable file
1033 * descriptors and a method of handling them. */ 1133 * descriptors and a method of handling them. */
1034 for (i = devices.dev; i; i = i->next) { 1134 for (i = devices.dev; i; i = i->next) {
1035 if (i->handle_input && FD_ISSET(i->fd, &fds)) { 1135 if (i->handle_input && FD_ISSET(i->fd, &fds)) {
1036 int dev_fd;
1037 if (i->handle_input(fd, i)) 1136 if (i->handle_input(fd, i))
1038 continue; 1137 continue;
1039 1138
@@ -1043,13 +1142,12 @@ static void handle_input(int fd)
1043 * buffers to deliver into. Console also uses 1142 * buffers to deliver into. Console also uses
1044 * it when it discovers that stdin is closed. */ 1143 * it when it discovers that stdin is closed. */
1045 FD_CLR(i->fd, &devices.infds); 1144 FD_CLR(i->fd, &devices.infds);
1046 /* Tell waker to ignore it too, by sending a
1047 * negative fd number (-1, since 0 is a valid
1048 * FD number). */
1049 dev_fd = -i->fd - 1;
1050 write(waker_fd, &dev_fd, sizeof(dev_fd));
1051 } 1145 }
1052 } 1146 }
1147
1148 /* Is this the timeout fd? */
1149 if (FD_ISSET(timeoutpipe[0], &fds))
1150 handle_timeout(fd);
1053 } 1151 }
1054} 1152}
1055 1153
@@ -1098,7 +1196,7 @@ static struct lguest_device_desc *new_dev_desc(u16 type)
1098/* Each device descriptor is followed by the description of its virtqueues. We 1196/* Each device descriptor is followed by the description of its virtqueues. We
1099 * specify how many descriptors the virtqueue is to have. */ 1197 * specify how many descriptors the virtqueue is to have. */
1100static void add_virtqueue(struct device *dev, unsigned int num_descs, 1198static void add_virtqueue(struct device *dev, unsigned int num_descs,
1101 void (*handle_output)(int fd, struct virtqueue *me)) 1199 void (*handle_output)(int, struct virtqueue *, bool))
1102{ 1200{
1103 unsigned int pages; 1201 unsigned int pages;
1104 struct virtqueue **i, *vq = malloc(sizeof(*vq)); 1202 struct virtqueue **i, *vq = malloc(sizeof(*vq));
@@ -1114,6 +1212,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
1114 vq->last_avail_idx = 0; 1212 vq->last_avail_idx = 0;
1115 vq->dev = dev; 1213 vq->dev = dev;
1116 vq->inflight = 0; 1214 vq->inflight = 0;
1215 vq->blocked = false;
1117 1216
1118 /* Initialize the configuration. */ 1217 /* Initialize the configuration. */
1119 vq->config.num = num_descs; 1218 vq->config.num = num_descs;
@@ -1246,6 +1345,24 @@ static void setup_console(void)
1246} 1345}
1247/*:*/ 1346/*:*/
1248 1347
1348static void timeout_alarm(int sig)
1349{
1350 write(timeoutpipe[1], "", 1);
1351}
1352
1353static void setup_timeout(void)
1354{
1355 if (pipe(timeoutpipe) != 0)
1356 err(1, "Creating timeout pipe");
1357
1358 if (fcntl(timeoutpipe[1], F_SETFL,
1359 fcntl(timeoutpipe[1], F_GETFL) | O_NONBLOCK) != 0)
1360 err(1, "Making timeout pipe nonblocking");
1361
1362 add_device_fd(timeoutpipe[0]);
1363 signal(SIGALRM, timeout_alarm);
1364}
1365
1249/*M:010 Inter-guest networking is an interesting area. Simplest is to have a 1366/*M:010 Inter-guest networking is an interesting area. Simplest is to have a
1250 * --sharenet=<name> option which opens or creates a named pipe. This can be 1367 * --sharenet=<name> option which opens or creates a named pipe. This can be
1251 * used to send packets to another guest in a 1:1 manner. 1368 * used to send packets to another guest in a 1:1 manner.
@@ -1264,10 +1381,25 @@ static void setup_console(void)
1264 1381
1265static u32 str2ip(const char *ipaddr) 1382static u32 str2ip(const char *ipaddr)
1266{ 1383{
1267 unsigned int byte[4]; 1384 unsigned int b[4];
1268 1385
1269 sscanf(ipaddr, "%u.%u.%u.%u", &byte[0], &byte[1], &byte[2], &byte[3]); 1386 if (sscanf(ipaddr, "%u.%u.%u.%u", &b[0], &b[1], &b[2], &b[3]) != 4)
1270 return (byte[0] << 24) | (byte[1] << 16) | (byte[2] << 8) | byte[3]; 1387 errx(1, "Failed to parse IP address '%s'", ipaddr);
1388 return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3];
1389}
1390
1391static void str2mac(const char *macaddr, unsigned char mac[6])
1392{
1393 unsigned int m[6];
1394 if (sscanf(macaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
1395 &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) != 6)
1396 errx(1, "Failed to parse mac address '%s'", macaddr);
1397 mac[0] = m[0];
1398 mac[1] = m[1];
1399 mac[2] = m[2];
1400 mac[3] = m[3];
1401 mac[4] = m[4];
1402 mac[5] = m[5];
1271} 1403}
1272 1404
1273/* This code is "adapted" from libbridge: it attaches the Host end of the 1405/* This code is "adapted" from libbridge: it attaches the Host end of the
@@ -1288,6 +1420,7 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name)
1288 errx(1, "interface %s does not exist!", if_name); 1420 errx(1, "interface %s does not exist!", if_name);
1289 1421
1290 strncpy(ifr.ifr_name, br_name, IFNAMSIZ); 1422 strncpy(ifr.ifr_name, br_name, IFNAMSIZ);
1423 ifr.ifr_name[IFNAMSIZ-1] = '\0';
1291 ifr.ifr_ifindex = ifidx; 1424 ifr.ifr_ifindex = ifidx;
1292 if (ioctl(fd, SIOCBRADDIF, &ifr) < 0) 1425 if (ioctl(fd, SIOCBRADDIF, &ifr) < 0)
1293 err(1, "can't add %s to bridge %s", if_name, br_name); 1426 err(1, "can't add %s to bridge %s", if_name, br_name);
@@ -1296,64 +1429,90 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name)
1296/* This sets up the Host end of the network device with an IP address, brings 1429/* This sets up the Host end of the network device with an IP address, brings
1297 * it up so packets will flow, the copies the MAC address into the hwaddr 1430 * it up so packets will flow, the copies the MAC address into the hwaddr
1298 * pointer. */ 1431 * pointer. */
1299static void configure_device(int fd, const char *devname, u32 ipaddr, 1432static void configure_device(int fd, const char *tapif, u32 ipaddr)
1300 unsigned char hwaddr[6])
1301{ 1433{
1302 struct ifreq ifr; 1434 struct ifreq ifr;
1303 struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; 1435 struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr;
1304 1436
1305 /* Don't read these incantations. Just cut & paste them like I did! */
1306 memset(&ifr, 0, sizeof(ifr)); 1437 memset(&ifr, 0, sizeof(ifr));
1307 strcpy(ifr.ifr_name, devname); 1438 strcpy(ifr.ifr_name, tapif);
1439
1440 /* Don't read these incantations. Just cut & paste them like I did! */
1308 sin->sin_family = AF_INET; 1441 sin->sin_family = AF_INET;
1309 sin->sin_addr.s_addr = htonl(ipaddr); 1442 sin->sin_addr.s_addr = htonl(ipaddr);
1310 if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) 1443 if (ioctl(fd, SIOCSIFADDR, &ifr) != 0)
1311 err(1, "Setting %s interface address", devname); 1444 err(1, "Setting %s interface address", tapif);
1312 ifr.ifr_flags = IFF_UP; 1445 ifr.ifr_flags = IFF_UP;
1313 if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0) 1446 if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0)
1314 err(1, "Bringing interface %s up", devname); 1447 err(1, "Bringing interface %s up", tapif);
1448}
1449
1450static void get_mac(int fd, const char *tapif, unsigned char hwaddr[6])
1451{
1452 struct ifreq ifr;
1453
1454 memset(&ifr, 0, sizeof(ifr));
1455 strcpy(ifr.ifr_name, tapif);
1315 1456
1316 /* SIOC stands for Socket I/O Control. G means Get (vs S for Set 1457 /* SIOC stands for Socket I/O Control. G means Get (vs S for Set
1317 * above). IF means Interface, and HWADDR is hardware address. 1458 * above). IF means Interface, and HWADDR is hardware address.
1318 * Simple! */ 1459 * Simple! */
1319 if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0) 1460 if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0)
1320 err(1, "getting hw address for %s", devname); 1461 err(1, "getting hw address for %s", tapif);
1321 memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6); 1462 memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6);
1322} 1463}
1323 1464
1324/*L:195 Our network is a Host<->Guest network. This can either use bridging or 1465static int get_tun_device(char tapif[IFNAMSIZ])
1325 * routing, but the principle is the same: it uses the "tun" device to inject
1326 * packets into the Host as if they came in from a normal network card. We
1327 * just shunt packets between the Guest and the tun device. */
1328static void setup_tun_net(const char *arg)
1329{ 1466{
1330 struct device *dev;
1331 struct ifreq ifr; 1467 struct ifreq ifr;
1332 int netfd, ipfd; 1468 int netfd;
1333 u32 ip; 1469
1334 const char *br_name = NULL; 1470 /* Start with this zeroed. Messy but sure. */
1335 struct virtio_net_config conf; 1471 memset(&ifr, 0, sizeof(ifr));
1336 1472
1337 /* We open the /dev/net/tun device and tell it we want a tap device. A 1473 /* We open the /dev/net/tun device and tell it we want a tap device. A
1338 * tap device is like a tun device, only somehow different. To tell 1474 * tap device is like a tun device, only somehow different. To tell
1339 * the truth, I completely blundered my way through this code, but it 1475 * the truth, I completely blundered my way through this code, but it
1340 * works now! */ 1476 * works now! */
1341 netfd = open_or_die("/dev/net/tun", O_RDWR); 1477 netfd = open_or_die("/dev/net/tun", O_RDWR);
1342 memset(&ifr, 0, sizeof(ifr)); 1478 ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_VNET_HDR;
1343 ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
1344 strcpy(ifr.ifr_name, "tap%d"); 1479 strcpy(ifr.ifr_name, "tap%d");
1345 if (ioctl(netfd, TUNSETIFF, &ifr) != 0) 1480 if (ioctl(netfd, TUNSETIFF, &ifr) != 0)
1346 err(1, "configuring /dev/net/tun"); 1481 err(1, "configuring /dev/net/tun");
1482
1483 if (ioctl(netfd, TUNSETOFFLOAD,
1484 TUN_F_CSUM|TUN_F_TSO4|TUN_F_TSO6|TUN_F_TSO_ECN) != 0)
1485 err(1, "Could not set features for tun device");
1486
1347 /* We don't need checksums calculated for packets coming in this 1487 /* We don't need checksums calculated for packets coming in this
1348 * device: trust us! */ 1488 * device: trust us! */
1349 ioctl(netfd, TUNSETNOCSUM, 1); 1489 ioctl(netfd, TUNSETNOCSUM, 1);
1350 1490
1491 memcpy(tapif, ifr.ifr_name, IFNAMSIZ);
1492 return netfd;
1493}
1494
1495/*L:195 Our network is a Host<->Guest network. This can either use bridging or
1496 * routing, but the principle is the same: it uses the "tun" device to inject
1497 * packets into the Host as if they came in from a normal network card. We
1498 * just shunt packets between the Guest and the tun device. */
1499static void setup_tun_net(char *arg)
1500{
1501 struct device *dev;
1502 int netfd, ipfd;
1503 u32 ip = INADDR_ANY;
1504 bool bridging = false;
1505 char tapif[IFNAMSIZ], *p;
1506 struct virtio_net_config conf;
1507
1508 netfd = get_tun_device(tapif);
1509
1351 /* First we create a new network device. */ 1510 /* First we create a new network device. */
1352 dev = new_device("net", VIRTIO_ID_NET, netfd, handle_tun_input); 1511 dev = new_device("net", VIRTIO_ID_NET, netfd, handle_tun_input);
1353 1512
1354 /* Network devices need a receive and a send queue, just like 1513 /* Network devices need a receive and a send queue, just like
1355 * console. */ 1514 * console. */
1356 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd); 1515 add_virtqueue(dev, VIRTQUEUE_NUM, net_enable_fd);
1357 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output); 1516 add_virtqueue(dev, VIRTQUEUE_NUM, handle_net_output);
1358 1517
1359 /* We need a socket to perform the magic network ioctls to bring up the 1518 /* We need a socket to perform the magic network ioctls to bring up the
@@ -1364,28 +1523,56 @@ static void setup_tun_net(const char *arg)
1364 1523
1365 /* If the command line was --tunnet=bridge:<name> do bridging. */ 1524 /* If the command line was --tunnet=bridge:<name> do bridging. */
1366 if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) { 1525 if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) {
1367 ip = INADDR_ANY; 1526 arg += strlen(BRIDGE_PFX);
1368 br_name = arg + strlen(BRIDGE_PFX); 1527 bridging = true;
1369 add_to_bridge(ipfd, ifr.ifr_name, br_name); 1528 }
1370 } else /* It is an IP address to set up the device with */ 1529
1530 /* A mac address may follow the bridge name or IP address */
1531 p = strchr(arg, ':');
1532 if (p) {
1533 str2mac(p+1, conf.mac);
1534 *p = '\0';
1535 } else {
1536 p = arg + strlen(arg);
1537 /* None supplied; query the randomly assigned mac. */
1538 get_mac(ipfd, tapif, conf.mac);
1539 }
1540
1541 /* arg is now either an IP address or a bridge name */
1542 if (bridging)
1543 add_to_bridge(ipfd, tapif, arg);
1544 else
1371 ip = str2ip(arg); 1545 ip = str2ip(arg);
1372 1546
1373 /* Set up the tun device, and get the mac address for the interface. */ 1547 /* Set up the tun device. */
1374 configure_device(ipfd, ifr.ifr_name, ip, conf.mac); 1548 configure_device(ipfd, tapif, ip);
1375 1549
1376 /* Tell Guest what MAC address to use. */ 1550 /* Tell Guest what MAC address to use. */
1377 add_feature(dev, VIRTIO_NET_F_MAC); 1551 add_feature(dev, VIRTIO_NET_F_MAC);
1378 add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY); 1552 add_feature(dev, VIRTIO_F_NOTIFY_ON_EMPTY);
1553 /* Expect Guest to handle everything except UFO */
1554 add_feature(dev, VIRTIO_NET_F_CSUM);
1555 add_feature(dev, VIRTIO_NET_F_GUEST_CSUM);
1556 add_feature(dev, VIRTIO_NET_F_MAC);
1557 add_feature(dev, VIRTIO_NET_F_GUEST_TSO4);
1558 add_feature(dev, VIRTIO_NET_F_GUEST_TSO6);
1559 add_feature(dev, VIRTIO_NET_F_GUEST_ECN);
1560 add_feature(dev, VIRTIO_NET_F_HOST_TSO4);
1561 add_feature(dev, VIRTIO_NET_F_HOST_TSO6);
1562 add_feature(dev, VIRTIO_NET_F_HOST_ECN);
1379 set_config(dev, sizeof(conf), &conf); 1563 set_config(dev, sizeof(conf), &conf);
1380 1564
1381 /* We don't need the socket any more; setup is done. */ 1565 /* We don't need the socket any more; setup is done. */
1382 close(ipfd); 1566 close(ipfd);
1383 1567
1384 verbose("device %u: tun net %u.%u.%u.%u\n", 1568 devices.device_num++;
1385 devices.device_num++, 1569
1386 (u8)(ip>>24),(u8)(ip>>16),(u8)(ip>>8),(u8)ip); 1570 if (bridging)
1387 if (br_name) 1571 verbose("device %u: tun %s attached to bridge: %s\n",
1388 verbose("attached to bridge: %s\n", br_name); 1572 devices.device_num, tapif, arg);
1573 else
1574 verbose("device %u: tun %s: %s\n",
1575 devices.device_num, tapif, arg);
1389} 1576}
1390 1577
1391/* Our block (disk) device should be really simple: the Guest asks for a block 1578/* Our block (disk) device should be really simple: the Guest asks for a block
@@ -1550,7 +1737,7 @@ static bool handle_io_finish(int fd, struct device *dev)
1550} 1737}
1551 1738
1552/* When the Guest submits some I/O, we just need to wake the I/O thread. */ 1739/* When the Guest submits some I/O, we just need to wake the I/O thread. */
1553static void handle_virtblk_output(int fd, struct virtqueue *vq) 1740static void handle_virtblk_output(int fd, struct virtqueue *vq, bool timeout)
1554{ 1741{
1555 struct vblk_info *vblk = vq->dev->priv; 1742 struct vblk_info *vblk = vq->dev->priv;
1556 char c = 0; 1743 char c = 0;
@@ -1621,6 +1808,64 @@ static void setup_block_file(const char *filename)
1621 verbose("device %u: virtblock %llu sectors\n", 1808 verbose("device %u: virtblock %llu sectors\n",
1622 devices.device_num, le64_to_cpu(conf.capacity)); 1809 devices.device_num, le64_to_cpu(conf.capacity));
1623} 1810}
1811
1812/* Our random number generator device reads from /dev/random into the Guest's
1813 * input buffers. The usual case is that the Guest doesn't want random numbers
1814 * and so has no buffers although /dev/random is still readable, whereas
1815 * console is the reverse.
1816 *
1817 * The same logic applies, however. */
1818static bool handle_rng_input(int fd, struct device *dev)
1819{
1820 int len;
1821 unsigned int head, in_num, out_num, totlen = 0;
1822 struct iovec iov[dev->vq->vring.num];
1823
1824 /* First we need a buffer from the Guests's virtqueue. */
1825 head = get_vq_desc(dev->vq, iov, &out_num, &in_num);
1826
1827 /* If they're not ready for input, stop listening to this file
1828 * descriptor. We'll start again once they add an input buffer. */
1829 if (head == dev->vq->vring.num)
1830 return false;
1831
1832 if (out_num)
1833 errx(1, "Output buffers in rng?");
1834
1835 /* This is why we convert to iovecs: the readv() call uses them, and so
1836 * it reads straight into the Guest's buffer. We loop to make sure we
1837 * fill it. */
1838 while (!iov_empty(iov, in_num)) {
1839 len = readv(dev->fd, iov, in_num);
1840 if (len <= 0)
1841 err(1, "Read from /dev/random gave %i", len);
1842 iov_consume(iov, in_num, len);
1843 totlen += len;
1844 }
1845
1846 /* Tell the Guest about the new input. */
1847 add_used_and_trigger(fd, dev->vq, head, totlen);
1848
1849 /* Everything went OK! */
1850 return true;
1851}
1852
1853/* And this creates a "hardware" random number device for the Guest. */
1854static void setup_rng(void)
1855{
1856 struct device *dev;
1857 int fd;
1858
1859 fd = open_or_die("/dev/random", O_RDONLY);
1860
1861 /* The device responds to return from I/O thread. */
1862 dev = new_device("rng", VIRTIO_ID_RNG, fd, handle_rng_input);
1863
1864 /* The device has one virtqueue, where the Guest places inbufs. */
1865 add_virtqueue(dev, VIRTQUEUE_NUM, enable_fd);
1866
1867 verbose("device %u: rng\n", devices.device_num++);
1868}
1624/* That's the end of device setup. */ 1869/* That's the end of device setup. */
1625 1870
1626/*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */ 1871/*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */
@@ -1628,11 +1873,12 @@ static void __attribute__((noreturn)) restart_guest(void)
1628{ 1873{
1629 unsigned int i; 1874 unsigned int i;
1630 1875
1631 /* Closing pipes causes the Waker thread and io_threads to die, and 1876 /* Since we don't track all open fds, we simply close everything beyond
1632 * closing /dev/lguest cleans up the Guest. Since we don't track all 1877 * stderr. */
1633 * open fds, we simply close everything beyond stderr. */
1634 for (i = 3; i < FD_SETSIZE; i++) 1878 for (i = 3; i < FD_SETSIZE; i++)
1635 close(i); 1879 close(i);
1880
1881 /* The exec automatically gets rid of the I/O and Waker threads. */
1636 execv(main_args[0], main_args); 1882 execv(main_args[0], main_args);
1637 err(1, "Could not exec %s", main_args[0]); 1883 err(1, "Could not exec %s", main_args[0]);
1638} 1884}
@@ -1663,7 +1909,7 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd)
1663 /* ERESTART means that we need to reboot the guest */ 1909 /* ERESTART means that we need to reboot the guest */
1664 } else if (errno == ERESTART) { 1910 } else if (errno == ERESTART) {
1665 restart_guest(); 1911 restart_guest();
1666 /* EAGAIN means the Waker wanted us to look at some input. 1912 /* EAGAIN means a signal (timeout).
1667 * Anything else means a bug or incompatible change. */ 1913 * Anything else means a bug or incompatible change. */
1668 } else if (errno != EAGAIN) 1914 } else if (errno != EAGAIN)
1669 err(1, "Running guest failed"); 1915 err(1, "Running guest failed");
@@ -1691,13 +1937,14 @@ static struct option opts[] = {
1691 { "verbose", 0, NULL, 'v' }, 1937 { "verbose", 0, NULL, 'v' },
1692 { "tunnet", 1, NULL, 't' }, 1938 { "tunnet", 1, NULL, 't' },
1693 { "block", 1, NULL, 'b' }, 1939 { "block", 1, NULL, 'b' },
1940 { "rng", 0, NULL, 'r' },
1694 { "initrd", 1, NULL, 'i' }, 1941 { "initrd", 1, NULL, 'i' },
1695 { NULL }, 1942 { NULL },
1696}; 1943};
1697static void usage(void) 1944static void usage(void)
1698{ 1945{
1699 errx(1, "Usage: lguest [--verbose] " 1946 errx(1, "Usage: lguest [--verbose] "
1700 "[--tunnet=(<ipaddr>|bridge:<bridgename>)\n" 1947 "[--tunnet=(<ipaddr>:<macaddr>|bridge:<bridgename>:<macaddr>)\n"
1701 "|--block=<filename>|--initrd=<filename>]...\n" 1948 "|--block=<filename>|--initrd=<filename>]...\n"
1702 "<mem-in-mb> vmlinux [args...]"); 1949 "<mem-in-mb> vmlinux [args...]");
1703} 1950}
@@ -1765,6 +2012,9 @@ int main(int argc, char *argv[])
1765 case 'b': 2012 case 'b':
1766 setup_block_file(optarg); 2013 setup_block_file(optarg);
1767 break; 2014 break;
2015 case 'r':
2016 setup_rng();
2017 break;
1768 case 'i': 2018 case 'i':
1769 initrd_name = optarg; 2019 initrd_name = optarg;
1770 break; 2020 break;
@@ -1783,6 +2033,9 @@ int main(int argc, char *argv[])
1783 /* We always have a console device */ 2033 /* We always have a console device */
1784 setup_console(); 2034 setup_console();
1785 2035
2036 /* We can timeout waiting for Guest network transmit. */
2037 setup_timeout();
2038
1786 /* Now we load the kernel */ 2039 /* Now we load the kernel */
1787 start = load_kernel(open_or_die(argv[optind+1], O_RDONLY)); 2040 start = load_kernel(open_or_die(argv[optind+1], O_RDONLY));
1788 2041
@@ -1826,10 +2079,10 @@ int main(int argc, char *argv[])
1826 * /dev/lguest file descriptor. */ 2079 * /dev/lguest file descriptor. */
1827 lguest_fd = tell_kernel(pgdir, start); 2080 lguest_fd = tell_kernel(pgdir, start);
1828 2081
1829 /* We fork off a child process, which wakes the Launcher whenever one 2082 /* We clone off a thread, which wakes the Launcher whenever one of the
1830 * of the input file descriptors needs attention. We call this the 2083 * input file descriptors needs attention. We call this the Waker, and
1831 * Waker, and we'll cover it in a moment. */ 2084 * we'll cover it in a moment. */
1832 waker_fd = setup_waker(lguest_fd); 2085 setup_waker(lguest_fd);
1833 2086
1834 /* Finally, run the Guest. This doesn't return. */ 2087 /* Finally, run the Guest. This doesn't return. */
1835 run_guest(lguest_fd); 2088 run_guest(lguest_fd);
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 72aff61e7315..6f6d117ac7e2 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -1024,6 +1024,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1024 intel-mac-v3 Intel Mac Type 3 1024 intel-mac-v3 Intel Mac Type 3
1025 intel-mac-v4 Intel Mac Type 4 1025 intel-mac-v4 Intel Mac Type 4
1026 intel-mac-v5 Intel Mac Type 5 1026 intel-mac-v5 Intel Mac Type 5
1027 intel-mac-auto Intel Mac (detect type according to subsystem id)
1027 macmini Intel Mac Mini (equivalent with type 3) 1028 macmini Intel Mac Mini (equivalent with type 3)
1028 macbook Intel Mac Book (eq. type 5) 1029 macbook Intel Mac Book (eq. type 5)
1029 macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3) 1030 macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
diff --git a/Documentation/sparse.txt b/Documentation/sparse.txt
index 1a3bdc27d95e..42f43fa59f24 100644
--- a/Documentation/sparse.txt
+++ b/Documentation/sparse.txt
@@ -73,10 +73,10 @@ recompiled, or use "make C=2" to run sparse on the files whether they need to
73be recompiled or not. The latter is a fast way to check the whole tree if you 73be recompiled or not. The latter is a fast way to check the whole tree if you
74have already built it. 74have already built it.
75 75
76The optional make variable CHECKFLAGS can be used to pass arguments to sparse. 76The optional make variable CF can be used to pass arguments to sparse. The
77The build system passes -Wbitwise to sparse automatically. To perform 77build system passes -Wbitwise to sparse automatically. To perform endianness
78endianness checks, you may define __CHECK_ENDIAN__: 78checks, you may define __CHECK_ENDIAN__:
79 79
80 make C=2 CHECKFLAGS="-D__CHECK_ENDIAN__" 80 make C=2 CF="-D__CHECK_ENDIAN__"
81 81
82These checks are disabled by default as they generate a host of warnings. 82These checks are disabled by default as they generate a host of warnings.
diff --git a/Documentation/video4linux/CARDLIST.au0828 b/Documentation/video4linux/CARDLIST.au0828
index 86d1c8e7b18f..eedc399e8deb 100644
--- a/Documentation/video4linux/CARDLIST.au0828
+++ b/Documentation/video4linux/CARDLIST.au0828
@@ -2,3 +2,4 @@
2 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008] 2 1 -> Hauppauge HVR950Q (au0828) [2040:7200,2040:7210,2040:7217,2040:721b,2040:721f,2040:7280,0fd9:0008]
3 2 -> Hauppauge HVR850 (au0828) [2040:7240] 3 2 -> Hauppauge HVR850 (au0828) [2040:7240]
4 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620] 4 3 -> DViCO FusionHDTV USB (au0828) [0fe9:d620]
5 4 -> Hauppauge HVR950Q rev xxF8 (au0828) [2040:7201,2040:7211,2040:7281]
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 10591467ef16..89c7f32abf9f 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -1,11 +1,11 @@
1 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800] 1 0 -> Unknown EM2800 video grabber (em2800) [eb1a:2800]
2 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2750,eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883] 2 1 -> Unknown EM2750/28xx video grabber (em2820/em2840) [eb1a:2820,eb1a:2821,eb1a:2860,eb1a:2861,eb1a:2870,eb1a:2881,eb1a:2883]
3 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036] 3 2 -> Terratec Cinergy 250 USB (em2820/em2840) [0ccd:0036]
4 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208] 4 3 -> Pinnacle PCTV USB 2 (em2820/em2840) [2304:0208]
5 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201] 5 4 -> Hauppauge WinTV USB 2 (em2820/em2840) [2040:4200,2040:4201]
6 5 -> MSI VOX USB 2.0 (em2820/em2840) 6 5 -> MSI VOX USB 2.0 (em2820/em2840)
7 6 -> Terratec Cinergy 200 USB (em2800) 7 6 -> Terratec Cinergy 200 USB (em2800)
8 7 -> Leadtek Winfast USB II (em2800) 8 7 -> Leadtek Winfast USB II (em2800) [0413:6023]
9 8 -> Kworld USB2800 (em2800) 9 8 -> Kworld USB2800 (em2800)
10 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a] 10 9 -> Pinnacle Dazzle DVC 90/DVC 100 (em2820/em2840) [2304:0207,2304:021a]
11 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500] 11 10 -> Hauppauge WinTV HVR 900 (em2880) [2040:6500]
@@ -14,7 +14,46 @@
14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047] 14 13 -> Terratec Prodigy XS (em2880) [0ccd:0047]
15 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840) 15 14 -> Pixelview Prolink PlayTV USB 2.0 (em2820/em2840)
16 15 -> V-Gear PocketTV (em2800) 16 15 -> V-Gear PocketTV (em2800)
17 16 -> Hauppauge WinTV HVR 950 (em2880) [2040:6513,2040:6517,2040:651b,2040:651f] 17 16 -> Hauppauge WinTV HVR 950 (em2883) [2040:6513,2040:6517,2040:651b,2040:651f]
18 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227] 18 17 -> Pinnacle PCTV HD Pro Stick (em2880) [2304:0227]
19 18 -> Hauppauge WinTV HVR 900 (R2) (em2880) [2040:6502] 19 18 -> Hauppauge WinTV HVR 900 (R2) (em2880) [2040:6502]
20 19 -> PointNix Intra-Oral Camera (em2860) 20 19 -> PointNix Intra-Oral Camera (em2860)
21 20 -> AMD ATI TV Wonder HD 600 (em2880) [0438:b002]
22 21 -> eMPIA Technology, Inc. GrabBeeX+ Video Encoder (em2800) [eb1a:2801]
23 22 -> Unknown EM2750/EM2751 webcam grabber (em2750) [eb1a:2750,eb1a:2751]
24 23 -> Huaqi DLCW-130 (em2750)
25 24 -> D-Link DUB-T210 TV Tuner (em2820/em2840) [2001:f112]
26 25 -> Gadmei UTV310 (em2820/em2840)
27 26 -> Hercules Smart TV USB 2.0 (em2820/em2840)
28 27 -> Pinnacle PCTV USB 2 (Philips FM1216ME) (em2820/em2840)
29 28 -> Leadtek Winfast USB II Deluxe (em2820/em2840)
30 29 -> Pinnacle Dazzle DVC 100 (em2820/em2840)
31 30 -> Videology 20K14XUSB USB2.0 (em2820/em2840)
32 31 -> Usbgear VD204v9 (em2821)
33 32 -> Supercomp USB 2.0 TV (em2821)
34 33 -> SIIG AVTuner-PVR/Prolink PlayTV USB 2.0 (em2821)
35 34 -> Terratec Cinergy A Hybrid XS (em2860) [0ccd:004f]
36 35 -> Typhoon DVD Maker (em2860)
37 36 -> NetGMBH Cam (em2860)
38 37 -> Gadmei UTV330 (em2860)
39 38 -> Yakumo MovieMixer (em2861)
40 39 -> KWorld PVRTV 300U (em2861) [eb1a:e300]
41 40 -> Plextor ConvertX PX-TV100U (em2861) [093b:a005]
42 41 -> Kworld 350 U DVB-T (em2870) [eb1a:e350]
43 42 -> Kworld 355 U DVB-T (em2870) [eb1a:e355,eb1a:e357]
44 43 -> Terratec Cinergy T XS (em2870) [0ccd:0043]
45 44 -> Terratec Cinergy T XS (MT2060) (em2870)
46 45 -> Pinnacle PCTV DVB-T (em2870)
47 46 -> Compro, VideoMate U3 (em2870) [185b:2870]
48 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305]
49 48 -> KWorld DVB-T 310U (em2880)
50 49 -> MSI DigiVox A/D (em2880) [eb1a:e310]
51 50 -> MSI DigiVox A/D II (em2880) [eb1a:e320]
52 51 -> Terratec Hybrid XS Secam (em2880) [0ccd:004c]
53 52 -> DNT DA2 Hybrid (em2881)
54 53 -> Pinnacle Hybrid Pro (em2881)
55 54 -> Kworld VS-DVB-T 323UR (em2882) [eb1a:e323]
56 55 -> Terratec Hybrid XS (em2882) (em2882) [0ccd:005e]
57 56 -> Pinnacle Hybrid Pro (2) (em2882) [2304:0226]
58 57 -> Kworld PlusTV HD Hybrid 330 (em2883) [eb1a:a316]
59 58 -> Compro VideoMate ForYou/Stereo (em2820/em2840) [185b:2041]
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
index 0c4880af57a3..bcaf4ab383be 100644
--- a/Documentation/video4linux/gspca.txt
+++ b/Documentation/video4linux/gspca.txt
@@ -1,4 +1,4 @@
1List of the webcams know by gspca. 1List of the webcams known by gspca.
2 2
3The modules are: 3The modules are:
4 gspca_main main driver 4 gspca_main main driver