]>
git.karo-electronics.de Git - karo-tx-linux.git/log
Pekka Enberg [Sat, 8 Jan 2011 12:50:32 +0000 (14:50 +0200)]
kvm: Redirect serial console to stdout, not stderr
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 8 Jan 2011 12:28:59 +0000 (14:28 +0200)]
kvm: Implement virtio block device write support
This patch implement virtio block device write support. The writes are not
persistent because we map the disk image with MAP_PRIVATE.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 8 Jan 2011 11:24:49 +0000 (13:24 +0200)]
kvm: Kill debug logging from blk-virtio.c
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 8 Jan 2011 11:20:56 +0000 (13:20 +0200)]
kvm: Support MSR register for serial console
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 8 Jan 2011 10:06:47 +0000 (12:06 +0200)]
kvm: Fix virtio block device support some more
This patch fixes the following issues in virtio block device support:
- Handle all requests in the virtqueue before signaling an interrupt.
- Initialize ->used vring elements properly.
- Handle non-read requests by injecting an I/O error to the guest.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sat, 8 Jan 2011 10:18:44 +0000 (12:18 +0200)]
kvm: Fix virtqueue ring index check
This patch fixes the virtqueu ring index check that was totally wrong. The
->last_avail_idx is the index we've last seen but it doesn't need to match with
avail->idx.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Sat, 8 Jan 2011 02:28:26 +0000 (10:28 +0800)]
virtio: capacity should be in 512-byte sectors
struct virtio_blk_config {
/* The capacity (in 512-byte sectors). */
uint64_t capacity;
...
}
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Fri, 7 Jan 2011 19:25:24 +0000 (21:25 +0200)]
kvm: Fail if user specifies a QCOW disk image
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Fri, 7 Jan 2011 19:17:59 +0000 (21:17 +0200)]
kvm: Improve kvm__init() error message
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Fri, 7 Jan 2011 19:06:27 +0000 (21:06 +0200)]
kvm: Enable virtio block device if disk image specified
This patch removes the "--enable-virtion" command line option and enable virtio
block device when a disk image is specified.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Thu, 6 Jan 2011 09:58:36 +0000 (11:58 +0200)]
Merge branch 'master' of git://github.com/cyrillos/vm
Cyrill Gorcunov [Thu, 6 Jan 2011 09:55:32 +0000 (12:55 +0300)]
virtio-blk: Leave disk geometry to compute in kernel
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Thu, 6 Jan 2011 09:48:45 +0000 (11:48 +0200)]
kvm: Introduce a list of known BUGS
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Thu, 6 Jan 2011 08:22:09 +0000 (10:22 +0200)]
kvm: Cleanup disk geometry setup code
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Cyrill Gorcunov [Wed, 5 Jan 2011 22:37:29 +0000 (01:37 +0300)]
kvm: Setup disk geometry if needed
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Wed, 5 Jan 2011 20:47:28 +0000 (22:47 +0200)]
kvm: Use disk image API from virtio block device
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Wed, 5 Jan 2011 17:54:48 +0000 (19:54 +0200)]
kvm: Add support for disk images
This patch implements "--image" command line option that can be used to specify
a disk image. It supports raw images and it needs to be integrated to the
hypervisor block layer.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Wed, 5 Jan 2011 16:11:15 +0000 (18:11 +0200)]
kvm: Kill stale interrupt configuration comment
Yes, our interrupt configuration is OK. We can see the guest interrupt trapping
to our hypervisor.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Wed, 5 Jan 2011 16:00:52 +0000 (18:00 +0200)]
kvm: Implement virtio blk device vring lookup
This patch changes VIRTIO_PCI_QUEUE_NOTIFY handler to look up the actual I/O
request from the vring. We don't inject anything back to the guest yet.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 19:07:30 +0000 (21:07 +0200)]
kvm: Implement virtqueues for virtio block device
This patch implements virtqueues for virtio block device. It doesn't handle the
I/O requests on the vring yet, though.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 18:41:25 +0000 (20:41 +0200)]
kvm: Add ->queue_selector and ->queue_pfn to struct device
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 17:30:06 +0000 (19:30 +0200)]
kvm: Make virtio block device read-only
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 16:21:21 +0000 (18:21 +0200)]
kvm: Implement virtio blk device config space
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 16:21:35 +0000 (18:21 +0200)]
Revert "kvm: Fix virtio block PCI device IRQ configuration"
This reverts commit
00b793d98754629f833d5a3003554f841e64ec45 .
Pekka Enberg [Tue, 4 Jan 2011 15:22:57 +0000 (17:22 +0200)]
kvm: Remove bogus #include directive
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 15:20:23 +0000 (17:20 +0200)]
kvm: Don't use VIRTIO_BLK_F_SEG_MAX in the hypervisor
We don't actually support VIRTIO_BLK_F_SEG_MAX so disable it from host
features. This fixes the following error during virtio block device probe in
the guest kernel which is caused by bogus "sg_elems" in virtblk_probe():
------------[ cut here ]------------
WARNING: at mm/page_alloc.c:1968 __alloc_pages_nodemask+0x5b4/0x6c0()
Modules linked in:
Pid: 1, comm: swapper Not tainted 2.6.35-rc3 #48
Call Trace:
[<
ffffffff81081e7f >] warn_slowpath_common+0x7f/0xc0
[<
ffffffff81081eda >] warn_slowpath_null+0x1a/0x20
[<
ffffffff8110a6e4 >] __alloc_pages_nodemask+0x5b4/0x6c0
[<
ffffffff8124f860 >] ? idr_get_empty_slot+0x110/0x2c0
[<
ffffffff8124f860 >] ? idr_get_empty_slot+0x110/0x2c0
[<
ffffffff81138795 >] alloc_page_interleave+0x45/0xa0
[<
ffffffff811395d9 >] alloc_pages_current+0xb9/0xe0
[<
ffffffff8110993e >] __get_free_pages+0xe/0x50
[<
ffffffff8114191e >] __kmalloc+0x14e/0x1c0
[<
ffffffff8137dbf7 >] ? virtio_config_buf+0x57/0x80
[<
ffffffff81671e15 >] virtblk_probe+0x78/0x498
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 15:14:56 +0000 (17:14 +0200)]
kvm: Cleanup virtio block device I/O functions
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Tue, 4 Jan 2011 15:13:19 +0000 (17:13 +0200)]
kvm: Implement "host features" for virtio blk device
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Cyrill Gorcunov [Mon, 3 Jan 2011 16:37:36 +0000 (19:37 +0300)]
bios: Use proper grep syntax
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Mon, 3 Jan 2011 16:21:11 +0000 (18:21 +0200)]
kvm: Fix virtio block PCI device IRQ configuration
This patch fixes up hang when guest kernel tries to setup virtio block device.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Cyrill Gorcunov [Thu, 18 Nov 2010 17:17:04 +0000 (20:17 +0300)]
bios: Get rid of redundant ops
cli/sti is not needed here
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sun, 29 Aug 2010 16:17:03 +0000 (20:17 +0400)]
kvm: Don't forget to close initrd file
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Sun, 29 Aug 2010 14:11:17 +0000 (17:11 +0300)]
kvm: Fix kernel loading error messages
This patch fixes kernel loading error messages. We expect users to try to load
bzImage most of the time and. However, if the user passes a binary that's not a
bzImage, lets just print out the following warning:
Warning: vmlinux is not a bzImage. Trying to load it as a flat binary...
and pass the control to the binary.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Cyrill Gorcunov [Sun, 29 Aug 2010 11:42:51 +0000 (15:42 +0400)]
kvm: Add virtio_blk.h to tree
This patch adds virtio_blk.h from Linux kernel sources to the tree. We will
need it to implement virtio block device emulation.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sun, 29 Aug 2010 11:27:40 +0000 (15:27 +0400)]
kvm: Add virtio_ring.h to tree
This patch adds virtio_ring.h from Linux kernel sources to the tree. We will
need it to implement virtio block device emulation.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Sun, 15 Aug 2010 15:39:27 +0000 (18:39 +0300)]
kvm: Virtio block device emulation
This patch implements a rough first version of virtio block device emulation.
You can enable it with the '--enable-virtio' command line option. We're still
missing virtio queue handling so enabling virtio will cause a guest kernel to
hang.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Asias He [Wed, 25 Aug 2010 03:06:34 +0000 (11:06 +0800)]
kvm: Add cscope target to Makefile
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 14:17:43 +0000 (17:17 +0300)]
kvm: Fail virtio blk ioports by default
This patch changes virtio block device ioports to fail by default and adds few
specific stubs to keep kernel booting still.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 12:13:00 +0000 (15:13 +0300)]
kvm: Add virtio PCI ioport handler stubs
This patch adds stub virtio PCI ioport handlers to our virtio emulation layer.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 12:03:01 +0000 (15:03 +0300)]
kvm: Add port range to ioport__register()
This patch adds a 'count' argument to ioport__register() to allow callers to
register a range of ioports.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 11:45:13 +0000 (14:45 +0300)]
kvm: Update .gitignore to ignore tags
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 11:44:41 +0000 (14:44 +0300)]
kvm: Extract virtio-blk driver to separate file
This patch extracts virtio-blk driver to a separate file.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 11:27:23 +0000 (14:27 +0300)]
kvm: Fix unaligned PCI_CONFIG_ADDRESS accesses
This patch fixes unaligned PCI_CONFIG_ADDRESS accesses to use the same
mechanism as with PCI_CONFIG_DATA.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 15 Aug 2010 09:10:51 +0000 (12:10 +0300)]
Merge branch 'master' of git://github.com/cyrillos/vm
Cyrill Gorcunov [Sun, 8 Aug 2010 18:35:30 +0000 (22:35 +0400)]
kvm: Support loading initrd image
The start address of initrd image is set properly
but it seems we need /dev tuning since kernel issue
panic still.
Suggested-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Mon, 9 Aug 2010 16:06:02 +0000 (19:06 +0300)]
kvm: Add KVM ABI headers
This patch adds KVM ABI headers to the source tree. We can no longer include
<linux/kvm.h> directly because someone added a "#warning" to <linux/types.h>
that prevents kernel header inclusion from userspace.
We can switch back to using kernel headers if we ever make it to Linux
mainline.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Pekka Enberg [Sun, 8 Aug 2010 15:03:52 +0000 (18:03 +0300)]
kvm: Kill virtio debugging code
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Asias He [Sat, 7 Aug 2010 06:47:25 +0000 (14:47 +0800)]
kvm, pci: fill up virtio device configuration header
IO base address register must be aligned at 4 bytes.
Memory base address register must be aligned at 16 bytes.
We should not shift io port or memory address in base address register.
See PCI_System_Architecture_FourthEdition Page 427.
We need more io space for virtio device, qemu-kvm uses 64 byes,
so io space reserved for bios is not enough.
See drivers/virtio/virtio_pci.c
static struct virtio_config_ops virtio_pci_config_ops = {
.get = vp_get,
.set = vp_set,
.get_status = vp_get_status,
.set_status = vp_set_status,
.reset = vp_reset,
.find_vqs = vp_find_vqs,
.del_vqs = vp_del_vqs,
.get_features = vp_get_features,
.finalize_features = vp_finalize_features,
};
---------------------------------------------------------------------
guest_using_virtio_blk $ lspci -xxx
00:04.0 SCSI storage controller: Qumranet, Inc. Virtio block device
00: f4 1a 01 10 03 00 10 00 00 00 00 01 00 00 00 00
10: 01 c2 00 00 00 00 03 f2 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 f4 1a 02 00
30: 00 00 00 00 40 00 00 00 00 00 00 00 0b 01 00 00
40: 11 00 01 80 01 00 00 00 01 08 00 00 00 00 00 00
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
---------------------------------------------------------------------
guest_using_virtio_blk $ cat /proc/iomem
f2030000 -
f2030fff : 0000:00:04.0
f2030000 -
f2030fff : virtio-pci
---------------------------------------------------------------------
guest_using_virtio_blk $ cat /proc/ioports
c200-c23f : 0000:00:04.0
c200-c23f : virtio-pci
---------------------------------------------------------------------
$ ./kvm bzImage #virtio enabled guest kernel
Logs:
[ 0.548000] virtio-pci 0000:00:01.0: enabling device (0000 -> 0001)
[ 0.549000] asias:drivers/virtio/virtio.c:virtio_dev_probe
[ 0.549000] asias:drivers/virtio/virtio_pci.c:vp_get_features
Info: virtio_io
[ 0.549000] asias:drivers/block/virtio_blk.c:virtblk_probe
[ 0.549000] virtio_blk: probe of virtio0 failed with error -16
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Sun, 1 Aug 2010 10:06:17 +0000 (14:06 +0400)]
kvm, pci: Claim virtio device ioport in pci header
It still doesn't work because we need to fill .class
properly. But at least virtio probe function passes fine now.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sun, 1 Aug 2010 08:57:55 +0000 (12:57 +0400)]
kvm, pci: Fix offset for pci CONFIG_DATA ioport
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sat, 31 Jul 2010 21:16:17 +0000 (01:16 +0400)]
kvm, pci: Add bus forwarding register
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Sat, 31 Jul 2010 20:20:01 +0000 (23:20 +0300)]
kvm, pci: Fix unaligned PCI accesses
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sat, 31 Jul 2010 20:05:01 +0000 (23:05 +0300)]
kvm, pci: Don't calculate offset twice
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sat, 31 Jul 2010 20:01:10 +0000 (23:01 +0300)]
kvm: Fix PCI config space emulation
This fixes the two problems:
1. Yes, 'register number' is offset in 4 bytes, not 1 byte
2. We must be able to return sane values for the whole 256 configuration
space, not just for the first 64 bytes that's covered by the fixed header
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sat, 31 Jul 2010 19:51:07 +0000 (22:51 +0300)]
kvm, pci: Fix device probe accesses
The register number is offset in bytes, not in words.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Sat, 31 Jul 2010 19:06:10 +0000 (23:06 +0400)]
kvm, pci: Add dummy virtio device for probing
[ penberg@cs.helsinki.fi: fixes, cleanups ]
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sat, 31 Jul 2010 16:04:24 +0000 (20:04 +0400)]
kvm, pci: Return "no device" by default
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Sat, 31 Jul 2010 14:54:56 +0000 (17:54 +0300)]
kvm: Add PCI CONFIG_ADDRESS register layout
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Sat, 31 Jul 2010 14:03:14 +0000 (18:03 +0400)]
pci: Fix typo in previous commit
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sat, 31 Jul 2010 13:50:15 +0000 (17:50 +0400)]
pci: Use proper PCI port names
[ penberg@cs.helsinki.fi: rename ops and variables ]
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Sat, 31 Jul 2010 12:52:43 +0000 (15:52 +0300)]
kvm: Initial PCI probe emulation
This patch adds simple PCI Configuration Mechanism 1 probing emulation. It
doesn't expose any actual PCI devices yet.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sat, 31 Jul 2010 13:09:36 +0000 (16:09 +0300)]
kvm: Force PCI Configuration Mechanism 1
This patch forces the guest Linux kernel to use PCI Configuration Mechanism 1.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sat, 31 Jul 2010 12:10:45 +0000 (15:10 +0300)]
kvm: Enable Linux kernel PCI probing
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sat, 31 Jul 2010 12:18:43 +0000 (15:18 +0300)]
kvm: Add some more ioport emulation
This patch adds some more ioport emulation code so that I can boot a Linux
kernel cleanly with "--ioport-debug" command line option enabled.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Wed, 28 Jul 2010 17:13:27 +0000 (21:13 +0400)]
bios: clean predefined bios area early
otherwise say EBDA area could have some trash
values gotten from malloc.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Fri, 16 Jul 2010 12:44:26 +0000 (15:44 +0300)]
kvm: Use proper segment + offset in e820 bios
This patch fixes E820 BIOS emulation on AMD CPUs that, unlike Intel ones,
require proper 16-bit segment/offset addressing in virtualized 16-bit mode.
Reported-by: Asias He <asias.hejun@gmail.com>
Tested-by: Asias He <asias.hejun@gmail.com>
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Fri, 16 Jul 2010 13:42:13 +0000 (16:42 +0300)]
kvm: Exclude BIOS object files from header deps
This patch fixes build error reported by Asias.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Fri, 16 Jul 2010 13:40:01 +0000 (16:40 +0300)]
kvm: Clean header dependency files
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Fri, 16 Jul 2010 13:12:53 +0000 (16:12 +0300)]
kvm: Fix Makefile header dependencies
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Thu, 15 Jul 2010 15:04:41 +0000 (18:04 +0300)]
kvm: Update bios .gitignore list
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Thu, 15 Jul 2010 14:53:58 +0000 (17:53 +0300)]
kvm: Clear performance monitoring CPUID flags
Commit
3d446cf17faefd621c0842b58c92a50bd307eec7 ("kvm__setup_cpuid: use
KVM_GET_SUPPORTED_CPUID to simplify cpuid setup") causes the following errors
to be printed on host kernel dmesg:
[ 775.134693] kvm: 2882: cpu0 unhandled rdmsr: 0x345
[ 775.143130] kvm: 2882: cpu0 unhandled wrmsr: 0x40 data 0
[ 775.143136] kvm: 2882: cpu0 unhandled wrmsr: 0x60 data 0
[ 775.143141] kvm: 2882: cpu0 unhandled wrmsr: 0x41 data 0
[ 775.143146] kvm: 2882: cpu0 unhandled wrmsr: 0x61 data 0
[ 775.143150] kvm: 2882: cpu0 unhandled wrmsr: 0x42 data 0
[ 775.143155] kvm: 2882: cpu0 unhandled wrmsr: 0x62 data 0
[ 775.143159] kvm: 2882: cpu0 unhandled wrmsr: 0x43 data 0
[ 775.143164] kvm: 2882: cpu0 unhandled wrmsr: 0x63 data 0
As explained by Cyrill Gorcunov, these MSR accesses come from Linux performance
events subsystems which is not supported by our little hypervisor. Therefore,
clear the performance monitoring CPUID flags to let guest kernels know about
that.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Thu, 15 Jul 2010 14:44:23 +0000 (17:44 +0300)]
kvm: Use sizeof instead of magic number
The 'ecx' register contains size of copied data. Use sizeof(struct e820_entry)
instead of a magic number to make it obvious from the code.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Thu, 15 Jul 2010 09:39:07 +0000 (12:39 +0300)]
kvm: Cleanup BIOS setup code
This patch cleans up BIOS setup code by introducing struct irq_handler and
switching to more declarative setup.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Wed, 14 Jul 2010 14:57:17 +0000 (18:57 +0400)]
kvm, bios: Make e820 map to look similar the real one
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Thu, 15 Jul 2010 09:22:57 +0000 (12:22 +0300)]
kvm: Remove unused outb() function from e820.c
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Wed, 14 Jul 2010 17:28:59 +0000 (21:28 +0400)]
kvm, bios: BIOS code redesign
Instead of keeping bios code in various bin junks make
it to host in one binary blob. This blob gets copied
to a predefined place at startup and IVT handlers set
as appropriate.
Also we need to generate header file which will contain
BIOS tourine offsets for symbols being used.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Wed, 14 Jul 2010 12:28:45 +0000 (15:28 +0300)]
kvm: Use -Werror for building the thing
It's easy to miss warnings so use -Werror. We're a shiny new userspace project
so there's no reason not to use it.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Wed, 14 Jul 2010 12:20:21 +0000 (15:20 +0300)]
kvm: Use 32-bit operand size prefix for rdfs8()
E820 memory map resides in EBDA region which starts at address 0x9fc00 which
doesn't fit in 16 bits. Therefore, use 'addr32' operand size prefix to fix the
following error:
bios/e820.c: Assembler messages:
bios/e820.c:14: Warning: 654336 shortened to 64512
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Wed, 14 Jul 2010 11:58:25 +0000 (14:58 +0300)]
kvm: Fix load_bzimage for flat binaries
We must not die if load_bzimage() fails because we want to fall-back to loading
flat binaries.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Wed, 14 Jul 2010 11:34:40 +0000 (14:34 +0300)]
kvm: Fix usage command line format
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Wed, 14 Jul 2010 11:32:15 +0000 (14:32 +0300)]
kvm: Check for read() return value in load_bzimage()
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Wed, 14 Jul 2010 11:30:50 +0000 (14:30 +0300)]
kvm: Fix VM support check for unrecognized CPUs
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Wed, 14 Jul 2010 11:26:47 +0000 (14:26 +0300)]
kvm: Use -Os optimization for GCC
GCC generates unreadable machine code with default optimization level.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Asias He [Mon, 12 Jul 2010 12:52:23 +0000 (20:52 +0800)]
kvm__setup_cpuid: use KVM_GET_SUPPORTED_CPUID to simplify cpuid setup
Let kernel setup "struct kvm_cpuid2" for us!
https://kerneltrap.org/mailarchive/linux-kernel/2010/4/27/
4563640
Avi Kivity:
'''
No. KVM_GET_CPUID2 reads what was set by KVM_SET_CPUID, as modified by
the guest executing the cpuid instruction. KVM_GET_SUPPORTED_CPUID
tells userspace which bits are supported by the host cpu and kvm.
The API for KVM_GET_SUPPORTED_CPUID returns all cpuid leaves supported
in one go, IIRC.
'''
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Sun, 11 Jul 2010 10:06:30 +0000 (14:06 +0400)]
kvm: Add --mem= option
Which allow an user to specify the amount of memory
he would like to provide for kernel.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sat, 10 Jul 2010 20:57:47 +0000 (00:57 +0400)]
bios: No need for sti at int15 irq exit
iret will restore eflags anyway
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Sat, 10 Jul 2010 20:56:33 +0000 (00:56 +0400)]
bios: Don't clobber 32bit registers
To be on safe side we better to save whole 32bit
of appropriate registers. Even in real mode.
At moment no code affected but it's possible in future.
Actually int15 code does touch 32bit registers but it
uses caller's stack.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Thu, 8 Jul 2010 18:27:35 +0000 (21:27 +0300)]
kvm: BIOS E820 memory map emulation
This patch adds BIOS E820 memory map emulation to KVM.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Thu, 8 Jul 2010 15:00:07 +0000 (19:00 +0400)]
kvm, bios: Rework BIOS setup
This is a really huge rework of our primitive BIOS emulator.
The initial idea was to implement stack management in BIOS
irq handlers. In turn it ends up in re-factoring of all BIOS
code.
Some code details
-----------------
1) BIOS stack is placed at predefined constant memory address.
2) BIOS stack is only 64 bytes deep. It must be enough even for
future irq handlers.
3) To be able to place irq handlers at almost arbitrary place of
guest memory their start address must be 16 byte aligned.
This makes easy to compute irq routines local variables addresses.
4) To eliminate address relocations in irq handlers code we use a
special loader script.
TODO
----
- Still needs e820 map implements, int15 is dummy at moment
P.S. Thanks H. Peter Anvin for advices.
[ penberg@cs.helsinki.fi: cleanups ]
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Thu, 8 Jul 2010 11:05:46 +0000 (15:05 +0400)]
Exclude .cscope from .gitignore
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cyrill Gorcunov [Wed, 7 Jul 2010 19:19:34 +0000 (23:19 +0400)]
kvm, bios: Get rid of buggy int10 handler
At moment any BIOS code using which needs own stack
have to be remade. It's a bit not that easy task.
We're happily may live without int10 handler since we
switch to early_printk interface really early. And
actually we don't scan VGA memory anyway so that even
if there is something written we ignore the result.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Pekka Enberg [Mon, 5 Jul 2010 19:16:54 +0000 (22:16 +0300)]
kvm: Cleanup struct boot_params setup
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Mon, 5 Jul 2010 18:43:17 +0000 (21:43 +0300)]
kvm: Cleanup kvm__cpu_supports_vm()
This patch cleans up kvm__cpu_supports_vm() by unifying the VMX and SVM paths.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Cyrill Gorcunov [Mon, 5 Jul 2010 17:10:48 +0000 (21:10 +0400)]
kvm: Check for SVM extension being supported for AMD cpus
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Asias He [Mon, 5 Jul 2010 06:01:11 +0000 (14:01 +0800)]
kvm: Check vmx capability using cpuid
[ penberg@cs.helsinki.fi: use host_cpuid(), cleanups ]
Reported-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sun, 4 Jul 2010 18:57:14 +0000 (21:57 +0300)]
kvm: Introduce '--kvm-dev' command line option
This patch introduces a '--kvm-dev' command line option for debugging purposes.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sun, 4 Jul 2010 16:24:35 +0000 (19:24 +0300)]
kvm: Introduce 'make devices' target
This patch adds a 'make devices' target to Makefile that sets up KVM device if
one does not exist in '/dev/kvm'.
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sun, 4 Jul 2010 11:13:20 +0000 (14:13 +0300)]
kvm: Fix compilation warning
This patch fixes the following compilation warning:
main.c: In function ‘main’:
main.c:149: warning: label ‘out’ defined but not used
Reported-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sun, 4 Jul 2010 11:02:05 +0000 (14:02 +0300)]
kvm: Don't stop on ioport errors by default
This patch introduces a '--ioport-debug' option that preserves the old
stop-on-error behavior and changes the default to keep on running despite of
ioport errors. This allows Linux kernel to boot to VFS mount phase.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Pekka Enberg [Sun, 4 Jul 2010 10:59:10 +0000 (13:59 +0300)]
kvm: Add '--params' to usage
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>