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>
Sasha Levin [Mon, 22 Aug 2011 12:58:13 +0000 (15:58 +0300)]
kvm tools: Separate virtio-pci layer
This patch builds a virtio-pci layer which can be used by virtio
devices as a layer to interact with virtio-pci. The purpose of the
patch is to separate the common virtio-pci layer from being replicated
in all virtio devices.
The new layer provides a callback interface to receive information about
virtio events.
This allows us to share the entire functionality of virtio-pci throughout all
virtio devices, for example - we don't need to implement MSI-X for each device
and can just do it once for virtio-pci.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Thu, 18 Aug 2011 12:18:31 +0000 (15:18 +0300)]
kvm tools: Guest kernel compatability
The problem of users running kernel which wasn't built for kvm tools is
somewhat common. Usualy the result is a panic during boot and a user whos'
stuck and doesn't know what to do next.
Compatability checks try to solve this issue by giving the user a meaningfull
error message which can explain whats going on and how he can fix it.
The idea is to register the device during device init and unregister the
device when the device has been 'used'. In case the kernel didn't access
the device before the guest is shut down, the host will notify the user that
something is wrong.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Sat, 13 Aug 2011 10:22:13 +0000 (13:22 +0300)]
kvm tools: Fix wrong kill() PID in commands
There was a mixup in the balloon usage string and some of the commands were
retrieving the instance name from the wrong place. This will cause the commands
to issue kill() with negative PIDs (which sends the signal to every process in
the system). Without this patch, 'kvm command instance' will do crazy things
like restart whole Gnome session.
Tested-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 13 Aug 2011 09:38:13 +0000 (12:38 +0300)]
kvm tool, sdl: Set window caption
Fix empty window caption for the tool. We should also display the guest name
but unfortunately the SDL code doesn't know about "struct kvm" so that requires
code reorganization.
Liming Wang [Fri, 12 Aug 2011 14:59:29 +0000 (22:59 +0800)]
kvm tools: unify all serials' registers with the first serial
To make all serials work well, unify value of the last three
serials' registers with the first serial. Otherwise, using ttyS1,
ttyS2, ttyS3 as console will slow the output.
Signed-off-by: Liming Wang <walimisdev@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Fri, 12 Aug 2011 11:23:06 +0000 (14:23 +0300)]
kvm tools, bios: Rename bios.S to entry.S
This patch renames bios.S to entry.S to make it more obvious what the file
contains. There's already too much source files with the word "bios" in their
names.
Pekka Enberg [Fri, 12 Aug 2011 07:51:17 +0000 (10:51 +0300)]
kvm tools, bios: Setup CF after returning from interrupt handler
While reading the code, I noticed that we don't set CF in our interrupt handler
stubs. The guest kernel may think the interrupt handler succeeded depending on
whether or not it has set CF by itself (or whether BIOS code set it by chance).
While at it, fix INT 10h handler to clear CF to make sure the guest kernel
knows the interrupt handler succeeded.
Pekka Enberg [Thu, 11 Aug 2011 15:15:18 +0000 (18:15 +0300)]
kvm tools: Organize includes in builtin-run.c
This patch organizes the includes in builtin-run.c so that KVM tool local
headers are included first, then Linux kernel headers, and finally system
headers.
This helps in keeping headers dependencies in check so that they can be
included by themselves.
Sasha Levin [Thu, 11 Aug 2011 09:04:07 +0000 (12:04 +0300)]
kvm tools: Fix IRQ mapping
This thread fixes two issues:
- Slave IRQCHIP was mapped wrong, this caused all IRQs which belong
to it to be ignored (breaking such things as the mouse).
- Line 2 was being mapped, since it's the link between slave and master
IRQCHIPs it shouldn't be.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Thu, 11 Aug 2011 12:43:54 +0000 (15:43 +0300)]
kvm tools: Make keyboard termination go through regular termination path
Instead of exiting directly when a user enters 'ctrl x + a', go through
the regular termination path by stopping all VCPUs and letting the
main thread handle it.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
kvm tools: Save and restore the iovec related values in read and write
The virtio_p9_set_reply_header function looks at the pdu buffer to find the cmd
so that it can find the reply command value. We actually found the issue when
Sasha reported that dd on his system in failing with unknown error 512 with
dotl. The reason being that, since we didn't update iovec in virtio_p9_write
virtio_p9_set_reply_header was looking at a wrong offset and the reply cmd got
set to RLERROR, and the client picked the bytes written as errno number.
We need to restore the value properly so that rest of readf and writef
work as expected.
Pekka Enberg [Wed, 10 Aug 2011 18:48:11 +0000 (21:48 +0300)]
kvm tools: Stop guest if SDL window is closed
Send SIGKVMSTOP signal to the process if the SDL window is closed. This fixes
an annoying problem where closing the window makes the guest seem like it froze
although it's really running in the background but the UI is unusable.
Pekka Enberg [Wed, 10 Aug 2011 18:32:58 +0000 (21:32 +0300)]
kvm tool: Fix builtin command usage printouts
This patch fixes builtin commands to use usage_with_options() instead of die().
The latter prefixes messages with "Fatal" which makes the usage text ugly.
Pekka Enberg [Tue, 9 Aug 2011 17:46:08 +0000 (20:46 +0300)]
kvm tools: Enable kernel DHCP autoconf by default
As we boot to '/bin/sh' by default, enable kernel DHCP autoconfiguration too.
The guest kernel needs to be configured with the following configuration
options:
Sasha Levin [Tue, 9 Aug 2011 10:17:39 +0000 (13:17 +0300)]
kvm tools: Change method of retrieving process name
This patch changes './kvm list' to retrieve process name from
'/proc/<pid>/stat' instead of '/proc/<pid>/comm' as it appears the latter
does not exist by default on several systems.
Sasha Levin [Sun, 7 Aug 2011 19:23:06 +0000 (22:23 +0300)]
kvm tools: Split 'kvm pause' and add 'kvm resume'
This patch seperates 'kvm pause' into 'kvm pause' and 'kvm resume',
'kvm pause' no longer acts as a switch between running and paused state but
instead just switches the instance into paused and reume is handled by
the new 'kvm resume'.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Thu, 21 Jul 2011 09:04:39 +0000 (12:04 +0300)]
kvm tools, qcow: Add support for writing to zero refcount clusters
This patch adds support for writing to zero refcount clusters. Refcount blocks
are cached in like L2 tables and flushed upon VIRTIO_BLK_T_FLUSH and when
evicted from the LRU cache.
With this patch applied, 'qemu-img check' no longer complains about referenced
clusters with zero reference count after
dd if=/dev/zero of=/mnt/tmp
where '/mnt' is freshly generated QCOW2 image.
Cc: Asias He <asias.hejun@gmail.com> Cc: Cyrill Gorcunov <gorcunov@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Kevin Wolf <kwolf@redhat.com> Cc: Prasad Joshi <prasadjoshi124@gmail.com> Cc: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>