]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
6 years agolib/vfscore: add necessary internal prototypes
Yuri Volchkov [Mon, 18 Feb 2019 14:54:35 +0000 (15:54 +0100)]
lib/vfscore: add necessary internal prototypes

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agolib/vfscore: introduce fdclose
Yuri Volchkov [Mon, 18 Feb 2019 14:54:34 +0000 (15:54 +0100)]
lib/vfscore: introduce fdclose

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agolib/vfscore: remove _KERNEL ifdefs
Yuri Volchkov [Mon, 18 Feb 2019 14:54:33 +0000 (15:54 +0100)]
lib/vfscore: remove _KERNEL ifdefs

All this code is running in kernel

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agolib/vfscore: add necessary field in vfscore_file
Yuri Volchkov [Mon, 18 Feb 2019 14:54:32 +0000 (15:54 +0100)]
lib/vfscore: add necessary field in vfscore_file

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agolib/vfscore: introduce fget, fdrop, fdalloc
Yuri Volchkov [Mon, 18 Feb 2019 14:54:31 +0000 (15:54 +0100)]
lib/vfscore: introduce fget, fdrop, fdalloc

These functions are used in the imported code, which is not enabled
yet. This required to expand functionality of vfscore_install_fd and
friends with locking and reference counting.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: prefix exported functions
Yuri Volchkov [Mon, 18 Feb 2019 14:54:30 +0000 (15:54 +0100)]
lib/vfscore: prefix exported functions

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: introduce UK_FS_REGISTER
Yuri Volchkov [Mon, 18 Feb 2019 14:54:29 +0000 (15:54 +0100)]
lib/vfscore: introduce UK_FS_REGISTER

The macro registers the filesystem in the static array

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: add utility funcs&defs to support imported
Yuri Volchkov [Mon, 18 Feb 2019 14:54:28 +0000 (15:54 +0100)]
lib/vfscore: add utility funcs&defs to support imported

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: use Unikraft types and functions
Yuri Volchkov [Mon, 18 Feb 2019 14:54:27 +0000 (15:54 +0100)]
lib/vfscore: use Unikraft types and functions

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: use Unikraft includes
Yuri Volchkov [Mon, 18 Feb 2019 14:54:26 +0000 (15:54 +0100)]
lib/vfscore: use Unikraft includes

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: remove obvious c++isms and irrelevant code
Yuri Volchkov [Mon, 18 Feb 2019 14:54:25 +0000 (15:54 +0100)]
lib/vfscore: remove obvious c++isms and irrelevant code

Some c++isms are keep because bigger pieces needed to be redone around
them.

Some code is just disabled with #if 0, as we will make use of it later

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: update license header for imported files
Yuri Volchkov [Mon, 18 Feb 2019 14:54:24 +0000 (15:54 +0100)]
lib/vfscore: update license header for imported files

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: tabify imported vfs code
Yuri Volchkov [Mon, 18 Feb 2019 14:54:23 +0000 (15:54 +0100)]
lib/vfscore: tabify imported vfs code

To comply with Unikraft coding style, indents must be tabs, not
spaces. Imported code was a mixture of both.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: Initial import of OSv vfs
Yuri Volchkov [Mon, 18 Feb 2019 14:54:22 +0000 (15:54 +0100)]
lib/vfscore: Initial import of OSv vfs

The code is imported as is.

Commit f1f42915a33bebe120e70af1f32c1a4d92bac780

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: adapt mount.h to Unikraft
Yuri Volchkov [Mon, 18 Feb 2019 14:54:21 +0000 (15:54 +0100)]
lib/nolibc: adapt mount.h to Unikraft

Style problems and proper includes

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: import mount.h
Yuri Volchkov [Mon, 18 Feb 2019 14:54:20 +0000 (15:54 +0100)]
lib/nolibc: import mount.h

tag: v1.1.20
commit: 0fa1e638e87cf257e9f96b4019b2076afd674a19

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk: introduce __weak_alias macro
Yuri Volchkov [Mon, 18 Feb 2019 14:54:19 +0000 (15:54 +0100)]
include/uk: introduce __weak_alias macro

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/linuxu: Acknowledge all interrupts on controller
Simon Kuenzer [Mon, 18 Feb 2019 12:58:15 +0000 (13:58 +0100)]
plat/linuxu: Acknowledge all interrupts on controller

Like on plat/kvm, we acknowledge interrupts even in the
case when there was no handler for it. We do this to get
similar platform behaviour.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/kvm: Acknowledge all interrupts
Simon Kuenzer [Sun, 17 Feb 2019 18:46:46 +0000 (19:46 +0100)]
plat/kvm: Acknowledge all interrupts

Acknowledge interrupts even in the case when there was no
handler for it. We do this to (1) compensate potential
spurious interrupts like currently happening on virtio,
and (2) to minimize impact on device drivers that share
one interrupt line that got previously disabled. Whenever
an interrupt was unhandled a critical warning is still
printed to the kernel console.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/ukdebug: Align hexdump with print system
Simon Kuenzer [Tue, 12 Feb 2019 17:07:49 +0000 (18:07 +0100)]
lib/ukdebug: Align hexdump with print system

With the recent update of the print system, the hexdump functionality
was not adopted. This made this functionality useless. With this
commit hexdump is align with the printing again system. For instance,
uk_hexdumpd() is only enabled in the code when either UK_DEBUG is
defined for the compilation unit or debug messages are enabled
globally. uk_hexdumpk() depends on having kernel console enabled and
on the configured maximum message level.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen: Arm32, x86_64: Unify linker scripts
Simon Kuenzer [Tue, 12 Feb 2019 14:21:39 +0000 (15:21 +0100)]
plat/xen: Arm32, x86_64: Unify linker scripts

Unify linker scripts of both architectures of the Xen platform.
For simplicity, the layout and linker-provided symbols should
be as close as possible.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen: arm: Initialize the bss section to 0
Dafna Hirschfeld [Tue, 12 Feb 2019 13:03:11 +0000 (14:03 +0100)]
plat/xen: arm: Initialize the bss section to 0

Clear the bss section during boot so that it is initialized with 0.
Additonally, we make sure with the linker script that all
bss-related symbols are placed within the bss area marked with
_end and __bss_start when the compile option "dropping of unused
symbols" is enabled.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen: CPU definition for Arm32
Simon Kuenzer [Wed, 13 Feb 2019 13:07:37 +0000 (14:07 +0100)]
plat/xen: CPU definition for Arm32

Introduce minimal CPU definitons to enable compiling for Arm32.
This commits also removes x86 specific CPU functions from the
Arm32 build unit and introduces CONFIG_XN_HVMLITE as invisible
menu configuraiton. Its intention is to support switching
between PV and PVH mode later. For now, we set PV mode for x86
and PVH mode for Arm.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen: Split emergency and hypervisor console
Simon Kuenzer [Wed, 13 Feb 2019 12:26:26 +0000 (13:26 +0100)]
plat/xen: Split emergency and hypervisor console

Splits the two console implemetations (hvc, emergency) from each other.
Similar to plat/kvm, a console option menu is populated in the platform
configuration where each console can be individually selected as output
for kernel or debug messages. Because hvc is currently not yet supported
on Arm32, we set the debug console as default output on Arm32.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen: Grant table support as menu option
Simon Kuenzer [Tue, 12 Feb 2019 16:09:49 +0000 (17:09 +0100)]
plat/xen: Grant table support as menu option

Introduces a menu option to enable or disable grant table support.
The reason is that our grant table implementation depends on
libuklock, libuksched, and libukalloc. A minimal configuration
requires these libraries selected, too. This may be an obstacle
when running implementation written in higher-level languages.
Additionally, some of these libraries are currenlty not supported
on Arm32. It is wiser to give an option for disabling grant table
support.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: Add HAVE_NW_STACK feature symbol
Simon Kuenzer [Wed, 13 Feb 2019 13:36:17 +0000 (14:36 +0100)]
build: Add HAVE_NW_STACK feature symbol

Provide HAVE_NW_STACK feature symbol in lib/Config.uk.
When liblwip is used, it is set.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: Notice user when to do `make clean`
Simon Kuenzer [Mon, 11 Feb 2019 17:01:10 +0000 (18:01 +0100)]
build: Notice user when to do `make clean`

The little helper script `configupdate` did not detect any config changes
with `.config` anymore because it did prefix `CONFIG_` prefix for the
configuration symbols.
This commit makes sure that `configupdate` can detect changes
(e.g., CPU architecture, code optimizations) that requires `make clean`
before continuing. It is still called automatically by the build system.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/common: Add cpu.h for Arm32
Simon Kuenzer [Fri, 8 Feb 2019 15:19:26 +0000 (16:19 +0100)]
plat/common: Add cpu.h for Arm32

Adds a minimal cpu.h for Arm32 so that linux user space
can be built again.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoarch/arm: Correct source paths in libarmmath
Dafna Hirschfeld [Fri, 8 Feb 2019 15:19:25 +0000 (16:19 +0100)]
arch/arm: Correct source paths in libarmmath

The source files of libarmmath were moved to a subdirectory
without modifiying the corresponding Makefile.uk. This caused
compilation erros.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agolib/ukboot: include uk/essentials.h in weak_main
Yuri Volchkov [Tue, 12 Feb 2019 22:26:54 +0000 (23:26 +0100)]
lib/ukboot: include uk/essentials.h in weak_main

In case of compiling with newlib enabled, essentials.h is not getting
included. Because of that, compiler does not know what '__weak' means,
and the compilation fails. Let's include essentials.h explicitly.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agoplat/kvm: Disconnect console options from ukdebug
Simon Kuenzer [Fri, 8 Feb 2019 10:38:08 +0000 (11:38 +0100)]
plat/kvm: Disconnect console options from ukdebug

Like on the other platforms, the console options for debugging
messages should not be hidden when global debug output is not
enabled. One may still want to enable individual debugging for a
particular library or file. This commit makes this configuration
option independent in the menu.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/ukboot: move weak main in separate sub-lib
Yuri Volchkov [Fri, 4 Jan 2019 16:18:00 +0000 (17:18 +0100)]
lib/ukboot: move weak main in separate sub-lib

Link Time Optimization does not work well with incremental linking (ld
-r), which is heavily used by Unikraft.

The ukboot has a weak main() function, which is supposed to be called
if no other library/application provided a proper main. However gcc
resolves main() to whatever is available while linking the
libukboot.ld.o. Which is the weak one.

In the upcoming gcc v9 release a better support of incremental link
optimization is announced. Which hopefully will fix this issue. But
for now, let's fix it with a workaround.

Let's create a sublib under the ukboot, containing only the weak
main. This way we will leave no chance for the first "ld -r" to link
with the wrong main. The next "ld -r" will have all the objects, so it
will be able to make correct decision.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: limit gcc version to 6.1 if LTO is enabled
Yuri Volchkov [Fri, 4 Jan 2019 16:17:59 +0000 (17:17 +0100)]
build: limit gcc version to 6.1 if LTO is enabled

Unikraft is using incremental linking, which is not supported by lto
in gcc earlier then 6.1.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: mark LTO as experimental
Yuri Volchkov [Wed, 6 Feb 2019 16:14:04 +0000 (17:14 +0100)]
build: mark LTO as experimental

Currently LTO during incremental linking is not supported well enough
by gcc.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agosupport: don't throw error message when not in a git repo
Florian Schmidt [Thu, 17 Jan 2019 12:39:29 +0000 (13:39 +0100)]
support: don't throw error message when not in a git repo

The gitsha1 script is used to create a version string for unikraft that
includes the git hash. However, if we are not building from a git repo
checkout, it will throw error messages on the command line. Suppress
these because there's little gain in them.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agobuild: `print-libs`, `print-objs`, `print-srcs` depend on `.config`
Simon Kuenzer [Thu, 31 Jan 2019 11:12:52 +0000 (11:12 +0000)]
build: `print-libs`, `print-objs`, `print-srcs` depend on `.config`

As soon as no configuration `.config` is available, the Make targets
`print-libs`, `print-objs`, and `print-srcs` will return an error
message. Without a configuration file these targets are not able
to do any listing of which units are used or created by a build.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: `print-vars` target is a `null_targets`
Simon Kuenzer [Thu, 31 Jan 2019 11:12:51 +0000 (11:12 +0000)]
build: `print-vars` target is a `null_targets`

Include the `print-vars` target to the `null_targets` variable. This
is done for consistency.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: `distclean`, `properclean` independent of `.config`
Simon Kuenzer [Thu, 31 Jan 2019 11:12:50 +0000 (11:12 +0000)]
build: `distclean`, `properclean` independent of `.config`

Until now, the targets `distclean` and `properclean` were not
available if `.config` file is not present. This does not make sense,
because these targets have nothing to do with the configuration. They
just clean everything (except .config in case of properclean).
Since these targets use some functions declared in
`support/build/Makefile.rules`, we include this file at an earlier
point.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc/string: fix checkpatch issues in strlcpy and strlcat
Yuri Volchkov [Tue, 4 Dec 2018 17:16:28 +0000 (18:16 +0100)]
lib/nolibc/string: fix checkpatch issues in strlcpy and strlcat

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc/string: import strlcpy and strlcat from musl
Yuri Volchkov [Tue, 4 Dec 2018 17:16:27 +0000 (18:16 +0100)]
lib/nolibc/string: import strlcpy and strlcat from musl

git tag v1.1.20
commit <0fa1e638e87cf257e9f96b4019b2076afd674a19>

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc/string: fix underflow in strnlen
Yuri Volchkov [Tue, 4 Dec 2018 17:16:26 +0000 (18:16 +0100)]
lib/nolibc/string: fix underflow in strnlen

The memchr return NULL if it did not find '\0' character. The strnlen
did not take this into account and always did subtraction to count the
string length.

Return the provided length limit if the line ending is not found
within this limit.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/ukdebug: Fix spelling in configuration menu
Simon Kuenzer [Wed, 30 Jan 2019 23:44:58 +0000 (23:44 +0000)]
lib/ukdebug: Fix spelling in configuration menu

The help text of LIBUKDEBUG_PRINTK was speaking about debug messages
although the option configures kernel messages.
The option LIBUKDEBUG_PRINTK_INFO enables all types of kernel messages
instead of debug messages.
The message redirection option does not have a dependency on
LIBUKDEBUG_PRINTD neither on LIBUKDEBUG_PRINTK.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk: introduce ukarch_dec
Yuri Volchkov [Wed, 30 Jan 2019 19:25:10 +0000 (20:25 +0100)]
include/uk: introduce ukarch_dec

This is a function symmetric to ukarch_inc, which we already have. The
ukarch_dec does atomic decrement, applying a full memory barrier.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc/string: import memrchr and strrchr from musl
Yuri Volchkov [Mon, 28 Jan 2019 10:51:13 +0000 (11:51 +0100)]
lib/nolibc/string: import memrchr and strrchr from musl

tag: v1.1.20
commit <0fa1e638e87cf257e9f96b4019b2076afd674a19>

Only style modifications have been applied on top of the original code

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/uklock: introduce UK_MUTEX_INITIALIZER
Yuri Volchkov [Wed, 9 Jan 2019 11:33:59 +0000 (12:33 +0100)]
lib/uklock: introduce UK_MUTEX_INITIALIZER

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/uklock: introduce mutex_is_locked
Yuri Volchkov [Wed, 9 Jan 2019 11:33:58 +0000 (12:33 +0100)]
lib/uklock: introduce mutex_is_locked

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/uklock: rename mutex functions to match pthread_ analogues
Yuri Volchkov [Wed, 9 Jan 2019 11:33:57 +0000 (12:33 +0100)]
lib/uklock: rename mutex functions to match pthread_ analogues

People are more used to functions like mutex_lock and mutex_unlock,
then mutex_hold and mutex_release.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agodrivers/virtio: Memory barrier before notifying host on virtqueue updates
Simon Kuenzer [Thu, 31 Jan 2019 15:48:44 +0000 (15:48 +0000)]
drivers/virtio: Memory barrier before notifying host on virtqueue updates

Before notifying the virtio backend on the host we should make
sure that the virtqueue index update operation actually happened.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agodrivers/virtio: virtio_netdev_recv(): Remove disabling interrupts
Simon Kuenzer [Thu, 31 Jan 2019 15:48:43 +0000 (15:48 +0000)]
drivers/virtio: virtio_netdev_recv(): Remove disabling interrupts

Disabling interrupts by virtio_netdev_recv() is not needed because in
normal cases they are already disabled by the internal receive
interrupt handler, right before a uknetdev API program can call the
receive function. When the device is used in pure polling mode, queue
interrutps are never enabled.
We remove this step because of performance reasons. An assertion is
making sure that the API is used as intended.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/uknetdev: Flag-based status report on rx and tx functions
Simon Kuenzer [Thu, 31 Jan 2019 15:48:42 +0000 (15:48 +0000)]
lib/uknetdev: Flag-based status report on rx and tx functions

Introduce flag based status return codes on receive and transmit
functions. They are replacing the current enum-like return codes. The
flags are able to inform the API user about additional driver
states (e.g., queue underruns).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/uknetdev: Introduce receive buffer allocator callback
Simon Kuenzer [Thu, 31 Jan 2019 15:48:41 +0000 (15:48 +0000)]
lib/uknetdev: Introduce receive buffer allocator callback

The idea of having a fill-up parameter on the receive function is
inconvenient because a user never knows how many receive buffers have
to be programmed before calling the receive function.
This commit introduces registering a callback when configuring a
receive queue. This callback has to be provided by the NETDEV API user
and is called by the driver whenever it programs new receive buffers to
the receive queue. In order to still provide performance, this
allocation callback function is called for a batch of receive buffers.
This new mechanism replaces the fill-up parameter on the receive function.

This commit also adopts virtio-net in order to comply with the API change.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/uklock: Debug level for semaphore messages
Simon Kuenzer [Wed, 30 Jan 2019 17:33:34 +0000 (17:33 +0000)]
lib/uklock: Debug level for semaphore messages

Use debug prints also for semaphore initialization message.
This is done in order to be inline with other messages
produced by libuklock.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: Introduce fd_set operation macros
Simon Kuenzer [Wed, 30 Jan 2019 17:33:33 +0000 (17:33 +0000)]
lib/nolibc: Introduce fd_set operation macros

Port FD_CLR, FD_ISSET, FD_SET, and FD_ZERO macros from FreeBSD.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/ukswrand: Add uk_swrand_def to exportsyms.uk
Simon Kuenzer [Wed, 30 Jan 2019 17:33:32 +0000 (17:33 +0000)]
lib/ukswrand: Add uk_swrand_def to exportsyms.uk

Add uk_swrand_def to exportsyms.uk because it is used by the
uk_swrand_randr() inline function that is defined in
include/swrand.h header.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: add functionality to alternate linker script
Yuri Volchkov [Mon, 28 Jan 2019 10:02:55 +0000 (11:02 +0100)]
build: add functionality to alternate linker script

With this patch libraries can amend the master linker script by
registering the extra script in EXTRA_LD_SCRIPT-y variable.

See doc/guides/developers-app.rst for details.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc/include: import statfs.h from musl
Yuri Volchkov [Wed, 30 Jan 2019 16:38:54 +0000 (17:38 +0100)]
lib/nolibc/include: import statfs.h from musl

This is a combination of include/sys/statfs.h and
arch/generic/bits/statfs.h. We do not need to provide different
statfs.h for different architectures, because this files differs only
for mips*, s390x, x32, which we do not have plans to support.

tag: v1.1.20
commit: 0fa1e638e87cf257e9f96b4019b2076afd674a19

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: add fs-related types
Yuri Volchkov [Wed, 30 Jan 2019 16:38:53 +0000 (17:38 +0100)]
lib/nolibc: add fs-related types

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: replace param.h with imported from musl
Yuri Volchkov [Wed, 30 Jan 2019 16:38:52 +0000 (17:38 +0100)]
lib/nolibc: replace param.h with imported from musl

Only style modifications on top of the imported code

tag: v1.1.20
commit <0fa1e638e87cf257e9f96b4019b2076afd674a19>

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: adapt imported fs-related headers
Yuri Volchkov [Wed, 30 Jan 2019 16:38:51 +0000 (17:38 +0100)]
lib/nolibc: adapt imported fs-related headers

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/nolibc: import fs-related headers from musl
Yuri Volchkov [Wed, 30 Jan 2019 16:38:50 +0000 (17:38 +0100)]
lib/nolibc: import fs-related headers from musl

Git tab v1.1.20
Commit 0fa1e638e87cf257e9f96b4019b2076afd674a19

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/common/pci: use new list api
Yuri Volchkov [Fri, 25 Jan 2019 14:10:04 +0000 (15:10 +0100)]
plat/common/pci: use new list api

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/ukbus: use new list api
Yuri Volchkov [Fri, 25 Jan 2019 14:10:03 +0000 (15:10 +0100)]
lib/ukbus: use new list api

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: update license header for imported code
Yuri Volchkov [Fri, 25 Jan 2019 14:10:02 +0000 (15:10 +0100)]
include/uk/list: update license header for imported code

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: fix style issues
Yuri Volchkov [Fri, 25 Jan 2019 14:10:01 +0000 (15:10 +0100)]
include/uk/list: fix style issues

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: prefix imported functions with uk_
Yuri Volchkov [Fri, 25 Jan 2019 14:10:00 +0000 (15:10 +0100)]
include/uk/list: prefix imported functions with uk_

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: remove unneeded workarounds from imported code
Yuri Volchkov [Fri, 25 Jan 2019 14:09:59 +0000 (15:09 +0100)]
include/uk/list: remove unneeded workarounds from imported code

This implementation of lists intended to be the only one and going to
replace the existing one completely. There is no need of LIST_HEAD
conflict avoidance. The prefetch is not belong here either.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: adapt imported code for Unikraft
Yuri Volchkov [Fri, 25 Jan 2019 14:09:58 +0000 (15:09 +0100)]
include/uk/list: adapt imported code for Unikraft

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: rename UK_LIST_HEAD in the old implementation
Yuri Volchkov [Fri, 25 Jan 2019 14:09:57 +0000 (15:09 +0100)]
include/uk/list: rename UK_LIST_HEAD in the old implementation

UK_LIST_HEAD from the new list implementation conflicts with the old
one. Since the current UK_LIST_HEAD is never used, and the current
implementation will be a subject for removal, rename it to
UK_COMPAT_LIST_HEAD

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk/list: import linux linked list code from freebsd
Yuri Volchkov [Fri, 25 Jan 2019 14:09:56 +0000 (15:09 +0100)]
include/uk/list: import linux linked list code from freebsd

Original file: sys/compat/linuxkpi/common/include/linux/list.h
commit <910f555845468ecbdd14dbce7bcc584812e084dc>

The new linked list will replace the existing one.  The old
implementation is moved to compat_list.h.

The only difference in the imported code from the original one is a
"#if 0/endif" pair, to keep it from compilation, since some
modifications are needed before. And, at the end of that block the
old (compat_list.h) implementation is included. So by including
<uk/list.h> user will get both implementations.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoinclude/uk: import write_once and read_once from freebsd
Yuri Volchkov [Fri, 25 Jan 2019 14:09:55 +0000 (15:09 +0100)]
include/uk: import write_once and read_once from freebsd

commit <910f555845468ecbdd14dbce7bcc584812e084dc>

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agobuild: resolve common symbols in each lib individually
Yuri Volchkov [Fri, 25 Jan 2019 14:09:54 +0000 (15:09 +0100)]
build: resolve common symbols in each lib individually

If a symbol is not initialized, gcc declares it as a weak. It will be
resolved during the linking time.

Common symbols inside a library are fine, but we don't want them to be
resolved together with common symbols from another library.

For example:
lib/foo/main.c:
   int some_variable;
   int main(void) {
      printf("libfoo: %p\n", some_variable);
   }
lib/bar/main.c:
   char some_variable;
   int main(void) {
      printf("libbar: %p\n", some_variable);
   }

After linking the final Unikraft image, both libfoo and libbar will
get one address for their some_variable. Even if neither of them was
never declared "extern". Even if they have different types. Even if
some_variable is not listed in exportsyms.uk

The solution is to link library object files (libname.ld.o) with
'-d'. This will force linker to do allocation for common symbols.

Signed-off-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/common: Add a notice regarding trap handling
Florian Schmidt [Wed, 16 Jan 2019 09:35:15 +0000 (10:35 +0100)]
plat/common: Add a notice regarding trap handling

While traps.c itself is compiled with NO_X86_EXTREGS_FLAGS, it still
doesn't hurt to remind potential editors of the file that calling any
other function from your trap handler is potentially dangerous.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoarch/x86: Introduce NO_X86_EXTREGS_FLAGS
Florian Schmidt [Wed, 16 Jan 2019 09:35:14 +0000 (10:35 +0100)]
arch/x86: Introduce NO_X86_EXTREGS_FLAGS

This set of flags disables the use of extended registers: FP, MMX/XMM,
YMM, and hence should be used on files that implement
trap/exception/interrupt handler functions, because we do not save the
extended x86 register state when those events happen.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat/common: Support to save and restore extended (x86) registers
Florian Schmidt [Wed, 16 Jan 2019 09:35:13 +0000 (10:35 +0100)]
plat/common: Support to save and restore extended (x86) registers

On creation of a sw_ctx struct, allocate an area sufficiently large to
save all extended registers. On context switch, use the appropriate CPU
instruction to save and restore those registers to/from that area.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat: Add global struct to keep x86 CPU information
Florian Schmidt [Wed, 16 Jan 2019 09:35:12 +0000 (10:35 +0100)]
plat: Add global struct to keep x86 CPU information

Currently, all information relates to the additional registers that can
be available on x86 CPUs, and how to save and restore them.

For Arm, there is only a dummy function so far that can be filled later
when we support extended registers on Arm.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat/common: add include guards to include/x86/cpu.h
Florian Schmidt [Wed, 16 Jan 2019 09:35:11 +0000 (10:35 +0100)]
plat/common: add include guards to include/x86/cpu.h

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat: Add -DxxxPLAT define for each platform
Florian Schmidt [Wed, 16 Jan 2019 09:35:10 +0000 (10:35 +0100)]
plat: Add -DxxxPLAT define for each platform

This allows common code to distinguish for which platform it is
currently being built.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat: check for and enable extended CPU features
Florian Schmidt [Wed, 16 Jan 2019 09:35:09 +0000 (10:35 +0100)]
plat: check for and enable extended CPU features

But only do this if code is compiled with SSE/AVX.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat/{kvm, xen}: Clean up Makefile.uk conditional build rules
Florian Schmidt [Wed, 16 Jan 2019 09:35:08 +0000 (10:35 +0100)]
plat/{kvm, xen}: Clean up Makefile.uk conditional build rules

1) Those ifeqs aren't needed because the $(CONFIG_ARCH...) part already
   deals with the conditions under which to build those files.
2) Add $(LIBKVMPLAT_BASE)/include as include directory for libkvmpci.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat/*: Make timer interrupt frequency selectable
Florian Schmidt [Wed, 2 Jan 2019 15:46:24 +0000 (16:46 +0100)]
plat/*: Make timer interrupt frequency selectable

Add new configuration options for choosing a timer interrupt frequency.
The configured frequency is converted to the timer tick length which can
be of use for other modules (e.g., preemptive schedulers).

Previously, the tick was 100 Hz on KVM and 1000 Hz on Xen. The default
value is now 100 Hz across both platforms.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agolib/ukdebug: uk_printd() and uk_printk() use same format engine
Simon Kuenzer [Thu, 27 Sep 2018 12:41:13 +0000 (14:41 +0200)]
lib/ukdebug: uk_printd() and uk_printk() use same format engine

The same output engine is used for uk_printd() and
uk_printk(). Whenever uk_printd() is directed to a different output as
uk_printk(), individual states are kept.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agolib/ukdebug: Swap uk_printk() and uk_printd()
Simon Kuenzer [Thu, 27 Sep 2018 12:41:12 +0000 (14:41 +0200)]
lib/ukdebug: Swap uk_printk() and uk_printd()

Exchanges uk_printk() with uk_printd(). uk_printk gets a lvl parameter:
 uk_printk(lvl, fmt, ...)
  with having KLVL_INFO (former DLVL_INFO), KLVL_WARN (former
  DLVL_WARN), KLVL_ERR (KLVL_ERR), DLVL_CRIT (former KLVL_CRIT) as
  value for parameter `lvl`.

uk_printd() implements former uk_printk(). Its purpose is to replace
the previous DLVL_EXTRA level. Whenever `UK_DEBUG` is defined as macro
while compiling a source file, uk_printd() statements are
effective. libukdebug additionally provides a global flag to enable
debug messages in all source files.
 uk_printd(fmt, ...)

It seems to be more meaningful to redirect all messages to
ukplat_coutk() as default configuration. The uk_pr_*() shortcut
macros are updated to reflect this new scheme.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agolib/vfscore: Add stdin fop
Vlad-Andrei BĂDOIU (78692) [Thu, 20 Dec 2018 13:34:56 +0000 (13:34 +0000)]
lib/vfscore: Add stdin fop

This patch adds the stdin operation inside lib/vfscore/stdio.c.

The stdio is mapped by default to fd 0. This implementation mimics
the normal read behaviour.(read until count bytes or read until VEOF or
\n is met). The '\r' is replaced with '\n' because ukplat_cink returns
'\r' on KVM and Xen.

For every successful call of ukplat_cink the input is printed
to the stdout.

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agolib/nolibc/include: Add termios.h from musl
Vlad-Andrei BĂDOIU (78692) [Thu, 20 Dec 2018 13:34:55 +0000 (13:34 +0000)]
lib/nolibc/include: Add termios.h from musl

This patch combines include/termios.h with generic/bits/termios.h
from musl. It provides all the defines found in generic/bits/termios.h
but not the function declarations from include/termios.h.

The following changes are made to the original files:
*) add missing declarations from include/termios.h for cc_t, speed_t
and tcflag_t
*) add compile-time check of the architecture
*) add compile guards

tag: v1.1.20
commit <0fa1e638e87cf257e9f96b4019b2076afd674a19>

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agodriver/virtio: memset virtio hdr regions
Sharan Santhanam [Tue, 4 Dec 2018 14:25:20 +0000 (15:25 +0100)]
driver/virtio: memset virtio hdr regions

Explicitly memset the virtio header region with zero.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agodriver/virtio: Host notify and ring desc debug msg
Sharan Santhanam [Tue, 4 Dec 2018 14:10:35 +0000 (15:10 +0100)]
driver/virtio: Host notify and ring desc debug msg

We provide additional debug message when notify the host of
additional buffer and the descriptor information while enqueuing
a buffer into the ring.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agoplat/virtio: Use padded buffer for tx and rx
Sharan Santhanam [Tue, 4 Dec 2018 13:55:55 +0000 (14:55 +0100)]
plat/virtio: Use padded buffer for tx and rx

We introduce buffer padding while transmitting and receiving data. We
explicitly introduce padding to make sure that each network packet
needs two descriptors (one for virtio header and another for
network packet).

According the specification 5.1.6.6, we need to explicitly use 2
descriptor for each transmit and receive network packet since we do not
negotiate for VIRTIO_F_ANY_LAYOUT.

In the previous implementation the sg list merged the two descriptor
into one as the memory region were contiguous.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agodriver/virtio: Replace malloc with calloc
Sharan Santhanam [Tue, 4 Dec 2018 13:54:28 +0000 (14:54 +0100)]
driver/virtio: Replace malloc with calloc

We replace malloc with calloc to zero out the allocated memory.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agodriver/virtio: Configure the max desc as default
Sharan Santhanam [Tue, 4 Dec 2018 13:53:13 +0000 (14:53 +0100)]
driver/virtio: Configure the max desc as default

As a part of this patch, we configure the max queue size as the
configuration for the number descriptor if the user set the number
of descriptors to zero.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
6 years agolib/uknetdev: Zero-initialize netdev data
Simon Kuenzer [Mon, 3 Dec 2018 10:23:18 +0000 (11:23 +0100)]
lib/uknetdev: Zero-initialize netdev data

Whenever a network device is registered by a driver to the uknetdev
API, libuknetdev allocates an API-internal data structure that is used
to track the state of the device state. Subsequent API calls are
assuming that this allocation was zero-initialized. Otherwise,
assertions fail unexpectedly.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/kvm: Make mxcsr_ptr in entry64.S a 32-bit value
Florian Schmidt [Mon, 17 Dec 2018 09:46:16 +0000 (10:46 +0100)]
plat/kvm: Make mxcsr_ptr in entry64.S a 32-bit value

LDMXCSR reads 32 bits into the register. If mxcsr_ptr is only a .word
(and thus 16 bits), the instruction reads adjacent bytes into the MXCSR
register, which can to produce #GP faults on LDMXCSR when those adjacent
bytes contain 1's in bit locations that are reserved in MXCSR.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoarch/x86: add -mtune for ASFLAGS
Florian Schmidt [Mon, 17 Dec 2018 09:46:15 +0000 (10:46 +0100)]
arch/x86: add -mtune for ASFLAGS

This provides the preprocessor with compiler-provided defines such as
__AVX__.

Signed-off-by: Florian Schmidt <florian.schmidt@neclab.eu>
Reviewed-by: Yuri Volchkov <yuri.volchkov@neclab.eu>
6 years agoplat/virtio: Update off-by-one device id
Cristian Banu [Fri, 7 Dec 2018 05:19:00 +0000 (07:19 +0200)]
plat/virtio: Update off-by-one device id

Extract the virtio_device_id for legacy devices from the PCI Subsystem
Device ID. The previous behaviour resulted in some devices having the
wrong ID attributed to them. For example, a virtio-9p device has a PCI
Device ID of 0x1009 (which would have resulted in virtio_device_id of
10), but a PCI Subsystem Device ID of 9 (which is the correct constant
under virtio_ids.h).

Removes now unused function virtio_device_id_add and misleading macro
VIRTIO_PCI_LEGACY_DEVICEID_START.

Signed-off-by: Cristian Banu <cristb@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/virtio: Fix virtio-bus init getting hanged
Cristian Banu [Wed, 5 Dec 2018 14:27:55 +0000 (16:27 +0200)]
plat/virtio: Fix virtio-bus init getting hanged

This patch fixes getting hanged in virtio-bus initialization. The inner
while loop does not iterate through all the dev_ids, and failing to find
a match against the first dev_id results in an infinite loop.

Signed-off-by: Cristian Banu <cristb@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen/xenbus: Add _GNU_SOURCE define when using asprintf
Bogdan Lascu [Sat, 24 Nov 2018 13:05:18 +0000 (15:05 +0200)]
plat/xen/xenbus: Add _GNU_SOURCE define when using asprintf

Compiling xenbus.c and xs.c gives the warning "implicit definition
of asprintf". Asprintf is not C nor POSIX, so its declaration is
conditioned by a header define that is activated by defining _GNU_SOURCE
before including stdio.h.

Signed-off-by: Bogdan Lascu <lascu.bogdan96@gmail.com>
Signed-off-by: Mihai Pogonaru <pogonarumihai@gmail.com>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoplat/kvm: Make VIRTIO_NET depend on VIRTIO_BUS
Teodora Serbanescu [Sat, 24 Nov 2018 13:08:25 +0000 (15:08 +0200)]
plat/kvm: Make VIRTIO_NET depend on VIRTIO_BUS

This is the setup to reproduce the bug:
Library Configuration -> enable uknetdev
Platform Configuration -> enable KVM guest:
-> disable Virtio bus driver
-> Virtio -> enable Virtio Net device

With this  setup, the following error occurs on build:
"undefined reference to ` _virtio_bus_register_driver'"

This fix solves the issue by enabling Virtio bus driver every time
Virtio Net device is enabled.

Signed-off-by: Teodora Serbanescu <teo.serbanescu16@gmail.com>
Signed-off-by: Andrei Gogonea <andrei.gogonea09@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
6 years agoplat/xen/hypervisor.c: Remove unused parameter
Radu Nicolau [Sat, 24 Nov 2018 11:23:23 +0000 (13:23 +0200)]
plat/xen/hypervisor.c: Remove unused parameter

Removed unused parameter cpu from macro active_evtchns

Signed-off-by: Radu Nicolau <radunicolau102@gmail.com>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoplat/xen/common/hypervisor: Delete unused code and comments
Radu Nicolau [Sat, 24 Nov 2018 11:23:22 +0000 (13:23 +0200)]
plat/xen/common/hypervisor: Delete unused code and comments

Delete unused code and deprecated comments

Signed-off-by: Radu Nicolau <radunicolau102@gmail.com>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoplat/xen/common: Move event channel functions in events.h
Radu Nicolau [Sat, 24 Nov 2018 11:23:21 +0000 (13:23 +0200)]
plat/xen/common: Move event channel functions in events.h

Move mask_evtchn, unmask_evtchn and clear_evtchn function
prototypes from hypervisor.h to events.h. Change parameter
type to evtchn_port_t. Remove hypervisor.h inclusion from
arm/arch_events.c and arm/arch_time.c

Signed-off-by: Radu Nicolau <radunicolau102@gmail.com>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>
6 years agoinclude/xen-x86: Remove os.h on x86
Radu Nicolau [Sat, 24 Nov 2018 11:23:20 +0000 (13:23 +0200)]
include/xen-x86: Remove os.h on x86

Remove os.h from the project as it was unused.
mm_pv.h included os.h but did not use anything from
it. The rest of the changes have been made in sources
which need the extern definition for the shared info
page.

Signed-off-by: Radu Nicolau <radunicolau102@gmail.com>
Reviewed-by: Costin Lupu <costin.lupu@cs.pub.ro>