Compilation on x86_64 failed with:
[...]
In file included from /usr/include/features.h:386:0,
from /usr/include/stdint.h:26,
from
/usr/lib/gcc/x86_64-redhat-linux/4.5.1/include/stdint.h:3,
from include/kvm/e820.h:4,
from bios/e820.c:1:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file
or directory
compilation terminated.
make: *** [bios/bios-rom.bin] Error 1
This is caused by a typo in the Makefile and because gnu/stubs.h (and
friends) expect to see __x86_64__. That's trivial to fix.
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Use read()/write() instead of mmap() for virtio block device emulation to
support large disk images on 32-bit.
Reported-and-tested-by: Asias He <asias.hejun@gmail.com>
Tested-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
User input is buffered anyway, so it's pointless to set the UART_LSR_OE bit.
Instead, wait for the guest kernel to consume the current input and send a new
character when the guest is ready.
This fixes the following warnings in guest kernels:
[ 207.485000] ttyS0: 1 input overrun(s)
Reported-by: Asias He <asias.hejun@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>
The size of the virtqueue(16) was smaller than scatter-gather(128)
which hypervisor tells the guest. Under some circumstances,
if the guest uses scatter-gather which larger than 16 - 2, kernel panics.
That is why the scatter-gather support v1 breaks Cyrill's kernel boot.
Two descriptors are used as the header and status descriptors.
The remaining descriptors can be used as the real disk data descriptors.
So DISK_SEG_MAX should be VIRTIO_BLK_QUEUE_SIZE - 2.
VIRTIO_BLK_QUEUE_SIZE is 128 and DISK_SEG_MAX is 126 in this patch.
Tested-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch introduces some virtqueue handling helper functions and converts the
blk virtio device to use them.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Since that is its only purpose, not the whole virtio
stuff.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Publish VIRTIO_BLK_F_SEG_MAX feature to guest.
In disk I/O request, guest can use multiple buffers which are not physicall
contiguousy as the I/O request buffer.
[ penberg@kernel.org: cleanups ]
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch implements 16550A FIFO support to the serial console emulation
layer. There's still a bug lurking somewhere which the hypervisor in some busy
loop taking up 100% of CPU. However, this patch is a definite improvement over
the previous hacks.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch cleans up receive emulation by separating the stdin polling and
reading logic from the interrupt logic. The patch also fixes the interrupt
injection code to inject one type of interrupt at a time.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch fixes the "too much work for irq4" problems caused by the fact that
we never set the UART_IIR_NO_INT flag in the emulation layer. This makes the
interrupt handler in the guest kernel process as much as possible which
triggers a warning.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch fixes the 8250 serial emulation to not have undefined ioports but
rather make them explicitly disabled.
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 enables the THRI ("transmission holding register empty") bit in the
IIR register to make sure the guest doesn't think we have data waiting for it.
Signed-off-by: Pekka Enberg <penberg@kernel.org>
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>
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>
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>
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>