]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
18 months ago.github: Enable dependabot for action bumping 1140/head
Cezar Craciunoiu [Mon, 16 Oct 2023 13:20:26 +0000 (16:20 +0300)]
.github: Enable dependabot for action bumping

Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
18 months agoRelease: v0.15.0 Pandora RELEASE-0.15.0
Alexander Jung [Mon, 23 Oct 2023 09:11:34 +0000 (09:11 +0000)]
Release: v0.15.0 Pandora

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>
18 months agobuild: Introduce `E=` parameter for excluding libraries
Simon Kuenzer [Mon, 18 Sep 2023 12:17:40 +0000 (14:17 +0200)]
build: Introduce `E=` parameter for excluding libraries

This commit introduces the build system parameter `E=` which expects a
colon separated list of paths that are matched against any library path
that the build system is including. This mechanism is intended to be used
for replacing internal libraries.
For example, to replace `uksched`, the replacing library (that has to match
configuration name(s) and APIs) needs to be included with `L=` while at the
same time, the Unikraft-internal library has to be excluded with `E=`:
```
 make L=/path/to/external-uksched E=/path/to/unikraft/lib/uksched
```

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Ability to skip imports with `import_lib`
Simon Kuenzer [Mon, 18 Sep 2023 12:15:42 +0000 (14:15 +0200)]
build: Ability to skip imports with `import_lib`

This commits adds the ability to skip including `Makefile.uk` files by
`import_lib` if the target path matches with one of the paths that can
be found in the `$(IMPORT_EXCLUDEDIRS)` variable.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Remove obsolete relative paths handling for external libs
Simon Kuenzer [Thu, 12 Oct 2023 13:18:21 +0000 (15:18 +0200)]
build: Remove obsolete relative paths handling for external libs

This commit removes obsolete build system code that checked if external
libraries and external platforms were handed over from `$(UK_BASE)`
(Application directory or Unikraft root). Relative paths were never
supported and in the meantime, arguments are even checked to be absolute.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Release `$(E)` variable in build system
Simon Kuenzer [Mon, 18 Sep 2023 10:19:16 +0000 (12:19 +0200)]
build: Release `$(E)` variable in build system

In order to release the `$(E)` variable in the build system, any
occurrence of `$(E)` is replaced with a different variable name.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: config-submenu: Remove trailing slashes from paths
Simon Kuenzer [Thu, 12 Oct 2023 20:07:24 +0000 (22:07 +0200)]
build: config-submenu: Remove trailing slashes from paths

This commit ensures that we remove a trailing slash of any path that is
handed over.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: config-submenu: Introduce parameter to exclude libraries
Simon Kuenzer [Thu, 14 Sep 2023 19:08:02 +0000 (21:08 +0200)]
build: config-submenu: Introduce parameter to exclude libraries

This commit introduces the `-e` parameter which accepts a colon-separated
list of library paths. Such a path is compared to any library path that
would be included. If a match occurs, the affected library path is skipped.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: config-submenu: Correctly quote file path for readlink
Simon Kuenzer [Thu, 14 Sep 2023 19:07:15 +0000 (21:07 +0200)]
build: config-submenu: Correctly quote file path for readlink

Whenever an output file is requested, `support/build/config-submenu`
writes the name of the target file to the console. This commit passes
this file name with quotes to `readlink` that converts it to a fully
qualified path.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Move arm64 clang target to architecture's Makefile.uk
Simon Kuenzer [Fri, 8 Sep 2023 23:43:48 +0000 (01:43 +0200)]
build: Move arm64 clang target to architecture's Makefile.uk

This commit moves setting of special ARCHFLAGS and ISR_ARCHFLAGS for arm64
with clang compilers from the main Makefile to the architecture's
`Makefile.uk` at `arch/arm/arm64/Makefile.uk`. The original feature was
introduced with:
Commit 55255f470592d ("Makfile: Add target flags for `clang` with `AArch64`")

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Rename `_import_linker` to `import_linker`
Simon Kuenzer [Fri, 8 Sep 2023 23:32:07 +0000 (01:32 +0200)]
build: Rename `_import_linker` to `import_linker`

This commit renames the Makefile function `_import_linker` to `import_linker`.
The original intent was for this function to be purely internal and only
used in the core `Makefile`. It turns out that it might be used in other
places in the future, like potentilly external architectures, so this
commit removes the inappropriate `_` prefix.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Rename `_import_lib` to `import_lib`
Simon Kuenzer [Fri, 8 Sep 2023 23:31:19 +0000 (01:31 +0200)]
build: Rename `_import_lib` to `import_lib`

This commit renames the Makefile function `_import_lib` to `import_lib`.
The original intent was for this function to be purely internal and only
used in the core `Makefile`. It turns out that it needs to be used in many
other places, like `drivers/`, so this commit removes the inappropriate
`_` prefix.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agobuild: Forcefully re-create link to main Makefile
Simon Kuenzer [Thu, 19 Oct 2023 15:17:54 +0000 (17:17 +0200)]
build: Forcefully re-create link to main Makefile

This commit makes sure that the symbolic link within the build directory
always points to the unikraft Makefile version that is used for a
build. This avoids issues when a project is build with multiple Unikraft
versions but using the same build path. The reason is that the build system
is invoking a sub-make call within the build directory using this symbolic
link.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

18 months agoplat/kvm: Enable linux-compatible virtio-mmio cmdline on Firecracker
Michalis Pappas [Wed, 27 Sep 2023 15:07:58 +0000 (17:07 +0200)]
plat/kvm: Enable linux-compatible virtio-mmio cmdline on Firecracker

Firecracker injects virtio-mmio device descriptors to the command line
using the Linux format. Enable VIRTIO_MMIO_LINUX_COMPAT_CMDLINE for
Firecracker.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/virtio/mmio: Support passing devices via the cmdline
Michalis Pappas [Thu, 31 Aug 2023 14:04:20 +0000 (16:04 +0200)]
drivers/virtio/mmio: Support passing devices via the cmdline

This commit adds support for passing virtio-mmio devices via the
command-line.

The probing function is invoked by ukbus at a priority lower than
the the platform bus, to ensure that the virtio devices have been
probed, to safely register with the parent device.

Add a config parameter to control compatibility with Linux.
Specifically, when VIRTIO_MMIO_LINUX_COMPAT_CMDLINE is selected
the MMIO driver is configured to accept devices in the Linux format,
ie:

  virtio_mmio.device = <size>@<base>:<irq>[:<id>]

If this option is not enabled, use the default libukparam
format for this library, ie:

  libvirtio_mmio.device = <size>@<base>:<irq>[:<id>]

This is useful for VMMs like Firecracker, that automatically inject
device descriptors the command line.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/ukbus/platform: Add uk_bus_pf_devmap
Michalis Pappas [Wed, 20 Sep 2023 11:18:33 +0000 (13:18 +0200)]
drivers/ukbus/platform: Add uk_bus_pf_devmap

Add `uk_bus_pf_devmap()` for mapping device regions. Because of the
current boot flow that initializes the vmmap API after the probing
the interrupt controller - which is required for bringing up secondary
cores - it is not possible to use uk_vma_map_dma() here, so we need to
resort to the low level paging API and map devices 1:1.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/virtio/mmio: Populate pfdev size
Michalis Pappas [Wed, 20 Sep 2023 06:59:44 +0000 (08:59 +0200)]
drivers/virtio/mmio: Populate pfdev size

Update virtio_mmio_probe_fdt() to populate the device size.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/ukbus/platform: Add size field to struct pf_device
Michalis Pappas [Wed, 6 Sep 2023 15:47:34 +0000 (17:47 +0200)]
drivers/ukbus/platform: Add size field to struct pf_device

Since it is possible that devices use more than a single page
of MMIO, add a size field to `struct pf_device` to track the
device region size.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/ukbus/pci: Make PCI ECAM conditional to fdt
Michalis Pappas [Mon, 18 Sep 2023 13:23:10 +0000 (15:23 +0200)]
drivers/ukbus/pci: Make PCI ECAM conditional to fdt

The PCI ECAM implementation is tightly coupled to fdt. Given that
the platform bus can now be used on x86_64, make PCI ECAM conditional
to the fdt libraries.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/virtio/mmio: Make fdt discovery optional
Michalis Pappas [Fri, 15 Sep 2023 18:29:45 +0000 (20:29 +0200)]
drivers/virtio/mmio: Make fdt discovery optional

Make ftd-based discovery optional, to allow using virtio-mmio
on x86_64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agodrivers/ukbus/platform: Make fdt discovery optional
Michalis Pappas [Fri, 15 Sep 2023 07:58:37 +0000 (09:58 +0200)]
drivers/ukbus/platform: Make fdt discovery optional

Make fdt-based discovery optional to allow the platform bus to be
selected for virtio-mmio on x86_64.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agolib/ukdebug: Replace fallthrough comment markers with macro
Michalis Pappas [Tue, 3 Oct 2023 16:08:51 +0000 (18:08 +0200)]
lib/ukdebug: Replace fallthrough comment markers with macro

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agolib/nolibc: Replace fallthrough comment marker with macro
Michalis Pappas [Tue, 3 Oct 2023 16:06:16 +0000 (18:06 +0200)]
lib/nolibc: Replace fallthrough comment marker with macro

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agoplat/kvm/x86: Replace fallthrough comment markers with macro
Michalis Pappas [Tue, 3 Oct 2023 16:05:07 +0000 (18:05 +0200)]
plat/kvm/x86: Replace fallthrough comment markers with macro

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agoinclude/essentials: Provide __fallthrough macro
Michalis Pappas [Tue, 3 Oct 2023 15:49:35 +0000 (17:49 +0200)]
include/essentials: Provide __fallthrough macro

Add a macro for `__attribute__(fallthrough)` to hint the compiler
about fallthrough cases in switch statements. The fallthough
attributed is supported by the minimum compiler version of both GCC
and clang.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1116

18 months agoplat/kvm: Adapt EFI boot to new APIC driver
Kha Dinh [Sun, 15 Oct 2023 08:59:34 +0000 (08:59 +0000)]
plat/kvm: Adapt EFI boot to new APIC driver

Fixed the header include and redelared missing macros in `efi_post.c`.
This is a temporary fix until our APIC driver can handle LAPIC.

Signed-off-by: Kha Dinh <khadinh@g.skku.edu>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1138

18 months agoplat/kvm/x86: Pre-initialize VGA framebuffer `terminal_buffer`
Sergiu Moga [Sat, 14 Oct 2023 09:17:55 +0000 (12:17 +0300)]
plat/kvm/x86: Pre-initialize VGA framebuffer `terminal_buffer`

After commit f57ca0bbc402 ("plat/kvm/x86: Make zero page inaccessible"),
early accesses to uninitialized VGA framebuffer would issue an unhandled
page fault and thus crashing the application. Solve this by
preinitializing the `terminal_buffer` variable.

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

18 months agoplat/kvm/x86: Use `ur_pte` for the first page table
Sergiu Moga [Sat, 14 Oct 2023 09:15:02 +0000 (12:15 +0300)]
plat/kvm/x86: Use `ur_pte` for the first page table

After commit f57ca0bbc402 ("plat/kvm/x86: Make zero page inaccessible"),
UEFI builds would fail to run due to the first page table becoming
unrelocatable.

Therefore, fix this by using the `ur_pte` variant of the `pte` macro.

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

18 months agolib/uklibid: Clang-compatible compile option flags
Simon Kuenzer [Thu, 12 Oct 2023 08:50:14 +0000 (10:50 +0200)]
lib/uklibid: Clang-compatible compile option flags

Clang's preprocessor seems to behave differently when computing an integer
based on undefined macros. For example, the following expression:
```
  (!(!__LIBUKLIBID_COMPILEOPT_PIE__) * (0x01 << 0))
```
resolves to 0x0 on GCC's GAS if __LIBUKLIBID_COMPILEOPT_PIE__ is not
defined. Clang is throwing an compile error because of the missing
definition. This commit adopts `libinfo.S` to define an intermediate
value macro that is set to `0` when the requested feature is not enabled.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1131

18 months agolib/nolibc: Remove LIBC_SYSCALLS guard in prctl.h
Tiago Andre Goncalves Oliveira [Sat, 16 Sep 2023 17:18:33 +0000 (18:18 +0100)]
lib/nolibc: Remove LIBC_SYSCALLS guard in prctl.h

sys/prctl.h in nolibc is using UK_LIBC_SYSCALLS as guard.
This is not required, since the guard only makes sense outside nolibc.
Remove UK_LIBC_SYSCALLS guard.

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: #1102

18 months agolib/nolibc: Move prctl.h inside nolibc/musl-imported
Tiago Andre Goncalves Oliveira [Sat, 16 Sep 2023 14:41:07 +0000 (15:41 +0100)]
lib/nolibc: Move prctl.h inside nolibc/musl-imported

The "sys/prctl.h" header is specific to "nolibc". Move it from
"lib/posix-process/include/" to "lib/nolibc/musl-imported/include/".
This also fixes a warning caused by including it when Musl was used
(instead of using the Musl version).

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: #1102

18 months agolib/vfscore: Fix typo in Config.uk
Riya Bisht [Tue, 19 Sep 2023 06:12:24 +0000 (11:42 +0530)]
lib/vfscore: Fix typo in Config.uk

Change `"filesysytem (/)"` to `filesystem (/)"`.

Signed-off-by: Riya Bisht <hack1001infinity@gmail.com>
Reviewed-by: Ioan-Teodor Teugea <ioan_teodor.teugea@stud.acs.upb.ro>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1106

18 months agobuild: Clean-up and removing unused targets, like `config`
Simon Kuenzer [Mon, 9 Oct 2023 16:04:23 +0000 (19:04 +0300)]
build: Clean-up and removing unused targets, like `config`

This is a small clean-up commit: it removes the unused targets `config`
and `%_defconfig`. Additionally, references to non-existing targets, like
`outputmakefile`, `silentoldconfig`, `list-defconfigs` are removed.

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

18 months agoscripts: configupdate: Only notify on architecture change
Simon Kuenzer [Sat, 30 Sep 2023 00:13:22 +0000 (02:13 +0200)]
scripts: configupdate: Only notify on architecture change

The `configupdate` script tells the user when `make properclean` should be
called. Since compilation is retriggered on command line changes, we can
limit the cases where cleanup is suggested to architecture changes. This is
done to ensure that the architecture is also considered for fetch and
prepare targets.

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

18 months agobuild: Recompile on `.config` changes (workaround)
Simon Kuenzer [Sat, 30 Sep 2023 00:06:34 +0000 (02:06 +0200)]
build: Recompile on `.config` changes (workaround)

Our build system is still not able to re-trigger the compilation if only
the command line of a compilation unit changed due to a configuration
change. This resulted in broken builds if the user did not call `make
clean` in between.
This commit introduces a workaround that attempts to improve the user
experience by triggering a recompile when the configuration is changed.
This makes this cleaning step unecessary.

It is intended that this commit gets reverted as soon as the build system
can properly detect changes to the compiler command line.

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

18 months agobuild: Fix rule that copies `.config` to `build/config`
Simon Kuenzer [Fri, 29 Sep 2023 14:51:35 +0000 (16:51 +0200)]
build: Fix rule that copies `.config` to `build/config`

The rule that copies the current `.config` to the build directory was
intended, among other things, to detect configuration changes. However, the
corresponding rule always copies the file, causing to update the timestamp
on every make call. This commit fixes that rule by only copying the file
when there have been configuration updates.

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

18 months agobuild: Restructure common dependencies for preprule_*
Simon Kuenzer [Fri, 29 Sep 2023 14:50:34 +0000 (16:50 +0200)]
build: Restructure common dependencies for preprule_*

Restructures the preprocess rules to put common dependencies in a single
place. The advantage is that these dependencies are now automatically
applied for externally defined prepare rules.

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

18 months agobuild: Link-time dependencies for libraries (`*_LDEPS`)
Simon Kuenzer [Fri, 29 Sep 2023 14:47:31 +0000 (16:47 +0200)]
build: Link-time dependencies for libraries (`*_LDEPS`)

For each `.o` library, additional dependencies that trigger relinking
can be specified in `Makefile.uk` with `*_LDEPS`:
```
<LIBNAME>_LDEPS   += <dependency>
<LIBNAME>_LDEPS-y += <dependency>
```

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

18 months agolib/nolibc: Provide symbols for `malloc`, `free`, `calloc`, `realloc`
Eduard Mihailescu [Fri, 11 Aug 2023 08:27:01 +0000 (11:27 +0300)]
lib/nolibc: Provide symbols for `malloc`, `free`, `calloc`, `realloc`

`posix_memalign` and `memalign`

To ensure that symbols such as malloc, calloc, and free are accessible
during link time for internal gcc objects, such as those related to gcov,
these functions must be designated as public.

As a side-effect of this change, unikraft loses the fine-grained stats
introduced in #229 when using the before-mentioned calls,
and instead each operation via the libc interface will be accounted
to `nolibc` instead to the individual libraries that made the calls.

Signed-off-by: Eduard-Florin Mihailescu <mihailescu.eduard@gmail.com>
iReviewed-by: Andra Paraschiv <andra@unikraft.org>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1042

18 months agoplat/kvm: Use `AllocatePages()` to allocate memory regions in `UEFI`
Sergiu Moga [Fri, 18 Aug 2023 16:44:40 +0000 (19:44 +0300)]
plat/kvm: Use `AllocatePages()` to allocate memory regions in `UEFI`

According to the `UEFI` specifications, `AllocatePool()` is the safest
allocation method, however there are two pitfalls:
- we don't know the BIOS's memory allocator or the system's memory map,
so the resulted allocation start address may be out of the range that
would be compatible with a Unikraft configuration that does not have
`CONFIG_HAVE_PAGING`
- it does not guarantee page-aligned allocations and, even though we
may be able to align the length or the end address, the allocation's
start address may therefore not be page-aligned

Thus, replace such calls to `AllocatePool()` with calls to
`AllocatePages()` to ensure page-aligned start addresses. Furthermore,
preserve backwards compatibility with Unikraft configurations that do
not have `CONFIG_HAVE_PAGING` by limiting the allocation's start address
to be below the highest address of the static boot page tables through
the help of `bpt_unmap_mrd`.

Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #1061

18 months agoarch/*: Introduce function for validating a single address
Kha Dinh [Wed, 11 Oct 2023 17:12:18 +0000 (17:12 +0000)]
arch/*: Introduce function for validating a single address

Introduced a common API for checking a single vaddr/paddr,
where each each architecture may implement differently.

Signed-off-by: Kha Dinh <khadinh@g.skku.edu>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1091

18 months agoarch/*: Update and align paddr/vaddr validation on x86 and arm64
Kha Dinh [Wed, 11 Oct 2023 17:09:55 +0000 (17:09 +0000)]
arch/*: Update and align paddr/vaddr validation on x86 and arm64

Changed the signature of paddr and vaddr range check to takes the
length of the range instead of the end address, which is more
clear and less error-prone.
The end address is subtracted by 1 to account for the maximum
address in the range.

Also changed the use sites of address range validation to use the
updated signature.

Signed-off-by: Kha Dinh <khadinh@g.skku.edu>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1091

18 months agoarch/x86: Align x86's paddr checks to arm64
Kha Dinh [Tue, 3 Oct 2023 14:12:02 +0000 (14:12 +0000)]
arch/x86: Align x86's paddr checks to arm64

This is also the correct implementation, e.g., maximum
possible 16-bit address is 0xFFFF, or `(1 << 16) - 1`.

Signed-off-by: Kha Dinh <khadinh@g.skku.edu>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1091

18 months agoplat/xen: Adapt Xen to the new uk_intctlr API
Michalis Pappas [Tue, 19 Sep 2023 07:40:21 +0000 (09:40 +0200)]
plat/xen: Adapt Xen to the new uk_intctlr API

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/linuxu: Adapt to changes introduced by uk_intctlr
Michalis Pappas [Tue, 19 Sep 2023 14:19:52 +0000 (16:19 +0200)]
plat/linuxu: Adapt to changes introduced by uk_intctlr

linuxu uses it's own implementation of interrupt handling that until
now implemented the old `ukplat_irq` API. Define `linuxu/irq.h` to
preserve compatibility with the old API. Once linuxu drivers move into
`drivers` they can be updated to provide their own implementation of
the uk_intctlr API.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/kvm: Adapt KVM to the new uk_intctlr API
Michalis Pappas [Tue, 19 Sep 2023 14:50:33 +0000 (16:50 +0200)]
plat/kvm: Adapt KVM to the new uk_intctlr API

Update KVM setup to use the new uk_intctlr API. Update the config
to define HAVE_INTCTLR and enable the default controller driver
depending on the VMM and architecture.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/common: Adapt common code to the new uk_intctlr API
Michalis Pappas [Tue, 19 Sep 2023 14:48:29 +0000 (16:48 +0200)]
plat/common: Adapt common code to the new uk_intctlr API

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukboot: Update ukboot to use the new uk_intctlr API
Michalis Pappas [Thu, 14 Sep 2023 12:03:14 +0000 (14:03 +0200)]
lib/ukboot: Update ukboot to use the new uk_intctlr API

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/ukbus/pci: Update PCI driver to the new uk_intctlr API
Michalis Pappas [Mon, 18 Sep 2023 10:56:02 +0000 (12:56 +0200)]
drivers/ukbus/pci: Update PCI driver to the new uk_intctlr API

Use in-place interrupt number translation until the device-tree
parsing of PCI is refactored.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/virtio: Update virtio to use the new uk_intctlr API
Michalis Pappas [Fri, 15 Sep 2023 16:43:43 +0000 (18:43 +0200)]
drivers/virtio: Update virtio to use the new uk_intctlr API

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/ukintctlr/xpic: Add IRQ allocation limits
Michalis Pappas [Thu, 14 Sep 2023 10:30:53 +0000 (12:30 +0200)]
drivers/ukintctlr/xpic: Add IRQ allocation limits

Assign the full IDT range to the IRQ allocator.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodriver/ukintctlr/gic: Add IRQ allocation limits
Michalis Pappas [Wed, 13 Sep 2023 17:11:57 +0000 (19:11 +0200)]
driver/ukintctlr/gic: Add IRQ allocation limits

Assign the entire SPI range to the IRQ allocator.

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukintctlr: Add IRQ allocation
Michalis Pappas [Thu, 14 Sep 2023 10:43:27 +0000 (12:43 +0200)]
lib/ukintctlr: Add IRQ allocation

Add an IRQ allocation function that will automatically assign
from a pool of free IRQs.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/kvm/x86: Register the full IDT
Michalis Pappas [Thu, 14 Sep 2023 08:00:50 +0000 (10:00 +0200)]
plat/kvm/x86: Register the full IDT

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukintctlr: Add uk_intctlr_irq_unregister()
Michalis Pappas [Wed, 13 Sep 2023 16:41:24 +0000 (18:41 +0200)]
lib/ukintctlr: Add uk_intctlr_irq_unregister()

Removes a previously registered interrupt handler.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/ukintctlr/gic: Define the maximum assignable IRQ number
Michalis Pappas [Thu, 14 Sep 2023 10:07:58 +0000 (12:07 +0200)]
drivers/ukintctlr/gic: Define the maximum assignable IRQ number

Add `uk/intctlr/limits.h` with the maximum assignable IRQ value
for GIC.

Update GIC_IRQ_MAX to define the maximum assignable INTID so that
it's consistent with the uk_intctlr API.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/ukintctlr/xpic: Add MAX_IRQ limits for xPIC
Michalis Pappas [Tue, 19 Sep 2023 14:37:51 +0000 (16:37 +0200)]
drivers/ukintctlr/xpic: Add MAX_IRQ limits for xPIC

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat: Define MAX_IRQ at the controller driver
Michalis Pappas [Thu, 14 Sep 2023 10:14:34 +0000 (12:14 +0200)]
plat: Define MAX_IRQ at the controller driver

The maximum interrupt number depends on the interrupt controller
and potentially also its version, so define that at the driver level.

Interrupt controller drivers that implement the uk_intctlr API are
expected to define such values in `uk/intctlr/limits.h`.

Remove sanity checks on returned irq value from arm drivers after
irq_translate as these are already performed in the function already.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/kvm: Remove IRQ acknowledgment from uk_intctlr_handle_irq
Michalis Pappas [Sun, 10 Sep 2023 21:59:12 +0000 (23:59 +0200)]
plat/kvm: Remove IRQ acknowledgment from uk_intctlr_handle_irq

The method of interrupt acknowledgment varies between interrupt
controllers. On GIC interupts are implicitly ACKed when reading the
interrupt id from GICC_IAR before passing control to the interrupt
handler, and completion is signaled post handling via the GICC_EOIR.
On x86 controllers acknowledgment happens after interrupt handling
is complete.

Remove the explicit interrupt acknledgment from
`uk_intctlr_handle_irq()` as it causes duplicate acknowledgment on
Arm, and move it to `ops->handle_irq()` of the xPIC driver.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/common: Remove explicit APIC IRQ ACKing from handlers
Michalis Pappas [Thu, 14 Sep 2023 13:51:46 +0000 (15:51 +0200)]
plat/common: Remove explicit APIC IRQ ACKing from handlers

Now that the xPIC drivers provides a unified IRQ handling,
remove explicit APIC IRQ acknowledgment from handlers.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/ukintctlr/xpic: Add uk_intctlr API implementation for xPIC
Michalis Pappas [Mon, 11 Sep 2023 19:38:52 +0000 (21:38 +0200)]
drivers/ukintctlr/xpic: Add uk_intctlr API implementation for xPIC

This commit adds the implementation of the uk_intctlr API for the
xPIC driver.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/common: Migrate the APIC implementation to the xPIC driver
Michalis Pappas [Mon, 11 Sep 2023 18:10:02 +0000 (20:10 +0200)]
plat/common: Migrate the APIC implementation to the xPIC driver

Introduce `arch/x86/x86_64/include/uk/asm/arch.h` for architectural
definitions of x86_64 and migrate APIC definitions into arch.

Migrate the driver implementation into `drivers/ukintctlr/xpic/`
The APIC ops are still accessible via the `apic` global.

Update the include guards of `apic.h`.

Update `plat/` to include `uk/intctlr/apic.h`. Update the KVM config
to enable `UKINTCTLR_XPIC` when compiling for x86_64.

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukintctlr: Migrate PIC implementation to the xPIC driver
Michalis Pappas [Mon, 11 Sep 2023 18:41:02 +0000 (20:41 +0200)]
lib/ukintctlr: Migrate PIC implementation to the xPIC driver

Migrate PIC to drivers/ukintctlr/xpic. Move architectural definitions
to arch/.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/ukintctlr: Add driver placeholder for Intel xPIC
Michalis Pappas [Mon, 11 Sep 2023 18:06:57 +0000 (20:06 +0200)]
drivers/ukintctlr: Add driver placeholder for Intel xPIC

Introduce a new driver placeholder for Intel interrupt controllers.
Since the different generations have often interrelated functionality,
similarly to Arm GIC, a single driver is introduced for the entire
*PIC family (PIC, APIC, x2APIC etc). More fine-grained functionality
can be controlled at the config level.

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukintctlr: Deprecate old intctrl API implementation for arm
Michalis Pappas [Sun, 10 Sep 2023 12:44:10 +0000 (14:44 +0200)]
lib/ukintctlr: Deprecate old intctrl API implementation for arm

Not that the GIC driver implements the uk_intctlr API, remove the
implementation of the old intctlr API for arm from `lib/ukintctlr`.

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukofw: Remove GIC interrupts parsing helper from libukofw
Michalis Pappas [Mon, 18 Sep 2023 08:50:54 +0000 (10:50 +0200)]
lib/ukofw: Remove GIC interrupts parsing helper from libukofw

The interpretation of the `interrupts` property in the fdt is
controller-specific [1]. As such, the implementation should be
provided by the corresponding driver. Remove the GIC `interrupts`
helper from libofw as this is now implemented by the GIC driver.

Notice: Picking individual commits in this PR will break the build.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic.yaml

Checkpatch-Ignore: COMMIT_LOG_LONG_LINE
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1103

18 months agodrivers/ukintctlr/gic: Adapt the GIC driver to the new uk_intctlr API
Michalis Pappas [Sun, 10 Sep 2023 20:11:32 +0000 (22:11 +0200)]
drivers/ukintctlr/gic: Adapt the GIC driver to the new uk_intctlr API

Deprecate `gic_init` in favor of `uk_intctlr_probe()`. Migrate the
`gic` global from the soon to be deprecated `arm64` implementation
of the old intctrl API on arm. This preserves direct access to
`gic->ops` to existing code, until all irq controller functionality
is abstracted away into `uk_intctlr_driver_ops`. Finally, update the
IRQ trigger types to use the ones defined by the uk_intctlr API, and
rename `ops->set_irq_type` to `ops->set_irq_trigger`, as the former
is too vague.

Notice: Picking individual commits in this PR will break the build.

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

18 months agodrivers/gic: Make the GIC driver conditional to HAVE_INTCTLR
Michalis Pappas [Tue, 19 Sep 2023 14:44:09 +0000 (16:44 +0200)]
drivers/gic: Make the GIC driver conditional to HAVE_INTCTLR

Arm ports of platforms that don't have an interrupt controller
(linuxu, xen) should not display the GIC driver in menuconfig.
Make the GIC driver conditional to `HAVE_INTCTLR` to prevent it
from being dispayed in these platforms.

Notice: Picking individual commits in this PR will break the build.

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

18 months agolib/ukintctlr: Introduce the uk_intctlr API
Michalis Pappas [Thu, 14 Sep 2023 11:08:57 +0000 (13:08 +0200)]
lib/ukintctlr: Introduce the uk_intctlr API

The new uk_intctlr API defines common interrupt controller driver ops,
along with a set of functions that must be implemented by the
interrupt controller drivers. It further provides unified interrupt
management and handling.

An interrupt controller descriptor that contains, among others, a
unified set of driver ops. Right now the ops implement a minimal set
of functions, which can be gradually extended to provide more
interrupt controller abstractions.

The interrupt descriptor contains properties that are populated by the
system's device discovery mechanism (fdt, ACPI) and passed to the
interrupt controller via the config operation. Right now it only
contains the interrupt trigger type (egde / level), and in the future
it can be extended to contain additional configuration such as
affinity, polarity, and priority.

The interrupt registration and handling are adaptated from the old
`ukplat_irq` API.

Finally, the previous copyright header of `ukintctlr.h` is replaced
with the one used in newly introduced files, as this is a complete
rewrite.

Notice: Picking individual commits in this PR will break the build.

Checkpatch-Ignore: RETURN_VOID
Co-authored-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1103

18 months agoplat/kvm: Migrate ukplat_irq implementation to libukintctlr
Michalis Pappas [Tue, 19 Sep 2023 08:27:56 +0000 (10:27 +0200)]
plat/kvm: Migrate ukplat_irq implementation to libukintctlr

Migrate the implementation of the ukplat_irq API from `plat/kvm/irq.c`
to `lib/ukintctlr/`. The code is moved without changes, and will be
updated once the new uk_intctlr API is defined.

Deprecate the old headers. These will be replaced by new headers that
define the uk_intctlr API.

Notice: Picking individual commits in this PR will break the build.

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

18 months agoplat/kvm/x86: Make zero page inaccessible
Marco Schlumpp [Sun, 8 Oct 2023 16:14:42 +0000 (18:14 +0200)]
plat/kvm/x86: Make zero page inaccessible

Commit ad684b5175f70e78dc37ed63d8a124c2b6e53d1c made the first page
accessible. This caused NULL-pointer accesses to not cause a page-fault.
This can hide bugs and therefore this commit splits the first 2MiB page
into 4KiB pages and marks the first one as inaccessible.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Simon Kuenzer <simon@unikraft.io>
GitHub-Closes: #1123

18 months agobuild: Remove unused `$(DATE)` variable
Simon Kuenzer [Wed, 11 Oct 2023 18:42:15 +0000 (20:42 +0200)]
build: Remove unused `$(DATE)` variable

This commits removes the unused `$(DATE)` variable from the build
system. Build time and date is available with the `$(HOSTUTC)`
variable.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1127

18 months agobuild: Use ISO 8601 format for $(HOSTUTC)
Simon Kuenzer [Wed, 11 Oct 2023 18:40:40 +0000 (20:40 +0200)]
build: Use ISO 8601 format for $(HOSTUTC)

In order to make the time format consistent for all host localizations
and systems, we use the ISO 8601 format for UTC.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1127

18 months agoarch/arm64: Fix dependency for `arm64_syscall_adapter`
Tianyi Liu [Thu, 12 Oct 2023 13:19:41 +0000 (21:19 +0800)]
arch/arm64: Fix dependency for `arm64_syscall_adapter`

The `arm64_syscall_adapter` was introduced by #1009.

In order to forward binary syscalls,
it requires a dependency on `CONFIG_LIBSYSCALL_SHIM_HANDLER`,
and the current `CONFIG_LIBSYSCALL_SHIM` is not enough.

Signed-off-by: Tianyi Liu <i.pear@outlook.com>
Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1132

18 months agolib/uklibid: Option to store "Compile date" to `.uklibid_info`
Simon Kuenzer [Tue, 10 Oct 2023 11:37:56 +0000 (13:37 +0200)]
lib/uklibid: Option to store "Compile date" to `.uklibid_info`

Adds the option to store the compile time and date for a library and
unikernel. When enabled, `libinfo.S` is recompiled on every rebuild. This
is achieved by handing over the current time and date as compile flag.
For this purpose, the build system provides `$(HOSTUTC)`, the current
time and date in UTC format.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/uklibid: Option to store "Compiled-by" to `.uklibid_info`
Simon Kuenzer [Fri, 6 Oct 2023 16:46:02 +0000 (19:46 +0300)]
lib/uklibid: Option to store "Compiled-by" to `.uklibid_info`

Adds the option to store information about the person/entity/robot that was
compiling a library and unikernel. When enabled, the local system user and
hostname is used as default. For this purpose, the build system provides
`$(HOSTNAME)` and `$(HOSTUSER)`. Custom strings are also supported as well.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/uklibid: Store compile options to `.uk_libinfo`
Simon Kuenzer [Fri, 6 Oct 2023 09:58:45 +0000 (12:58 +0300)]
lib/uklibid: Store compile options to `.uk_libinfo`

This commit introduces the storage of an initial set of compile options in
the metadata of each library. The following options are covered by this
commit:
- PIE: Library was compiled position-independent
- DCE: Library was compiled with support for dead code elimination
- LTO: Library was compiled with support for link time optimizations
The options are always saved, because some of the activation states cannot
be mixed, such as the PIE option (e.g., an Unikraft build must be pure PIE
enabled or pure PIE disabled) It is also intended that the encoded flags
are extended in the future.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/uklibid: Option to embed .config to `.uk_libinfo`
Simon Kuenzer [Tue, 26 Sep 2023 22:44:10 +0000 (00:44 +0200)]
lib/uklibid: Option to embed .config to `.uk_libinfo`

This commit introduces the option to embed a gzipped version of the
configuration (`.config`) used to generate the image.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/uklibid: Option to dump list of libraries during boot
Simon Kuenzer [Fri, 15 Sep 2023 11:02:24 +0000 (13:02 +0200)]
lib/uklibid: Option to dump list of libraries during boot

This commit introduces the `CONFIG_LIBUKLIBID_INFO_BOOTDUMP` option, which
prints the name and version of each library found in the `.uk_libinfo`
section during boot.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/uklibid: Add documentation for `.uk_libinfo` section
Simon Kuenzer [Wed, 27 Sep 2023 21:57:56 +0000 (23:57 +0200)]
lib/uklibid: Add documentation for `.uk_libinfo` section

This commit introduces a `README.md` document that describes the
`.uk_libinfo` section format and design principles.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agoscripts: uk-libinfo.py: Read .uk_libinfo section
Simon Kuenzer [Tue, 26 Sep 2023 22:45:12 +0000 (00:45 +0200)]
scripts: uk-libinfo.py: Read .uk_libinfo section

This commit introduces the first version of a tool that reads and parses
the library information section (`.uk_libinfo`) of a Unikraft (debug) image
or library object file.
This first version does not yet derive the endianness and int sizes from
the ELF file.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/uklibid: Embedded library information
Simon Kuenzer [Fri, 15 Sep 2023 10:57:10 +0000 (12:57 +0200)]
lib/uklibid: Embedded library information

This commit introduces the `.uk_libinfo` section which is used to store
additional library information in library object files. We define the data
structure of the section and declare it as layout version 1. For each
library the build system will generate a single header and each header can
contain an individual number of records to store values.
Layout version 1 also supports storing of information related to the image
as a whole and not to a specific library. A single header is created for
global information, which differs from the library headers in that it does
not contain a record for a library name (LIBNAME).

When a final Unikraft image is linked, the individual sections of each
library are merged into one section.

By default, a minimal set of library and global information is enabled. The
motivation behind this is that library objects are instrumented with
uk_libinfo from now on. In a future commit, the build system could provide
an option to remove this section from (non-debug) images if it is not used
by Unikraft code itself.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agoinclude/arch: types.h: Assembler equivalent data types
Simon Kuenzer [Wed, 4 Oct 2023 10:40:24 +0000 (12:40 +0200)]
include/arch: types.h: Assembler equivalent data types

Introduces data type macros for assembler code that matches integer sizes
of Unikraft-internal types: `__u8`, `__u16`, etc.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Robert Kuban <robert.kuban@opensynergy.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1117

18 months agolib/vfscore: Embedded initrd
Simon Kuenzer [Mon, 28 Aug 2023 13:14:54 +0000 (15:14 +0200)]
lib/vfscore: Embedded initrd

This commit introduces the ability to embed a CPIO initrd in a unikernel
image. This can be useful to hard link an initrd content to an
unikernel. An additionally provided initrd can then be used freely with the
fstab function.

Checkpatch-Ignore: AVOID_EXTERNS
Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1070

18 months agolib/vfscore: Support initrds with `LIBVFSCORE_ROOTFS_CUSTOM`
Simon Kuenzer [Mon, 28 Aug 2023 13:12:34 +0000 (15:12 +0200)]
lib/vfscore: Support initrds with `LIBVFSCORE_ROOTFS_CUSTOM`

Commit 24be5b01a7da ("lib/vfscore: Implement individual volume automounting")
disabled the ability to manually specify mounting of an initrd with
`LIBVFSCORE_ROOTFS_CUSTOM`. Initrd support depends on `LIBUKCPIO` and
`LIBRAMFS`. This commit brings back this feature.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1070

18 months agolib/vfscore: Move submenu under `menuconfig`
Simon Kuenzer [Mon, 28 Aug 2023 20:17:26 +0000 (22:17 +0200)]
lib/vfscore: Move submenu under `menuconfig`

This commit moves the library configuration under a menuconfig option for
vfscore. This is done for consistency.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1070

18 months agobuild: Compile dependencies for source files (`*_CDEPS`)
Simon Kuenzer [Mon, 28 Aug 2023 20:20:39 +0000 (22:20 +0200)]
build: Compile dependencies for source files (`*_CDEPS`)

For each source file, additional dependencies that trigger recompilation
can be specified in `Makefile.uk` with `*_CDEPS`:
```
 <LIBNAME>_<SOURCENAME>[_<VARIANT>]_CDEPS   += <dependency>
 <LIBNAME>_<SOURCENAME>[_<VARIANT>]_CDEPS-y += <dependency>
```
Please note that because of the need to remove quotes from filenames,
`qstrip` is called and therefore the CDEPS variable cannot be expanded
with a second expansion (`$$()`).

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1070

18 months agobuild: Restructure common dependencies for buildrule_*
Simon Kuenzer [Mon, 28 Aug 2023 20:19:48 +0000 (22:19 +0200)]
build: Restructure common dependencies for buildrule_*

Restructures the build rules to put common dependencies in a single place.
The advantage is that these dependencies are now automatically applied for
externally defined build rules.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Marco Schlumpp <marco@unikraft.io>
GitHub-Closes: #1070

18 months agoplat/virtio: Implement support for event index notification suppression
Marco Schlumpp [Mon, 20 Feb 2023 13:57:00 +0000 (14:57 +0100)]
plat/virtio: Implement support for event index notification suppression

This allows the drivers/device to specify the other side should
send a notification. This is required for firecracker which does not
support the original notification suppression flag.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1089

18 months agoarch/arm64: Support AArch64 binary syscalls
Tianyi Liu [Mon, 31 Jul 2023 05:50:16 +0000 (13:50 +0800)]
arch/arm64: Support AArch64 binary syscalls

An interrupt handler is provided to redirect the interrupts
generated by binary syscalls to the `syscall-shim` layer.

Signed-off-by: Tianyi Liu <i.pear@outlook.com>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
GitHub-Closes: #1009

18 months agoMakefile: Save UK_NAME on savedefconfig
Stefan Jumarea [Fri, 29 Sep 2023 16:13:54 +0000 (19:13 +0300)]
Makefile: Save UK_NAME on savedefconfig

Using `make savedefconfig` did not save the `UK_NAME` config option.
Fix that by appending the value by hand at the end of the `DEFCONFIG`
file.

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
GitHub-Closes: #762
Approved-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
Reviewed-by: Simon Kuenzer <simon.kuenzer@unikraft.io>
GitHub-Closes: #1118

18 months agoplat/common/arm: Check for offline GICC during ACPI MP enumeration
Sergiu Moga [Sat, 23 Sep 2023 12:21:30 +0000 (15:21 +0300)]
plat/common/arm: Check for offline GICC during ACPI MP enumeration

When we probe for available, valid GICC's, we only look for those
that are already online and initialized, totally forgetting about
those that are usable but offline. Therefore, check for powered off
GICC's as well, since, during probe, we re-initialize GICC's anyway.

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

18 months agoplat/common/acpi: Fix `VGIC IRQ MODE` flag bitfield of `GICC`
Sergiu Moga [Sat, 23 Sep 2023 11:58:13 +0000 (14:58 +0300)]
plat/common/acpi: Fix `VGIC IRQ MODE` flag bitfield of `GICC`

The bitfield `ACPI_MADT_GICC_FLAGS_VGIC_IRQ_MODE` of `GICC` had
the wrong value: it may be the 3rd bit from right to left, but its
corresponding value is 4 (1 << 2) not 3.

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

18 months agolib/9pfs: Remove unused warnings
Michalis Pappas [Wed, 27 Sep 2023 10:35:49 +0000 (12:35 +0200)]
lib/9pfs: Remove unused warnings

Add `__unused` attribute to uk_9pfs_ioctl parameters to silence GCC
warning.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

18 months agolib/vfscore: Remove unused warnings
Michalis Pappas [Mon, 25 Sep 2023 14:11:09 +0000 (16:11 +0200)]
lib/vfscore: Remove unused warnings

When building without assertions some arguments and variables
are not used. This commit adds respective attributes to solve
the warning.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

18 months agolib/ukblkdev: Remove unused warnings
Michalis Pappas [Mon, 25 Sep 2023 14:10:33 +0000 (16:10 +0200)]
lib/ukblkdev: Remove unused warnings

When building without assertions some arguments and variables
are not used. This commit adds respective attributes to solve
the warning.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

18 months agodrivers/virtio/blk: Remove unused warnings
Michalis Pappas [Mon, 25 Sep 2023 14:09:19 +0000 (16:09 +0200)]
drivers/virtio/blk: Remove unused warnings

When building without assertions some arguments and variables
are not used. This commit adds respective attributes to solve
the warning.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

18 months agodrivers/virtio: Fix unhandled IRQ
Marc Rittinghaus [Tue, 15 Feb 2022 16:37:51 +0000 (17:37 +0100)]
drivers/virtio: Fix unhandled IRQ

It may happen that depending on timing there is no new data in the
virtio queue, however, an IRQ is still pending. When this pending IRQ
is handled, the driver reports back that it did not handle the request
although in fact resetting the IRQ signal bit in the virtio device is
enough to acknowlegde that an interrupt for the device has been
received and handled (albeit without having to do any additional
work). This will lead to a false Unhandled IRQ error message on
the console. This commit is a first dirty hack to just always
acknowledge IRQs if the status bit is set, thereby avoiding the
error message.

Checkpatch-Ignore: LONG_LINE
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

18 months agodriver/virtio/mmio: Make config_get return value consistent with PCI
Michalis Pappas [Mon, 25 Sep 2023 14:57:02 +0000 (16:57 +0200)]
driver/virtio/mmio: Make config_get return value consistent with PCI

Update the return value of virtio-mmio ops->config_get to return zero
on success rather like the number of bytes read, to align with virtio-pci.
This allows consistent error handling from device driver side.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115

18 months agodrivers/virtio/blk: Downgrade empty queue message
Michalis Pappas [Mon, 25 Sep 2023 14:27:16 +0000 (16:27 +0200)]
drivers/virtio/blk: Downgrade empty queue message

Due to virtio using separate data and control paths, it is normal for
the queue to be observed as empty if the interrupt arrives before the
write can be observed by the driver. Downgrade the severity of the log
message to `debug`.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Topala <topala.andrei@gmail.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1115