Introduce a new macro KVM_BINARY_NAME for the binary name of kvm tools,
also for future using in printing command messages like these.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Commands' usage : Change the binary name from *kvm* to *lkvm*,
since commit ad3efb18 has done it.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
README: change the binary name from kvm to lkvm since
commit ad3efb18 has already done it.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Documentation: Change the binary name from *kvm* to *lkvm*,
since commit ad3efb18 already called the binary *lkvm* and
with a alias name *vm*.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The kernel already has pr_err helper lets do the same.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
To eliminate compile errors like
| CC builtin-run.o
| In file included from ../../arch/x86/include/asm/system.h:7:0,
| from include/kvm/barrier.h:13,
| from builtin-run.c:16:
| ../../arch/x86/include/asm/cmpxchg.h:11:13: error: no previous prototype for ‘__xchg_wrong_size’ [-Werror=missing-prototypes]
| ../../arch/x86/include/asm/cmpxchg.h: In function ‘__xchg_wrong_size’:
| ../../arch/x86/include/asm/cmpxchg.h:12:2: error: expected declaration specifiers before ‘__compiletime_error’
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
In file included from ../../include/linux/stddef.h:4:0,
from ../../include/linux/list.h:5,
from include/kvm/framebuffer.h:5,
from builtin-run.c:8:
include/linux/compiler.h:8:0: error: "__attribute_const__" redefined [-Werror]
/usr/include/sys/cdefs.h:226:0: note: this is the location of the previous definition
cc1: all warnings being treated as errors
make: *** [builtin-run.o] Error 1
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
because the program name is changed, "./lkvm list -i" can't work now.
This fix just remove the test:
1) this test is not reliable.
2) the target process can respond for "get_pid()", it must be
kvm-tool. (at least it is more reliable)
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
sandbox.sh is a shell script, it will translate its meta
chars to anather things.
example(before this patch applied):
./lkvm sandbox -- echo 'success; please try again!'
it fails with:
/virt/sandbox.sh: line 3: please: command not found
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
I found the program is always RE-created when I type 'make' even
it is new:
$ make
LINK lkvm
LN vm
I use 'make -d' to find the reason: rbtree.d is missing.
When I type 'make' after this patch applied(the lkvm is new):
$ make
make: Nothing to be done for `all'.
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch enables allocating new refcount blocks and so then kvm tools
could expand qcow2 image much larger.
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add compiler.h file to support using kernel error check funciotns(e.g
ERR_PTR, PTR_ERR and so on).
Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Fix the case when using a rootfs combined with a virtio-blk disk.
Also, simplify custon rootfs name lookup.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
It's useful to boot with no -d and no implicit 9p root, with --initrd.
Since commit eaf720b285947a6f4e29174d0eba1899de31d8ab, we die() failing
to create the 2nd stage custom rootfs. This patch doesn't try to set up
a custom rootfs by default if user specifies an initrd on the commandline.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
kvmtool's types.h includes <asm/types.h>, which by default on PPC64 brings in
int-l64.h; define __SANE_USERSPACE_TYPES__ to get LL64 types.
This patch also adds CFLAGS to the final link, so that any -m64 is obeyed
when linking, too.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
I'm getting this on x86-32, gcc 4.4.3:
CC x86/kvm-cpu.o
cc1: warnings being treated as errors
x86/kvm-cpu.c: In function ‘kvm_cpu__set_lint’:
x86/kvm-cpu.c:89: error: dereferencing pointer ‘lapic’ does break strict-aliasing rules
x86/kvm-cpu.c:88: error: dereferencing pointer ‘lapic’ does break strict-aliasing rules
x86/kvm-cpu.c:83: note: initialized from here
make: *** [x86/kvm-cpu.o] Error 1
Removing the nasty aliasing seems to be a good way to go.
Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
We already had kvm__has_extension, no need for two functions that do the
same.
This reverts commit 42efb1abf4ebebeedd14af34c073e673923e2898.
Conflicts:
tools/kvm/include/kvm/kvm.h
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
kvm__supports_extension has been there before, and it's does it's job right
unlike kvm__has_cap.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The KVM_NR_CPUS define is only really used to statically size the global
kvm_cpus array, which can just as easily be allocated on startup. There is
some checking of the -c <nr cpus> value given against NR_CPUs but this is
later again checked against a dynamically-determined limit from
KVM_CAP_MAX_VCPUS anyway. The hardwired limit is arbitrary and not strictly
necessary.
This patch removes the #define, replacing the statically-sized array with
a malloc; the array is kvm->nrcpus+1 in size so that any iterator can halt
at the end (this is done in kvm_cpu__reboot, which doesn't have access to
a struct kvm* and therefore kvm->nrcpus).
An unused #define in x86/mptable.c is also removed.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
If we took a MMIO exit, the data in the coalesced ring should be processes
before the data in the exit itself is processed.
Doing it wrong (like we did so far) will cause ordering issues.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Coalescing MMIOs is only required when we really want avoid having to exit
to userspace for every MMIO write, usually it's not the case so no reason
to coalesce every MMIO zone (I was also pretty sure it didn't always coalesce
zones)..
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This patch adds a new arch directory, powerpc, basic file structure, register
setup and where necessary stubs out arch-specific functions (e.g. interrupts,
runloop exits) that later patches will provide. The target is an
SPAPR-compliant PPC64 machine (i.e. pSeries); there is no support for PPC32 or
'bare metal' PPC64 guests as yet. Subsequent patches implement the hcalls and
RTAS required to boot SPAPR pSeries kernels.
Memory is mapped from hugetlbfs (as that is currently required by upstream PPC64
HV-mode KVM). The mapping of a VRMA region is yet to be implemented; this is
only necessary on processors that don't support VRMA, e.g. <= P6. Work is
therefore needed to get this going on pre-P7 CPUs.
Processor state is set up as a guest kernel would expect (both primary and
secondaries), and SMP is fully supported.
Finally, support is added for simply loading flat binary kernels (plus initrd).
(bzImages are not used on PPC, and this series does not add zImage support or an
ELF loader.) The intention is to later support loading firmware such as SLOF.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
commit 378ee7e6dd301347c6bf2c740cb1fb40174bcb8b broke the -Werror build
on 32bit targets due to some variable typing in struct statfs:
On 14/12/11 11:03, David Evensky wrote:
> On an x86 32bit system (and using the 32bit CodeSourcery toolchain on
> a x86_64 system) I get:
>
> evensky@machine:~/.../linux-kvm/tools/kvm$ make
> CC util/util.o
> util/util.c: In function 'mmap_hugetlbfs':
> util/util.c:93:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
> util/util.c:99:7: error: format '%ld' expects argument of type 'long int', but argument 2 has type 'int' [-Werror=format]
> cc1: all warnings being treated as errors
>
> make: *** [util/util.o] Error 1
Fixes the build.
Reported-by: David Evensky <evensky@dancer.ca.sandia.gov>
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Different architectures will deal with MMIO exits differently. For example,
KVM_EXIT_IO is x86-specific, and I/O cycles are often synthesised by steering
into windows in PCI bridges on other architectures.
This patch calls arch-specific kvm_cpu__emulate_io() and kvm_cpu__emulate_mmio()
from the main runloop's IO and MMIO exit handlers. For x86, these directly
call kvm__emulate_io() and kvm__emulate_mmio() but other architectures will
perform some address munging before passing on the call.
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Add a --hugetlbfs commandline option to give a path to hugetlbfs-map guest
memory (down in kvm__arch_init()). For x86, guest memory is a normal
ANON mmap() if this option is not provided, otherwise a hugetlbfs mmap.
This maps directly from a hugetlbfs temp file rather than using something
like MADV_HUGEPAGES so that, if the user asks for hugepages, we definitely
are using hugepages. (This is particularly useful for architectures that
don't yet support KVM without hugepages, so we definitely need to use
them for the whole of guest RAM.)
Signed-off-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The global id is shared, protect it when access it.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The allocation and the copy are not required in the C.S.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
read-write.c contains no kvm related code, it is just a lib.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
The missing "CC util/rbtree.o" will be output when building.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
threadpool.c contains no kvm related code, it is just a lib.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
In here, xxx_locked() should means "called with job_mutex locked",
the original funtion are opposite, fix them.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
We should check the condition before wait it,
otherewise we may get deadlock.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Just set delivery mode directly without going through ugly casting.
This cleans up and simplifies the code.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This allows triggering NMI on guests using 'kvm debug -m [cpu]'.
Please note that the default behaviour of 'kvm debug' dumping guest's cpu
state has been modified to require a '-d'/--dump.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>