Commit Graph

169 Commits

Author SHA1 Message Date
Christian Helmuth
791dd38160 wireguard: clean up build order/structure
- Move C++ sources from lib/wireguard to app/wireguard, which require
  Genode include paths (that conflict with linux)
- Rename lib/wireguard_lx_inc_dirs to lib/wireguard, which builds linux
  sources with linux include paths
2024-06-20 12:54:30 +02:00
Christian Helmuth
09ef478838 wireguard: cleanup jiffies symbol (alias to jiffies_64)
Issue #5236
2024-06-20 12:54:30 +02:00
Josef Söntgen
191306531c dde_linux: generate proper KBUILD_MODNAME
This commit remedies the somewhat lazy attempt to address unique names
for drivers where the name is directly derived from KBUILD_MODNAME,
e.g. rtlwifi, and also modifies the name accordingly to the rules
of Linux' build-system. The last part becomes necessary as driver
matching tables may rely on that as has already happend with the
ti-sn65dsi86 driver.
2024-06-20 12:54:30 +02:00
Sebastian Sumpf
b30bacf86e lxip: shadow asm-generic/access_ok.h
The IP stack checks "user" pointer access, for example, for iov's using
'access_ok' which in turn calls '__access_ok'. The function checks if the
pointer is below TASK_SIZE_MAX, which is usually a big value on 64 bit
systems, but 3GB on 32 bit systems. Because the IP stack is mostly used with
Genode's libc, where pointers on some kernels (base-linux) can be >3GB and we
don't want to make an additional copy of each buffer/iov interacting with the
IP stack, we short circuit the function

issue #5165
2024-04-12 15:02:45 +02:00
Norman Feske
1866520d6c dde_linux: build initcall_table.c after objects
The added hook 'OBJ_POSTPROC_SRC' gives us a way to post-process object
files for generating supplemental code. By using this hook, the
initcall_table.c generated by import-lx_emul_common.inc gets reliably
executed after all object files are built.

Fixes #5159
2024-04-12 15:00:44 +02:00
Norman Feske
891f933863 import-lx_emul_common.inc: don't use 'nm -U'
The option is used during the generation of initcall_table.c.
However, it happens to strip the first argument following the option.
The long option --defined-only works as expected.

Issue #5155
2024-04-12 15:00:44 +02:00
Sebastian Sumpf
ecd7b0568b lx_emul: adjust import to lx_kit remove
'src/include/spec/x86' does no longer exist

issue #5104
2024-02-26 08:59:09 +01:00
Sebastian Sumpf
8aa3967201 dde_linux: remove legacy_lxip
Because legacy_lxlip is the last entry in dde_linux.port, remove the
port as well.

issue #5104
2024-02-26 08:59:09 +01:00
Sebastian Sumpf
8755993123 dde_linux: remove vfs_legacy_lxip
issue #5104
2024-02-26 08:59:09 +01:00
Sebastian Sumpf
b6baf3fe1e dde_linux: remove 'import-usb_arch_include.mk'
This seems to be an artifact left over from the legacy USB drivers.

issue #5104
2024-02-26 08:59:09 +01:00
Christian Helmuth
6a94b8d153 Remove obsolete lx_kit_setjmp library
Issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
7e8661f8bf virt_linux: disable SMP for arm_v7 and change to tiny rcu
When SMP is enabled multicore specific instructions (e.g., pldw) are
generated. These are not supported and lead to invalid instruction
faults on uni-processor systems (like Cortex-A8). Therefore, we disable
SMP for arm_v7 in Linux code. This requires also a switch from the RCU
tree implementation to RCU tiny, which we shadow and dummy implemented.

issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
561a9e7a72 vfs_lxip: adapt to 'genode_socket' C-API
Adjust the plugin to use the socket C-API found under
dde_linux/src/lib/lxip/include/genode_c_api/socket.h'.

This is the first minor step in generalizing the plugin.

isse #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
701856b06a dde_linux: copy vfs_lxip -> vfs_legacy_lxip
Make a copy of vfs_lxip so it can be revived easily. The plugin can now
be used like

! <legacy_lxip dhcp="yes"/>

issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
42d9640443 lxip: update to Linux 6.1.20
This commit updates lxip from version 4.4.3 to 6.1.20. It uses the
current lx_kit approach and is a shared library again. The stack has
been tested for x86_32/x86_64/arm_v6/arm_v7/arm_8.

The C-interface of the IP stack can be found under
lxip/include/genode_c_api/socket.h.

issue #5104
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
5dc4ee6524 wireguard: adjust to virt_linux config changes
* remove dummies for '__alloc_pages'
* adjust arm_64 -> arm_v8
* remove IPv6 dummies (disabled in virt_linux)

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
7395f24423 virt_lx_emul: add shadow 'page_alloc.c'
Add suspport for '__alloc_pages' in virt_linux

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
360d38c36d dde_linux: move lxip -> legacy_lxip
move lxip stack to 'legacy_lxip' so it can be revived easily.

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
f19cd8416e lx_kit: split includes and setjmp into arm_v(6|7|8)
Move 'arch_execute.h' headers and 'setjmp/longjmp' implementation from
arm/arm_64 to arm_v(6|7|8).

issue #5104
2024-02-26 08:59:07 +01:00
Sebastian Sumpf
d191c376f7 dde_linux: add libnl for arm_v6
This was covered before by SPEC 'arm'.
2024-02-26 08:31:06 +01:00
Sebastian Sumpf
1b4f7ae0d3 lx_emul: generate initcalls during build
Functions registered with 'module_init' (i.e., '__define_initcalls'),
'OF_DECLARE', and 'DECLARE_PCI_FIXUP_CLASS_FINAL' used to be static
constructors and had be explicitly registered using
'exec_static_constructors' before executing any Linux code.

With this commit we remove the constructor attributes from these
functions and create a global function pointer in the form of

__initptr_<name>_<id>_<counter>_<line number of macro>

'import-lx_emul_common.inc' will collect these '__initptr' symbols after
the compile step and generate a 'lx_emul_register_initcalls' function
that executes the functions pointed to. This step is now automatically
performed in 'lx_emul_start_kernel'. This way a call to
'exec_static_constructors' can be omitted in case there are no other
constructors in place.

issue #5096
2024-02-26 08:31:05 +01:00
Sebastian Sumpf
f9bff3bc7c dde_linux: remove library mk for usb_host_include
This library does not exist anymore.

issue #5095
2024-02-26 08:31:05 +01:00
Sebastian Sumpf
a67bc59686 virt_linux: add arm_v6
also split into arm_v(6|7|8)

issue #5095
2024-02-26 08:31:05 +01:00
Sebastian Sumpf
bb06e8451a dde_linux: split lib/mk into arm_v6/7/8
Split 'arm' and 'arm_64' into 'arm_v(6|7|8)'

issue #5095
2024-02-26 08:31:05 +01:00
Christian Helmuth
b80fd10a70 wireguard: don't shadow lx_emul memory backend
Issue #4809
2023-12-13 12:33:05 +01:00
Christian Helmuth
1e7116fcc1 lx_emul: manage page structs per buffer range
The management of Linux page structs is now tied to the life time of DMA
buffers. Thus, page structs are created when a buffer is allocated and
deallocated only when a buffer is freed - not on lx_emul_mem_free()
because DMA buffers are cached. Page struct refcounting was entirely
reworked in lx_emul/shadow/mm/page_alloc.c.

Fixes #4809
2023-12-13 12:33:05 +01:00
Pirmin Duss
37a7119eb3 wireguard: initialize timekeeping with RTC
This commit fixes the "Invalid handshake initiation" error when the
client restarts.

Fixes genodelabs/genode#4957
2023-11-28 14:24:23 +01:00
Pirmin Duss
f66a7db87f lx_emul: allow setup of the persistent clock
This commit adds support to initialize the timekeeping for
the Linux subsystem with the value from the RTC.

Only the seconds part of timespec64 is supported.

Issue genodelabs/genode#4957
2023-11-28 14:24:23 +01:00
Sebastian Sumpf
798fb709a2 dde_linux: remove usb_modem driver
The driver is superseded by the USB network driver (usb_net) which also
contains MBIM support for LTE modems previously provided by this
driver.

issue #4958
2023-09-29 12:17:45 +02:00
Sebastian Sumpf
7e823f7c19 dde_linux: remove legacy_usb_net
issue #4958
2023-09-29 12:17:45 +02:00
Sebastian Sumpf
cd2910eb2c dde_linux: remove usb_hid_legacy
issue #4958
2023-09-29 12:17:45 +02:00
Sebastian Sumpf
f4d7455a9f recipe: wireguard use virt_linux api
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
5bce4dac81 recipe: virt_linux api
for x86_32, x86_64, arm, arm_64

issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
d27e0a8fe6 virt_lx_emul: add shadow 'vmalloc.c'
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
22231c0604 virt_lx_emul: adjust dummies for usb_hid/net
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
71c32f2923 virt_linux: add init calls for USB HID/NET
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
9a6423b4ef dde_linux: move usb_net -> legacy_usb_net
issue #4958
2023-09-29 12:15:06 +02:00
Sebastian Sumpf
8f34c27ca5 dde_linux: move usb_hid -> usb_hid_legacy
issue #4958
2023-09-29 12:15:05 +02:00
Josef Söntgen
dd1b8a106f drivers/wifi: perform multi-staged construction
Since the wireless LAN driver is actually a 'Libc::Component' due to
its incorporation of the 'wpa_spplicant' application, we have to
intercept its construction because we have to initialize the Lx_kit
environment before any static ctors are executed. Most Linux initcalls
are implemented as ctors that will be otherwise implicitly executed
before the controll is given to us in 'Libc::Component::construct'.

Issue #4927.
2023-07-14 12:06:32 +02:00
Josef Söntgen
fc24ffcdb8 wifi: use mac address reporter
Remove the handcrafted MAC address reporter in favour the Genode
C API utility (cf. #4918).

Issue #4927
Issue #4918
2023-07-14 12:06:32 +02:00
Josef Söntgen
7109b80bbd dde_linux: enable -gnu11
The option is default since 5.18 and several compilation units
require it.

Issue genodelabs/genode-allwinner#21.
2023-07-14 12:01:19 +02:00
Josef Söntgen
497c8b0922 wifi: provide WPA3-personal support
This commit introduces preliminary support for joining networks secured
via WPA3-personal. So far it was only tested with the one OpenWRT AP
configured for WPA3 (see excerpt below) where it WPA3-only as well as
WPA2/WPA3 mixed worked fine.

Scan results excerpt:

00:11:22:33:44:55    5180    -45     [WPA2-SAE-CCMP][SAE-H2E][ESS][UTF-8]    PewPew
00:11:22:33:44:55    2412    -67     [WPA2-PSK+SAE+PSK-SHA256-CCMP][SAE-H2E][ESS][UTF-8]     PewPew2

Issue #4861.
2023-05-30 12:03:33 +02:00
Josef Söntgen
dc178e0ab2 dde_linux: enhance KBUILD_MODNAME generation
It turns out solely relying on the name of the compilation-unit
is not enough. In at least one multi-device driver, e.g. rtlwifi,
an equally called compilation-unit is found in several different
directories. There KBUILD_MODNAME is used to name the driver,
which fails later on as the driver framework refuses to register
an equally named driver twice.

Instead of only considering the name of the compilation-unit also
include the last element of the path to generate differentiating
KBUILD_MODNAME value.

Issue #4861.
2023-05-30 12:03:33 +02:00
Josef Söntgen
22c9157231 wifi: add RFKILL notification interface
Add somewhat cosmetic changes to the RFKILL interface used between
the management layer and the driver library to make the intent clear.

Issue #4861.
2023-05-30 12:03:33 +02:00
Josef Söntgen
6b406469f6 dde_linux: remove unused var from libnl_include
Issue #4861.
2023-05-30 12:03:33 +02:00
Josef Söntgen
080b0fb9b3 dde_linux: update wpa_supplicant to version 2.10
The supplicant is updated to the current release and is now downloaded
as archive rather than pulled from git. For the time being 'libnl' is
still kept at 3.2.25 as the current 3.7.0 release relies on more Linux
infrastructure that our integration does not provide.

Issue #4861.
2023-05-30 12:03:33 +02:00
Josef Söntgen
ea0a692879 wifi: get firmware from tar archive
This commit changes the firmware handling from requesting each
firmware file as a ROM module that is checked against a list of
known images (including their size) to requesting each file via
the local VFS of the 'wifi_drv'. This allows for using the original
probing mechanism that tries to select a matching firmware version.

The 'repos/dde_linux/src/drivers/wifi/README' file contains more
detailed information on how to configure the driver.

Issue #4861.
2023-05-30 12:03:33 +02:00
Josef Söntgen
d5710d9de3 Move 'wifi' driver to dde_linux repository
The bulk of the driver code now lives in the 'dde_linux' repository,
which is available on all platforms, from where it can be referenced by
other repositories.

The 'wifi_drv' binary was delegated to a generic harness that includes
all configuration and management functionality shared by all wireless
device driver components, e.g., the wpa_supplicant. The code of the
device driver emulation environment is located in 'src/lib/wifi'. It
is referenced by the platform-specific driver library that resides in
the corresponding platform repository. The runtime configuration needs
to point the driver to proper driver library.

The platform-specific library is in charge of orchestrating the contrib
source utilized by the driver as well as providing the 'source.list'
and 'dep.list' files. It must include the generic library snippet
'repos/dde_linux/lib/wifi.inc' that deals with managing the emulation
environment code.

The 'repos/dde_linux/src/drivers/wifi/README' file contains more
detailed information on how to deploy the driver.

Issue #4861.
2023-05-30 12:03:32 +02:00
Christian Helmuth
590cf78c0f lx_emul: clarify Linux does not support -O0/-Og 2023-05-30 12:03:28 +02:00
Sebastian Sumpf
69d3d83930 lx_emul: set minimum alignment of allocations to 16 byte
FPU allocations on x86/ARM require a minimum alignment or may raise
faults (#GP or general protection in the x86 case).
2023-05-30 12:03:28 +02:00