Pekka Enberg [Tue, 6 Dec 2011 13:54:29 +0000 (15:54 +0200)]
kvm tools: Fix kvm/barrier.h build breakage
Ingo Molnar writes:
On Tue, 6 Dec 2011, Ingo Molnar wrote:
> > FYI, today's version fails to build:
> >
> > In file included from x86/include/kvm/barrier.h:13:0,
> > from virtio/core.c:5:
> > ../../arch/x86/include/asm/system.h:404:1: error: unknown type
> > name ‘bool’
> > make: *** [virtio/core.o] Error 1
> > make: *** Waiting for unfinished jobs....
> >
> > latest Fedora Rawhide.
>
> There's no 'bool' in system.h for 3.2-rc4. Is this something that's
> changed in -tip?
It got introduced by a post-rc4 fix:
e5fd47bfab2d: xen/pm_idle: Make pm_idle be default_idle under Xen.
Fix it by include <stdbool.h> in kvm/barrier.h
Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Matt Evans [Tue, 6 Dec 2011 03:37:17 +0000 (14:37 +1100)]
kvm tools: Split x86 arch-specific bits into x86/
Create a new arch-specific subdirectory to contain architecture-specific code
and includes.
The Makefile now adds various arch-specific objects based on detected
architecture. That aside, this patch should only contain code moves. These
include:
- x86-specific kvm_cpu setup, kernel loading, memory setup etc. now in
x86/kvm{-cpu}.c
- BIOS now lives in x86/bios/
- ioport setup
- KVM extensions are asserted in arch-specific kvm.c now, so each architecture
can manage its own dependencies.
- Various architecture-specific #defines are moved into $(ARCH)/include/kvm{-cpu}.h
such as struct kvm_cpu, KVM_NR_CPUS, KVM_32BIT_GAP_SIZE.
Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Tue, 6 Dec 2011 08:45:21 +0000 (10:45 +0200)]
kvm tools: Ninja out support for VIRTIO_F_FEATURES_HIGH
Rusty has just removed it out of the spec. Since we probably the only ones
who implemented support for it, we should remove it out of our code as well.
There is no issue with breaking anything since nothing else worked with it,
so it's fully backwards compatible.
Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Lan Tianyu [Tue, 29 Nov 2011 07:30:26 +0000 (15:30 +0800)]
kvm tools, qcow: Add the support for copy-on-write cluster
When meeting request to write the cluster without copied flag,
allocate a new cluster and write original data with modification
to the new cluster. This also adds support for the writing operation
of the qcow2 compressed image. After testing, image file can pass
through "qemu-img check". The performance is needed to be improved.
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Mon, 28 Nov 2011 05:34:11 +0000 (13:34 +0800)]
kvm tools: Improve virtio blk request processing
There are at most bdev->reqs[VIRTIO_BLK_QUEUE_SIZE] outstanding requests
at any time. We can simply use the head of each request to fetch the
right 'struct blk_dev_req' in bdev->reqs[].
So, we can eliminate the list and lock operations which introduced by
virtio_blk_req_{pop, push}.
Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Mon, 28 Nov 2011 19:02:19 +0000 (21:02 +0200)]
kvm tools, rtc: Add RTC register names
Add missing RTC register names to hw/rtc.c and rename the current ones to
follow <linux/mc146818rtc.h> naming. It would be nice to use the header
directly but unfortunately it includes <linux/spinlock.h>.
Asias He [Fri, 25 Nov 2011 11:59:56 +0000 (19:59 +0800)]
kvm tools: Fix build in virtio/net.c
virtio/net.c: In function ???virtio_net__vhost_init???:
virtio/net.c:476:22: error: cast from pointer to integer of different
size [-Werror=pointer-to-int-cast]
cc1: all warnings being treated as errors
Signed-off-by: Asias He <asias.hejun@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Sasha Levin [Thu, 17 Nov 2011 13:53:24 +0000 (15:53 +0200)]
kvm tools: Prepare support for VIRTIO_RING_F_EVENT_IDX
This patch is the base for enabling support for event index feature in the virtio spec.
We do so by updating and evaluating the used/avail event idx in the virtio ring functions.
Actual usage of this flag is in the following patches.
The results are less notifications between the guest and host, and in
result faster operation of the virt queues.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
16384 87380 1 1 10.00 14811.55
MIGRATED UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
229376 229376 1 1 10.00 16000.44
229376 229376
After:
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
192.168.33.4 (192.168.33.4) port 0 AF_INET
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 10.00 6340.74
MIGRATED UDP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to
192.168.33.4 (192.168.33.4) port 0 AF_INET
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
16384 87380 1 1 10.00 17126.10
MIGRATED UDP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
to 192.168.33.4 (192.168.33.4) port 0 AF_INET : first burst 0
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
229376 229376 1 1 10.00 17944.51 Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Sasha Levin <levinsasha928@gmail.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
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).