Cyrill Gorcunov [Fri, 4 Nov 2011 06:48:06 +0000 (10:48 +0400)]
kvm tools: Fix VESA BIOS mode info
Some VGA data such as VESA info needs a proper tuning for addresses
passed on kernel requests. We returned linear addresses there while
spec points out that far pointers are needed.
This fixes a long-standing issue that caused Linux kernel to never exit
the mode scanning loop in arch/x86/boot/video-vesa.c::vesa_probe()
because returned mode info table segment/offset pair was bogus. The
issue triggered on some machines when CONFIG_FB_VESA was disabled.
Also use already VESA structures defined in <boot/vesa.h> header now
that we no longer use the struct to store VESA BIOS data.
Reported-by: Pekka Enberg <penberg@kernel.org> CC: Sasha Levin <levinsasha928@gmail.com> CC: Ingo Molnar <mingo@elte.hu> CC: Asias He <asias.hejun@gmail.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
[ penberg@kernel.org: minor cleanups to setup_vga_rom() ] Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Wed, 2 Nov 2011 05:41:08 +0000 (07:41 +0200)]
kvm tools: Modify behaviour on missing ops ptr
In case a read or write op ptr is missing simply ignore it instead of
critically failing. This provides an easier way to prevent read or write
in specific scenarios.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Thu, 27 Oct 2011 13:14:33 +0000 (21:14 +0800)]
kvm tools: Fix MSI-X table size set up
We at most have VIRTIO_PCI_MAX_VQ entries for virt queue,
VIRTIO_PCI_MAX_CONFIG entries for config.
To quote the PCI spec:
System software reads this field to determine the
MSI-X Table Size N, which is encoded as N-1.
For example, a returned value of "00000000011"
indicates a table size of 4.
So, we should set table size to
VIRTIO_PCI_MAX_VQ + VIRTIO_PCI_MAX_CONFIG - 1
not
VIRTIO_PCI_MAX_VQ + VIRTIO_PCI_MAX_CONFIG
Acked-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Thu, 27 Oct 2011 12:47:28 +0000 (20:47 +0800)]
kvm tools: Set correct virtio pci device class code
All the virtio pci device is set to class code 0x010000, this is wrong.
This patch sets the correct class code and makes lspci report correct
class type. For example, the net device:
Before:
$ lspci
00:03.0 SCSI storage controller: Red Hat, Inc Virtio network device
After:
$ lspci
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
Acked-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Wed, 26 Oct 2011 14:12:51 +0000 (17:12 +0300)]
kvm tools: Fix kvm__set_dir() to include trailing slash
All of our code expects kvm__get_dir() to return a path with a trailing slash.
This fixes "kvm run" and "kvm setup" making directories such as
"$HOME/.kvmtoolsdefault" for guest rootfs.
Pekka Enberg [Tue, 25 Oct 2011 20:53:14 +0000 (23:53 +0300)]
kvm tools: Fix 'kvm run' when run the first time
The realpath() function returns NULL if directory does not exists. This patch
changes kvm__set_dir() to call mkdir() to make sure the directory is there.
This fixes 'kvm run' breakage when run the very first time.
Sasha Levin [Tue, 25 Oct 2011 11:46:47 +0000 (13:46 +0200)]
kvm tools: Fix SDL exit on window close
We've changed IPC to use sockets instead of signals, but the process of
closing the SDL window was still trigerring an exit signal causing
an ugly message and not cleaning up after itself.
This patch switches that to use the proper method of cleaning up.
Reported-by: Osier Yang <jyang@redhat.com> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Mon, 24 Oct 2011 08:23:34 +0000 (11:23 +0300)]
kvm tools: Simplify msi message handling
This patch simplifies passing around msi messages by using
'struct kvm_irq_routing_msi' for storing of msi messages instead
of passing all msi parameters around.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 23 Oct 2011 07:03:19 +0000 (10:03 +0300)]
kvm tools, bios: Don't include glibc headers
We should not include glibc headers from BIOS code which can't rely on glibc at
runtime.
This patch fixes the following build breakage on 64-bit:
CC bios/e820.o
In file included from /usr/include/features.h:387:0,
from /usr/include/unistd.h:26,
from include/kvm/util.h:12,
from bios/e820.c:5:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated.
make: *** [bios/bios.bin.elf] Error 1
when built without the 'glibc-devel.i686' package on Fedora, for example.
Cc: Asias He <asias.hejun@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Sasha Levin <levinsasha928@gmail.com> Acked-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Fri, 21 Oct 2011 10:24:58 +0000 (12:24 +0200)]
kvm tools: Allow piping debug output to file descriptor
This patch makes debug output go to a 'debug_fd' instead of stdout.
Doing so allows us to send the output to a different console when
required.
This patch also changes the behaviour of 'kvm debug' to show the debug
output in the console that executed the debug command instead of in the
console of the guest.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 18 Oct 2011 16:52:29 +0000 (19:52 +0300)]
kvm tools: Disable stack protector for BIOS code
This pach fixes the following build breakage on Ubuntu Linux, for example,
which enables GCC stack protector by default:
CC bios/int10.o
bios/int10.o: In function `vbe_get_info':
/home/penberg/linux-2.6/tools/kvm/bios/int10.c:120: undefined reference to `__stack_chk_fail'
Suggested-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Fri, 30 Sep 2011 15:53:48 +0000 (18:53 +0300)]
kvm tools, bios: Fix BIOS to kernel memory copy
This patch implements memcpy16() function that copies memory areas in 16-bit
real mode and converts bios/int10.c to use it instead of relying on GCC struct
memcpy to do the right thing.
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Asias He <asias.hejun@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Lan Tianyu [Wed, 12 Oct 2011 13:00:03 +0000 (21:00 +0800)]
kvm tools: Add support for the read operation of qcow and qcow2 compressed image
This patch adds the decompression operation when confirming the qcow or
qcow2 image is compressed. This patch also divides the read cluster
fucntion into two which are respective for qcow and qcow2 in order to be
convenient to support these two kind images. Add some macros for qcow.
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
[ penberg@kernel.org: make zlib optional ] Signed-off-by: Pekka Enberg <penberg@kernel.org>
kvm tools: Set active console before running /bin/sh
This patch sets active console to the serial console before running the
shell. Doing so fixes two issues:
* Fix job control.
* Set all env vars.
The user visible issues are less warnings (no more of this:
sh: cannot set terminal process group (-1): Inappropriate ioctl for device
sh: no job control in this shell)
A working 'top', and a working ctrl-c.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add some missing keys to the SDL ui. This needed a bit of rework of
keyboard event handling since some of the new codes are multi-byte,
so I had to introduce a struct that keeps that information alongside
the code itself. Peculiar cases like PAUSE or PRNT SCRN are special
cased, however they aren't wired yet since I couldn't test them (I think
input grabbing is required to make them work).
Since we didn't raise the ISR INTx interrupts were sometimes ignored by
the guest. This caused hangs on boot when starting a guest without MSIX
support.
kvm tools: Use host's resolv.conf within the guest
Since kernel IP autoconfiguration doesn't set up /etc/resolv.conf, we'll
use the one located within the host, since this was anyway what we simulated
within the DHCP offer packets.
Network autoconfiguration was moved to the kernel, but the setup code still
tried to copy the script over to the rootfs. This prevented from /virt/ to
be properly created.
kvm tools: Use kernel dhcp for network autoconfiguration
This patch removes the manual/usermode dhcp client configuration and instead
uses the DHCP client built within the kernel.
Since this client is tightly integrated with NFS (if NFS config is set), we
will add a specific NFS root addr in our DHCP offer to point it to a non
existent address so that we won't hang trying to poke it for our root.
Acked-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Mon, 29 Aug 2011 12:25:00 +0000 (15:25 +0300)]
kvm tools: Add ivshmem device
The patch adds an ivshmem device which can be used to share memory between
guests on the same host.
This implementation is lacking inter-guest communication which should be
implemented later once information regarding the client-server protocol is
gathered, though infrastructure used to add and remove clients already exists
in the patch (but isn't used anywhere).
Patch is based on David Evansky's shmem device.
Original-patch-by: David Evensky <evensky@sandia.gov> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Wed, 24 Aug 2011 13:23:38 +0000 (16:23 +0300)]
kvm tools: Introduce 'kvm setup' command
This patch implements 'kvm setup' command that can be used to setup a guest
filesystem that shares system libraries and binaries from host filesystem in
read-only mode.
You can setup a new shared rootfs guest with:
./kvm setup -n default
and launch it with:
./kvm run --9p /,hostfs -p "init=virt/init" -d ~/.kvm-tools/default/
We want to teach 'kvm run' to be able to launch guest filesystems by name in
the future. Furthermore, 'kvm run' should setup a 'default' filesystem and use
it by default unless the user specifies otherwise.
Cc: Asias He <asias.hejun@gmail.com> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Tue, 23 Aug 2011 19:28:53 +0000 (22:28 +0300)]
kvm tools: MSI-X fixes
Several fixes in this patch:
* Don't ignore function level and per-vector masking. We're not
supposed to signal when masked and not doing so will improve
performance a bit (in addition to behaving correctly).
* Implement the missing PBA array. 'lspci -vv' will now show the correct
output:
Capabilities: [40] MSI-X: Enable+ Count=5 Masked-
Vector table: BAR=1 offset=00000000
PBA: BAR=3 offset=00000000
* Checking whether MSI-X is enabled or not is done by probing the
corresponding bit within the PCI header instead of trying to track
the status ourselves.
* Fallback to INTx if MSI-X isn't enabled.
* Use correct max size for MSI-X table.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>