History log of /kvmtool/include/kvm/util.h (Results 1 – 25 of 27)
Revision Date Author Comments
# bd4ba571 07-Jul-2023 Alexandru Elisei <alexandru.elisei@arm.com>

Add --loglevel argument for the run command

Add --loglevel command line argument, with the possible values of 'error',
'warning', 'info' or 'debug' to control what messages kvmtool displays. The
arg

Add --loglevel argument for the run command

Add --loglevel command line argument, with the possible values of 'error',
'warning', 'info' or 'debug' to control what messages kvmtool displays. The
argument functions similarly to the Linux kernel parameter, when lower
verbosity levels hide all message with a higher verbosity (for example,
'warning' hides info and debug messages, allows warning and error
messsages).

The default level is 'info', to match the current behaviour. --debug has
been kept as a legacy option, which might be removed in the future.

Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20230707151119.81208-5-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# fc184a68 07-Jul-2023 Alexandru Elisei <alexandru.elisei@arm.com>

util: Use __pr_debug() instead of pr_info() to print debug messages

pr_debug() is special, because it can be suppressed with a command line
argument, and because it needs to be a macro to capture th

util: Use __pr_debug() instead of pr_info() to print debug messages

pr_debug() is special, because it can be suppressed with a command line
argument, and because it needs to be a macro to capture the correct
filename, function name and line number. Display debug messages with the
prefix "Debug", to make it clear that those aren't informational messages.

Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20230707151119.81208-4-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 2cc4929c 07-Jul-2023 Alexandru Elisei <alexandru.elisei@arm.com>

util: Make pr_err() return void

Of all the pr_* functions, pr_err() is the only function that returns a
value, which is -1. The code in parse_options is the only code that relies
on pr_err() returni

util: Make pr_err() return void

Of all the pr_* functions, pr_err() is the only function that returns a
value, which is -1. The code in parse_options is the only code that relies
on pr_err() returning a value, and that value must be exactly -1, because
it is being treated differently than the other return values.

This makes the code opaque, because it's not immediately obvious where that
value comes from, and fragile, as a change in the return value of pr_err
would break it.

Make pr_err() more like the other functions and don't return a value.

Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20230707151119.81208-2-alexandru.elisei@arm.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 143ffa22 09-May-2022 Martin Radev <martin.b.radev@gmail.com>

kvmtool: Add WARN_ONCE macro

Add a macro to enable to print a warning only once. This is
beneficial for cases where a warning could be helpful for
debugging, but still log pollution is preferred not

kvmtool: Add WARN_ONCE macro

Add a macro to enable to print a warning only once. This is
beneficial for cases where a warning could be helpful for
debugging, but still log pollution is preferred not to happen.

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Martin Radev <martin.b.radev@gmail.com>
Link: https://lore.kernel.org/r/20220509203940.754644-2-martin.b.radev@gmail.com
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# 25cf3198 23-Apr-2020 Raphael Gault <raphael.gault@arm.com>

Add emulation for CFI compatible flash memory

The EDK II UEFI firmware implementation requires some storage for the EFI
variables, which is typically some flash storage.
Since this is already suppor

Add emulation for CFI compatible flash memory

The EDK II UEFI firmware implementation requires some storage for the EFI
variables, which is typically some flash storage.
Since this is already supported on the EDK II side, we add a CFI flash
emulation to kvmtool.
This is backed by a file, specified via the --flash or -F command line
option. Any flash writes done by the guest will immediately be reflected
into this file (kvmtool mmap's the file).
The flash will be limited to the nearest power-of-2 size, so only the
first 2 MB of a 3 MB file will be used.

This implements a CFI flash using the "Intel/Sharp extended command
set", as specified in:
- JEDEC JESD68.01
- JEDEC JEP137B
- Intel Application Note 646
Some gaps in those specs have been filled by looking at real devices and
other implementations (QEMU, Linux kernel driver).

At the moment this relies on DT to advertise the base address of the
flash memory (mapped into the MMIO address space) and is only enabled
for ARM/ARM64. The emulation itself is architecture agnostic, though.

This is one missing piece toward a working UEFI boot with kvmtool on
ARM guests, the other is to provide writable PCI BARs, which is WIP.

Tested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Raphael Gault <raphael.gault@arm.com>
[Andre: rewriting and fixing]
Signed-off-by: Andre Przywra <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# ce2fc8f5 14-Apr-2020 Alexandru Elisei <alexandru.elisei@arm.com>

Check that a PCI device's memory size is power of two

According to the PCI local bus specification [1], a device's memory size
must be a power of two. This is also implicit in the mechanism that a C

Check that a PCI device's memory size is power of two

According to the PCI local bus specification [1], a device's memory size
must be a power of two. This is also implicit in the mechanism that a CPU
uses to get the memory size requirement for a PCI device.

The vesa device requests a memory size that isn't a power of two.
According to the same spec [1], a device is allowed to consume more memory
than it actually requires. As a result, the amount of memory that the vesa
device now reserves has been increased.

To prevent slip-ups in the future, a few BUILD_BUG_ON statements were added
in places where the memory size is known at compile time.

[1] PCI Local Bus Specification Revision 3.0, section 6.2.5.1

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>

show more ...


# ac70b5aa 18-Jun-2018 Jean-Philippe Brucker <jean-philippe.brucker@arm.com>

Add fls_long and roundup_pow_of_two helpers

It's always nice to have a log2 handy, and the vfio-pci code will need to
perform power of two allocation from an arbitrary size. Add fls_long and
roundup

Add fls_long and roundup_pow_of_two helpers

It's always nice to have a log2 handy, and the vfio-pci code will need to
perform power of two allocation from an arbitrary size. Add fls_long and
roundup_pow_of_two, based on the GCC builtin.

Reviewed-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>

show more ...


# 3ebd8e0b 17-Jul-2012 Michael Ellerman <michael@ellerman.id.au>

kvm tools: Remember page size as kvm->ram_pagesize

On some powerpc platforms we need to make sure we only advertise page
sizes to the guest which are <= the size of the pages backing guest RAM.

So

kvm tools: Remember page size as kvm->ram_pagesize

On some powerpc platforms we need to make sure we only advertise page
sizes to the guest which are <= the size of the pages backing guest RAM.

So have mmap_hugetblfs() save the hugetblfs page size for us, and also
teach mmap_anon_or_hugetblfs() to set the page size for anonymous mmap.

Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# f8edca99 17-Jul-2012 Michael Ellerman <michael@ellerman.id.au>

kvm tools: Move mmap_anon_or_hugetblfs() into util

So we can use it on powerpc.

Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka

kvm tools: Move mmap_anon_or_hugetblfs() into util

So we can use it on powerpc.

Acked-by: Matt Evans <matt@ozlabs.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 4d95c112 20-Dec-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tool: Introduce own BUG_ON handler

Raise SIGABRT in case if run-time crtitical
problem found.

Proposed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed

kvm tool: Introduce own BUG_ON handler

Raise SIGABRT in case if run-time crtitical
problem found.

Proposed-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# d642f038 20-Dec-2011 Lai Jiangshan <laijs@cn.fujitsu.com>

kvm tools: add WARN_ON()

like the WARN_ON() of kernel code.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>


# 599ed2a8 18-Dec-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tools: Rename pr_error to pr_err to follow kernel convention

The kernel already has pr_err helper lets do the same.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enbe

kvm tools: Rename pr_error to pr_err to follow kernel convention

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>

show more ...


# a2857479 19-Dec-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tools: Add BUG_ON() helper to make a run-time critical tests

Also drop useless assert.h inclusions.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Sig

kvm tools: Add BUG_ON() helper to make a run-time critical tests

Also drop useless assert.h inclusions.

Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 61061257 13-Dec-2011 Matt Evans <matt@ozlabs.org>

kvm tools: Add ability to map guest RAM from hugetlbfs

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 norma

kvm tools: Add ability to map guest RAM from hugetlbfs

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>

show more ...


# ec52d504 12-Dec-2011 Lai Jiangshan <laijs@cn.fujitsu.com>

kvm tools: move strlcat() to util/strbuf.c

strlcat() is a string related function.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>


# aa400b00 10-Jun-2011 Prasad Joshi <prasadjoshi124@gmail.com>

kvm tools: Add IO delay option

Add a command line debug option to add a fix amount of delay in read and
write operation.

From Ingo "the delays are *constant* [make sure you use a high-res timers
ke

kvm tools: Add IO delay option

Add a command line debug option to add a fix amount of delay in read and
write operation.

From Ingo "the delays are *constant* [make sure you use a high-res timers
kernel], so they do not result in nearly as much measurement noise as real
block IO does.
[...]
This way you are basically 'emulating' a real disk drive but you will
emulate uniform latencies, which makes measurements a lot more
reliable - while still relevant to the end result."

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 4542f276 18-May-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tools: Prefix error() and friends helpers with pr_

To look more familiar with kernel functions.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Ack

kvm tools: Prefix error() and friends helpers with pr_

To look more familiar with kernel functions.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 37c34ca8 11-May-2011 Sasha Levin <levinsasha928@gmail.com>

kvm tools: Use constants for commonly used mmap flags

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>


# ed036f03 11-May-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tools: Add debug() helper

Useful for debugging. It adds "--debug" option as well so
debug prints are seen only if user asked for them.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed

kvm tools: Add debug() helper

Useful for debugging. It adds "--debug" option as well so
debug prints are seen only if user asked for them.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# ac600533 16-Apr-2011 Prasad Joshi <prasadjoshi124@gmail.com>

kvm tool: Remove the __stringify*() definition from util.h

Include the Linux kernel header file linux/stringify.h file instead of
redefining the __stringify* macros

Signed-off-by: Prasad Joshi <pra

kvm tool: Remove the __stringify*() definition from util.h

Include the Linux kernel header file linux/stringify.h file instead of
redefining the __stringify* macros

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# 98ee79f4 08-Apr-2011 Prasad Joshi <prasadjoshi124@gmail.com>

kvm tools: Use code from perf for argument processing

- parse-options.[ch] has argument processing code.

- types.h: Additional types for argument processing.

- strbuf.[ch]: Added a function prefix

kvm tools: Use code from perf for argument processing

- parse-options.[ch] has argument processing code.

- types.h: Additional types for argument processing.

- strbuf.[ch]: Added a function prefixcmp to compare string prefix

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>

show more ...


# b3594ec7 05-Apr-2011 Cyrill Gorcunov <gorcunov@gmail.com>

kvm tools: Separate BIOS specifics into own file

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.

kvm tools: Separate BIOS specifics into own file

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>

show more ...


# 0b322d96 10-May-2010 Cyrill Gorcunov <gorcunov@gmail.com>

kvm: Use strlcat helper for copying cmdline params

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>


# f3150089 28-Mar-2010 Pekka Enberg <penberg@cs.helsinki.fi>

kvm: Move util.h to include/kvm directory

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>


# 2a601aaf 27-Mar-2010 Pekka Enberg <penberg@cs.helsinki.fi>

kvm: Hardcode a "reset vector" at f000:fff0

It seems that if we attempt to run code at any other location than f000:fff0,
we get an KVM_EXIT_UNKNOWN error. To work around that, hardcode a "reset
vec

kvm: Hardcode a "reset vector" at f000:fff0

It seems that if we attempt to run code at any other location than f000:fff0,
we get an KVM_EXIT_UNKNOWN error. To work around that, hardcode a "reset
vector" at f000:fff0 that jumps to 0000:0x7c000 and load the kernel at the
latter location.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>

show more ...


12