- kvm-run.[ch] Adds a new kvm command called 'run'. The most of the code is
copied from main.c.
- main.c is modified to use the functionality provided by framework.
The old code from main.c is moved to kvm-run.c.
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
- rename {blk,console}-virtio.* to virtio-{blk,console}.*
- change the virtio block device PCI io space operation callback names
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Right now when a KVM session ends with an incomplete line printk'd
without a newline, kvm exits in an ugly way:
[ 4.638016] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 4.641668] Rebooting in 1 seconds..spirit:~/tip/tools/kvm>
spirit:~/tip/tools/kvm>
See the shell prompt intermixed with the last line of kernel output.
There's also no indication to the user that everything is fine on the
kvm tool side.
This is somewhat of a beauty wart and also a bit confusing to users.
To clarify and clean up things, add a final printout on normal exits:
[ 4.654814] Please append a correct "root=" boot option; here are the available partitions:
[ 4.584390] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 4.662243] Rebooting in 1 seconds..
# KVM session ended normally.
spirit:~/tip/tools/kvm>
This delimits the kernel output properly and gives feedback to the user
that (despite the scary kernel messages) all fine from the KVM POV.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch makes SIGQUIT to the host hypervisor send 'SysRq-P' to the guest
kernel via 8250 serial console to make debugging stuck guests easier.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This option enables virtio console and disables serial console.
At this time, the virtio and serial console can not work simultaneously.
Becasue we can not put both console's output to user at the same time.
However, once we redirect the virtio console to a pipe or socket. We can
use both console simultaneously.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch adds simple virtio console support to the hypervisor.
NOTE, NOTE, NOTE: Please add something like this to your /etc/inittab file:
T2:23:respawn:/sbin/getty -L hvc0 9600 vt100
to get a virtio console login.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch is a preparational step for virtio console and 8250 serial console
code consolidation.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Following patch adds more cleanup code when exiting.
Close disk image, free msrs array and destroy the timer fd.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
As noted by Cyrill, there's no need to pass 'nosmp' to the guest kernel because
it'll switch to PIC after noticing APIC is not available.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Instead of calling various BIOS routines from kvm.c better to have all BIOS
specifics sit in bios.c.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
There is no differences in terms of BIOS what kind of kernel is loaded so we
have to setup BIOS for both bzImage and flat image.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Hardcoding the root= option prevents an existing qemu-kvm based disk
image using LVM from booting. It fails to find the root filesystem.
By making the root parameter optional if given on the command line, the
image boots correctly. For example,
./kvm --kernel=/tmp/vmlinuz-2.6.38 \
--initrd=/tmp/initramfs-2.6.38.img \
--image=/home/dsa/vm/images/f14/nkvm-f14.img \
--mem=1024
--params="ro root=/dev/mapper/vg_f14vm-lv_root"
works now.
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch changes the userspace hypervisor to exit gracefully upon
KVM_EXIT_SHUTDOWN which is triggered when guest userspace is shut down.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Use disk name for kernel "root=" parameter rather than the dynamic major and
minor numbers that vary from system to system.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
As suggested by Ingo Molnar, put terminal in canonical mode. This makes poll()
on stdin to react to keystrokes insted of return key and fixes the double
echo'd character problem for input.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch fixes 8250 emulation to inject interrupts to guest so we actually
see what's sent to the serial console.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The 8250 emulation is no longer there to just support early_printk() so rename
the source file to reflect that.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
As reported by Asias He, guest kernels mount filesystems as readonly under our
hypervisor:
without rw:
[ 0.909000] EXT3-fs: mounted filesystem with writeback data mode.
[ 0.909000] VFS: Mounted root (ext3 filesystem) readonly on device 253:1.
/dev/root on / type ext3 (ro,relatime,errors=continue,data=writeback)
by passing the "rw" kernel parameter, guest kernels are able to mount as
read-write:
[ 0.891000] EXT3 FS on vda1, internal journal
[ 0.891000] EXT3-fs: recovery complete.
[ 0.892000] EXT3-fs: mounted filesystem with writeback data mode.
[ 0.892000] VFS: Mounted root (ext3 filesystem) on device 253:1.
/dev/root on / type ext3 (rw,relatime,errors=continue,data=writeback)
There's some real problem hiding here but as we've done with other parts of the
kernel (PCI, SMP), just bypass the problem for now.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
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>
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>
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>
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>
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>
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>
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>
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>
We use 00E0 ioport for trapping to the hypervisor. This patch cleans up
handling of the ioport to call exit() in ioport emulation handler.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>