Commit Graph

449 Commits

Author SHA1 Message Date
Pekka Enberg 407475bf94 kvm tools: Cleanup virtio code some more
This patch cleans up some more style problems in virtio code.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 80ffe4d196 kvm tools: virtio-rng code cleanup
Clean coding style and naming within virtio-rng.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 0670c57677 kvm tools: virtio-net code cleanup
Clean coding style and naming within virtio-net.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin a643306e20 kvm tools: virtio-console code cleanup
Clean coding style and naming within virtio-console.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin fe2a70d1ef kvm tools: virtio-blk code cleanup
Clean coding style and naming within virtio-blk.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 3fdf659d95 kvm tools: Abolishment of uint*_t types
Clean uint*_t type from the code.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Pekka Enberg 3c8d07a7be kvm tools: Move virtio drivers under virtio directory
This patch moves the virtio drivers under virtio directory.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin a33979d8e2 kvm tools: Add cmdline options for loading multiple images
Introduced new syntax for loading disk images.
Example:

./kvm run --image image1.img,ro --image image2.img

Will load image1.img with read only, and image2.img as
read/write.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 4749e795e2 kvm tools: Add support for multiple virtio-blk
Add support for multiple blk_devices by un-globalizing
the current blk_device and allow multiple blk_devices.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 38605e1c11 kvm tools: Move disk_image into virtio-blk
There may be multiple disk images on a running guest,
each associated with a virtio-blk.

Move disk_image into virtio-blk in preperation for
multiple disk images.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Ingo Molnar 2caa836dc7 kvm tools: Fix 32-bit build of the asm/system.h include
Provide wrappers and other environmental dependencies that the
asm/system.h header file from hell needs to build fine in user-space.

Sidenote: right now alternative() defaults to the compatible, slightly
slower barrier instructions that work on all x86 systems.

If this ever shows up in profiles then kvm could provide an alternatives
patching machinery as well. Right now those instructions are emitted
into special sections and then discarded by the linker harmlessly.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 9490278221 kvm tools: Fix virt_queue__set_used_elem
Increase idx only after updating the used element.
Not doing so may mark a buffer as used without having
it's head and length updated.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin ab9e4f1c87 kvm tools: Drop ALIGN from bios.h
Drops align from bios.h, fixes related code to use
<linux/kernel.h> instead.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Pekka Enberg c9ad1e3c72 kvm tools: Fix virtio rng build breakage
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 53eca08245 kvm tools: Add cmdline switch to enable virtio-rng
Add --virtio-rnd switch to enable virtio RNG in the guest.
Once enabled, The RNG device will be located at /dev/hwrng.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 376ac44c19 kvm tools: Introduce virtio-rng
Enable virtio-rng, a virtio random number generator.
Guest kernel should be compiled with CONFIG_HW_RANDOM_VIRTIO.
Once enabled, A RNG device will be located at /dev/hwrng.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 9449cd3c7b kvm tools: Lock job_mutex before signalling
Locking mutex before signalling to prevent unexpected
scheduling.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin f6a083e925 kvm tools: Modify thread pool API
Modify API function names and type names.

[ penberg@kernel.org: drop virtio net parts ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Pekka Enberg c4aa7c0269 Revert "kvm tools: Use threadpool for virtio-net"
This reverts commit a37089da817ce7aad9789aeb9fc09b68e088ad9a.
2015-06-01 16:39:43 +01:00
Pekka Enberg 64136c1c52 kvm tools: Emulate RTC to fix system time in guests
This patch fixes system time in guests by implementing proper CMOS RTC clock
support.

  # Before:

  sh-2.05b# date
  Fri Aug  7 04:02:01 UTC 2009

  # After:

  sh-2.05b# date
  Thu Apr 28 19:12:21 UTC 2011

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Pekka Enberg 8e5accedb8 kvm tools: Fix disk image double-free on KVM panic
The kvm_cmd_run() calls disk_image__close() before exiting so we must not it in
kvm_cpu_thread() in the "panic_kvm" case.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin b11ba2ce72 kvm tools: Use threadpool for virtio-net
virtio-net has been converted to use the threadpool.  This is very similar to
the change done in virtio-blk, only here we had 2 queues to handle.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin b6638c22f4 kvm tools: Use threadpool for virtio-console
This is very similar to the change done in virtio-net.

Notice that one signal here comes from outside the module (actual terminal)
while the other one is generated by the virtio module.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin fb0957f299 kvm tools: Use threadpool for virtio-blk
virtio-blk has been converted to use the threadpool. All the threading code has
been removed, which left only simple callback handling code.

New threadpool job types are created within VIRTIO_PCI_QUEUE_PFN for every
queue (just one in the case of virtio-blk).  The module signals for work after
receiving VIRTIO_PCI_QUEUE_NOTIFY and expects the threadpool to call
virtio_blk_do_io to handle the I/O.  It is possible that the module will signal
work several times while virtio_blk_do_io is already working, but there is no
need to handle multithreading there since the threadpool will call each job in
linear and not in parallel.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin d60bafe5d4 kvm tools: Introduce generic I/O thread pool
This patch adds a generic pool to create a common interface for working with
threads within the kvm tool. Main idea here is using this threadpool for all
I/O threads instead of having every I/O module write it's own thread code. The
process of working with the thread pool is supposed to be very simple.

During initialization, each module which is interested in working with the
threadpool will call threadpool__add_jobtype with the callback function and a
void* parameter. For example, virtio modules will register every virt_queue as
a new job type.  During operation, When theres work to do for a specific job,
the module will signal it to the queue and would expect the callback to be
called with proper parameters. It is assured that the callback will be called
once for every signal action and each callback will be called only once at a
time (i.e. callback functions themselves don't need to handle threading).

[ penberg@kernel.org: Use Lindent ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin c1b3d8d86e kvm tools: Add kernel headers required for using list
Adds kernel headers so that <linux/list.h> (and others) could be included
directly.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Sasha Levin 41520f0fc9 kvm tools: Prevent duplicate definitions of ALIGN
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Pekka Enberg 9e854d1ae0 kvm tools: Show KVM state on SIGQUIT
SysRq-t isn't useful during early boot problems because serial console is not
set up. Therefore, also dump KVM state on SIGQUIT.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:43 +01:00
Prasad Joshi a33389d8f0 kvm tools: display appropriate error message when default kernel image could not be found
This change was recommended by Ingo Molnar in his reply to mail 'Use the root
partition of the host to boot the guest machine'. The patch informs user to
explicitly run the 'kvm run --help' command, in case the kvm tool could not find
a default kernel image to boot.

prasad@prasad-kvm:~/KVM/linux-kvm/tools/kvm$ ./kvm run
Fatal: could not find default kernel image in:
	./bzImage
	../../arch/x86/boot/bzImage
	/boot/vmlinuz-2.6.35-25-generic
	/boot/bzImage-2.6.35-25-generic

Please see 'kvm run --help' for more options.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Prasad Joshi afa0f6c1c6 kvm tools: check read permission before using the root partition of the host to boot VM
The commit fbe8d0f (kvm tools: Use the root partition of the host to boot the
guest machine) changed the default image for virtual machine to root partition
of the host machine. The patch adds a check to ensure appropriate permission
(a read permission) is available for kvm tool to use this partition.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Cyrill Gorcunov ca99b3d340 kvm tools: Add NR_CPUS definition in case of non-configured kernel sources
Pekka reported
|
| I see this if I ignore the reject:
|
| penberg@tiger:~/linux/tools/kvm$ make
| In file included from mptable.c:10:
| ../../arch/x86/include/asm/mpspec_def.h:20:6: error: "NR_CPUS" is not defined

This is because the source linux kernel might not be configured (bare sources)
so we add own definition in case if there is no NR_CPUS defined.

[ penberg@kernel.org: fix up compilation error ]
Reported-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Cyrill Gorcunov 62219c717e kvm tools: Use system wide msr-index.h instead of own definitions
To eliminate code duplication.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Cyrill Gorcunov 0c7c14a747 kvm tools: Add MP tables support
This is a raw prototipe for MP table support, most resources
such as IRQ pins and sources are hardcoded among other limitations.

Note we still limit the number of cpus to run up to a single cpu
until the full SMP support appear. In particular don't forget to
remove "nolapic" from command line then.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Cyrill Gorcunov bc0363c8f9 kvm tools: Use non shared pin/irqs for virtio devices
There is no need for shared IRQs for virtio devices.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Asias He 246c834771 kvm tools: Implement virtio net TSO/UFO support
This patch bumps host to guest tcp bandwidth from

1060 Mib/s to 1760 Mib/s,

and guest to host tcp bandwidth from

 342 Mib/s to  619 Mib/s.

*************************
Without TSO and UFO
*************************
(guest <- host)
root@sid1:~# iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.33.15 port 5001 connected with 192.168.33.2 port 38733
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  1.23 GBytes  1.06 Gbits/sec
^Croot@sid1:~# iperf -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size:   110 KByte (default)
------------------------------------------------------------
[  3] local 192.168.33.15 port 5001 connected with 192.168.33.2 port 54933
[ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total Datagrams
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec  0.030 ms    0/  893 (0%)

(guest to host)
root@sid1:~# iperf -c host
------------------------------------------------------------
Client connecting to host, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.33.15 port 42197 connected with 192.168.33.2 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec    408 MBytes    342 Mbits/sec
root@sid1:~# iperf -c host -u
------------------------------------------------------------
Client connecting to host, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size:   110 KByte (default)
------------------------------------------------------------
[  3] local 192.168.33.15 port 56176 connected with 192.168.33.2 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
[  3] Sent 893 datagrams
[  3] Server Report:
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec  0.012 ms    0/  893 (0%)

*************************
With TSO and UFO
*************************

(guest <- host)
root@sid1:~# iperf  -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.33.15 port 5001 connected with 192.168.33.2 port 42767
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec  2.05 GBytes  1.76 Gbits/sec
root@sid1:~# iperf  -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size:   110 KByte (default)
------------------------------------------------------------
[  3] local 192.168.33.15 port 5001 connected with 192.168.33.2 port 35049
[ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total Datagrams
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec  0.031 ms    0/  893 (0%)

(guest -> host)
asias@hj:~$ iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.33.2 port 5001 connected with 192.168.33.15 port 60868
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.0 sec   738 MBytes   619 Mbits/sec
asias@hj:~$ iperf -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size:  112 KByte (default)
------------------------------------------------------------
[  3] local 192.168.33.2 port 5001 connected with 192.168.33.15 port 40602
[ ID] Interval       Transfer     Bandwidth        Jitter   Lost/Total Datagrams
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.030 ms    0/  893 (0%)

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Sasha Levin d39cefd257 kvm tools: Fix possible leak in qcow
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Cyrill Gorcunov aa9b6bd1b3 kvm tools: Add missing space before root= option
If user passes own options we need an extra space; otherwise options get
joined.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Pekka Enberg ad627d62f9 kvm tools: Add read-only support for QCOW2 images
This patch extends the QCOW1 format to also support QCOW2 images as specified
by the following document:

  http://people.gnome.org/~markmc/qcow-image-format.html

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Sasha Levin 839051d949 kvm tools: Use mmap to allocate guest RAM
Using mmap to allocate the RAM enables us to allocate large blocks of memory
for the guest, allowing to boot guests with a large RAM.  Since if we try
KVM_SET_USER_MEMORY_REGION with a large memory block KVM used to oops (now it
just fails), we had to move the actual ioctl to after we KVM_CREATE_VCPU.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Pekka Enberg a51948cef1 kvm tools: Fix qcow1_read_cluster() return value on error
The qcow1_read_cluster() returns negative number on error but the return value
type is unsigned. Fix that up and also fix the call-site in qcow1_read_sector()
to deal with negative return value properly.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Pekka Enberg dae803fb59 kvm tools: Kill redundant assignment in qcow1_read_cluster()
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Sasha Levin 4baf6f73fc kvm tools: Use threading for virtio block devices
Add I/O thread to handle I/O operations in virtio-blk.

There is currently support for multiple virtio queues but the kernel side
supports only one virtio queue. It's not too much of a performance impact and
the ABI does support multiple queues there - So I've prefered to do it like
that to keep it flexible.

I/O performance itself doesn't increase much due to the patch, what changes is
system responsiveness during I/O operations.  On an unthreaded system, The VCPU
is frozen up until the I/O request is complete. On the other hand, On a
threaded system the VCPU is free to do other work or queue more I/O while
waiting for the original I/O request to complete.

[ penberg@kernel.org: cleanups ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Sasha Levin 7275607079 kvm tools: Fix possible leak in disk_image
Close leaking fd if ioctl fails.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Prasad Joshi 26c853e48f kvm tools: Use the root partition of the host to boot the guest machine
The kvm run command should automatically pickup the image file to boot if one is
not explicitly specified.

Quoting Ingo Molnar:

  Looks good here, with your patch applied 'kvm run' will now boot host userspace
  with zero configuration needed (!), when there's a bzImage built in that kernel
  tree:

    aldebaran:~/linux/linux/tools/kvm> ./kvm run

    [...]

    Welcome to Fedora release 16 (Rawhide)!

Tested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Pekka Enberg 179b71f0b2 kvm tools: Untangle qcow1_read_sector() function
This patch rearranges qcow1_read_sector() code so that all normal, zero
cluster, and I/O error paths share the same exit point which also deals with L2
table freeing.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Pekka Enberg d8eea993d7 kvm tools: Cleanup qcow1_read_sector() function
Fix formatting issues and rename 'length' variable to 'nr_read'.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Prasad Joshi 65182f37d2 kvm tools: Correct a variable naming spelling mistake
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Prasad Joshi 3dac48d4a6 kvm tools: check the cluster boundary in the qcow read code
The QCOW1 code should always read the data in cluster size. A new function
qcow1_read_cluster() is added to read a cluster wort of data. The current
function to read the data i.e. qcow1_read_sector is modified to use this newly
added function and preserve the cluster boundary.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Sasha Levin 4c0205d09a kvm tools: Fix iov shifting
Use helper function to remove full iov when 'reading in full'.

Thanks Konstantin Khlebnikov.

[ penberg@kernel.org: fix formatting ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00
Sasha Levin 2d10309857 kvm tools: Rename _sg to _iov and remove dead code
Use _iov to indicate scatter-gather.
Remove simple IO ops from raw image - Dead code.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:42 +01:00