Commit Graph

1178 Commits

Author SHA1 Message Date
Stefan Kalkowski
2f6864a487 lx_emul: make ARM irqchip handler extendable
* Allow support for kernel configurations without CONFIG_IRQ_DOMAIN_HIERARCHY
* Export `irq_domain` instantiated for driver-specific extensions of the irqchip

Fix genodelabs/genode#4964
2023-07-14 12:06:32 +02:00
Josef Söntgen
e18c02991e lx_kit: use central signal handler for scheduling
This commit extends the Lx_kit initialization function by passing in
a signal handler that is used to perform the normally occurring
scheduler execution and is a follow-up change for the decoupling
scheduler execution commit.

Instead of burying the signal handler in the 'Lx_kit::Scheduler'
object it is provided by the main object where the driver is free
to perform any additional step before or after executing the scheduler.

Issue #4927
Fixes #4952
2023-07-14 12:06:32 +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
Stefan Kalkowski
cccb763737 lx_emul usb: handle RPC calls after async-URBS
Prevent missing new RPC calls handed over to a Linux task
of a corresponding usb-device, while that task blocked
during enqueuing of asynchronous URBs.

Fixed genodelabs/genode#4955
2023-07-14 12:06:32 +02:00
Josef Söntgen
1cac134030 lx_kit: support multiple pending IRQs
Decoupling the scheduler execution can lead to missed interrupts
because the current implementation only handles one pending
interrupt and requires immediate processing.

This commit introduces a helper object that is used to capture
any occuring interrupts that are then handled consecutively.

Issue #4927.
2023-07-14 12:06:32 +02:00
Josef Söntgen
caac994da8 lx_kit: decouple schedule execution
Prior to this commit, whenever an external event occurred, for example
timer or interrupt, the corresponding I/O signal handler was triggered.
This handler unblocked the task waiting for the event and initiated the
immediate execution of all unblocked tasks. Since these tasks may hit
serialization points, e.g. synchronously waiting for packet stream
operations, that require handling of other I/O signals this leads to
nested execution. This, however, is not supported and mixes application
and I/O level signal handling.

The flagging of the scheduling intent is now decoupled from its
execution by using an application level signal handler that is run in
the context of the components main entrypoint. The I/O signal handler
now triggers the scheduling execution by sending a local signal to
the EP.

Since it might be necessary to execute a pending schedule from the EP
directly the scheduler is extended with the 'execute' member function
that performs the check that the scheduler is called from within the
EP and triggers the execution afterwards.

Issue #4927.
2023-07-14 12:06:32 +02:00
Stefan Kalkowski
3d5ec9ea3f dde_linux: remove legacy imx6 usb host driver
Ref genodelabs/genode#4942
2023-07-14 12:06:31 +02:00
Stefan Kalkowski
edcd44d9a7 lx_emul: shadow ARM-specific asm/uaccess.h file
Fix genodelabs/genode#4939
2023-07-14 12:06:31 +02:00
Stefan Kalkowski
b15fd68b60 lx_emul: shadow the ARM-specific asm/domain.h file
Fix genodelabs/genode#4938
2023-07-14 12:06:31 +02:00
Stefan Kalkowski
720d2847b6 lx_emul: correct the return value of clk_get
Fix genodelabs/genode#4937
2023-07-14 12:06:31 +02:00
Christian Helmuth
1a7ff195d9 pc_linux: enable EFI and EFI_STUB
With these options enabled comparative testing between pc_linux drivers
and bzImages becomes much easier on EFI-only machines. The impact on the
actual Genode drivers is minimal.
2023-07-14 12:06:31 +02:00
Christian Helmuth
e2ddcee440 lx_emul: prevent warning about unsused static func 2023-07-14 12:06:31 +02:00
Christian Helmuth
ea294fff0c lx_emul: fix unplug of unclaimed USB devices
USB devices that are never associated to client sessions lack
usb_per_dev_data (and a kernel thread). Therefore, the devices should be
discontinued directly on unplug as no URBs can be pending.

Issue genodelabs/genode#4795
2023-07-14 12:06:31 +02:00
Christian Helmuth
ee564125df Replace ipxe_nic_drv by pc_nic_drv in run scripts
Issue #4921
2023-07-14 12:06:31 +02:00
Josef Söntgen
adf0b893e8 lx_kit: add random dummy back end
This back end can be used in place of the existing jitterentropy based
on in case random is not strictly needed by the component but one
wants to use the available 'shadow/drivers/char/random.c'
implementation.

Issue genodelabs/genode-allwinner#21.
2023-07-14 12:01:19 +02:00
Josef Söntgen
c888fcbdd9 lx_emul: implement __get_random_u32_below
The implementation was already part of the Zynq's sd_card driver and
since other ARM drivers need it as well, promote it to the common
shadow library.

Issue genodelabs/genode-allwinner#21.
2023-07-14 12:01:19 +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
Christian Helmuth
0a28df8805 lx_emul: skb_init() in lx_emul_init_task_function()
Issue #4921
2023-07-14 12:01:19 +02:00
Norman Feske
79e262921e depot: update recipe hashes 2023-06-16 11:24:26 +02:00
Christian Helmuth
54a549d808 lx_emul: move arch_atomic64_add_return to dde_linux 2023-06-16 11:24:26 +02:00
Stefan Kalkowski
97bf616b5b lx_emul: fix rcu_needs_cpu() for older kernels
Resolves observed regression for the older usb host drivers (< linux
version 5.18).

Ref genodelabs/genode#4798
2023-06-16 11:24:25 +02:00
Christian Helmuth
583f2d6a36 depot: update recipe hashes 2023-05-30 12:13:34 +02:00
Christian Helmuth
22bee79534 port/metadata: improve info for multi-source ports
Now, ./tool/ports/metadata dde_linux produces the following output.

  PORT:     dde_linux
  LICENSE:  GPLv2
  VERSION:  individual (see sources)
  SOURCE:   https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.3.tar.xz VERSION 4.4.3 (lxip)
  SOURCE:   https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz VERSION 4.16.3 (fec)
  SOURCE:   https://github.com/cproc/dwc_otg.git git r5 (dwc_otg_host)
  SOURCE:   https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz VERSION 4.16.3 (usb_host)
  SOURCE:   https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz VERSION 4.16.3 (usb_hid)
  SOURCE:   https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz VERSION 4.16.3 (usb_modem)
  SOURCE:   https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz VERSION 4.16.3 (usb_net)

Issue #4685
2023-05-30 12:03:34 +02:00
Stefan Kalkowski
1c790b2776 lx_emul: use alternative initcall for pci on ARM
On platforms different than x86 the subsys initcall `pci_subsys_init`
is not available. Therefore, we choose an alternative one here.

Fix genodelabs/genode#4907
2023-05-30 12:03:33 +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
cfd3be675f pc_wifi: enable RTL8192CE support in rtlwifi
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
Josef Söntgen
6727b5ea49 dde_linux: promote PC specific additions
Issue #4861.
2023-05-30 12:03:32 +02:00
Stefan Kalkowski
8cb9d19079 lx_emul: add vmalloc defines to ARM64
Ref genodelabs/genode#4813
2023-05-30 12:03:32 +02:00
Stefan Kalkowski
46c8267fa9 Fix "wifi: support building for ARM64"
Issue #4813
2023-05-30 12:03:32 +02:00
Christian Prochaska
e88a84e2ab wireguard: fix build error with -std=gnu++20
Fixes #4887
2023-05-30 12:03:30 +02:00
Alexander Boettcher
1f2dc78feb intel/display: replace intel_fbdev with drm/kms
Fixes #4806
2023-05-30 12:03:30 +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
Stefan Kalkowski
97e3572844 lx_emul: use devio API for USB driver operations
Fix genodelabs/genode#4795
2023-05-08 15:55:34 +02:00
Stefan Kalkowski
f079d1f7c3 usb_hid_drv: ensure freeing packets in destructor
Ref genodelabs/genode#4795
2023-05-08 15:55:34 +02:00
Stefan Kalkowski
19e2b5b8b2 usb_net_drv: ensure freeing packets in destructor
Ref genodelabs/genode#4795
2023-05-08 15:55:34 +02:00
Stefan Kalkowski
3c3e45746a usb_modem: ensure freeing packets in destructor
Ref genodelabs/genode#4795
2023-05-08 15:55:34 +02:00
Stefan Kalkowski
cad11093f1 lx_emul: align of page-size allocations properly
Use page-alignment for multiple of page-size allocations within
all kmalloc allocations.

Ref genodelabs/genode#4795
2023-05-08 15:55:34 +02:00
Christian Helmuth
e9a497abe4 depot: update recipe hashes 2023-04-26 11:58:16 +02:00
Stefan Kalkowski
8ae5ae76fb wifi: support building for ARM64
This commit introduces support for building the WLAN driver for ARM
platforms. It makes the WPA supplicant and its support libraries
available for all platforms. It also seperates the PCI parts to
accommodate platforms where other bus protocols are used.

Issue #4813
2023-04-26 11:58:14 +02:00
Josef Söntgen
7b146e0563 lx_emul: use 'dma_address' in 'dma_unmap_sg_attrs'
The way the 'struct page' management is currently implemented it is
not safe to rely on it in case allocations share the same page. This
is in particular true where the virtual address is obtained by
querying the page object for maintaining the CPU caches.

Issue #4813
2023-04-26 11:58:14 +02:00
Josef Söntgen
997e60d52a lx_emul: guard 6.1.x signature changes
Needed for drivers still implemented using Linux 5.x.x.

Issue #4813
2023-04-18 11:09:55 +02:00
Christian Helmuth
b5f79756b3 depot: update recipe hashes 2023-04-17 14:48:30 +02:00
Josef Söntgen
1041ed8773 wifi: use latest available firmware
This commit updates the used firmware images for the iwlwifi device
to latest available ones (supported by the current 6.1.x driver).
It also removes old firmware images that by now are not used anymore.

Fixes #4807.
2023-04-17 14:48:30 +02:00
Josef Söntgen
118fff0472 iwlwifi: limit rx bufs to 2048
Recent devices are configured with 4096 RX pages that lead to an
increased memory usage. For the moment lower the amount to 2048
and treat in potientially lower throughput for more conservative
memory consumption.

Fixes #4801.
2023-04-17 14:48:25 +02:00
Stefan Kalkowski
0bc5bcce4a test/driver_time: fix page-fault of ARMv8a variant
The get_cycles() call within the test doesn't apply to RDTSC
access when running on ARM but to arch_timer_read_counter, which
is an empty function pointer. By setting it to a function that
returns Genode::Trace::timestamp() we can enable the test for ARM.

Issue #4775
2023-04-17 14:48:24 +02:00
Stefan Kalkowski
2269f42e17 lx_emul: update Linux port to 6.1.20
Fix genodelabs/genode#4798
2023-04-17 14:48:24 +02:00
Christian Helmuth
6a80b4bd17 dde_linux: move test/driver_time to virt_linux
Fixes #4775
2023-04-17 14:48:23 +02:00
Christian Helmuth
3a9ef48721 dde_linux: separate virt_linux from wireguard
Preparation to support further hardware-agnostic dde_linux components
(incl. lxip and tests).

Fixes #4774
2023-04-17 14:48:23 +02:00
Christian Helmuth
4016c799f2 lx_emul: move shadowed random.c from pc to generic
Issue #4774
2023-04-17 14:48:23 +02:00
Christian Helmuth
ef5e211fa0 lx_emul: check usb actconfig after potential preemption
Issue #4795
2023-04-17 14:48:23 +02:00
Christian Helmuth
3c45f5c7ab usb: support 32 in-flight packets
- move metadata specific to isochronous transfers from the descriptor
  into the content of USB-session packets
- restore support for 32 in-flight packets in the USB C API

Fixes #4749
2023-04-17 14:48:23 +02:00
Christian Helmuth
217d59ce68 usb: use buffer type in C API
Also, some reasonable sanity checks of client-passed parameters were
added and for-int loops replaced by for-range loops where applicable.

Issue #4749
2023-04-17 14:48:23 +02:00
Christian Helmuth
73771669f1 depot: update recipe hashes 2023-03-13 14:32:54 +01:00
Norman Feske
e9b249b709 Replace use of base/snprintf.h by format library
Issue #2064
2023-03-13 14:32:53 +01:00
Christian Helmuth
bed084c17c Add missing sources to wireguard
The additional files provide Chacha implementation in case
may_use_simd() returns false because in_interrupt() returns true.

Related to issue #4778, commit "lx_emul: track irq state changes"
2023-03-13 14:32:37 +01:00
Christian Helmuth
9ae4fc2371 dde_linux: explicitly list patch files
Using wildcards for selecting patch files clashes with files from
linux.port.
2023-03-13 14:32:37 +01:00
Stefan Kalkowski
6a7a30ceaa lx_emul: unify udelay implementation
Implement udelay for all architectures within common lx_emul code,
remove driver-specific version.

Always do busy looping in udelay and use cpu_relax()
like the original Linux code. Thereby, we profit from architecture specific
instructions (cpu cool down), and jiffies are updated if irqs are on.

Ref genodelabs/genode#4778
2023-03-13 14:32:37 +01:00
Stefan Kalkowski
50541c68ec lx_emul: shadow cpu_relax to update jiffies
There are rare use-cases where cpu_relax is used inside a busy loop
(i2c bus functions), which only will break when the jiffies counter
reaches a specific value.
Because of the cooperative scheduling done in lx_emul, no timer
interrupt will break such a loop. As a workaround, we check for
necessary jiffies updates inside cpu_relax if interrupts are enabled.

Ref genodelabs/genode#4778
2023-03-13 14:32:37 +01:00
Stefan Kalkowski
7e2c546d8e lx_emul: update jiffies during schedule
Whenever a new schedule decision is made in the Linux emulation layer,
we try to update the jiffies counter.

Ref genodelabs/genode#4778
2023-03-13 14:32:37 +01:00
Stefan Kalkowski
c90b61f571 lx_emul: track irq state changes
To be able to check for interrupts being on or off,
the enabling and disabling is tracked in lx_emul.
When interrupts get received, they have to be turned off.

Ref genodelabs/genode#4778
2023-03-13 14:32:37 +01:00
Stefan Kalkowski
eba2c8cf2f lx_emul: set timer irq task to highest priority
If a timer signal got received, first all time updates
have to be done, before other tasks get active.

Ref genodelabs/genode#4778
2023-03-13 14:32:37 +01:00
Stefan Kalkowski
2c1724d7f2 lx_emul: adjust start & stop tick behaviour
Do not start and stop idle ticking within the timer interrupt
routine, but do it around the whole Lx_kit scheduling, which
is always called when Linux code gets active again, either
because of backend signals, interrupts, or timing signals.

This commit implicitly reverts the (incomplete) solution of
issue #4550

Ref genodelabs/genode#4778
2023-03-13 14:32:37 +01:00
Roland Bär
b9b18c92d0 usb_host: deliver UTF-16 strings on request
Linux kernel static functions usb_string_sub() and usb_get_langid() were
made accessible to implement robust string rerieval.

Fixes #4756
Fixes #4757
Fixes #4772
2023-03-13 14:32:37 +01:00
Josef Söntgen
23cc96e661 wifi/pc: add firmware for the Intel AX210 2023-03-13 14:32:37 +01:00
Christian Helmuth
e265cf6d49 depot: update recipe hashes 2023-02-27 08:22:51 +01:00
Sebastian Sumpf
e2c334d6e4 linux: allow more workers when scheduling works
Workers are only summoned by the manager or when there are no workers on
a work queue. In case a work in front of a work queue depends on a work
behind it, a deadlock may occur. To solve this Linux spawns a rescue
worker using timers. Timing of Linux based drivers is currently reworked
and not reliable. Therefore, we increase the number of workers that are
spawned from 1 to 3 per work queue in order to resolve possible
deadlocks.

Fixes #4762
2023-02-27 08:22:50 +01:00
Norman Feske
bdf47785b8 vfs: remove 'file_size' from read/write interfaces
The 'file_size' type denotes the size of files on disk in bytes. On
32-bit architectures it is larger than the size_t, which refers to
in-memory object sizes.

Whereas the use of 'file_size' is appropriate for ftruncate and seek, it
is not a suitable type for the parameters of read/write operations
because those operations refer to in-memory buffers.

This patch replaces the use of 'file_size' by size_t. However, since it
affects all sites where the read/write interface is uses, it takes the
opportunity to replace the C-style (pointer, size) arguments by
'Byte_range_ptr' and 'Const_byte_range_ptr'.

Issue #4706
2023-02-27 08:22:49 +01:00
Christian Helmuth
73f7f8aef6 dde_linux: generalize kmalloc_order() implementation 2023-02-27 08:22:48 +01:00
Sebastian Sumpf
8279038da2 lx_emul: provide _raw_read_lock/unlock functions
Required by i.MX8's gpu driver. '_raw_read_lock' was already present but
not implemented, add it's counter part as well.

issue #4713
2023-02-27 08:22:48 +01:00
Christian Helmuth
de9ea43616 dde_linux: remove custom lx_backtrace (use lx_emul_backtrace) 2023-02-27 08:22:46 +01:00
Josef Söntgen
578a8c9918 wifi/pc: add rtlwifi driver
Due to lacking hardware access the driver was test with one RTL8188EE
based device, namely [10ec:8179] (rev 01), only. As the access to the
PCI config space is restricted the driver loads the non power-saving
FW and the driver port is therefor only tested with that. The
accesses are documented should we choose to support them one way or
another later on.

The 'wifi.run' run script as well as Sculpt served as testing ground
where the driver worked fine so far.

Fixes #4714.
2023-02-27 08:20:45 +01:00
Josef Söntgen
e826095e71 legacy/lx_emul/usb: handle saturated submit queue
Check if we are able to submit the Usb packet before attempting to
allocate it. In case the queue is already full we wait until another
pending packet is freed.

Fixes #4701.
2023-02-27 08:20:45 +01:00
Benjamin Lamowski
faf37b51e7 dde_linux: backport fix for use-after-free reported by GCC 12
On my system, compiling dde_linux fails with `-Werror=use-after-free`.
Backport the fix from mainline to get rid of the issue.

Fixes #4740
2023-02-27 08:20:45 +01:00
Christian Helmuth
25eac6b9e6 depot: update recipe hashes 2023-01-24 12:07:33 +01:00
Tomasz Gajewski
d33139c40a enable ccache for reference Linux kernel
Genode build system allows to easily enable 'ccache' for builds. This
change allows to enable using 'ccache' also for build of reference
Linux kernel used during porting device drivers.

To enable 'ccache' it is enough to pass value of 'CC' variable when
executing Linux build but this build by default depends on time when it
is built which causes 'ccache' misses. To solve this issue additional
flags are passed to make build independent from time, current user and
host on which build is performed.

Issue #4718
2023-01-24 12:07:32 +01:00
Norman Feske
25e4bcefbf vfs: remove 'Io_response_handler' interface
The old 'Io_response_handler::io_progress_response' interface has been
replaced by the 'Vfs::Env::User::wakeup_vfs_user' (issue #4697). The
remaining 'read_ready_response' method is now hosted in the
appropriately named 'Read_ready_response_handler'.

Issue #4706
2023-01-24 12:07:30 +01:00
Stefan Kalkowski
767632e1af dde_linux: remove leftovers of legacy fec_nic_drv
Some relicts in `repos/dde_linux/lib`.

Ref #4651
2023-01-24 12:07:30 +01:00
Christian Helmuth
b59ec55d50 lx_emul: provide irqsave/restore write-lock functions 2023-01-24 12:07:29 +01:00
Christian Helmuth
6d14f5442e lx_emul: provide more pci functions
- pci_dev_present() based on devices on bus
- pci_request_regions() as dummy
- pci_release_regions() as dummy
2023-01-24 12:07:29 +01:00
Norman Feske
ca0d3757cc vfs: make 'File_io_service::read_ready' const
... and replace pointer argument to const reference.

Issue #4706
2023-01-24 12:07:29 +01:00
Norman Feske
ff2176a586 vfs,libc: support write fds in select
By adding a 'write_ready' interface following the lines of the existing
'read_ready', VFS plugins become able to propagate the (de-)saturation
of I/O buffers to the VFS user. This information is important when using
a non-blocking file descriptor for writing into a TCP socket. Once the
application observes EAGAIN, it expects a subsequent 'select' call to
return as soon as new I/O buffer space becomes available.

Before this patch, the select call would always return under this
condition, causing an unnecessarily busy write loop.

Issue #4697
2023-01-24 12:07:28 +01:00
Christian Helmuth
772f89e77f linux.port: xhci patch to fix "unknown event type 37"
Issue #4678
2023-01-24 12:07:27 +01:00
Christian Helmuth
b033b30f95 depot: update recipe hashes 2022-11-29 12:32:49 +01:00
Christian Helmuth
5ff8e7cadf lx_emul: use usb_unlink_urb() in timeout handler
Replace usb_kill_urb() by usb_unlink_urb() in the timeout handler for
control URBs, as usb_kill_urb() may block and is not allowed to be
called in IRQ/bottom half contexts.

Fixes #4681
2022-11-29 12:29:57 +01:00
Stefan Kalkowski
f6825eea5f pci_decode: increase default ram quota
To circumvent problems of the page-table entries getting short on sel4,
increase the RAM quota for this component in all run-scripts.

Fix #4686
2022-11-29 12:29:57 +01:00
Christian Helmuth
c58d799f16 depot: update recipe hashes 2022-11-17 08:00:37 +01:00
Christian Helmuth
25d7970b6f depot: fix README of pkg/usb_modem_drv 2022-11-17 08:00:37 +01:00
Benjamin Lamowski
0e9a49d1cf wifi/pc: add firmware for the Intel AX211
Lenovo Thinkpads with 12th gen Intel i7 CPUs such as the X1 Nano G2 may
contain such a wifi card.

Issue #4663
2022-11-17 08:00:37 +01:00
Benjamin Lamowski
e46a7dd6f5 dde_linux: fix Intel Intel AX211 wifi without MSI-X
Lack of MSI-X support in DDE Linux causes a timeout when the Intel AX211
tries to call back into the driver while loading the PNVM file while
interrupts are still disabled.

With the patch picked up from QubesOS the card works on an X1 Nano G2:
5fcfe0f19e

Issue #4663
2022-11-17 08:00:37 +01:00
Benjamin Lamowski
04efe88044 wifi/pc: add support for loading PNVM files
Intel wifi cards in the AX210 family need additional PNVM firmware to
function properly. Enable the bundling and loading of *.pnvm files.

Issue #4663
2022-11-17 08:00:37 +01:00
Stefan Kalkowski
3082950e74 usb_session: align USB packet allocation correctly
To prevent caching side-effects of USB DMA memory taken from the packet stream
all allocations of USB packets need to be on separated cachelines at least.

Fix genodelabs/genode#4655
2022-11-17 08:00:35 +01:00
Josef Söntgen
b03059b933 dde_linux: allow GPIO state access
To complement the GPIO support allow for setting and reading input
pins. So far this is needed by drivers that attempt to perform I2C
bit-banging via GPIO pins.

Fixes #4624.
2022-11-17 08:00:35 +01:00
Josef Söntgen
85f98d7038 dde_linux: provide __phys_to_pfn for arm64
This macro is needed by the 'pinephone_camera_drv' driver port.

Fixes #4625.
2022-11-17 08:00:35 +01:00
Stefan Kalkowski
f0315b2715 dde_linux: remove legacy fec_nic_drv
Ref genodelabs/genode#4651
2022-11-17 08:00:35 +01:00
Stefan Kalkowski
018c562447 lx_emul: refine configurations & memory attributes
Ref genodelabs/genode#4651
2022-11-17 08:00:35 +01:00
Stefan Kalkowski
9482355c47 lx_emul: allow different irqchip declarations
To enable other irqchip declarations beyond the lx_emul generic code base,
make the ARM specific initialization routine public.

Ref genodelabs/genode#4651
2022-11-17 08:00:34 +01:00
Christian Helmuth
5a06a9dec1 lx_emul: provide pci_try_set_mwi() 2022-11-17 08:00:34 +01:00
Christian Helmuth
d5577421f8 wireguard: create dir before generating asm file
Prevents errors like follows.

  /bin/bash: arch/arm64/crypto/poly1305-core.S: No such file or directory
  make[4]: *** [.../genode/repos/dde_linux/lib/mk/spec/arm_64/wireguard_lx_inc_dirs.mk:17: arch/arm64/crypto/poly1305-core.S] Error 1
2022-11-17 08:00:34 +01:00
Sebastian Sumpf
cd08cd54a4 usb_block_drv: allow for using UAS devices via BOT
Reintroduce:

USB Attached SCSI devices might expose a bulk-only interface
as fall-back at interface 0 and alternate setting 0. This commit
allows for probing all alternate settings of the active interface
to be able to use such devices.

The configuration was extended so that in case the device interface
is known beforehand the driver can be configured accordingly.

Additionally:

Perform configuration reset upon sessions close in order to bring USB
device to a well defined state.

fixes #4494
2022-11-17 08:00:34 +01:00
Christian Helmuth
847266d027 depot: update recipe hashes 2022-10-12 14:31:50 +02:00
Norman Feske
80e2cea4aa dde_linux: enable Intel Alderlake graphics
With this patch, the Intel framebuffer driver works on the Framework
Gen12 laptop.

Fixes #4627
2022-10-12 12:09:35 +02:00
Josef Söntgen
427bd93921 wifi/pc: add FW image for new so devices
The Framework laptop with the 12the Generation CPU contains such a
device.

Fixes #4626.
2022-10-12 12:09:35 +02:00
Christian Helmuth
ee19426f4d lx_emul: validate endpoint for isochronous URB
Thanks to Andreas for the patch.
2022-10-12 12:09:35 +02:00
Stefan Kalkowski
fa124dd340 lx_kit: do not close/re-open IRQ session
Instead of dynamically close/open IRQ session whenever an IRQ
gots masked/unmasked, track the state internally and resp.
deliver an interrupt delayed.
2022-10-12 12:09:35 +02:00
Stefan Kalkowski
6a7247ab44 platform: remove cache attribute from io_mem call
Instead of allowing the client to set a caching attribute
in the io_mem() call of the device interface, which was
only used to decide in between of the memory  being
write-combined or not, remove it from the API.
Instead use the information delivered by the devices ROM,
whether memory from a PCI BAR is prefetchable or not,
to decide whether it is mapped write-combined or not.

Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
b8eab65536 dde_linux: remove legacy usb_host_drv for x86
Remove legacy platform_session API usage from legacy lx_kit/lx_emul

Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
71eefc3315 nic_router_uplinks.run: remove legacy platform_drv
Ref genodelabs/genode#4511
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
5528434fb6 lx_kit & lx_emul: use generic platform API
* Remove wrapper for legacy x86 platform API
* Move PCI configuration space quirks to corresponding driver
  (pc_usb_host_drv, pc_wifi_drv, pc_intel_fb_drv)
* Adapt driver test run-scripts to changed configuration

Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Christian Helmuth
3f1870841c depot: update recipe hashes 2022-09-21 12:19:10 +02:00
Stefan Kalkowski
3d26ce9f8d usb_host: acknowledge all requests asynchronously
Fix genodelabs/genode#4601
2022-09-19 14:00:33 +02:00
Norman Feske
dd9e12601e Remove pseudo targets for building shared libs
Thanks to the change "build: support library builds via lib/<libname>",
shared libraries can now be built directly by the build system.

Issue #4599
2022-09-19 14:00:32 +02:00
Alexander Boettcher
354667bb6d lx_emul: validate USB endpoint and settings param
to avoid pagefaults and general protection faults on access to unpaged memory
regions.

Fixes #4596
2022-08-31 15:10:17 +02:00
Christian Helmuth
4dddc41b71 depot: update recipe hashes 2022-08-31 09:32:09 +02:00
Christian Helmuth
44e2cd14a0 depot: update recipe hashes 2022-08-17 12:03:26 +02:00
Sebastian Sumpf
b5c780993c board: Rename virt_qemu to virt_qemu_<arch>
Instead of having a generic "virt_qemu" board use "virt_qemu_<arch>" in
order to have a clean distinction between boards. Current supported
boards are "virt_qemu_arm_v7a", "virt_qemu_arm_v8a", and
"virt_qemu_riscv".

issue #4034
2022-08-17 12:03:26 +02:00
Christian Helmuth
1dd69eeb6c lx_emul: skip USB config setting if already set
Skip SET_CONFIGURATION requests if the device already has the selected
config as active config. This workaround prevents issues with Linux
guests in VirtualBox and SDC-reader passthrough.

Thanks to Peter for the patch.
2022-08-10 13:33:04 +02:00
Josef Söntgen
3d8c1080b1 dde_linux: remove exited tasks
The commit introduces means to mark a task for destruction that is
removed on the next scheduling cycle. This fixes stack leakage from
dynamic kworker tasks.

Issue #4575.
2022-08-10 13:33:04 +02:00
Josef Söntgen
bc665384c3 dde_linux: free stack on task destruction
Issue #4575.
2022-08-10 13:33:04 +02:00
Stefan Kalkowski
89f9e7a3ee lx_emul: consolidate SMP + NO_HZ_IDLE
* Move common SMP and NO_HZ_IDLE variables and functions into
  generic lx_emul shadow implementations, and integrate them
  into the common lx_emul import rules
* Enable SMP and NO_HZ_IDLE within virt_linux kernel configuration
* Adapt pc drivers and wireguard accordingly
* Use original Linux softirq implementation in wireguard
* Remove erroneous softirq shadow implementation

Ref genodelabs/genode#4540
Ref genodelabs/genode#4562
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
560747c22e lx_emul: active config validation in usb driver
Fix genodelabs/genode#4567
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
92a5fa9bed lx_emul: remove usb device reset in session close
Ref genodelabs/genode#4566
2022-08-10 13:33:03 +02:00
Christian Helmuth
8d7ade5604 lx_emul: fix single USB interface claim/release
Fixes #4565
2022-08-10 13:33:02 +02:00
Stefan Kalkowski
596c20c199 pc: enable SMP and softirq/tasklets in lx_emul
Enables symetric-multi-processor support in the Linux kernel configuration
used as base for the driver ports for PC. This is done to be compliant with
common usage of x86 drivers today.
Moreover, this commit uses the original kernel source for softirq/tasklet
implementation to get rid of the insufficient shadow implementation
in the lx_emul sources.

Ref genodelabs/genode#4562
2022-08-10 13:33:02 +02:00
Stefan Kalkowski
ec1b060fc5 dde_linux: x86 requirements for SMP
Prepare shadow implementations in spinlocks, pagetable defines,
and irq_stack assembler macros to be able to enable SMP on x86/PC.

Ref genodelabs/genode#4562
2022-08-10 13:33:02 +02:00
Stefan Kalkowski
c898a4770b dde_linux: initialize wait_bit subsystem
This is needed to compile kernel/sched/wait_bit.c needed by
x86 SMP as prerequisite for kernel/softirq.c.

Ref genodelabs/genode#4562
2022-08-10 13:33:01 +02:00
Alexander Boettcher
46b487c2f7 pc: consolidate __const_udelay for linux drivers
Use common implementation used by wifi and (not merged) audio driver.
Avoid usage of lib/delay.c since lpj and loop_for_jiffies are not calibrated
for the ported drivers as done on native Linux during boot and leads to wrong
delays for usb and intel_fb.

Issue #4540
2022-08-10 13:33:01 +02:00
Alexander Boettcher
7b4556e546 intel_fb: remove schedule_timeout wrap
Issue #4540
2022-08-10 13:33:01 +02:00
Alexander Boettcher
ce67be5a86 lx_kit: sanitize that solely ep calls schedule()
with expected primary stack.

Issue #4540
2022-08-10 13:33:01 +02:00
Christian Helmuth
fb0fe8617c dde_linux: re-enable -Wformat
Fixes #4542
2022-08-10 13:33:01 +02:00
Christian Helmuth
0f009ecbdd lx_emul: add lx_emul_backtrace()
Issue #4542
2022-08-10 13:33:01 +02:00
Christian Helmuth
3b3eef5307 lx_emul: add devm_ioremap_uc()
Issue #4542
2022-08-10 13:33:01 +02:00
Christian Helmuth
ea8df22dbb dde_linux: fully enable printk format specifiers
The new Lx_kit::Console::print_string() method skips leading
log-level markers in strings if detected.

Issue #4542
2022-08-10 13:33:00 +02:00
Alexander Boettcher
01d7c07920 pc/linux: add contrib patches
- intel_fb: avoid pagefault in fliphandler
- usb_host: avoid hang of usb xhci hardware

Fixes #4556
2022-08-10 13:33:00 +02:00
Alexander Boettcher
757fdba9fd dde_linux: set max timeout for rcu_needs_cpu
Adhere to include/linux/rcutiny.h behaviour, which sets the max timeout
for rcu_needs_cpu. Without the commit, in the most cases the timeout value
is zero (or random since the pointer is on stack uninitialized), which leads
to programming very short timeouts again and again, making the system never
idle.

Issue #4540
2022-08-10 13:33:00 +02:00
Alexander Boettcher
a23f6209ae lx_emul: stop ticking in idle task
Fixes #4540
2022-08-10 13:33:00 +02:00
Christian Helmuth
f14b68202c dde_linux: shadow evdev.c and use event C API
Fixes #4543
2022-08-10 13:33:00 +02:00
Christian Helmuth
924e1d741d lx_emul: cleanup naming of lx_emul_random_gen*
Issue #4544
2022-08-10 13:33:00 +02:00
Martin Stein
1fbe72b7dd lx_emul: fixed types in lx_emul_gen_random_u*
* Rename lx_emul_gen_random_uint lx_emul_gen_random_u32.
* Use genode_uint*_t as return types for the lx_emul_gen_random_u* functions.

Ref #4544
2022-08-10 13:33:00 +02:00
Sebastian Sumpf
64c81e2846 usb_net: Add cdc_ether ECM support
* Enable ECM devices
* Allow disconnect of devices
* Handle link state correctly
* Required by PinePhone's USB modem

issue #4557
2022-08-10 13:32:59 +02:00
Sebastian Sumpf
96b147b63d dde_linux/usb/legacy: only free completed URBs
In case a USB client cancelled URBs, do not free them, wait until the
packets/URBs are acked by the USB session.

issue #4557
2022-08-10 13:32:59 +02:00
Sebastian Sumpf
87aa456bfd lx_emul: remove 'shadow/softirq.c' from common imports
softirq.c implements tasklets that need on the PinePhone cannot be
called directly.

issue #4557
2022-08-10 13:32:59 +02:00
Christian Helmuth
47c924d1f5 pc: use lx_emul_gen_random_bytes() for randomness
Fixes #4544
2022-08-10 13:32:59 +02:00
Johannes Schlatow
1c5db07342 lxip: add warning when schedule_timeout is called
genodelabs/genode#4551
2022-08-10 13:32:59 +02:00
Stefan Kalkowski
0b5ad90bde usb_host: handle control URBs asynchronously
In the Genode C API and the DDE Linux USB host driver, turn control
URBs into asynchronously handled ones.

Fix genodelabs/genode#4535
2022-08-10 13:32:58 +02:00
Josef Söntgen
9393c0136c pc/wifi: prevent calling driver from pthread
Querying the RFKILL state led to execution of the Lx_kit::scheduler by
the pthread running the wpa_supplicant. As this may not happen the
RFKILL state is now solely managed by the driver and only the cached
state is read by the supplicant.

Fixes #4537.
2022-08-10 13:32:58 +02:00
Sebastian Sumpf
c74a8c9fa8 lx_emul: support for 'alloc_pages_exact' 2022-08-10 13:32:57 +02:00
Sebastian Sumpf
dc77417396 lx_emul: add 'virt_range_start' to memory model
Returns the start address of are memory region for given virtual
address.
2022-08-10 13:32:57 +02:00
Sebastian Sumpf
151a5e2d7f lx_emul: add 'pgprot_noncached' to pgtable.h 2022-08-10 13:32:57 +02:00
Josef Söntgen
0ffc55a20a Remove unneeded session_size check
As accommodating the session component object is already taken care of
be the root component implementation, remove the remaining redundant
checks.

Fixes #4521.
2022-08-10 13:32:57 +02:00
Josef Söntgen
9d383037e4 lx_emul: set task 'stack' member
Instead of allocating the stack via 'kmalloc' point it to the actual
stack used by the task. This addresses issues with the USB
host-controller driver where sometimes hub port enumeration is not
working.

Fixes #4522.
2022-08-10 13:32:56 +02:00
Martin Stein
9375e8d010 wireguard: no warning about possible alignm. issue
We locally disable 'address-of-packed-member' warnings because GCC complained
about possible alignment issues when returning a reference to a packed member
as naturally aligned pointer (for some reason only on arm_v8a). We know that
the member is aligned to NETDEV_ALIGN via __attribute__ and that the warning
is therefor unnecessary.

Ref #4519
2022-08-10 13:29:40 +02:00
Martin Stein
48e396913c wireguard: don't always rebuild device.c/netlink.c
We have to correct the CC_OPT_* variable for these files and used to do so via
phony pre-requisite for the corresponding object files because the correction
had to take place after the variable initialization in
import-lx_emul_common.inc and before the creation of the object files. However,
this caused the objects to always rebuild.

This commit fixes this issue by using Make's feature of target-specific
variables instead. The drawback of this solution is that we can no longer
override CC_OPT_* with a modification of its original value but instead have to
override with a completely new value. This is because otherwise, Make would
either complain about recursive assignment or produce an empty value.

Ref #4519
2022-08-10 13:29:40 +02:00
Martin Stein
b1c77dc42b wireguard: enable WARN_STRICT_CONVERSION in lib
The strict conversion warnings were disabled during development when the
contrib code was still compiled with the wireguard lib. Now this isn't
necessary anymore as the contrib code is in the wireguard_lx_inc_dirs lib.

Ref #4520
2022-08-10 13:29:40 +02:00
Martin Stein
6f777f90a8 wireguard: test multiple peers at a time
Extends the wg_reconfig run script to test that the WireGuard component is able
to handle multiple peers at the same time if configured.

Ref #4520
2022-08-10 13:29:40 +02:00
Martin Stein
36d2374ff9 wireguard: exit on invalid configurations
With this commit, the WireGuard component exits with a descriptive uncaught
exception on invalid configurations or when the user attempts to re-configure
attributes that are not re-configurable (private_key, listen_port, interface).

This is particularly important when it comes to the not re-configurable private
key. If the component would just ignore the attempt to override the private
key, the user may come to believe that his old (potentially compromised)
private key is not in use anymore.

The fact that the component now exits instead shouldn't be a problem, as the
user would have to restart the component anyway in order to apply the new
attribute values.

The commit also extends the wg_reconfig run script to test that WireGuard
exits on the attempt to re-configure the private key.

Ref #4520
2022-08-10 13:29:40 +02:00
Martin Stein
86259b998e wireguard: support removing peers
Support removing peers by removing them from the component configuration.
This commit also introduces the wg_reconfig run script that tests adding and
removing single peers.

Ref #4520
2022-08-10 13:29:39 +02:00
Martin Stein
560a166613 wireguard: flags value via enum when adding a peer
I used to set the peer flags to 2 when adding a peer but merely because I
observed that value in my reference Linux. I now found that the flag 1<<1 means
'WGPEER_F_REPLACE_ALLOWEDIPS' and is ignored whenever the peer is new. Anyway,
I keep setting the flag but with the clearer enum name because the wg tool is
doing it as well when adding new peers and we want to stay close to how the
original code interacts.

Ref #4520
2022-08-10 13:29:39 +02:00
Christian Helmuth
871ee04ed6 wireguard: enable wg_fetchurl.run on sel4 2022-08-10 13:29:39 +02:00
Christian Helmuth
a037fac5c5 depot: update recipe hashes 2022-05-31 10:52:11 +02:00
Stefan Kalkowski
e6602d527c lx_emul: remove duplication of ZERO_PAGE for ARM
The extra definition introduced by commit:
"lx_emul & arm: define ZERO_PAGE" re-defined the macro included
by a header of the contrib sources. This commit removes the
contrib header and defines thereby missing macros.
2022-05-31 10:52:11 +02:00
Stefan Kalkowski
d213cfa897 lx_emul: fix spinlock header for ARM
Fixes wrong atomic_*(ptr) usage with u32 pointer introduced by
commit "lx_emul: eliminate wrong include pathes". Atomic read or
write is nt needed in our case, we always schedule cooperatively.
2022-05-31 10:52:11 +02:00
Martin Stein
aea993b96a wireguard: sculpt package
Introduces the pkg/wireguard archive that depends on the new src/wireguard
archive and deploys one WireGuard component with an empty configuration (can
be configured by the user via a launcher, for instance).

Fixed #4519
2022-05-31 10:52:00 +02:00
Martin Stein
520742cf3e wireguard: generic target.mk
Introduce an arch-specific wireguard lib that contains all code from the
former arch-specific target.mk files. This allows us to create a generic
target.mk that merely depends on the library and a dummy.cc file. The latter
ensures that building/linking of the target isn't skipped by the build system.

Ref #4519
2022-05-31 10:52:00 +02:00
Martin Stein
83408ef35c wireguard: rename wireguard lib
The wireguard library's purpose is having a separate INC_DIR setting for the
files that need Linux include paths that would clash with Genode include paths.
Therefore, the name wireguard_lx_inc_dirs is more descriptive. Furthermore,
this allows us to create a new arch-specific wireguard lib in a future commit
in the course of preventing arch-specific target.mk's (a commonly used
approach in Genode).

Ref #4519
2022-05-31 10:52:00 +02:00
Christian Helmuth
3105fa9e0f depot: update recipe hashes 2022-05-25 12:23:04 +02:00
Stefan Kalkowski
115ac58fd0 lx_emul: increase usb driver dynamic robustness
* Prevent page-faults when the active interface of a device got unset
  during elimination of the device
* Resets devices, where a corresponding session got closed to
  be re-useable when a new session gets opened

Ref #4512
2022-05-25 12:23:03 +02:00
Martin Stein
03349f9fff lx_emul/random: re-seed the local PRNG regularly
With this commit, the Xoroshiro128+ PRNG in lx_emul/random.cc gets wrapped
by a new class that automatically re-seeds the PRNG with jitterentropy every
1024 * 1024 + random(0..4095) bytes of generated output.

Ref #4397
2022-05-25 12:23:03 +02:00
Martin Stein
ab0bce77ec lx_emul & wireguard & wifi: centralized random.cc
Both the Wifi driver and the WireGuard port used local implementations for
their source of randomness. Wifi used a Xoroshiro128+ PRNG for rapid generation
of random values but initialized this PRNG always with the same static seed
value. WireGuard, in contrast, requested each random byte directly from the
jitterentropy lib, which is considered to be very time intensive.

This commit removes the local variants of random.cc and introduces a new
centralized lx_emul/random.cc . The new variant combines the former approaches,
so, that jitterentropy is accessed only in order to generate a random seed for
a Xoroshiro128+ PRNG. Front-end requests for random values are then fulfilled
efficiently via the PRNG.

:Warning:

The output of the Xoroshiro128+ PRNG that is used in the new implementation of
the lx_emul randomness functions has known statistical problems (see
https://en.wikipedia.org/wiki/Xoroshiro128%2B#Statistical_Quality).
Furthermore, the integration of Xoroshir128+ with the lx_emul code was not
reviewed/audited for its security-related properties, so far, and has the
known deficiency of seeding the PRNG only once during initialization. Thus,
we strongly advise against the use of the lx_emul randomness functions for
security-critical purposes.

Ref #4397
2022-05-25 12:23:03 +02:00
Stefan Kalkowski
f652657d9d Consolidate USB test run-scripts
Ref genodelabs/genode#4511
2022-05-25 12:23:03 +02:00
Martin Stein
4869349d57 lx_emul & x86: no unnecessary memset of zero page
Ref #4397
2022-05-25 12:23:03 +02:00
Martin Stein
a845dffa63 dde_linux: port of WireGuard kernel module
A userland component that ports the Linux WireGuard kernel module (originally
from kernel version 5.14.21) and integrates it via a NIC session (public
network side) and an Uplink session (private network side). The
WireGuard-specific device configuration is done through the component
configuration. The port is done using lx_emul, lx_kit and the virt_linux
targets. The commit adds also 4 corresponding run scripts of which 3 are fully
automated of which 1 is added to the autopilot.

:Warning:

Although in principal functioning, the WireGuard port has not been exposed to a
sufficient amount of real-world testing, so far. Therefore, we strongly
recommend not to use it in any security-critical scenarios! There is no
guarantee that the port meets any of the security goals pursued by the
WireGuard protocol or other WireGuard implementations!

Ref #4397
2022-05-25 12:23:03 +02:00
Martin Stein
f84e512ded virt_linux: support arm_64
This feature was motivated and used only by the WireGuard port, so far.

Ref #4397
2022-05-25 12:23:02 +02:00
Martin Stein
cded594346 lx_emul & arm: define ZERO_PAGE
The implementation was copied from the already existing LX-emul implementation
for x86 but the commit additionally page-aligns the array that serves as
backing store for the zero page as we assume this to be expected by the contrib
code. However, this commit doesn't apply the alignment also to the x86
implementation as we agreed, that this should be done in a separate commit.

Ref #4397
2022-05-25 12:23:02 +02:00
Stefan Kalkowski
c049aed44f lx_emul: eliminate wrong include pathes
Fix genodelabs/genode#4510
2022-05-25 12:23:02 +02:00
Stefan Kalkowski
081b878bbd lx_emul: align zero page to page size
Fix genodelabs/genode#4509
2022-05-25 12:23:02 +02:00
Alexander Boettcher
38e5972e45 Remove legacy intel display driver
The driver is superseded by the new driver located in the 'pc'
repository.

Issue #4508
2022-05-25 12:23:02 +02:00
Josef Söntgen
f146f9acb6 Move wpa_supplicant to own port
Issue #4508.
2022-05-25 12:22:10 +02:00
Josef Söntgen
fd14cf9f1e Move libnl to own port
Issue #4508.
2022-05-25 12:22:10 +02:00
Josef Söntgen
573cabaf24 Remove legacy wifi driver
The driver is superseded by the new driver located in the 'pc'
repository.

Fixes #4508.
2022-05-25 12:22:10 +02:00
Johannes Schlatow
55795127a3 lx_emul(arm): add Cortex-A9 irqchip
genodelabs/genode#4499
2022-05-25 12:22:09 +02:00
Johannes Schlatow
547db8531b lx_emul: use generic preempt_count accessor
genodelabs/genode#4499
2022-05-25 12:22:09 +02:00
Johannes Schlatow
4cdba04c88 lx_emul: fix spinlock implementation for ARM
Since Linux does not use the arch-independent spinlock structs for ARM,
we must use different members when accessing the lock value.

genodelabs/genode#4499
2022-05-25 12:22:09 +02:00
Johannes Schlatow
ba04aab75f lx_emul: initialise preempt_count for ARM 32bit
genodelabs/genode#4499
2022-05-25 12:22:09 +02:00
Stefan Kalkowski
6731067116 lx_emul: add basic ARM 32-bit support
genodelabs/genode#4499
2022-05-25 12:22:09 +02:00
Josef Söntgen
e313059dd5 lx_emul_common: prevent override of CC_OPT_$(1)
This allows for extending such compilation unit specific options
for down by users of the library.

Issue #4500.
2022-05-25 12:19:33 +02:00
Stefan Kalkowski
d0694b3e0b platform_drv: separate devices info from config
Fix genodelabs/genode#4491
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
18dcf8af68 Remove NIC server role from drivers
* Remove "mode" attribute utility and XML description
* Remove unused nic/stat.h header

Fix genodelabs/genode#3961
2022-05-25 12:19:31 +02:00
Stefan Kalkowski
56831a247f usb_net_drv: remove deprecated server mode
Ref genodelabs/genode#3961
2022-05-25 12:19:31 +02:00
Christian Helmuth
0768185fea depot: update recipe hashes 2022-04-28 11:52:06 +02:00
Stefan Kalkowski
af0531398a lx_emul: cleanup URBs in USB driver in release
* Claim and release USB interfaces
* Collect URBs in flight in anchor list
* When releasing interfaces, wait until all
  anchored URBs finally got killed successfully

Fix genodelabs/genode#4483
2022-04-28 08:02:33 +02:00
Stefan Kalkowski
4b983f92c5 lx_emul: support execution till condition applies
In rare cases it is necessary to execute Linux contributed code
until certain work is finished, e.g. when in a synchronous RPC call,
a session construction or destruction a result is needed. Therefore,
we introduce a new lx_emul function called lx_emul_execute_kernel_until.

Ref genodelabs/genode#4483
2022-04-28 08:02:33 +02:00
Josef Söntgen
2fd2b7d628 lx_kit: map I/O mem with proper offset
In case multiple devices shared the same memory-mapped I/O page
we have to take the offset into account. This commit fixes the
'pc_usb_host_drv' on the Thinkpad X201 where the two EHCI host
controller share the some I/O memory page.

Fixes #4477.
2022-04-28 08:02:33 +02:00
Christian Helmuth
b66650c2e8 lx_emul: remove forward declaration in clocksource 2022-04-13 15:17:49 +02:00
Christian Helmuth
8ece236635 depot: update recipe hashes 2022-04-13 11:54:46 +02:00
Alexander Boettcher
40a5eabf88 pc: shadow schedule_timeout in intel_fb_drv
Issue #4450
2022-04-13 09:29:05 +02:00
Christian Helmuth
eb895975e2 lib/vfs: clear BUILD_ARTIFACTS in dummy targets 2022-04-13 09:29:05 +02:00
Josef Söntgen
2e47eb6fb9 dde_linux: use new wifi driver in uplinks test
Issue #4455.
2022-04-13 09:29:04 +02:00
Christian Helmuth
520a08b205 Remove pkg runtime for pc_wifi_drv/legacy_pc_wifi_drv
Both runtimes were broken due to missing requirement for "Uplink"
service and thus unused.

Issue #4455
2022-04-13 09:29:04 +02:00
Josef Söntgen
e7e7893f22 pc: update wifi driver
The driver falls in line with the previous 'legacy_wifi_drv' component
where the ported wireless LAN stack and device driver is encapsulated
in a library. This library in return is used by the 'Libc::Component'
providing the necessary environment for the 'wpa_supplicant'.

In constrast to the old driver a 'wifi' VFS plugin is in charge of
initalizing the 'Lx_kit::Env' prior to executing any static
constructors.

Fixes #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
8056811b4f Rename wifi_drv to legacy_wifi_drv
Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
0bd1a53326 dde_linux: add linux-firmware port
Move 'linux-firmware' portion from 'dde_linux' into its own port,
while it is used by the upcoming new WLAN driver keep it in place
for the legacy one.

Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
56427da393 wifi: add interface query functions
Various libraries, like libnl and wpa_driver_nl80211, used hardcoded
values for the interface index (ifindex) and name (ifname).
To accomdate the legacy as well as the upcoming new driver we add
functions to query these information where at least the index differs.

Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
c1fea8c002 wpa_supplicant: remove hard lx_printf dependency
Not needed and breaks 'pc_wlan_drv'.

Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
447f3fcb35 libnl: use MSG_DONTWAIT
Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
f5eddce1d1 wifi/socket_call: add MSG_DONTWAIT
Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
24c0bb95ef pc_lx_emul: allow for being used in a library
The location of the used 'source.list' file is hard-coded and will not
work when the ported driver is implemented as a shared library. For
this use-case provide means to set the location differently.

Issue #4455.
2022-04-13 09:29:04 +02:00
Josef Söntgen
b2e11f1e9e pc_lx_emul: add __put_user
Issue #4455.
2022-04-13 09:29:03 +02:00
Josef Söntgen
edb08770dc lx_emul: initialize task members needed by network
Those members are access via static inline functions in the network
core code and from certain protocols, e.g. AF_NETLINK.

Issue #4455.
2022-04-13 09:29:03 +02:00
Josef Söntgen
77cdceabaa lx_emul: add additional atomic64 functions
Needed by the WLAN driver on x86_32.

Issue #4455.
2022-04-13 09:29:03 +02:00
Josef Söntgen
0c617366e5 lx_emul: get pid from task
Issue #4455.
2022-04-13 09:29:03 +02:00
Josef Söntgen
4b43b5c1c1 lx_kit: handle %hu specifier in console
Prevent '<warning unsupported format specifier>' when encountering
'%hu'.

Issue #4455.
2022-04-13 09:29:03 +02:00
Josef Söntgen
ffea0bf857 lx_kit: remove execution of static ctors
In case where the ported driver or protocol stack is executed from
an already managed environment, e.g. the libc, the execution
of the static constructors will be performed at the appropriate
time.

Issue #4455.
2022-04-13 09:29:03 +02:00
Christian Helmuth
18c5f1e90d tool/run: improve disk image size automatic
Set disk size to 1.5 times the run folder size and shrinked later to
real content.

Thanks to Roland for the patch.
2022-04-13 08:08:00 +02:00
Christian Helmuth
1b4cd93dc2 lx_kit/x86: clamp PCI interrupt PIN to 1
If any PCI device reports 0 as interrupt PIN, drivers may try to force
MSI setup (e.g., xhci). So, we clamp the interrupt PIN to 1 to let
drivers finish initialization and don't bother the platform driver.
2022-04-13 08:08:00 +02:00
Josef Söntgen
c6cc43f0e4 lx_kit/x86: use virtual information for PCI
This commit removes all physical notions from the information given
to the Linux kernel regarding PCI BARs.

With the exception for the host bridge that needs to be located at
'0:00.0' as required by the Intel FB driver, all other devices are
announced at the PCI BUS in an ascending order.

Additionally the MMIO regions start at 1 GiB and are capped at 32 bit
to prevent unnecessary access to 64 bit addresses.
2022-04-13 08:08:00 +02:00
Alexander Boettcher
c0560ab0cb pc: update intel display driver
Fixes #4450
2022-04-13 08:08:00 +02:00
Alexander Boettcher
6d924d3285 lx_kit(x86): restrict usb heuristics to usb
Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
b6c1b7806b lx_kit: io_mem_map with write combined support (x86)
Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
6f64917e8f lx_emul: add ioremap_cache/_wc to shadow/asm/io.h
used by intel_fb for write combined allocation

Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
8dbcda9943 lx_emul: x86_32 shadow header adaptations
required for upcoming intel display driver in 32bit

Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
7c3f010cd6 lx_emul: shadow asm/uaccess_32/64.h
Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
cdf1b39c5e lx_emul: shadow asm/special_insns.h
wbinvd is not supported in user mode

Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
88a6a9d628 lx_emul: add missing fpu/api.h to shadow pgtable.h
Issue #4450
2022-04-13 08:07:59 +02:00
Alexander Boettcher
279f038b9e lx_emul: shadow asm/cpufeature and asm/page_64
Issue #4450
2022-04-13 08:07:58 +02:00
Josef Söntgen
fd8df3a623 lx_emul: handle page refcount 2022-04-13 08:07:58 +02:00
Alexander Boettcher
4474460377 lx_emul: __alloc_pages support in shadow/mm/page_alloc.c 2022-04-13 08:07:58 +02:00
Alexander Boettcher
dd10e5d977 intel_fb: move to legacy_intel_fb
Move the depot recipe and consistently name the old drivers with a legacy_
prefix as done with the old usb_host driver.

Issue #4450
2022-04-13 08:07:58 +02:00
Norman Feske
33c71d1d2c usb_host: change error to warning message
An insufficient session quota as offered by a USB client is not an
erroneous situation of the USB driver.
2022-04-13 08:07:57 +02:00
Christian Helmuth
d182b20705 build: ensure rules with pipes might fail
.SHELLFLAGS is extended by option pipefail to make pipes fail if any pipe
element fails. As .SHELLFLAGS is exported into sub-make instances it
must be unexported before calling third-party build systems recursively.
2022-03-21 13:43:13 +01:00
Christian Helmuth
7da691b52a pc/usb: defer startup until config is available
The commit also adds lx_kit/initial_config.h as utility.
2022-03-21 13:42:17 +01:00
Stefan Kalkowski
e95f0a409d lx_emul: add implementation for Genode's USB C-API
Fix #4444
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
9713014130 dde_linux: add virt_linux lx_emul flavor
To support device-less protocol-stacks only ports, we can use a
Virt I/O Linux kernel flavor, and export the lx_kit/lx_emul parts
not depending on platform API and devices.

Ref #4397
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
35cf8aada4 lx_emul(x86): fill zero page with zeroes
Ref #4397
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
13c4abf4ad lx_emul: add static_cpu_has macro to shadow header
Ref #4397
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
0fa695dbd7 lx_kit/lx_emul: make memory backend configureable
* Drivers have to use lx_kit/memory_dma.cc
* Protocol-stacks use lx_kit/memory_non_dma.cc
* Moreover the device-dependent lx_emul parts get removed
  from the common lx_emul import rules

Fix #4443
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
5c71a8d74d lx_emul: extract common lx_emul import makefile
Fix #4442
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
b80146a6f7 genode_c_api: unify shared dataspace callbacks
* Unifies the declaration of callbacks which manage driver/client
  shared dataspaces
* Move the Linux driver-specific callback implementation to the
  lx_emul library from the PC's USB host driver

Fix genodelabs/genode#4439
2022-03-09 10:55:16 +01:00
Stefan Kalkowski
600997d8d6 usb_hid_raw: don't use deprecated qemu option
* Use -device instead of deprecated -usbdevice
* Use the same xhci model as in usb_hid_reconnect
2022-03-07 16:43:12 +01:00
Stefan Kalkowski
2a35c8f9e7 lx_emul: add page macros to x86 shadow headers
* Add page_to_phys and dummy macro for pgprot_device

Original commit provided by Josef Soentgen

Ref genodelabs/genode#4438
2022-03-07 16:43:12 +01:00
Josef Söntgen
2760b67902 lx_kit/lx_emul: add I/O port support
Ref genodelabs/genode#4438
2022-03-07 16:43:12 +01:00
Christian Helmuth
2b3370c8d8 depot: update recipe hashes 2022-02-28 11:46:35 +01:00
Stefan Kalkowski
14d1ca17a9 Use new pc_usb_host_drv in all recipes and tests
* Switch from the legacy usb_host driver to the new PC version
  in recipes and automated tests
* Update documentation snippets
* Remove outdated, unused usb_rndis run-script

Fix genodelabs/genode#4416
2022-02-21 15:47:50 +01:00