]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
12 years agokvm tools: Support virtio indirect buffers
Sasha Levin [Mon, 28 Nov 2011 17:54:27 +0000 (19:54 +0200)]
kvm tools: Support virtio indirect buffers

Indirect buffers are ring descriptors which point to more (even more)
descriptors.

This can be used to increase the effective ring capacity, which helps the
guest to batch large requests - very useful for blk devices.

This patch also enables indirect buffers for virtio-net and virtio-blk.

The patch is based on the lguest's code which does the same.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Improve virtio blk request processing
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>
12 years agokvm tools, rtc: Nonvolatile BIOS memory support
Pekka Enberg [Mon, 28 Nov 2011 19:02:19 +0000 (21:02 +0200)]
kvm tools, rtc: Nonvolatile BIOS memory support

This adds a ->cmos_data array to 'struct rtc_device' that is used to emulate
nonvolatile BIOS memory and the RTC registers.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools, rtc: Implement RTC_DAY_OF_WEEK
Pekka Enberg [Mon, 28 Nov 2011 19:02:19 +0000 (21:02 +0200)]
kvm tools, rtc: Implement RTC_DAY_OF_WEEK

This patch implements support for RTC_DAY_OF_WEEK RTC register.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools, rtc: Add RTC register names
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>.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools, rtc: Introduce 'struct rtc_device'
Pekka Enberg [Mon, 28 Nov 2011 19:02:19 +0000 (21:02 +0200)]
kvm tools, rtc: Introduce 'struct rtc_device'

This patch introduces a 'struct rtc_device' in preparation for implementing
missing RTC features like alarms which need auxiliary data structures.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use vring_need_event() to determine if interrupt is needed
Asias He [Fri, 25 Nov 2011 15:47:07 +0000 (23:47 +0800)]
kvm tools: Use vring_need_event() to determine if interrupt is needed

This patch also fixes fio seq-read hang problem.

   root@guest-kvm:~# cat seq-read.fio
   [seq-read]
   rw=read
   bs=4096
   size=512m
   direct=1
   filename=/dev/vdb

   root@guest-kvm:~# fio seq-read.fio
   random-read: (g=0): rw=read, bs=4K-4K/4K-4K, ioengine=sync, iodepth=1
   Starting 1 process
   Jobs: 1 (f=1): [R] [50.0% done] [0K/0K /s] [0/0 iops] [eta 00m:27s]

Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix build in virtio/net.c
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>
12 years agokvm tools: Add event idx support to virtio-blk
Sasha Levin [Thu, 17 Nov 2011 13:53:26 +0000 (15:53 +0200)]
kvm tools: Add event idx support to virtio-blk

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Support event idx in virtio-net
Sasha Levin [Thu, 17 Nov 2011 13:53:25 +0000 (15:53 +0200)]
kvm tools: Support event idx in virtio-net

Support event idx both when using vhost and when using simple TAP mode.

I did simple TCP stream performance test with vhost, and it showed another 9%
increase over regular vhost mode.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Prepare support for VIRTIO_RING_F_EVENT_IDX
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>
12 years agokvm tools: Add '--no-dhcp' to disable kernel DHCP
Sasha Levin [Thu, 17 Nov 2011 13:53:23 +0000 (15:53 +0200)]
kvm tools: Add '--no-dhcp' to disable kernel DHCP

This new option disables the kernel DHCP which runs when starting
a custom rootfs.

This is useful when we want to start a rootfs but are using a network
other than the usermode IP proxy (a network which doesn't provide DHCP).

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add vhost-net support
Sasha Levin [Wed, 16 Nov 2011 12:24:36 +0000 (14:24 +0200)]
kvm tools: Add vhost-net support

This patch adds support to using the vhost-net device when using a tap backed
virtio-net device.

Activating vhost-net is done by appending a 'vhost=1' flag to the net device
configuration. For example:

'kvm run -n mode=tap,vhost=1'

This improves performance as follows:

  Short version
  ------------------

  TCP Throughput: +29%
  UDP Throughput: +10%
  TCP Latency: -15%
  UDP Latency: -12%

  Long version
  ------------------

  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    4895.04

  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

  229376   65507   10.00      125287      0    6565.60
  229376           10.00      106910           5602.57

  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

  229376   65507   10.00      131478      0    6890.09
  229376           10.00      118136           6190.90

  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>
12 years agokvm tools: Add optional callbacks for VQs
Sasha Levin [Wed, 16 Nov 2011 12:24:35 +0000 (14:24 +0200)]
kvm tools: Add optional callbacks for VQs

This patch adds optional callbacks which get called when the VQ gets assigned
an eventfd for notifications, and when it gets assigned with a GSI.

This allows the device to pass the eventfds to 3rd parties which can use
them to notify and get notifications regarding the VQ.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use IRQ line 5+ for devices
Sasha Levin [Tue, 15 Nov 2011 16:20:25 +0000 (18:20 +0200)]
kvm tools: Use IRQ line 5+ for devices

IRQ lines 3 and 4 are used by the serial device, assigning them to other
devices as well hurts performance. We should avoid shared IRQs if possible.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Don't add the -Wunused-result flag
Wanlong Gao [Sun, 13 Nov 2011 06:19:36 +0000 (14:19 +0800)]
kvm tools: Don't add the -Wunused-result flag

The -Wunused-result is the default option of gcc, so no need to add it
to the FLAGS.

And the previous version of gcc can't support this flag, it may cause a
compile error.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix parameter to virtio device features config
Sasha Levin [Fri, 11 Nov 2011 22:02:21 +0000 (00:02 +0200)]
kvm tools: Fix parameter to virtio device features config

Commit ef10d0b ("kvm tools: Add abstract virtio transport layer") config
updates by passing wrong argument to set_config(), this patch fixes it.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add abstract virtio transport layer
Sasha Levin [Wed, 9 Nov 2011 20:01:52 +0000 (22:01 +0200)]
kvm tools: Add abstract virtio transport layer

Since virtio-mmio was introduced in 3.2, virtio-pci isn't the only transport
layer between the kernel and virtio devices.

This patch adds an abstract virtio-transport layer which allows to easily
use different transports while making it transparent to the device.

This is the first step in adding virtio-mmio support.

Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Create /etc/passwd in shared rootfs
Sasha Levin [Mon, 7 Nov 2011 21:36:21 +0000 (23:36 +0200)]
kvm tools: Create /etc/passwd in shared rootfs

This patch creates a dummy /etc/passwd on guest creation.

This is done because some applications (read: git) get angry when they
can't find current user in /etc/passwd.

Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Clean up remove/rename in 9p
Sasha Levin [Mon, 7 Nov 2011 21:36:20 +0000 (23:36 +0200)]
kvm tools: Clean up remove/rename in 9p

Trivial cleanups.

Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Drop "notsc" no longer needed kernel option
Cyrill Gorcunov [Wed, 9 Nov 2011 19:25:34 +0000 (23:25 +0400)]
kvm tools: Drop "notsc" no longer needed kernel option

"notsc" option has been used to avoid APIC calibration
problem at early days when we didn't support APIC at all.

Now with KVM APIC emulation used there is no longer need
for this option. Drop it.

Reported-by: Richard Weinberger <richard@nod.at>
Tested-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use correct config defines
Sasha Levin [Wed, 9 Nov 2011 14:42:20 +0000 (16:42 +0200)]
kvm tools: Use correct config defines

For some reason some of the defines were set to HAS_VIRTIO instead of HAS_AIO.

This broke raw blk device.

Reported-and-tested-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Remove async flag from QCOW
Sasha Levin [Wed, 9 Nov 2011 12:00:49 +0000 (14:00 +0200)]
kvm tools: Remove async flag from QCOW

QCOW disk image async flag was erroneously enabled, while QCOW doesn't support
async ops yet.

This has caused a hang when booting QCOW images.

Reported-and-tested-by: Richard -rw- Weinberger <richard.weinberger@gmail.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add missing 9p rename handler
Sasha Levin [Mon, 7 Nov 2011 15:54:12 +0000 (17:54 +0200)]
kvm tools: Add missing 9p rename handler

This adds a rename handler which actually allows us to rename files in the
guest.

Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add missing 9p remove handler
Sasha Levin [Mon, 7 Nov 2011 15:54:11 +0000 (17:54 +0200)]
kvm tools: Add missing 9p remove handler

This adds a remove handler which actually allows us to unlink files in the
guest.

Reported-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokconfig: Update 'make kvmconfig'
Sasha Levin [Sat, 5 Nov 2011 04:36:31 +0000 (06:36 +0200)]
kconfig: Update 'make kvmconfig'

Adds missing deps.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix VESA BIOS mode info
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>
12 years agoconfig: Add 'make kvmconfig'
Sasha Levin [Thu, 27 Oct 2011 12:07:14 +0000 (14:07 +0200)]
config: Add 'make kvmconfig'

This patch adds 'make kvmconfig' which allows to add KVM guest support
to a config file.

This allows for easier testing of configurations under virtualized
environments.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: <linux-kbuild@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Michal Marek <mmarek@suse.cz>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use native vectored AIO in virtio-blk
Sasha Levin [Wed, 2 Nov 2011 05:41:14 +0000 (07:41 +0200)]
kvm tools: Use native vectored AIO in virtio-blk

This patch hooks AIO support into virtio-blk, allowing for faster IO.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
[ penberg@kernel.org: wrap libaio include with CONFIG_HAS_AIO ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add aio read write functions
Sasha Levin [Wed, 2 Nov 2011 05:41:13 +0000 (07:41 +0200)]
kvm tools: Add aio read write functions

This patch adds basic native vectored AIO functions.

These functions should be optimized to process multiple io
requests at once.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Hook virtio-blk completion to disk op completion
Sasha Levin [Wed, 2 Nov 2011 05:41:12 +0000 (07:41 +0200)]
kvm tools: Hook virtio-blk completion to disk op completion

This patch connects the completion processing in virtio-blk to the completion
notification coming from disk image.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Split io request from completion
Sasha Levin [Wed, 2 Nov 2011 05:41:11 +0000 (07:41 +0200)]
kvm tools: Split io request from completion

This patch splits IO request processing from completion notification.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Remove qcow nowrite function
Sasha Levin [Wed, 2 Nov 2011 05:41:10 +0000 (07:41 +0200)]
kvm tools: Remove qcow nowrite function

It is no longer needed due to previous changes.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add optional callback on disk op completion
Sasha Levin [Wed, 2 Nov 2011 05:41:09 +0000 (07:41 +0200)]
kvm tools: Add optional callback on disk op completion

This patch adds an optional callback to be called when a disk op completes.

Currently theres not much use for it, but it is the infrastructure for adding
aio support.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Modify behaviour on missing ops ptr
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>
12 years agokvm tools: Modify disk ops usage
Sasha Levin [Wed, 2 Nov 2011 05:41:07 +0000 (07:41 +0200)]
kvm tools: Modify disk ops usage

This patch modifies the definition and usage of ops for read only, mmap and
regular IO.

There is no longer a mix between iov and mmap, and read only no longer implies
mmap (although it will try to use it first).

This allows for more flexibility defining different ops for different
scenarios.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Remove the non-iov interface from disk image ops
Sasha Levin [Wed, 2 Nov 2011 05:41:06 +0000 (07:41 +0200)]
kvm tools: Remove the non-iov interface from disk image ops

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Switch to using an enum for disk image types
Sasha Levin [Wed, 2 Nov 2011 05:41:05 +0000 (07:41 +0200)]
kvm tools: Switch to using an enum for disk image types

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Remove dead code virt_queue__trigger_irq()
Asias He [Mon, 31 Oct 2011 14:39:42 +0000 (22:39 +0800)]
kvm tools: Remove dead code virt_queue__trigger_irq()

This function is not used anymore. Instead, We are using
virtio_pci__signal_vq() to trigger interrupt right now.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix ndev mutex and condition variable initialization
Asias He [Mon, 31 Oct 2011 14:39:41 +0000 (22:39 +0800)]
kvm tools: Fix ndev mutex and condition variable initialization

This patch fixes the initialization of the following variables:

   ndev->io_tx_lock
   ndev->io_rx_lock
   ndev->io_tx_cond
   ndev->io_rx_cond

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix a vertical indentation for net/uip/udp.c
Asias He [Mon, 31 Oct 2011 14:39:40 +0000 (22:39 +0800)]
kvm tools: Fix a vertical indentation for net/uip/udp.c

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use macro in uip_tx_do_ipv4()
Asias He [Mon, 31 Oct 2011 14:39:39 +0000 (22:39 +0800)]
kvm tools: Use macro in uip_tx_do_ipv4()

Use marcro instead of magic number in uip_tx_do_ipv4()

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Drop unused variable in struct uip_buf
Asias He [Mon, 31 Oct 2011 14:39:38 +0000 (22:39 +0800)]
kvm tools: Drop unused variable in struct uip_buf

'u32 payload' is not used, so drop it.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Cleanup ghost socket files
Sasha Levin [Fri, 28 Oct 2011 09:01:55 +0000 (11:01 +0200)]
kvm tools: Cleanup ghost socket files

Clean ghost socket files as part of the regular connection process.

This fixes the bug of 'kvm list' failing with "Failed connecting to instance"
when ghost socket files existed.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Handle only relevant events in epoll
Sasha Levin [Fri, 28 Oct 2011 09:01:54 +0000 (11:01 +0200)]
kvm tools: Handle only relevant events in epoll

Handle only new incoming data for listener and stop fds, treat all other
events as error events which close the socket.

This fixes the bug where a 'kvm list' could have hanged because a close
event in the listener fd have been treated as a new connection.

Cc: Osier Yang <jyang@redhat.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix MSI-X table size set up
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>
12 years agokvm tools: Set correct virtio pci device class code
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>
12 years agokvm tools: Beautify kvm list output
Osier Yang [Wed, 26 Oct 2011 06:02:11 +0000 (14:02 +0800)]
kvm tools: Beautify kvm list output

With the patch, output of "kvm list" will be:

% ./kvm list
   PID NAME                 STATE
------------------------------------
 5270 test                 running
      test                 shut off
      default              shut off

"not running" is changed into "shut off", as it might
be other states which are "not running" in future? such
as "paused".

Signed-off-by: Osier Yang <jyang@redhat.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use ARRAY_SIZE helper to count serial devices
Cyrill Gorcunov [Thu, 27 Oct 2011 06:35:17 +0000 (10:35 +0400)]
kvm tools: Use ARRAY_SIZE helper to count serial devices

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix kvm__set_dir() to include trailing slash
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.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix 'kvm run' when run the first time
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.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Avoid overwriting socket files with same name
Sasha Levin [Tue, 25 Oct 2011 13:21:49 +0000 (15:21 +0200)]
kvm tools: Avoid overwriting socket files with same name

This patch prevents overwriting socket files by running two instances with
the same name.

Reported-by: Osier Yang <jyang@redhat.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Improve "kvm list" default output
Pekka Enberg [Tue, 25 Oct 2011 12:20:09 +0000 (15:20 +0300)]
kvm tools: Improve "kvm list" default output

This patch changes 'kvm list' default output to look as follows:

  [penberg@tux kvm]$ ./kvm list
    PID GUEST
   8156 guest-8156
        default (not running)
        test-box (not running)

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Cc: Asias He <asias.hejun@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Improve "kvm setup" info and error messages
Pekka Enberg [Tue, 25 Oct 2011 11:59:55 +0000 (14:59 +0300)]
kvm tools: Improve "kvm setup" info and error messages

This patch improves the output of 'kvm setup' as follows:

  [penberg@tux kvm]$ ./kvm setup

  kvm setup creates a new rootfs under /home/penberg//.kvm-tools/.
  This can be used later by the '-d' parameter of 'kvm run'.

   usage: kvm setup [name]

  [penberg@tux kvm]$ ./kvm setup test-box
  A new rootfs 'test-box' has been created in '/home/penberg//.kvm-tools/test-box'.

  You can now start it by running the following command:

    kvm run -d test-box

  [penberg@tux kvm]$ ./kvm setup test-box
  Unable to create rootfs in /home/penberg//.kvm-tools/test-box: File exists

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Cc: Asias He <asias.hejun@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Kill double slash from kvm__get_dir()
Pekka Enberg [Tue, 25 Oct 2011 12:09:02 +0000 (15:09 +0300)]
kvm tools: Kill double slash from kvm__get_dir()

In preparation for showing kvm__get_dir() path to the user, kill the
unnecessary double slash to make the output more readable.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Cc: Asias He <asias.hejun@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix SDL exit on window close
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>
12 years agokvm tools: Add method to stop ipc thread
Sasha Levin [Tue, 25 Oct 2011 11:30:53 +0000 (13:30 +0200)]
kvm tools: Add method to stop ipc thread

Stop the ipc thread when shutting down the hypervisor.

This solves a bug where the .sock files weren't removed upon shutdown.

Reported-by: Osier Yang <jyang@redhat.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Simplify msi message handling
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>
12 years agokvm tools, bios: Don't include glibc headers
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>
12 years agokvm tools: Allow piping debug output to file descriptor
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>
12 years agokvm tools: Move memory stat print to client
Sasha Levin [Sun, 16 Oct 2011 19:57:55 +0000 (21:57 +0200)]
kvm tools: Move memory stat print to client

So far we were printing memory statistics in the terminal of the guest,
this was annoying, confusing and inneficient.

This patch moves the print to the terminal which ran 'kvm stat'

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Switch to using UNIX sockets instead of signals
Sasha Levin [Sun, 16 Oct 2011 19:57:54 +0000 (21:57 +0200)]
kvm tools: Switch to using UNIX sockets instead of signals

This patch changes the IPC method to use UNIX sockets instead of
signals.

This allows for more flexibility in moving data between processes, for example
it would allow avoid printing output in the terminal of the guest.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Disable stack protector for BIOS code
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>
12 years agokvm tools, bios: Fix BIOS to kernel memory copy
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>
12 years agokvm tools: Use kvm__get_dir() helper function
Pekka Enberg [Sun, 16 Oct 2011 18:22:49 +0000 (21:22 +0300)]
kvm tools: Use kvm__get_dir() helper function

This patch adds a kvm__get_dir() helper function that replaces open-coded uses
of HOME_DIR and KVM_PID_FILE_PATH.

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>
12 years agokvm tools: Use HOME_DIR and KVM_PID_FILE_PATH from <kvm/kvm.h>
Pekka Enberg [Sun, 16 Oct 2011 18:22:49 +0000 (21:22 +0300)]
kvm tools: Use HOME_DIR and KVM_PID_FILE_PATH from <kvm/kvm.h>

This patch removes duplicate defines from builtin-setup.c.

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>
12 years agokvm tools: Add support for the read operation of qcow and qcow2 compressed image
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>
12 years agokvm tools: Enable fast string operations
Sasha Levin [Fri, 14 Oct 2011 07:36:09 +0000 (09:36 +0200)]
kvm tools: Enable fast string operations

Recent kernels check for MSR_IA32_MISC_ENABLE_FAST_STRING in the
MSR_IA32_MISC_ENABLE MSR before enabling reps/movs memcpy.

So far we didn't set it, and got a slower memcpy and a warning:

[    0.000000] Disabled fast string operations

This patch enables fast string operations.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add option to list rootfs in 'kvm list'
Sasha Levin [Thu, 13 Oct 2011 09:32:46 +0000 (11:32 +0200)]
kvm tools: Add option to list rootfs in 'kvm list'

Previously we would only list running instances, now that we create
rootfs instances it's appropriate to add a method to list them as
well.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Modify 'kvm setup' parameters
Sasha Levin [Thu, 13 Oct 2011 09:32:45 +0000 (11:32 +0200)]
kvm tools: Modify 'kvm setup' parameters

This patch makes the name as the default parameter, this makes usability
easier since this is the only parameter available at the moment anyway.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add help and info messages to 'kvm setup'
Sasha Levin [Thu, 13 Oct 2011 09:32:44 +0000 (11:32 +0200)]
kvm tools: Add help and info messages to 'kvm setup'

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Add basic help when starting 'kvm' without args
Sasha Levin [Thu, 13 Oct 2011 09:32:43 +0000 (11:32 +0200)]
kvm tools: Add basic help when starting 'kvm' without args

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Improve compat message
Sasha Levin [Thu, 13 Oct 2011 09:32:42 +0000 (11:32 +0200)]
kvm tools: Improve compat message

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Use compat message per device instead of per instance
Sasha Levin [Thu, 13 Oct 2011 09:32:41 +0000 (11:32 +0200)]
kvm tools: Use compat message per device instead of per instance

This prevents multiple messages for the same type of device.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix spelling mistake
Sasha Levin [Thu, 13 Oct 2011 09:32:40 +0000 (11:32 +0200)]
kvm tools: Fix spelling mistake

Suggested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Move segment_to_flat() to kvm/segment.h
Pekka Enberg [Fri, 30 Sep 2011 15:37:59 +0000 (18:37 +0300)]
kvm tools: Move segment_to_flat() to kvm/segment.h

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools, sdl: Fix "5" key
Alessandro Guido [Thu, 29 Sep 2011 12:59:19 +0000 (14:59 +0200)]
kvm tools, sdl: Fix "5" key

Use the right set2 scancode for the "5" key.

Signed-off-by: Alessandro Guido <ag@alessandroguido.name>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: NULL-terminate init env
Pekka Enberg [Thu, 29 Sep 2011 14:31:16 +0000 (17:31 +0300)]
kvm tools: NULL-terminate init env

This patch fixes 'kvm run' rootfs boot failures:

  Starting '/bin/sh'...
  Init failed: Bad address

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Support multiple net devices
Sasha Levin [Wed, 28 Sep 2011 05:45:55 +0000 (08:45 +0300)]
kvm tools: Support multiple net devices

This patch adds support for multiple network devices. The command line syntax
changes to the following:

--network/-n [mode=tap/user/none][,guest_ip=ip][,host_ip=
ip][,guest_mac=mac][,script=file]

Each of the parameters is optional, and the config defaults to a TAP based
networking with a sequential MAC.

Acked-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Fix up build instructions on Fedora
Pekka Enberg [Tue, 27 Sep 2011 14:12:47 +0000 (17:12 +0300)]
kvm tools: Fix up build instructions on Fedora

Fix up build instructions so that people can build the tool on fresh
installation of Fedora.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: Set active console before running /bin/sh
Sasha Levin [Tue, 27 Sep 2011 13:03:47 +0000 (16:03 +0300)]
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>
12 years agokvm tools, ui: Add some missing key codes
Alessandro Guido [Mon, 26 Sep 2011 11:12:12 +0000 (13:12 +0200)]
kvm tools, ui: Add some missing key codes

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).

Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Alessandro Guido <ag@alessandroguido.name>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
12 years agokvm tools: don't use custom strtoul for hex numbers
Andy Shevchenko [Fri, 23 Sep 2011 14:53:44 +0000 (17:53 +0300)]
kvm tools: don't use custom strtoul for hex numbers

Cc: kvm@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Clear presence of performance-energy bias bit
Cyrill Gorcunov [Sun, 18 Sep 2011 07:33:33 +0000 (11:33 +0400)]
kvm tools: Clear presence of performance-energy bias bit

In case if host machine supports performance-energy bias
capability it should not be propagated to KVM hypervisor.

Otherwise the kernel tries to do read MSR_IA32_ENERGY_PERF_BIAS
register and cause kernel panic (general protection fault).

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Document steps to debug kernel using KGDB
Sasha Levin [Mon, 19 Sep 2011 11:05:56 +0000 (14:05 +0300)]
kvm tools: Document steps to debug kernel using KGDB

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
13 years agokvm tools: Fix INTx handling
Sasha Levin [Mon, 19 Sep 2011 10:40:45 +0000 (13:40 +0300)]
kvm tools: Fix INTx handling

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.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
13 years agokvm tools: Use correct subsys id in virtio-pci
Sasha Levin [Sun, 18 Sep 2011 18:25:51 +0000 (21:25 +0300)]
kvm tools: Use correct subsys id in virtio-pci

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
13 years agokvm tools: Use host's resolv.conf within the guest
Sasha Levin [Wed, 14 Sep 2011 16:28:26 +0000 (19:28 +0300)]
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.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
13 years agokvm tools: Don't copy network autoconfiguration script
Sasha Levin [Wed, 14 Sep 2011 16:28:25 +0000 (19:28 +0300)]
kvm tools: Don't copy network autoconfiguration script

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.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
13 years agokvm tools: Allow remapping guest TTY into host PTS
Sasha Levin [Fri, 16 Sep 2011 08:49:13 +0000 (11:49 +0300)]
kvm tools: Allow remapping guest TTY into host PTS

This patch adds the '-tty' option to 'kvm run' which allows the user to
remap a guest TTY into a PTS on the host.

Usage:
        'kvm run --tty [id]'

The tty will be mapped to a pts and will be printed on the screen:
        '  Info: Assigned terminal 1 to pty /dev/pts/X'

At this point, it is possible to communicate with the guest using that pty.

This is useful for debugging guest kernel using KGDB:

1. Run the guest:
        'kvm run -k [vmlinuz] -p "kgdboc=ttyS1 kgdbwait" --tty 1'

And see which PTY got assigned to ttyS1.

2. Run GDB on the host:
        'gdb [vmlinuz]'

3. Connect to the guest (from within GDB):
        'target remote /dev/pty/X'

4. Start debugging! (enter 'continue' to continue boot).

Cc: David Evensky <evensky@dancer.ca.sandia.gov>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
13 years agokvm tools: Don't use i8042 AUX port
Sasha Levin [Wed, 14 Sep 2011 07:24:53 +0000 (10:24 +0300)]
kvm tools: Don't use i8042 AUX port

We are enabling i8042 even without VNC or SDL so that we could use it's
reset method to reboot the guest.

AUX port might cause delays during boot. Disable it if the user didn't ask
for VNC or SDL.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use kernel dhcp for network autoconfiguration
Sasha Levin [Wed, 14 Sep 2011 07:11:09 +0000 (10:11 +0300)]
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>
13 years agokvm tools: Fix 32bit build errors
Sasha Levin [Wed, 14 Sep 2011 08:17:27 +0000 (11:17 +0300)]
kvm tools: Fix 32bit build errors

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: remove addr_type - unused but set variable
Hagen Paul Pfeifer [Wed, 7 Sep 2011 18:48:37 +0000 (20:48 +0200)]
kvm tools: remove addr_type - unused but set variable

Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix compat message formatting
Sasha Levin [Mon, 12 Sep 2011 17:25:29 +0000 (20:25 +0300)]
kvm tools: Fix compat message formatting

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Modify 'kvm run' to use virt fs
Sasha Levin [Mon, 12 Sep 2011 17:25:28 +0000 (20:25 +0300)]
kvm tools: Modify 'kvm run' to use virt fs

'kvm run' will now create a 'default' profile and boot into it.

Currently we boot into rw rootfs of the host, which is risky. Instead,
we can boot in a 'safe' enviroment with networking.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add guestfs network autoconfiguration
Sasha Levin [Mon, 5 Sep 2011 23:23:55 +0000 (02:23 +0300)]
kvm tools: Add guestfs network autoconfiguration

Add a script to automatically configure networking in the guest.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Teach 'run' to handle guestfs
Sasha Levin [Mon, 5 Sep 2011 23:23:54 +0000 (02:23 +0300)]
kvm tools: Teach 'run' to handle guestfs

This patch allows to run previously created guestfs by simply specifying it
with the '-d' parameter.

This allows running guestfs which were created before using:

kvm setup -n [name]

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Attach default 'root=' only if required
Sasha Levin [Mon, 5 Sep 2011 23:23:53 +0000 (02:23 +0300)]
kvm tools: Attach default 'root=' only if required

This patch fixes a case where the 'root=' parameter was passed twice
when using virtio-9p root mode.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix 32bit warnings
Sasha Levin [Mon, 5 Sep 2011 23:23:52 +0000 (02:23 +0300)]
kvm tools: Fix 32bit warnings

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>