]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
18 months agolib/uknetdev: Add header for basic network structures
Marco Schlumpp [Wed, 8 Mar 2023 13:02:56 +0000 (14:02 +0100)]
lib/uknetdev: Add header for basic network structures

These structures allow introspection of network packets for drivers.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1088

18 months agodrivers/virtio: Add support for IPv4/TSO
Marco Schlumpp [Wed, 8 Mar 2023 13:02:56 +0000 (14:02 +0100)]
drivers/virtio: Add support for IPv4/TSO

When the host indicates support for TSO, enable it and accept large
packets when the corresponding uknetbuf flag is set.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1088

18 months agoarch/*: Add an non-aligned version for stack-pushing
Tianyi Liu [Fri, 15 Sep 2023 18:02:41 +0000 (02:02 +0800)]
arch/*: Add an non-aligned version for stack-pushing

For AArch64, `ukarch_rctx_stackpush` may add padding to make sure
the `sp` register is aligned to 16 bytes. But there're also some
use cases where alignment is not allowed. In such cases, the newly
added `ukarch_rctx_stackpush_packed` and `ukarch_rstack_push_packed`
will be useful.

Signed-off-by: Tianyi Liu <i.pear@outlook.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1096

18 months agolib/vfscore: Fix pipe error codes
Andrei Tatar [Thu, 14 Sep 2023 08:58:45 +0000 (11:58 +0300)]
lib/vfscore: Fix pipe error codes

This change fixes incorrect return of error codes in the pipe module of
vfscore. Specifically:
- Return positive error codes from internal functions; syscall handlers
  expect positive errors and will negate them as required
- Do not set errno, rather return the error code
- Correctly return EINVAL when attempting to open a pipe with O_DIRECT,
  as we do not support packet mode pipes, and calling code needs to be
  made aware of this

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1093

18 months agolib/vfscore: Remove timeval-related build warnings
Tiago Andre Goncalves Oliveira [Sat, 16 Sep 2023 17:02:38 +0000 (18:02 +0100)]
lib/vfscore: Remove timeval-related build warnings

The futimes and lutimes functions are defined with a `struct timeval [2]`
argument. They are however instantiated with a pointer. This causes a build
warning.

Change the instantiation from pointer to array. This removes the build warning.

Signed-off-by: Tiago Andre Goncalves Oliveira <t.g.oliveira@ua.pt>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1099

18 months agolib/ramfs: Fix UAF bug when deleting open file
Andrei Tatar [Mon, 28 Aug 2023 19:31:17 +0000 (21:31 +0200)]
lib/ramfs: Fix UAF bug when deleting open file

Previously ramfs would eagerly free filesystem nodes when deleting a
file regardless whether the file is open, leading to a possible
use-after-free bug if the open file is later used.
This change fixes this issue by marking nodes as deleted after they have
been removed from the filesystem, then only releasing resources lazily
once all open references have been garbage-collected.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
GitHub-Closes: #1075

18 months agolib/vfscore: Fix potential vfscore_file mem leak
Andrei Tatar [Mon, 28 Aug 2023 19:13:49 +0000 (21:13 +0200)]
lib/vfscore: Fix potential vfscore_file mem leak

Previously if `fdalloc` failed to allocate a file descriptor, the
function would exit without decrementing the reference count on the
vfscore_file object, leading to a potential memory leak.
This change reorders operations to prevent this scenario.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1074

18 months agobuild: Always save architecture with savedefconfig
Simon Kuenzer [Fri, 8 Sep 2023 17:37:46 +0000 (19:37 +0200)]
build: Always save architecture with savedefconfig

With `savedefconfig`, KConfig creates a file that contains only options
that are different from the default selection. Because the build system
automatically detects the host architecture and sets the default
architecture to this detected architecture, the architecture is never
part of the defconfig file if the architecture in the configuration
matches the host architecture. This becomes problematic as soon as such
a file is loaded on a build environment that has a different host
architecture: The configuration can fail because of architectural
configuration differences.

This commit ensures that the configured architecture is always stored
in the defconfig file. The `savedefconfig` target appends the configured
architecture to the file if the architectures between host and config
match.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1084

18 months agobuild: Forward host architecture from build system to KConfig
Simon Kuenzer [Fri, 8 Sep 2023 21:30:11 +0000 (23:30 +0200)]
build: Forward host architecture from build system to KConfig

Commit c11dceaa9698 ("kconfig: Determine the default arch from CC")
introduced the automatic selection of a default target architecture by
querying and parsing the default compiler's target machine. Because the
detection breaks across GCC output versions, this commit forwards the host
architecture already detected by the main Makefile to the KConfig
system. This way, KConfig will be in sync with what the Makefile system has
detected.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1084

18 months agobuild: Do not check for updates with `savedefconfig`
Simon Kuenzer [Fri, 8 Sep 2023 17:37:18 +0000 (19:37 +0200)]
build: Do not check for updates with `savedefconfig`

The `savedefconfig` target is not saving a new configuration (`.config`)
but it derives a minimal configuration from the current
configuration. Because of this, it is not necessary to check for
updates to the configuration.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1084

18 months agolib/ukcpio: Preserve timestamp of extracted files
Andrei Tatar [Wed, 16 Aug 2023 15:10:50 +0000 (17:10 +0200)]
lib/ukcpio: Preserve timestamp of extracted files

Previously ukcpio did not honor the `mtime` field of cpio sections,
leaving extracted files timestamped with the extraction time.
This change implements setting the timestamps for regular files.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Adina-Maria Vaman <adinamariav22@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1071

18 months agolib/ukcpio: Remove use of malloc & free
Andrei Tatar [Wed, 16 Aug 2023 14:24:50 +0000 (16:24 +0200)]
lib/ukcpio: Remove use of malloc & free

This change removes the use of heap memory for computing the extraction
path, eliminating a call to malloc & free for every cpio section,
leaving ukcpio to use only stack memory.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Adina-Maria Vaman <adinamariav22@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1071

18 months agolib/ukcpio: Replace file libcalls with syscalls
Andrei Tatar [Wed, 16 Aug 2023 14:01:36 +0000 (16:01 +0200)]
lib/ukcpio: Replace file libcalls with syscalls

This change replaces calls to open, close, write, chmod, and mkdir with
their raw Unikraft syscall equivalents, preventing a call into
potentially non-unikraft code, as well as eliminating the use of errno.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Adina-Maria Vaman <adinamariav22@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikrat.io>
GitHub-Closes: #1071

18 months agolib/posix-user: Allow custom user & group
Andrei Tatar [Mon, 28 Aug 2023 19:11:08 +0000 (21:11 +0200)]
lib/posix-user: Allow custom user & group

This change adds Kconfig options to select the default UID, GID,
username, and groupname that Unikraft reports to applications.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Ioan-Teodor Teugea <ioan_teodor.teugea@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1072

18 months agolib/ukmmap: Fix wrong return of NULL
Andrei Tatar [Mon, 28 Aug 2023 19:25:05 +0000 (21:25 +0200)]
lib/ukmmap: Fix wrong return of NULL

Previously ukmmap's `mmap()` would return NULL for unimplemented cases.
However, no calling code expects this, and will wrongly try to use the
returned buffer.
This change corrects this oversight and returns MAP_FAILED in all cases
of error.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro>
Reviewed-by: Andra Paraschiv <andra@unikraft.org>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1073

18 months agodrivers/virtio: Add UK_PLAT_COMMON_BASE to the include path
Michalis Pappas [Mon, 18 Sep 2023 14:25:35 +0000 (16:25 +0200)]
drivers/virtio: Add UK_PLAT_COMMON_BASE to the include path

The virtio drivers have both direct and indirect dependencies
on `uk/plat/common` headers.

Add UK_PLAT_COMMON_BASE to the library include path of every
driver library to fix compile errors.

Also add LIBUKVIRTIO_BUS_BASE to the include path of virtio-ring
as it includes `virtio/virtio_bus.h`.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1095

18 months agodrivers/ukbus/pci: Add UK_PLAT_COMMON_BASE to the include path
Michalis Pappas [Mon, 18 Sep 2023 14:25:35 +0000 (16:25 +0200)]
drivers/ukbus/pci: Add UK_PLAT_COMMON_BASE to the include path

The pci driver has various dependencies on headers in `uk/plat/common`.
Add UK_PLAT_COMMON_BASE to the library include path.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1095

18 months agodrivers/ukbus/platform: Add UK_PLAT_COMMON_BASE to the include path
Michalis Pappas [Mon, 18 Sep 2023 14:25:35 +0000 (16:25 +0200)]
drivers/ukbus/platform: Add UK_PLAT_COMMON_BASE to the include path

The platform bus driver depeds on `uk/plat/common/cpu.h`. Add
UK_PLAT_COMMON_BASE to the library include path.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
GitHub-Closes: #1095

19 months agoscripts: `mkukimg`: Run only on Linux
Simon Kuenzer [Fri, 22 Sep 2023 15:01:12 +0000 (17:01 +0200)]
scripts: `mkukimg`: Run only on Linux

The script `mkukimg` can only be run on a Linux host. This commit adds a
check that stops execution if the detected host environment is not Linux.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Jakub Ciolek <jakub.ciolek@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1109

 enter the commit message for your changes. Lines starting

19 months agoscripts: Use GNU version of coreutils on Darwin
Simon Kuenzer [Fri, 22 Sep 2023 14:52:39 +0000 (16:52 +0200)]
scripts: Use GNU version of coreutils on Darwin

This commit changes the scripts under `support/scripts` and
`support/build` so that they use the GNU versions of the following
commands on Darwin:
```
 readlink, dirname, grep
```
As soon as Darwin is detected as host environment, the scripts use
the following commands instead:
```
 greadlink, gdirname, ggrep
```
These tools are typically installed with HomeBrew
(`brew install coreutils`).

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Jakub Ciolek <jakub.ciolek@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1109

19 months agobuild: Provide command variables for `readlink` and `dirname`
Simon Kuenzer [Fri, 22 Sep 2023 20:13:56 +0000 (22:13 +0200)]
build: Provide command variables for `readlink` and `dirname`

For future references this commit adds command variables for `readlink`
and `dirname`. On Darwin these variables point to the GNU versions of
the commands. They are typically installed with HomeBrew
(`brew install coreutils`) and prefixed with a `g`:
`greadlink`, `gdirename`.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Jakub Ciolek <jakub.ciolek@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1109

19 months agobuild: Use ggrep on Darwin (MacOS)
Simon Kuenzer [Fri, 22 Sep 2023 15:00:17 +0000 (17:00 +0200)]
build: Use ggrep on Darwin (MacOS)

The build system depends on the GNU version of `grep`. Since this is
typically installed with `ggrep` on Darwin environments with HomeBrew
(`brew install coreutils`), we call `ggrep` in such a case.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Jakub Ciolek <jakub.ciolek@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1109

19 months agosupport/scripts: mkcpio: Support Darwin (MacOS) environments
Simon Kuenzer [Wed, 30 Aug 2023 21:38:19 +0000 (23:38 +0200)]
support/scripts: mkcpio: Support Darwin (MacOS) environments

The standard `cpio` tool available under Darwin is the equivalent of the
`bsdcpio` tool available under Linux. At the beginning of the script we
detect the host environment and use `bsdcpio` or `cpio` accordingly.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Eduard-Florin Mihailescu <mihailescu.eduard@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1078

19 months agobuild: Add target to print unikernel LoC stats
Andrei Tatar [Fri, 15 Sep 2023 12:52:19 +0000 (14:52 +0200)]
build: Add target to print unikernel LoC stats

This change adds the `print-loc` Makefile target which (fairly hackishly)
computes and prints statistics about the number of lines of code that
make it into a built unikernel image. It is not intended as an end-user
metric and thus does not aim for any particular level of accuracy or
edge-case handling, rather it is a fun little dev tool that allows
rough comparisons of the level of "bloat" between unikernels.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1108

19 months agobuild: Forward YACC/LEX to kconfig make invocation
Marco Schlumpp [Wed, 13 Sep 2023 09:34:17 +0000 (11:34 +0200)]
build: Forward YACC/LEX to kconfig make invocation

KConfig relies on GNU bison and does not work with the classical yacc.
While most Linux distributions prefer bison and add a symlink for yacc,
there are distributions that do not this (Fedora). They seem to actually
use the original Berkeley yacc to provide `yacc`.

Instead of using the default `yacc` for `YACC` in make explicitly forward
our preference for `bison` to the kconfig Makefile.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1092

19 months agolib/vfscore: Replace dup2 syscalls with dup3
Andrei Tatar [Tue, 22 Aug 2023 13:43:05 +0000 (15:43 +0200)]
lib/vfscore: Replace dup2 syscalls with dup3

vfscore contained internal calls to the dup2 syscall, which is not
universally provided on all architectures, notably absent on AArch64.
This change replaces calls to dup2 with dup3 which is more universal.

Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Ioan-Teodor Teugea <ioan_teodor.teugea@stud.acs.upb.ro>
Reviewed-by: Andra Paraschiv <andra@unikraft.org>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1069

19 months agolib/nolibc: Add `__errno_location` implementation
Eduard Mihailescu [Fri, 11 Aug 2023 11:28:37 +0000 (14:28 +0300)]
lib/nolibc: Add `__errno_location` implementation

At link time, objects such as the ones derived from `gcov` which comes
with `gcc-13` require this symbol in order to build.

Signed-off-by: Eduard-Florin Mihailescu <mihailescu.eduard@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1044

19 months agolib: Remove dirent64-related build warnings
Tiago Andre Goncalves Oliveira [Sat, 16 Sep 2023 10:57:03 +0000 (11:57 +0100)]
lib: Remove dirent64-related build warnings

Using Musl and the dirent64 structure causes build warnings. This is
because certain source code files do not define _GNU_SOURCE. Fix build
warnings by defining _GNU_SOURCE in the required source code files.

Signed-off-by: Tiago Andre Goncalves Oliveira <t.g.oliveira@ua.pt>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1097

19 months agoplat/kvm: Fix typo in configuration variable
Robert Kuban [Tue, 5 Sep 2023 16:42:44 +0000 (18:42 +0200)]
plat/kvm: Fix typo in configuration variable

Remove a redundant `KVM_` in order to reference `KVM_KERNEL_SERIAL_CONSOLE`
when deciding if a serial console driver needs to be chosen.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1081

19 months agoMakefile: Fix support for external platforms
Robert Kuban [Tue, 5 Sep 2023 14:39:58 +0000 (16:39 +0200)]
Makefile: Fix support for external platforms

Set `KCONFIG_EPLAT_DIRS` to the list of external platforms `$(P)` instead
of `$(E)`, which is not defined in this context.

With the change, the `config-submenu.sh` script will pickup the `Config.uk`
of an external platform as expected.

Signed-off-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1082

20 months agolib/ukofw: Fix configuration dependencies
Rares Miculescu [Sat, 9 Sep 2023 22:15:25 +0000 (01:15 +0300)]
lib/ukofw: Fix configuration dependencies

Replace `depends on` with `select` for `LIBFDT` to allow
chained dependency resolution.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agodrivers/ukbus: Add `HAVE_PCI`
Rares Miculescu [Sat, 9 Sep 2023 22:14:52 +0000 (01:14 +0300)]
drivers/ukbus: Add `HAVE_PCI`

Add `HAVE_PCI` to limit menuconfig PCI options to
platforms that provide this feature.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat/kvm: Update `kvm/Config.uk` and `kvm/Makefile.uk`
Rares Miculescu [Sat, 9 Sep 2023 22:11:31 +0000 (01:11 +0300)]
plat/kvm: Update `kvm/Config.uk` and `kvm/Makefile.uk`

Remove VIRTIO from `kvm/Makefile.uk` and
update VIRTIO drivers on KVM:

* Enable the VIRTIO PCI driver on KVM QEMU VMMs.
* Enable the VIRTIO MMIO driver on all KVM VMMs for arm64.
* Enable the VIRTIO BLK and NET drivers for both
  KVM QEMU and Firecracker.
* Enable the VIRTIO 9P driver for when `LIBUK9P`
  is selected.
* Correct indentation

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agodrivers/virtio: Update include guards
Rares Miculescu [Sat, 9 Sep 2023 22:09:14 +0000 (01:09 +0300)]
drivers/virtio: Update include guards

Update include guards to the drivers convention.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agodrivers/virtio: Add `VIRTIO_DEVICE`
Rares Miculescu [Sat, 9 Sep 2023 21:56:26 +0000 (00:56 +0300)]
drivers/virtio: Add `VIRTIO_DEVICE`

Create `VIRTIO_DEVICE` to avoid typing all devices one by one.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO PCI driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:52:26 +0000 (00:52 +0300)]
plat: Migrate VIRTIO PCI driver to drivers/virtio/

Migrate VIRTIO PCI driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO NET driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:50:15 +0000 (00:50 +0300)]
plat: Migrate VIRTIO NET driver to drivers/virtio/

Migrate VIRTIO NET driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO MMIO driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:47:38 +0000 (00:47 +0300)]
plat: Migrate VIRTIO MMIO driver to drivers/virtio/

Migrate VIRTIO MMIO driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO BLK driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:44:08 +0000 (00:44 +0300)]
plat: Migrate VIRTIO BLK driver to drivers/virtio/

Migrate VIRTIO BLK driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO 9P driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:39:41 +0000 (00:39 +0300)]
plat: Migrate VIRTIO 9P driver to drivers/virtio/

Migrate the VIRTIO 9P driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO BUS driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:36:05 +0000 (00:36 +0300)]
plat: Migrate VIRTIO BUS driver to drivers/virtio/

Migrate VIRTIO BUS driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO RING driver to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:21:27 +0000 (00:21 +0300)]
plat: Migrate VIRTIO RING driver to drivers/virtio/

Migrate VIRTIO RING driver to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Migrate VIRTIO headers to drivers/virtio/
Rares Miculescu [Sat, 9 Sep 2023 21:18:10 +0000 (00:18 +0300)]
plat: Migrate VIRTIO headers to drivers/virtio/

Migrate include folder to the newly introduced VIRTIO drivers
subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agoplat: Introduce VIRTIO to drivers subsystem
Rares Miculescu [Sat, 9 Sep 2023 21:03:31 +0000 (00:03 +0300)]
plat: Introduce VIRTIO to drivers subsystem

Introduce VIRTIO to newly introduced drivers subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #967

20 months agolib/9pfs: Add check for `NULL` `data` in `uk_9pfs_parse_options`
Sergiu Moga [Fri, 8 Sep 2023 09:10:40 +0000 (12:10 +0300)]
lib/9pfs: Add check for `NULL` `data` in `uk_9pfs_parse_options`

The `mount` system call may actually allow ignoring the `data`
argument depending on the usecase. Therefore allow `data` to be
`NULL` by adding a check in `uk_9pfs_parse_options`.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1086

20 months agolib/9pfs: Remove `__unused` from `uk_9pfs_parse_options`'s `data`
Sergiu Moga [Fri, 8 Sep 2023 09:09:16 +0000 (12:09 +0300)]
lib/9pfs: Remove `__unused` from `uk_9pfs_parse_options`'s `data`

Since `uk_9pfs_parse_options` actually processes `data` it is actually
used, so remove this false `__unused`.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1086

20 months agoarch/ctx.h: Update ctx members declaration order
Stefan Jumarea [Sat, 9 Sep 2023 10:54:25 +0000 (13:54 +0300)]
arch/ctx.h: Update ctx members declaration order

Out-of-order designated initialization is not allowed in C++, so change
the `ctx` declaration order to match the `ukarch_ctx` definition order.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1085

20 months agodoc: Add KIT to ADOPTERS.md
Lukas Werling [Wed, 23 Aug 2023 12:50:31 +0000 (14:50 +0200)]
doc: Add KIT to ADOPTERS.md

Signed-off-by: Lukas Werling <lukas.werling@kit.edu>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1068

20 months agoplat/kvm: Enable the platform bus by default on arm64
Michalis Pappas [Mon, 28 Aug 2023 20:59:45 +0000 (22:59 +0200)]
plat/kvm: Enable the platform bus by default on arm64

Enable the platform bus driver on all KVM VMMs for arm64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers/ukbus/platform: Update include guards
Michalis Pappas [Tue, 29 Aug 2023 17:26:53 +0000 (19:26 +0200)]
drivers/ukbus/platform: Update include guards

Update include guards to the drivers convention and add guards for
linkage with C++.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers: Update includes to the new platform bus headers path
Michalis Pappas [Mon, 28 Aug 2023 21:13:51 +0000 (23:13 +0200)]
drivers: Update includes to the new platform bus headers path

With the platform bus driver being migrated to the ukbus drivers subsystem
its headers path and names have been updated according the the drivers
conventions. Update drivers to use the new include path.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agoplat: Migrate the platform bus driver to drivers/ukbus/
Michalis Pappas [Tue, 29 Aug 2023 16:57:52 +0000 (18:57 +0200)]
plat: Migrate the platform bus driver to drivers/ukbus/

Migrate the platform bus driver to the newly introduced ukbus drivers
subsystem.

Notice that the migration of this driver is performed in two steps:

1. Migrate the sources into driver verbatim (does not compile)
2. Update the sources for this migration (next commit)

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agoplat/kvm: Enable the PCI driver by default
Michalis Pappas [Tue, 29 Aug 2023 16:17:44 +0000 (18:17 +0200)]
plat/kvm: Enable the PCI driver by default

Enable LIBUKBUS_PCI on all KVM VMMs. That will be eventually replaced
by VIRTIO_PCI, yet we add it now to maintain backwards compatibility
with existing applications.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers/ukbus/pci: Fix checkpatch styling issues
Michalis Pappas [Thu, 31 Aug 2023 08:36:56 +0000 (10:36 +0200)]
drivers/ukbus/pci: Fix checkpatch styling issues

Fix some coding style issues reported by checkpatch
about space after cast on arm64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers/ukbus/pci: Memset dummy_imask using size not element count
Michalis Pappas [Tue, 29 Aug 2023 19:14:44 +0000 (21:14 +0200)]
drivers/ukbus/pci: Memset dummy_imask using size not element count

The call of memset in the initialization of dummy_imask in the fdt
irq parser of pci_ecam would pass the number of array elements instead
of the array size in bytes.

This bug was pinpointed by a long ignored GCC warning:

  warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
  237 |  memset((void *)dummy_imask, cpu_to_fdt32(~0), ARRAY_SIZE(dummy_imask));
      |  ^~~~~~

Checkpatch-Ignore: COMMIT_LOG_LONG_LINE
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers/ukbus/pci: Fix result check of drv->add_dev() operation
Michalis Pappas [Tue, 29 Aug 2023 19:06:51 +0000 (21:06 +0200)]
drivers/ukbus/pci: Fix result check of drv->add_dev() operation

Fix a bug in pci_ecam where a check against the result of drv->add_dev()
would happen outside the scope of the conditional call to that function.

This would trigger failure of arch_pci_driver_add_device() depending on
the state of the stack.

This bug was pinpointed by a long ignored GCC warning:

  warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Checkpatch-Ignore: COMMIT_LOG_LONG_LINE
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agoplat/kvm: Update Kconfig options to use LIBUKBUS_PCI
Michalis Pappas [Wed, 30 Aug 2023 15:37:13 +0000 (17:37 +0200)]
plat/kvm: Update Kconfig options to use LIBUKBUS_PCI

The migration of PCI to the drivers subsystem has caused the update
of its Kconfig options according to the driver's conventions. Update
plat/kvm/Config.uk accordingly.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers/ukbus/pci: Update include guards
Michalis Pappas [Tue, 29 Aug 2023 17:23:42 +0000 (19:23 +0200)]
drivers/ukbus/pci: Update include guards

Update include guards to the drivers conventions and add guards for
linkage with C++.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agodrivers: Update includes to the new PCI bus driver headers path
Michalis Pappas [Tue, 29 Aug 2023 16:02:47 +0000 (18:02 +0200)]
drivers: Update includes to the new PCI bus driver headers path

With the PCI driver being migrated to the ukbus drivers subsystem
its headers path and names have been updated according the the drivers
conventions. Update drivers to use the new include path.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agoplat: Migrate PCI bus driver to drivers/ukbus/
Michalis Pappas [Thu, 31 Aug 2023 08:05:28 +0000 (10:05 +0200)]
plat: Migrate PCI bus driver to drivers/ukbus/

Introduce the ukbus drivers subsystem and migrate the PCI driver from
plat/common.

Notice that the migration of this driver is performed in two steps:

1. Migrate the sources into driver verbatim (does not compile)
2. Update the sources for this migration (next commit)

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1024

20 months agoplat: Move GIC from plat/drivers
Rares Miculescu [Thu, 24 Aug 2023 10:13:43 +0000 (13:13 +0300)]
plat: Move GIC from plat/drivers

Migrate GIC to newly introduced drivers subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #971

20 months agodrivers: Move GIC to drivers/ukintctlr
Rares Miculescu [Thu, 24 Aug 2023 10:12:31 +0000 (13:12 +0300)]
drivers: Move GIC to drivers/ukintctlr

Migrate GIC to newly introduced drivers subsystem.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #971

20 months agolib: Add ukintctlr as library
Rares Miculescu [Thu, 24 Aug 2023 10:10:45 +0000 (13:10 +0300)]
lib: Add ukintctlr as library

Move the API from `plat/kvm/` into `lib/`.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #971

20 months agobuild: Introduce drivers subsystem
Michalis Pappas [Fri, 18 Aug 2023 12:55:33 +0000 (14:55 +0200)]
build: Introduce drivers subsystem

This commit adds a drivers subsystem to Unikraft. Drivers are placed
under the top-level `drivers/` directory.

In menuconfig drivers appear at a top-level section called "Device
Drivers".

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1023

20 months agobuild: Fix stdout descriptor duplication in config-submenu.sh on linux
Michalis Pappas [Thu, 24 Aug 2023 16:40:44 +0000 (18:40 +0200)]
build: Fix stdout descriptor duplication in config-submenu.sh on linux

The original way to duplicate stdout to a new file descriptor fails on
Ubuntu 22.04 with error:

support/build/config-submenu.sh: line 92: 7: Bad file descriptor

Update to a syntax that works in both Linux and MacOS.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1023

20 months agolib/ukofw: Move ofw into lib/
Rares Miculescu [Tue, 22 Aug 2023 15:58:50 +0000 (18:58 +0300)]
lib/ukofw: Move ofw into lib/

Move ofw driver from plat/drivers to lib/ukofw.
Create and update configuration files for migration.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #966

20 months agoplat: Move ofw from plat/drivers/
Rares Miculescu [Tue, 22 Aug 2023 15:49:26 +0000 (18:49 +0300)]
plat: Move ofw from plat/drivers/

Move ofw driver from plat/drivers/ into lib/.
Update files that depend on headers from the driver,
as well as configuration from plat/kvm/.

Signed-off-by: Rares Miculescu <miculescur@gmail.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #966

20 months agoRelease: v0.14.0 Atlas RELEASE-0.14.0
Razvan Deaconescu [Thu, 17 Aug 2023 23:08:13 +0000 (02:08 +0300)]
Release: v0.14.0 Atlas

Signed-off-by: Razvan Deaconescu <razvand@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc@unikraft.io>
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Signed-off-by: Alexander Jung <alex@unikraft.io>
20 months agolib/uknetdev: Collect stats and export via uk_store
Michalis Pappas [Thu, 11 May 2023 08:12:21 +0000 (10:12 +0200)]
lib/uknetdev: Collect stats and export via uk_store

Collect per-interface statistics and export them as dynamic
uk_store objects.

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #943

20 months agolib/ukstore: Add README.md
Michalis Pappas [Thu, 8 Jun 2023 03:55:40 +0000 (05:55 +0200)]
lib/ukstore: Add README.md

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939

20 months agolib/ukstore: Introduce dynamic API
Cezar Craciunoiu [Thu, 8 Jun 2023 03:55:15 +0000 (05:55 +0200)]
lib/ukstore: Introduce dynamic API

This commit adds dynamic entry support to uk_store. Libraries can
dynamically register uk_store objects at runtime, each one of which
is associated with one or more entries. Similarly to static entries,
each dynamic entry is associated with a getter and / or a setter.

Consumers are notified for the lifetime of objects via events.

Checkpatch-Ignore: SPACING LONG_LINE
GitHub-Closes: #539
Co-authored-by: Michalis Pappas <michalis@unikraft.io>
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939

20 months agolib/ukalloc: Add entry IDs and update static entry definitions
Michalis Pappas [Tue, 6 Jun 2023 08:34:05 +0000 (10:34 +0200)]
lib/ukalloc: Add entry IDs and update static entry definitions

Introduce header for definitions related to uk_store. Add
entry IDs for stats tracked by uk_alloc, and update static
entry definitions to pass entry IDs.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939

20 months agolib/ukalloc: Remove deprecated cookie parameter from static entry definitions
Michalis Pappas [Tue, 6 Jun 2023 05:57:01 +0000 (07:57 +0200)]
lib/ukalloc: Remove deprecated cookie parameter from static entry definitions

Update calls to UK_STORE_STATIC_ENTRIES to remove the deprecated
cookie parameter.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939

20 months agolib/ukstore: Lookup entries by id
Michalis Pappas [Tue, 6 Jun 2023 09:31:50 +0000 (11:31 +0200)]
lib/ukstore: Lookup entries by id

Introduce an id property to uk_store entries and replace name with id
on lookup operations, to avoid costly string comparison.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939

20 months agolib/ukstore: Remove cookie from static entries
Michalis Pappas [Tue, 6 Jun 2023 05:25:28 +0000 (07:25 +0200)]
lib/ukstore: Remove cookie from static entries

Remove cookie from static uk_store entries. This is in anticipation of
dynamic entries that provide a cookie at the object level.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939

20 months agoplat/drivers/virtio: Fix virtio_9p tag read
Xingjian Zhang [Thu, 17 Aug 2023 13:42:54 +0000 (21:42 +0800)]
plat/drivers/virtio: Fix virtio_9p tag read

Swap the last two arguments of virtio_9p_feature_negotiate's first
call to virtio_config_get. As per the function definition, the last
argument needs to actually be the length of the type.

Signed-off-by: Xingjian Zhang <zhxj9823@qq.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1059

20 months agolib/posix-environ: Remove unused variable warnings
Sergiu Moga [Wed, 16 Aug 2023 17:58:26 +0000 (20:58 +0300)]
lib/posix-environ: Remove unused variable warnings

If an environment variable is not set, the
`DECLARE_LIBPOSIX_ENVIRON_ENV_VAR` macros end up declaring unused
global variables which generate warnings.

To solve this, guard the use of these macros so that they are not used
for a particular unset environment variable.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1058

20 months agoplat/kvm/x86: Ensure that lxboot initrd/cmdl regions are aligned
Sergiu Moga [Wed, 16 Aug 2023 15:20:39 +0000 (18:20 +0300)]
plat/kvm/x86: Ensure that lxboot initrd/cmdl regions are aligned

All memory region descriptors must be aligned. Therefore, ensure
that the initrd and command-line related memory regions inserted
when booting through the Linux Boot Protocol are also aligned.

Note: If these two are aligned, all the other memory regions reported
through the boot protocol should be already aligned. Thus, we do not
do this explicit alignment on the free memory regions, as they must
have been already aligned by the previous boot phase. If this is not
the case, then the issue lies in the entity that booted us.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1057

20 months agosupport/qemu-guest: Workaround for TCG/x86 and Unikraft paging
Simon Kuenzer [Fri, 11 Aug 2023 21:32:22 +0000 (23:32 +0200)]
support/qemu-guest: Workaround for TCG/x86 and Unikraft paging

Limits QEMU PC machine model up to version 7.0 (pc-i440fx-7.0) for
x86. This is primarily done to keep Unikraft compatibility with TCG.

GitHub-Issue: #1040
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1041

20 months agolib/vfscore: Add non-largefile variant for dirent
Stefan Jumarea [Thu, 29 Jun 2023 08:59:30 +0000 (11:59 +0300)]
lib/vfscore: Add non-largefile variant for dirent

Unikraft defines the `dirent` structure as identical to `dirent64`.
This works fine if not using Unikraft in binary compatibility mode,
since we have total control over the internal functions/structures that
are used.

However, if we use Unikraft in binary compatibility mode, we want to use
Linux `dirent` and `dirent64` structures in order to maintain compatibility
with older libc versions that do not use the `*64` calls by default.
Since the filesystems `READDIR` vop uses `dirent64`, we will convert to a
`dirent` structure within the `readdir_r` call.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
GitHub-Closes: #919
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #963

20 months agolib/vfscore: Remove readdir_r result from TLS
Stefan Jumarea [Sun, 30 Jul 2023 09:30:02 +0000 (12:30 +0300)]
lib/vfscore: Remove readdir_r result from TLS

The `result` structure of the `readdir_r` function will not need to be
part of the TLS, the `entry` structure alone is enough.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #963

20 months agoplat/kvm/arm: Use length when clean/invalidating cache in `KVM` entry
Sergiu Moga [Wed, 16 Aug 2023 08:56:15 +0000 (11:56 +0300)]
plat/kvm/arm: Use length when clean/invalidating cache in `KVM` entry

Fix second argument of [clean_and_]invalidate_dcache_range in `KVM`
entry to use the length of the range instead of the address of the
end of the range.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1056

20 months agoplat/drivers: Add two configurations to ns16550
Xingjian Zhang [Mon, 14 Aug 2023 15:29:18 +0000 (23:29 +0800)]
plat/drivers: Add two configurations to ns16550

The register shift of ns16550 is hard-coded in the driver, but it does
not match the hardware on some platforms. The device-tree specification
has a property "reg-shift" to describe the register shift of a device.
To match the specification, the register shift of ns16550 is retrieved
from the device tree instead. If no such property is found, the default
value 0 is used.

The register width of ns16550 varies on different platforms. u-boot uses
a reg-io-width property in the device tree to determine it. If no such
property is found, the default value 1 is used. The read and write
macros are replaced by functions with the same name.

This patch also adds the corresponding configurations to override the
values when dts does not specify them.

These two configurations break the compatibility of the driver. To keep
the compatibility, the device tree should contain these properties or
set them in configurations.

Signed-off-by: Xingjian Zhang <zhxj9823@qq.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #985

20 months agoplat/common/arm: Do not use a barrier on every invalidation
Michalis Pappas [Wed, 12 Jul 2023 13:36:29 +0000 (15:36 +0200)]
plat/common/arm: Do not use a barrier on every invalidation

The current implementation of clean and invalidate by region uses
a barrier after every cache line. This is unnecessary and expensive.
Use a barrier once, at the end of the operation.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1049

20 months agoplat/kvm/arm: Do not clean & invalidate the cache after enabling the MMU
Michalis Pappas [Thu, 13 Jul 2023 11:07:13 +0000 (13:07 +0200)]
plat/kvm/arm: Do not clean & invalidate the cache after enabling the MMU

To maximize boot performance we only invalidate the cache for regions
accessed before enabling the MMU. This makes the clean & invalidate
step of the entire image region after enabling the MMU redundant.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1049

20 months agoplat/kvm: Do not unconditionally clean and invalidate the cache
Michalis Pappas [Thu, 13 Jul 2023 11:06:08 +0000 (13:06 +0200)]
plat/kvm: Do not unconditionally clean and invalidate the cache

The arm64 linux boot protocol provides the requirements for
the system's state before jumping into the kernel [1]. Among
these it is required that upon entry:

- The MMU is off
- The D-cache for the region corresponging to the loaded image
  must be cleaned to the point of coherence.

Skip expensive cache clean & invalidate operations if the MMU is
found to be disabled at boot. Although this heuristic is not
strictly required it provides with some additional confidence
that the bootloader behaves as expected.

With a clean cache, additionally optmize cache invalidations by
limiting them to the regions accessed before the MMU is enabled.

[1] https://www.kernel.org/doc/Documentation/arm64/booting.txt

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1049

20 months agolib/posix-environ: Ensure that compiled-in strings are writable
Sergiu Moga [Tue, 15 Aug 2023 07:32:34 +0000 (10:32 +0300)]
lib/posix-environ: Ensure that compiled-in strings are writable

Previously, the elements of `__init_env` would be compile-in strings
that would correspond to `CONFIG_LIBPOSIX_ENVIRON_ENVPx` configurable
strings. This lead to these strings being placed by in the `.rodata`
section and making them unmodifiable.

Unfortunately, Redis represents an application whose code may want to
modify such data (see
commit 6356cf6808be ("Set process name in ps output to make operations safer.")).
Therefore, to appease such actions, make sure that this data is placed
in a modifiable section such as `.data` by using statically declared
global variables containing these very strings as an indirection.

To make it look somewhat nicer, do so with the help of two basic helper
macros: DECLARE_LIBPOSIX_ENVIRON_ENV_VAR to transparently declare such
variables and LIBPOSIX_ENVIRON_ENV_VAR to transparently access them.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1054

20 months agoplat/common: Align TLS sections to PAGE_SIZE
Sergiu Moga [Mon, 14 Aug 2023 15:33:25 +0000 (18:33 +0300)]
plat/common: Align TLS sections to PAGE_SIZE

`mkbootinfo.py` takes each ELF segment and aligns it to PAGE_SIZE to
convert it to a `struct ukplat_memregion_desc`. However, this ends up
generating overlapping memregion descriptors in the case of the ELF
segment corresponding to the TLS sections.

To solve this, simply ensure that the TLS sections are already aligned
by PAGE_SIZE.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1050

20 months agoplat/kvm: Enable 8250 / NS16550
Michalis Pappas [Mon, 14 Aug 2023 07:09:00 +0000 (09:09 +0200)]
plat/kvm: Enable 8250 / NS16550

Update the KVM configuration to enable the 8250 / NS16550 UART driver.
This driver is selected when KVM_VMM_FIRECRACKER is selected on arm64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1048

20 months agoplat/kvm: Check return code of all memory region inserting methods
Sergiu Moga [Mon, 14 Aug 2023 15:50:04 +0000 (18:50 +0300)]
plat/kvm: Check return code of all memory region inserting methods

Make sure that we do check the return codes of all of the memory region
inserting methods so that we can crash in case of failure, instead
of letting the system run with a corrupted state.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1052

20 months agobuild: Adjust fixdep to the changed config.h location
Marco Schlumpp [Mon, 14 Aug 2023 14:01:21 +0000 (16:01 +0200)]
build: Adjust fixdep to the changed config.h location

PR unikraft/unikraft#1034 moved the header to a different location, causing
full rebuilds for every `make` invocation.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1055

20 months agoplat/common: Increase granularity of hardcoded legacy high memory
Sergiu Moga [Mon, 14 Aug 2023 15:42:31 +0000 (18:42 +0300)]
plat/common: Increase granularity of hardcoded legacy high memory

To ensure compatibility with boot protocols that do report the
BIOS System Memory region as a reserved region, split the memory
region inserted by `ukplat_memregion_list_insert_legacy_hi_mem`
into two memory region descriptors: one to contain known memory
holes (e.g. VGA Text Mode framebuffer) and one to contain the
previously mentioned BIOS System Memory region. The former will
have read/write permissions to ensure that zones like the VGA
framebuffer or certain PCI BARs mapped by the BIOS are writable,
while the latter will only have read permissions to ensure
compatibility with other boot protocols.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1051

20 months agoplat/kvm/arm: Fix default choice in arm64 VMM menu
Michalis Pappas [Mon, 14 Aug 2023 14:07:15 +0000 (16:07 +0200)]
plat/kvm/arm: Fix default choice in arm64 VMM menu

Fix the default selection of the VMM in Config.uk. Kconfig requires
that the default is defined as an attribute of the `choice` option
rather than the contained item.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1053

20 months agobuild: Use -fcf-protection for GCC >= 8 or Clang >= 7
Andrei Tudor TOPALĂ (101668) [Mon, 24 Jul 2023 21:15:20 +0000 (00:15 +0300)]
build: Use -fcf-protection for GCC >= 8 or Clang >= 7

Signed-off-by: Andrei Tudor TOPALĂ <topala.andrei@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #944

20 months agoplat/kvm/arm: Fix bootstack base alignment on arm64
Michalis Pappas [Mon, 14 Aug 2023 08:21:36 +0000 (10:21 +0200)]
plat/kvm/arm: Fix bootstack base alignment on arm64

280c69559 introduces a regression to the alignment of the
bootstack. Update __libkvmplat_entry to enforce the correct
alignment before assigning to the sp.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1047

20 months agoplat/common: Add BIOS system memory in legacy high memory region
Sergiu Moga [Mon, 14 Aug 2023 08:08:17 +0000 (11:08 +0300)]
plat/common: Add BIOS system memory in legacy high memory region

Previously, `ukplat_memregion_list_insert_legacy_hi_mem` did not
include the `0xf0000 -> 0x100000` memory regions that would usually
contain the legacy BIOS system memory below the first 1MiB. This
would lead to x86 platforms that do not yet have any form of
ACPI (RSDP from BDA or UEFI System Tables) such as Firecracker
to crash when looking for the `RSDP` in that specific region.

Therefore, make sure that this region is also included so that it
can be mapped accordingly by the paging initialization phase.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1046

20 months agoplat/kvm/x86: Enable relocation for `Firecracker` `PIE` builds
Sergiu Moga [Sun, 13 Aug 2023 12:06:12 +0000 (15:06 +0300)]
plat/kvm/x86: Enable relocation for `Firecracker` `PIE` builds

Previously, `PIE` builds for `Firecracker VMM` would fail at runtime
due to the fact that the static boot page tables would not be
relocated.

Therefore, enable `Firecracker` builds to run as `PIE` by employing
the early self relocator from `libukreloc`. Since an early bootstack
is also required to backup `rsi` holding the Linux Boot Protocol
structure as well as to provide room to `do_uk_reloc`'s local variables,
use the already existing `lcpu_bootstack` since it does not matter
whether it ends up being tainted or not.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1045

21 months agoplat/kvm: Fix guest hang on `UKPLAT_HALT` during shutdown request
Sergiu Moga [Fri, 11 Aug 2023 17:51:08 +0000 (20:51 +0300)]
plat/kvm: Fix guest hang on `UKPLAT_HALT` during shutdown request

As soon as
commit 170a8a4fb242 ("plat/kvm/shutdown.c: If on a `UEFI` system, rely on Runtime Services")
got merged guests would not finish on successful runs by exiting, but
instead by halting.

Although confusing, the intention was to use `UKPLAT_HALT` for a
graceful shutdown instead of a `cpu_halt` as it acts now.

Therefore, fix this by deleting the `UKPLAT_HALT` `case` from the
`switch` statement.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Alexander Jung <alex@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1039

21 months agoplat/kvm: Enable Firecracker on arm64
Michalis Pappas [Thu, 20 Jul 2023 06:41:00 +0000 (08:41 +0200)]
plat/kvm: Enable Firecracker on arm64

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #989

21 months agoplat/kvm/arm: Add pagetables for Firecracker
Michalis Pappas [Thu, 20 Jul 2023 02:50:49 +0000 (04:50 +0200)]
plat/kvm/arm: Add pagetables for Firecracker

The memory map of Firecracker on Arm64 is:

0x0000000000000000 - 0x000000007fffffff     Devices:     0 -    2GiB
0x0000000080000000 - 0x000000ffffffffff     DRAM:     2GiB - 1024GiB

https://github.com/firecracker-microvm/firecracker
441fc98a src/vmm/src/arch/aarch64/layout.rs

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #989