Tidy up the code in hw/vesa.c:
- Make videomem local to hw/vesa.c
- Remove debugging printf() calls
- Fix up coding style issues
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
There is a couple of functions which defines 'ah' variable but
never use it in real so that gcc 4.6.x series does complain on
me as
CC bios/bios-rom.bin
bios/int10.c: In function ‘int10_putchar’:
bios/int10.c:86:9: error: variable ‘ah’ set but not used [-Werror=unused-but-set-variable]
bios/int10.c: In function ‘int10_vesa’:
bios/int10.c:96:9: error: variable ‘ah’ set but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors
so get rid of them.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
CC: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Requirements - Kernel compiled with:
CONFIG_FB_BOOT_VESA_SUPPORT=y
CONFIG_FB_VESA=y
CONFIG_FRAMEBUFFER_CONSOLE=y
Start VNC server by starting kvm tools with "--vnc".
Connect to the VNC server by running: "vncviewer :0".
Since there is no support for input devices at this time,
it may be useful starting kvm tools with an additional
' -p "console=ttyS0" ' parameter so that it would be possible
to use a serial console alongside with a graphic one.
Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Update feature tests to test for libvncserver.
VESA support doesn't get compiled in unless libvncserver
is installed.
Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add a simple VESA device which simply moves a framebuffer
from guest kernel to a VNC server.
VESA device PCI code is very similar to virtio-* PCI code.
Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Allow setting video mode in guest kernel.
For possible values see Documentation/fb/vesafb.txt
Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
INT10 handler is a basic implementation of BIOS video services.
The handler implements a VESA interface which is initialized at
the very beginning of loading the kernel.
Signed-off-by: John Floren <john@jfloren.net>
[ turning code into patches and cleanup ]
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add a new function virtio_blk__delete() goes through array of block
devices and releases memory allocated for block device.
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The patch moves the code for initialization of all of the virtio block
devices to virtio subsystem.
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The patch was suggested by Ingo to move the disk image subsystem code
from the kvm-run.c file. The code to open all of the specified disk
images is now moved to a wrapper function in disk/core.c.
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
There's no point in registering dummy ops for PCI ioports because pci__init()
registers the real ones before we enter the guest kernel.
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Without 'ret' usage I get
| cyrill@sun kvm $ make
| CC virtio/9p.o
| virtio/9p.c: In function ‘virtio_p9_wstat’:
| virtio/9p.c:448:6: error: variable ‘res’ set but not used [-Werror=unused-but-set-variable]
| cc1: all warnings being treated as errors
| make: *** [virtio/9p.o] Error 1
so add a basic check for ftruncate result, this eliminate warning and
we might need to use 'res' status later in caller code.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The serial8250__init() function registers ops for all serial ports before we
start running the guest kernel so drop the dummy op registrations.
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
We already register ioports for 0x2f8 and 0x3e8 and mark them as inactive so
mark 0x2e8 ioport as such as well. This is a preparational step to dropping
serial port dummy registrations from ioport__setup_legacy().
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Currently the ioport implementation is based on a USHRT_MAX length
array of ptrs to ioport_operations.
Instead, use an interval rbtree to map the ioports to
ioport_operations.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Augmentation is started on the pre-rotation node found in the search,
augment the rotated node instead.
Max high is the max of max highs below it, not the max of highs below it.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Several cleanups in the patch:
- Use kernel headers for e820 types and definitions.
- A byte sized entry count for e820 enteries was used,
this should be dword sized. Update in-memory layout and
bios code to fix it.
- Use struct e820map to calculate offsets used by bios code.
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch updates:
- kernel configuration options
- kvm command line options
- authors
in README.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Overview:
9p allows for simple RPC based resource sharing over
different transports (in our case, virtio).
This is the implementation of (most of) the original
9p2000 protocol, without the .u or the .l extensions.
How to use:
1. Make sure kernel is compiled with:
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_9P_DEBUG=y (At least until code is stable)
CONFIG_9P_FS=y
2. Start KVM with '--virtio-9p <dirname>'. What happens now is that
a virtio transport with the name 'kvm_9p' is created. The server side
of the transport maps dirname to the root of the file system.
3. Within the guest, mount the fs:
mount -t 9p -otrans=virtio kvm_9p <local_dir> -oversion=9p2000
This will mount the 9p server to local_dir.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Header could not be included directly because among some minor
issues, the original header declared the same function twice:
int p9_errstr2errno(char *errstr, int len);
int p9_errstr2errno(char *, int);
A patch has been sent to 9P maintainers, this header should
be removed once the patch is in.
Until then, use a modified copy of the header.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
When shutting down SMP guests only VCPU #0 will receive
a KVM_EXIT_SHUTDOWN. Waiting for all VCPU threads to exit
causes them to hang.
Instead, notify all VCPU threads once VCPU #0 thread is terminated
so they could also stop properly.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Thomas and Asias reported that kernel doesn't find MP
tables on 32 bit host. This is because previously the
alignment was done on address obtained from calloc
missing the fact that MP tables are put into guest
memory *with* offset and MP signature should be
calculated keeping this offset in midn as well and
then aligned.
Reported-by: Thomas Heil <heil@terminal-consulting.de>
Reported-by: Asias He <asias.hejun@gmail.com>
Tested-by: Thomas Heil <heil@terminal-consulting.de>
Tested-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Don't link the rbtree.o from kernel object tree, build
rbtree.o from source by ourselves.
Acked-by: Ingo Molnar <mingo@elte.hu>
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch moves hypervisor native hardware emulation drivers to "hw" directory
like we've done for virtio and disk image code.
Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
We recently changed the meaning of "-i" from disk image to initrd. This has
confused many users because kvm just reports:
Fatal: mmap() failed.
if a disk image is passed as initrd. This patch fixes that by checking for the
first two ID bytes in initrd:
$ ./kvm run -i ~/images/linux-0.2.qcow
# kvm run -k ../../arch/x86/boot/bzImage -m 256 -c 1
Fatal: /home/penberg/images/linux-0.2.qcow is not an initrd
Reported-by: Thomas Heil <heil@terminal-consulting.de>
Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Thomas reported that on some systems there might be no bdf
library installed. So we take perf approach and check for
library presence at compilation time.
Reported-by: Thomas Heil <heil@terminal-consulting.de>
Tested-by: Thomas Heil <heil@terminal-consulting.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch fixes cryptic "out of memory" errors on hosts where sysconf() fails
by defaulting to MIN_RAM_SIZE_MB.
Reported-by: <born2befrag@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch renames:
raw_image__read_sector_ro_mmap to raw_image__read_sector
raw_image__write_sector_ro_mmap to raw_image__write_sector
raw_image__close_ro_mmap to raw_image__close
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Make read/write ops in 'struct disk_image_operations'
always return the number of bytes read/written and close/flush
ops return int.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch renames disk_image__{read, write}_sector_io to
disk_image__{read, write}.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch moves raw image and blk device code into disk/raw.c
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch prepares the splitting of disk-image.c to core.c,
blk.c and raw.c.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch removes disk-image.c and qcow.c under disk directory.
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
"bornto befrag <born2befrag@gmail.com>" writes:
> When i compile i kvm native tool tools/kvm && make i get this
>
> CC read-write.o
> cc1: warnings being treated as errors
> read-write.c: In function ‘xpreadv’:
> read-write.c:255: error: implicit declaration of function ‘preadv’
> read-write.c:255: error: nested extern declaration of ‘preadv’
> read-write.c: In function ‘xpwritev’:
> read-write.c:268: error: implicit declaration of function ‘pwritev’
> read-write.c:268: error: nested extern declaration of ‘pwritev’
> make: *** [read-write.o] Error 1
Fix that up by including <sys/uio.h> for preadv()/pwritev().
Reported-by: <born2befrag@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Instead of redefining virtio IDs in our headers, use IDs defined
in <linux/virtio_ids.h>.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
When we have a MMIO exit, we need to find which device
has registered to use the accessed MMIO space.
The mapper maps ranges of guest physical addresses to
callback functions.
Implementation is based on an interval red-black tree.
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Interval rb-tree allows to directly store interval ranges
and quickly lookup an overlap with a single point or a range.
The helper is based on the kernel rb-tree implementation
(located in <linux/rbtree.h>) which alows for the augmention
of the classical rb-tree to be used as an interval tree.
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>