Commit Graph

47 Commits

Author SHA1 Message Date
Masahiro Yamada 505d3085d7 scripts/spelling.txt: add "overide" pattern and fix typo instances
Fix typos and add the following to the scripts/spelling.txt:

  overide||override

While we are here, fix the doubled "address" in the touched line
Documentation/devicetree/bindings/regulator/ti-abb-regulator.txt.

Also, fix the comment block style in the touched hunks in
drivers/media/dvb-frontends/drx39xyj/drx_driver.h.

Link: http://lkml.kernel.org/r/1481573103-11329-21-git-send-email-yamada.masahiro@socionext.com
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-03-09 17:01:09 -08:00
Daniel Baluta db91e2370e tools/lguest: Don't bork the terminal in case of wrong args
Running lguest without arguments or with a wrong argument name
borks the terminal, because the cleanup handler is set up too late
in the initialization process.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-09-08 08:05:24 +02:00
Luis R. Rodriguez 4650459032 tools/lguest: Force disable tboot and APM
The paravirt_enabled() check is going away, the area tossed to
the kernel on lguest is not zeroed out, so ensure lguest force
disables tboot and APM just in case the kernel file being read
might have this set for whatever reason.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: andrew.cooper3@citrix.com
Cc: andriy.shevchenko@linux.intel.com
Cc: bigeasy@linutronix.de
Cc: boris.ostrovsky@oracle.com
Cc: david.vrabel@citrix.com
Cc: ffainelli@freebox.fr
Cc: george.dunlap@citrix.com
Cc: glin@suse.com
Cc: jgross@suse.com
Cc: jlee@suse.com
Cc: josh@joshtriplett.org
Cc: julien.grall@linaro.org
Cc: konrad.wilk@oracle.com
Cc: kozerkov@parallels.com
Cc: lenb@kernel.org
Cc: lguest@lists.ozlabs.org
Cc: linux-acpi@vger.kernel.org
Cc: lv.zheng@intel.com
Cc: matt@codeblueprint.co.uk
Cc: mbizon@freebox.fr
Cc: rjw@rjwysocki.net
Cc: robert.moore@intel.com
Cc: tiwai@suse.de
Cc: toshi.kani@hp.com
Cc: xen-devel@lists.xensource.com
Link: http://lkml.kernel.org/r/1460592286-300-8-git-send-email-mcgrof@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-04-22 10:29:03 +02:00
Luis R. Rodriguez 907bb65579 tools/lguest: Make lguest launcher use X86_SUBARCH_LGUEST explicitly
Be explicit and make use of X86_SUBARCH_LGUEST directly.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: andrew.cooper3@citrix.com
Cc: andriy.shevchenko@linux.intel.com
Cc: bigeasy@linutronix.de
Cc: boris.ostrovsky@oracle.com
Cc: david.vrabel@citrix.com
Cc: ffainelli@freebox.fr
Cc: george.dunlap@citrix.com
Cc: glin@suse.com
Cc: jgross@suse.com
Cc: jlee@suse.com
Cc: josh@joshtriplett.org
Cc: julien.grall@linaro.org
Cc: konrad.wilk@oracle.com
Cc: kozerkov@parallels.com
Cc: lenb@kernel.org
Cc: lguest@lists.ozlabs.org
Cc: linux-acpi@vger.kernel.org
Cc: lv.zheng@intel.com
Cc: matt@codeblueprint.co.uk
Cc: mbizon@freebox.fr
Cc: rjw@rjwysocki.net
Cc: robert.moore@intel.com
Cc: tiwai@suse.de
Cc: toshi.kani@hp.com
Cc: xen-devel@lists.xensource.com
Link: http://lkml.kernel.org/r/1460592286-300-4-git-send-email-mcgrof@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-04-22 10:29:00 +02:00
Rusty Russell b51aa1cc78 tools/lguest: Clean up include dir
It contains a symlinked header we use; ignore it and clean it up
on 'make clean'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-08-26 06:12:35 +02:00
Rusty Russell e523caa601 tools/lguest: Fix redefinition of struct virtio_pci_cfg_cap
Ours uses a u32 for the data, since we ensure it's always
aligned and it's x86 so it doesn't matter anyway.

  lguest.c:128:8: error: redefinition of ‘struct virtio_pci_cfg_cap’

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Fixes: 3121bb023e ("virtio: define virtio_pci_cfg_cap in header.")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-08-26 06:12:35 +02:00
Rusty Russell 206ad06b2e tools/lguest: don't use legacy definitions for net device in example launcher.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:55 +10:30
Rusty Russell 1e1c17a7a2 tools/lguest: use common error macros in the example launcher.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:53 +10:30
Rusty Russell 17c56d6de8 tools/lguest: give virtqueues names for better error messages
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:53 +10:30
Rusty Russell d39a6785f4 tools/lguest: more documentation and checking of virtio 1.0 compliance.
This is from all the non-PCI parts of the spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:52 +10:30
Rusty Russell d761b03291 tools/lguest: don't start devices until DRIVER_OK status set.
We were activating them with the virtqueues, and that's not allowed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:51 +10:30
Rusty Russell 3afe3e0f8d tools/lguest: handle indirect partway through chain.
Linux doesn't generate these, but it's perfectly valid according to
a close reading of the spec.  I opened virtio spec bug VIRTIO-134 to
make this clearer there, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:50 +10:30
Rusty Russell c97eb679ef tools/lguest: insert driver references from the 1.0 spec (4.1 Virtio Over PCI)
As a demonstration, the lguest launcher is pretty strict, trying to
catch badly behaved drivers.  Document this precisely.

A good implementation would *NOT* crash the guest when these happened!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:49 +10:30
Rusty Russell 8dc425ffdd tools/lguest: insert device references from the 1.0 spec (4.1 Virtio Over PCI)
There are some (optional) parts we don't implement, but this quotes all
the device requirements from the spec (csd 03, but it should be the same
across all released versions).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:47 +10:30
Rusty Russell b2ce1ea442 tools/lguest: rename virtio_pci_cfg_cap field to match spec.
The next patch will insert many quotes from the virtio 1.0 spec; they
make most sense if we copy the spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:47 +10:30
Rusty Russell 53aceb49f9 tools/lguest: fix features_accepted logic in example launcher.
We were clearing the lower bits when setting the upper bits.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:46 +10:30
Rusty Russell d2dbdac336 tools/lguest: handle device reset correctly in example launcher.
The example launcher doesn't reset the queue_enable like the spec says
we have to.  Plus, we should reset the size in case they negotiated
a different (smaller) one.

This is easy to test by unloading and reloading a virtio module.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-13 17:15:45 +10:30
Rusty Russell 00f8d54651 lguest: remove NOTIFY facility from demonstration launcher.
This was only used for early console, now we can get rid of it altogether.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:45 +10:30
Rusty Russell 713e3f7224 lguest: always put console in PCI slot #1.
This simplifies the early probe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:44 +10:30
Rusty Russell 59eba788db lguest: support backdoor window.
The VIRTIO_PCI_CAP_PCI_CFG in the PCI virtio 1.0 spec allows access to
the BAR registers without mapping them.  This is a compulsory feature,
and we implement it here.

There are some subtleties involving access widths which we should
note:

4.1.4.7.1 Device Requirements: PCI configuration access capability

...
   Upon detecting driver write access to pci_cfg_data, the device MUST
   execute a write access at offset cap.offset at BAR selected by
   cap.bar using the first cap.length bytes from pci_cfg_data.

   Upon detecting driver read access to pci_cfg_data, the device MUST
   execute a read access of length cap.length at offset cap.offset at
   BAR selected by cap.bar and store the first cap.length bytes in
   pci_cfg_data.

So, for a write, we copy into the pci_cfg_data window, then write from
there out to the BAR.  This works correctly if cap.length != width of
write.  Similarly, for a read, we read into window from the BAR then
read the value from there.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:43 +10:30
Rusty Russell e8330d9bc1 lguest: support emerg_wr in console device in example launcher.
This is a magic register which causes a character to be outputted: it can
be used even before the device is configured.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:43 +10:30
Rusty Russell d9028eda7b lguest: remove support for lguest bus in demonstration launcher.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:42 +10:30
Rusty Russell eb39f83372 lguest: define VIRTIO_CONFIG_NO_LEGACY in example launcher.
We only support virtio 1.0 now

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:40 +10:30
Rusty Russell ebff01137a lguest: Convert console device to virtio 1.0 PCI.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:40 +10:30
Rusty Russell 0d5b5d399f lguest: Convert entropy device to virtio 1.0 PCI.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:39 +10:30
Rusty Russell bf6d40344d lguest: Convert net device to virtio 1.0 PCI.
The only real change here (other than using the PCI bus) is that we
didn't negotiate VIRTIO_NET_F_MRG_RXBUF before, so the format of the
packet header changed with virtio 1.0; we need TUNSETVNETHDRSZ on the
tun fd to tell it about the extra two bytes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:39 +10:30
Rusty Russell 5051654764 lguest: Convert block device to virtio 1.0 PCI.
We remove SCSI support (which was removed for 1.0) and VIRTIO_BLK_F_FLUSH
feature flag (removed too, since it's compulsory for 1.0).

The rest is mainly mechanical.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:38 +10:30
Rusty Russell 8e70946943 lguest: add a dummy PCI host bridge.
Otherwise Linux fails to find the bus.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:38 +10:30
Rusty Russell 3e0e5f2640 lguest: fix failure to find linux/virtio_types.h
We want to use the local kernel headers, but -I../../include/uapi leads us into
a world of hurt.  Instead we create a dummy include/ dir with symlinks.

If we just use #include "../../include/uapi/linux/virtio_blk.h" we get:

	../../include/uapi/linux/virtio_blk.h:31:32: fatal error: linux/virtio_types.h: No such file or directory
	 #include <linux/virtio_types.h>

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:37 +10:30
Rusty Russell 9315307710 lguest: implement virtio-PCI MMIO accesses.
For each device, We need to include the vendor capabilities to demark
where virtio common, notification and ISR regions are (we put them
all in BAR0).

We need to handle the switching of the virtqueues using the accessors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:36 +10:30
Rusty Russell d7fbf6e95e lguest: add PCI config space emulation to example launcher.
This handles ioport 0xCF8 and 0xCFC accesses, which are used to
read/write PCI device config space.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:36 +10:30
Rusty Russell 6a54f9ab0d lguest: decode mmio accesses for PCI in example launcher.
We don't do anything with them yet (emulate_mmio_write and
emulate_mmio_read are stubs), but we decode the instructions and
search for the device they're hitting.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:35 +10:30
Rusty Russell 0a6bcc183f lguest: add MMIO region allocator in example launcher.
This is where we point our PCI BARs, so that we can intercept MMIO
accesses.  We tell the kernel about it so any faults in this area are
directed to us.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:35 +10:30
Rusty Russell 7313d5217e lguest: add iomem region, where guest page faults get sent to userspace.
This lets us implement PCI.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:33 +10:30
Rusty Russell 48fd6b71d6 lguest: suppress PS/2 keyboard polling.
While hacking on getting I/O out to the lguest launcher, I noticed
that returning 0xFF for the PS/2 keyboard status made it spin for a
while thinking there was a key pending.  Fix this by returning 1
instead of 0xFF.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:32 +10:30
Rusty Russell c565650b10 lguest: send trap 13 through to userspace.
We copy 7 bytes at eip for userspace's instruction decode; we have to
carefully handle the case where eip is at the end of a page.  We can't
leave this to userspace since kernel has all the page table decode
logic.

The decode logic moves to userspace, basically unchanged.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:31 +10:30
Rusty Russell 69a09dc174 lguest: write more information to userspace about pending traps.
This is preparation for userspace handling MMIO and ioport accesses.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:30 +10:30
Rusty Russell a454bb36ca lguest: have --rng read from /dev/urandom not /dev/random.
Theoretical debates aside, now it boots.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-02-11 16:47:28 +10:30
Rusty Russell 927cfb9788 tools/lguest: offer VIRTIO_F_ANY_LAYOUT for net device.
We don't care about layout, so advertise that fact.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-07-15 11:18:32 +09:30
Rusty Russell e6dc0418bc lguest: fix example launcher compilation for broken glibc headers.
Somehow a naked u16 slipped into the glibc headers on my Ubuntu machine
(i386 2.17-0ubuntu5), breaking compile:

	In file included from lguest.c:46:0:
	/usr/include/linux/virtio_net.h:188:2: error: unknown type name ‘u16’

We use the kernel-style types anyway, just define them before the includes.
Also remove the advice on adding missing headers: that no longer works.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-07-04 11:25:07 +09:30
Rusty Russell 0d69a65e97 tools/lguest: real barriers.
Lguest guests are UP, but the host is probably SMP, so real barriers are
required in case the device thread and the guest are on different CPUs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-07-02 15:42:05 +09:30
Rusty Russell 8fd9a6365e tools/lguest: fix missing rmb().
The virtio spec was missing a barrier in example code, so I went back
to look at the lguest code.  Indeed, we need one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-07-02 15:42:04 +09:30
Wanlong Gao 289d1054e9 lguest: fix paths in comments
After commit 07fe997, lguest tool has already moved from
Documentation/virtual/lguest/ to tools/lguest/.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-03-07 09:56:46 +11:00
Kees Cook 483ea6074e tools/lguest: remove depends on CONFIG_EXPERIMENTAL
The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
while now and is almost always enabled by default. As agreed during the
Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
2013-01-11 11:40:03 -08:00
Rusty Russell c0316a945a lguest: fix block request handling in example launcher.
virtio requests are scatter-gather-style descriptors, but no
assumptions should be made about the layout.  lguest was lazy here,
but saved by the fact that the network device hands all requests to
tun (which does it correctly) and console and random devices simply
use readv and writev.

Block devices, however, are broken: we convert to iovecs internally,
just make sure we handle the correctly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-10-22 18:20:01 +10:30
Rusty Russell ca16f580a5 lguest: fix occasional crash in example launcher.
We usually got away with ->next on the final entry being NULL, but it
finally bit me.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: stable@kernel.org
2012-10-04 12:12:59 +09:30
Davidlohr Bueso 07fe9977b6 lguest: move the lguest tool to the tools directory
This is a better location instead of having it in Documentation.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (fixed compile)
2012-01-12 15:44:47 +10:30