Commit Graph

3288 Commits

Author SHA1 Message Date
Norman Feske
14d3c4cb5e Remove Cpu_session::State_access_failed exception
This patch removes the exception formerly thrown by 'Cpu_thread::state'
and turns the 'Thread_state' structure into a plain compound type w/o a
constructor.

Issue #5245
Fixes #5250
2024-06-20 12:56:20 +02:00
Johannes Schlatow
16b863fc6e tool/run: use xmlcatalog for xsd file paths
With libxml2 >= 2.13, the `-path` argument can no longer be used for
setting search paths for xsd files. Instead, we use an XML catalog to
replace genode:// URIs with absolute paths.

Fixes #5248
2024-06-20 12:56:20 +02:00
Norman Feske
0d7d60a1f4 Remove exceptions from Pd_session interface
This patch replaces exceptions of the PD session RPC interface with
result types.
The change of the quota-transfer RPC functions required the adaptation
of base/quota_transfer.h and base/child.h.
The 'alloc_signal_source' method has been renamed to 'signal_source'
to avoid an exceedingly long name of the corresponding result type.
The Pd_session::map function takes a 'Virt_range' instead of basic-type
arguments.
The 'Signal_source_capability' alias for 'Capability<Signal_source>' has
been removed.

Issue #5245
2024-06-20 12:56:19 +02:00
Martin Stein
a935a733ab ping: support reporting results
This feature simplifies automated testing. It was added to enable the creation
of the test/nic_router_uplink component.

Ref #5192
2024-06-20 12:56:19 +02:00
Norman Feske
24342db476 base/signal.h: remove pointers from API
This patch updates the signal API to avoid raw pointers, and
replaces the Context_already_in_use and Context_not_associated
exceptions by diagnostic messages.

Fixes #5247
2024-06-20 12:56:19 +02:00
Norman Feske
8a0689d832 Remove Pd_session::Invalid_signal_source exception
While changing 'Pd_session::alloc_context', this patch also tightens the
type of the imprint argument.

Issue #5245
2024-06-20 12:56:19 +02:00
Norman Feske
a52c2ce141 Remove exceptions from TRACE session interface
- Use attempt pattern for error handling
- Replace lookup of pointers by with_ pattern
- Remove virtual Trace::Session methods
- Merge client.h into connection.h
- Update coding style of test/trace

Issue #5245
2024-06-20 12:56:19 +02:00
Norman Feske
7de2f57ef2 Remove Xml_node::attribute accessors
This patch removes the two 'Xml_node::attribute' accessors along with
the 'Nonexistent_attribute' exception.

Issue #5245
Fixes #5246
2024-06-20 12:56:19 +02:00
Martin Stein
84bbde2879 nic_router: fix interface-local quota reporting
The router used to ignore the value of the <report quota=".."/> attribute when
it came to determining whether an interface's report is empty or not.
Therefore, merely configuring <report quota="yes"/> didn't cause interfaces
(and their quota) to show up in the report. Instead, interface quota was
reported as side effect of <report stats="yes"/>. The commit fixes this
inconsistency with the README.
2024-06-20 12:56:19 +02:00
Martin Stein
09b3fa389d nic_router: destroy timed out ARP waiters
The only object that is dynamically allocated by a network interface and that
was not equipped with a self-destruct timeout was the ARP waiter. This commit
closes this gap by adding a timeout to each ARP waiter that is set to 10
seconds by default but can be configured via the new <config> attribute
'arp_request_timeout_sec'.

Ref #4729
2024-06-20 12:56:19 +02:00
Martin Stein
20371d0445 nic_router: drop closed tcp links immediately
RFCs recommend to keep TCP connections for a certain time even after they
finished a close handshake, AFAIK, in order to be able to recognize astray
packets when they arrive later. This seems overambitious especially when in
the context of the router where session quota is pretty limited. Therefore,
this commit drops this final timeout and drops closed connections immediately.

Ref #4729
2024-06-20 12:56:19 +02:00
Martin Stein
58726a6707 nic_router: lower non-open tcp timeout to 30 sec
The previous value of 60 seconds was never observed in real-time scenarios and
UDP, for instance always used a timeout of 30 seconds without causing issues.
Note that this applies only to TCP connections in a state other than
ESTABLISHED, i.e., while it is still safe to early-drop the connection.

Ref #4729
2024-06-20 12:56:19 +02:00
Martin Stein
0a33168733 nic_router: mark tcp open only with full handshake
The TCP connection state "ESTABLISHED" (in the router "OPEN") is a privileged
one for peers because it lasts very long without any peer interaction (in the
NIC router it's only 10 minutes, but RFCs recommend not less than 2 hours and
4 minutes). Furthermore, TCP connections in this state are normally not
available for early-drop on resource exhaustion. This means that this state
binds resources to a connection potentially for a long time without the option
of regaining them under stress. Therefore, this state should be entered with
care.

Up to now, the router marked a TCP connection with this state as soon as it had
seen one matching packet in both directions, which is rather quick. However,
implementing a very precise tracking of the exact TCP states of both peers and
only marking the connection "ESTABLISHED" when both peers are "ESTABLISHED" is
a difficult task with lots of corner cases.

That said, this commit implements a compromise. The router now has two flags
for each peer of a TCP connection - FIN sent and FIN acked - and sets them
according to the observed TCP flags. The "ESTABLISHED" state is entered only
when FIN acked is set for both peers (without having observed an RST or FIN
flag meanwhile).

Ref #4729
2024-06-20 12:56:19 +02:00
Martin Stein
93c3f6371b nic_router: remove reference utilities
The Reference and Const_reference utility were introduced in order to express
that something is a reference (no null value) but can be changed dynamically
(not possible with built-in C++ references). However, the idea of preventing
every possibility for null pointer faults, with which the router was built
initially, has not prevailed and using pointers instead of the utility saves
logic and makes the code more readable to other C++ developers.

Ref #4729
2024-06-20 12:55:47 +02:00
Martin Stein
f7f171e457 nic_router: fix leak on domain deinit
The deinitialization method of Domain used to rely on Domain::with_dhcp_server
in order to dissolve and destroy a present DHCP server. However, this method
skipped calling its functor argument also when there was a DHCP server but an
invalid one. This commt replaces the with_dhcp_server with a pointer null-check
in order to fix the leak.

Ref #4729
2024-06-20 12:54:31 +02:00
Martin Stein
c96150bc70 nic_router: smarter emergency free on exhaustion
Re-implements an emergency freeing of resources on exhaustion of session quota.
In contrast to the past one, the new algorithm is executed directly where the
exhaustion occurs. Instead of interupting the packet handling and restart it
from the beginning after the freeing action, packet handling is now continued
at the point of exhaustion (if enough resources could be freed). Furthermore,
the new algorithm frees only 100 objects (instead of 1024) at a max as we found
this to better match real-life observations. And finally, the router now drops
ICMP first, then UDP, then TCP - as this better reflects priorities - and
refrains from dropping TCP connections in the ESTABLISHED state. If the router
cannot free a sufficient amount of resources, the packet that caused the
exhaustion is dropped with a warning (verbose_packet_drop="yes").

Ref #4729
2024-06-20 12:54:31 +02:00
Martin Stein
ac42ade48c nic_router: remove use of exception handling
Remove the use of C++ exception as much as possible from the router as C++
exception handling can be resource intensive and can make code hard to
understand.

This also removes the garbage collection that the router used to do when a
session ran out of quota. This is motivated by the fact that the garbage
collection was rather simple and removed connection states regardless of their
current state, thereby causing broken connections. The change is part of this
commit as the approach to integrating garbage collection relied strongly on
exception handling.

The user story behind removing garbage collection: The router emergency-dropped
an established TCP connection (with NAPT) and on the next matching packet
re-created it with a different NAPT port, thereby breaking the connection. With
this commit, existing connections are prioritized over new ones during resource
exhaustion and the packets that attempt to create a new connection in such a
state are dropped with a warning in the log (verbose_packet_drop="yes").

Note that the state resolves itself with time as existing connections time out
or are closed by peers.

Ref #4729
2024-06-20 12:54:31 +02:00
Martin Stein
0faec6afaa net/port.h: default constructor
Adds default constructor to Net::Port that initializes the value to 0. This
allows for using Net::Port with the Genode::Attempt utility.

Ref #4729
2024-06-20 12:54:30 +02:00
Johannes Schlatow
0aafec038d platform: pass reserved memory update to IOMMU
Only add default mappings on IOMMU construction and on reserved-memory
updates.

Issue #5232
2024-06-20 12:54:30 +02:00
Johannes Schlatow
6912dd62fa platform: handle reserved memory on devices update
Reserved memory regions must be excluded from the corresponding DMA
allocators irrespective of whether the device is in use. Otherwise, an
early allocation of DMA buffers may use the reserved memory regions of a
late acquired device.

Fixes #5232
2024-06-20 12:54:30 +02:00
Norman Feske
ef385696f6 base/child.h: remove Nonexistent_id_space exception
This exception got introduced as a mere convenience for implementers of
'Child_policy' but required a special case in the base library.
Following the goal of eliminating exceptions from the base system,
this patch removes it by making a server_id_space mandatory.

Issue #5245
2024-06-20 12:54:30 +02:00
Alexander Boettcher
8b0a16d750 driver/platform: re-configure bridges on resume
Fixes #5241
2024-06-20 12:54:30 +02:00
Alexander Boettcher
3216733a05 driver/platform: remember bridge configuration
by evaluating the pci decode's 'devices' ROM and storing the information in
the pci config list model representation.

Issue #5241
2024-06-20 12:54:30 +02:00
Alexander Boettcher
0c97c13562 pci_decode: report pci bridge configuration
as setup by firmware after boot. The information will/can be used by the
platform driver to re-program bridges after a system suspend/resume cycle.

Issue #5241
2024-06-20 12:54:30 +02:00
Norman Feske
b9594c2ae8 gui_session,nitpicker,testnit: update coding style
- Replace 'typedef' by 'using'
- Avoid plain pointers
- Import Genode namespace into Gui::
- Use enum class
- Use Attr struct for passing multiple attributes
- Turn testnit into proper Genode::Component
  - Use distinct types for top-level and child views
  - Remove dependency from timer
  - Use util/geometry.h
2024-06-20 12:54:30 +02:00
Norman Feske
4969c7cdb0 Reduce code duplication by using Point::from_xml 2024-06-20 12:54:30 +02:00
Norman Feske
c629c54153 Make util/geometry.h C++20 friendly
- Move header to base/include to make it applicable for base types
  like 'Affinity' down the road.
- Represent 'Rect' as typle of point and area, which is the most
  common form of initialization, creates in valid 'Rect' by default.
- Turn Point, Area, and Rect into compound types, making x, y, w, h, at,
  area accessible without a method call
- 'Rect::Compound' function for constructing a 'Rect' from two points,
  replacing a former constructor
- Use result type 'Rect::Cut_remainder' instead of out parameters.

Fixes #5239
2024-06-20 12:54:30 +02:00
Norman Feske
bb06d879aa os: make 'Genode::Color' C++20 friendly
This patch turns 'Color' from a class to a POD type by replacing
the constructors by the named create functions 'rgb', 'clamped_rgb',
and 'clamped_rgba'. It thereby enables the initialization of Color
values using { .r = ... } syntax and makes the type usable in const
expressions.

It also narrows the type for color components and alpha values to
uint8_t. So possible integer overflows of computed values are detected
by -Wconversion.

As 'Color::rgb(0, 0, 0)' is repeatedly used as a default value, the
patch adds the 'Color::black()' function.

Fixes #5238
2024-06-20 12:54:30 +02:00
Norman Feske
fe613fa9a3 Rename src/drivers to src/driver
Issue genodelabs/genode#4420
2024-06-20 12:54:30 +02:00
Norman Feske
8943a3e949 Remove '_drv' suffix
Issue #4420
2024-06-20 12:54:30 +02:00
Norman Feske
940a1912fa os: replace pkg/pc_nic by pkg/nic_uplink
This enables the combination of the nic_uplink component with any driver
pkg featuring a runtime file. This is already the case of the pc_nic
driver.

This is a preparatory step for issue #4420.
2024-06-20 12:54:29 +02:00
Norman Feske
00844efd2f test/terminal_expect_send: warn on excess chars
This patch adds a warning on the occurrence of overly long lines and
drops characters in this case.

Fixes #5108
2024-06-20 12:54:29 +02:00
Norman Feske
eca864175c Remove Gui::Session::session_control
This functionality has long been superseded by the window
manager/layouter.

Fixes #5160
2024-06-20 12:54:29 +02:00
Johannes Schlatow
78a6d2bd0c os: fix multiplication wrap-around in Area::count
When having a maximized terminal window, a suspend was causing an
invalid mode change at nitpicker. This triggered a huge resource request
in nitpicker because the RAM-quota check was rendered ineffective by a
wrap-around during unsigned multiplication.

Issue genodelabs/genode#5180
Fixes genodelabs/genode#5201
2024-06-20 12:54:29 +02:00
Timo Nicolai
dc5990ce4a black_hole: add missing report to config.xsd
Should have been added by 14d0b72f52.

Issue #5233
2024-06-20 12:54:29 +02:00
Christian Helmuth
4b9f4d8c38 depot: update recipe hashes 2024-05-30 08:20:21 +02:00
Christian Helmuth
b6aa021d76 internet_checksum.run: restrict tshark protocols
Restrict checksum checking in output.pcap to ip,tcp,udp,icmp.

Issue #4636
2024-05-29 09:18:49 +02:00
Christian Helmuth
95a7e7a840 internet_checksum.run: log values on error
Issue #4636
2024-05-29 09:18:49 +02:00
Norman Feske
98ecde5b7b test/platform_drv: stabilize final state
The test reverts the platform drivers' config at the end of the test
to an empty state. However, this state should still contain a default
policy (analogyously to the initial state). Otherwise, the platform
session of the test program will (sometimes) become invalid just before
successfully finishing the test.
2024-05-29 09:18:49 +02:00
Norman Feske
4801cbf47c drivers_interactive-pc: ram for event_filter
Slightly balance the ram quota of the drivers subsystem in favor of the
event_filter for letting demo.run test succeeed on sel4.
2024-05-29 09:18:48 +02:00
Norman Feske
f171bc5050 Remove loader and qpluginwidget
The original use cases of the loader have long been covered by the
dynamic init. The only substantial client of the loader remained to be
the qpluginwidget. However, the qpluginwidget was supported only by the
Arora web browser. But the blending of plugins with websites ultimately
remained a tech demo, and Arora has been replaced by Falkon.

Fixes #5229
2024-05-29 09:18:12 +02:00
Christian Helmuth
e90f6988d8 pci_decode: disable MSI/MSI-X capabilities
Default disabled initialization prevents follow-up errors if one
capability is already enabled on boot, but platform_drv decides to
enable the other one. The PCI spec explicitly states that "Behavior is
undefined if both MSI and MSI-X are enabled simultaneously".

Fixes #5228
2024-05-29 09:18:12 +02:00
Norman Feske
cfd013a01a os/include: use C++20 function template syntax
Issue #5227
2024-05-29 09:18:12 +02:00
Alexander Boettcher
b33afb24d7 nova: adjust to cmdline changes of kernel
- no need to explicitly switch off vga anymore
- use vPID for VMs which improves TLB usage if multiple vCPUs on same
  pCPU is used, which happens to happen on Sculpt.
- support for mwait by nova kernel, which is off by default

Issue #5206
2024-05-29 09:18:11 +02:00
Alexander Boettcher
bfddf08f75 ahci: make robuster during resume
During resume the waiting for Cmd::St takes ~2s on a T460p with Intel
AHCI SSD attached. According to the Serial ATA AHCI Spec. wakeup can take
seconds, e.g. chapter 8.2 Power State Mappings of the Serial ATA AHCI spec
(1.3.1).

Issue #5203
2024-05-07 16:46:34 +02:00
Christian Helmuth
8a019c9bb9 nitpicker: always update "displays" report
Restore the reporting in situations where all capture sessions are gone.
This fixes the webcam package that disables the USB webcam driver when
nitpicker report no active displays.

Issue #5187
2024-05-03 09:12:49 +02:00
Christian Helmuth
4b9d02fe31 depot: update recipe hashes 2024-05-02 11:19:50 +02:00
Florian Delizy
b2eca7cea2 event_filter: reduce bepo chargen to 486ln
issue #5202
2024-05-02 11:19:49 +02:00
Florian Delizy
1534ba21ce event_filter: add fr_bepo chargen file
issue #5202
2024-05-02 11:19:49 +02:00
Martin Stein
e350dc27e9 internet_checksum.run: test net checksum alorithms
See repos/os/src/test/internet_checksum/README for more detail.

Ref #4636
2024-05-02 11:19:49 +02:00
Christian Helmuth
59b85cc672 depot: update recipe hashes 2024-04-26 09:59:36 +02:00
Christian Helmuth
c4b5f11a38 pci_decode: report Intel PCH GPIO device
Discovered on Tigerlake (Fujitsu U7411) and Alderlake (Framework Gen12)
notebook devices.

Issue #5195
2024-04-25 15:43:02 +02:00
Christian Helmuth
10f8da4a13 pci_decode: fixup Intel LPSS (I2C) PCI BARs
Discovered on Tigerlake (Fujitsu U7411) and Alderlake (Framework Gen12)
notebook devices.

Issue #5195
2024-04-25 15:43:02 +02:00
Alexander Boettcher
9337c178c1 intel/gpu: support blanking system ROM state
Keep device resources alive, for "" and "blanking" state, so that
intel/display driver can try to switch off the connectors.

Issue #5180
2024-04-25 15:43:01 +02:00
Norman Feske
ad722f1450 nitpicker: avoid mode switches on driver restarts
This patch retains the buffer size of the last capture client as mode as
long as no capture client exists. This avoids intermediate mode changes
in situations like suspend/resume where the display driver is restarted.

Issue #5187
2024-04-25 15:43:00 +02:00
Alexander Boettcher
0b3cc37258 intel/gpu: provide platform device if hw resumed
If the gpu driver is resumed, delay new Device acquisition of the platform
client (intel_fb), until the gpu driver is in a working state.

Issue #5180
2024-04-19 13:54:16 +02:00
Norman Feske
084a14b114 record_play_mixer: make warning rate configurable
This patch disables latency warnings by default. The warnings can be
enabled by setting the 'warning_rate_ms` value to the desired
maximum rate.

Fixes #5186
Issue #5174
2024-04-19 13:42:05 +02:00
Christian Helmuth
85c99c238d depot: update recipe hashes 2024-04-19 08:54:22 +02:00
Christian Helmuth
87ea807136 test-signal: print signals per activation in stress test 2024-04-19 08:54:22 +02:00
Johannes Schlatow
7441aba6d5 platform: add suspend/resume interface to Io_mmu
genodelabs/genode#5180
2024-04-19 08:54:21 +02:00
Alexander Boettcher
b97e549dc4 intel/gpu: reset framebuffer part of ggtt
on display client close (intel_fb). The former code constructed a
temporary object on the stack, which sets up the scratch pages for the
closed client. However, the scratch page backing store (dma_buffer) gets
freed on destruction of the temporary stack object, which leads to DMA faults
with visual noise on the screen. Instead, use the already in use ggtt object
and add the scratch pages explicitly.

Issue #5180
2024-04-19 08:54:21 +02:00
Alexander Boettcher
d52af2ac94 os: avoid state names in system ROM
for ahci/gpu/nvme. Instead conclude from empty and non empty system state
to resume or stop driver.

Issue #5180
2024-04-19 08:54:21 +02:00
Josef Söntgen
e1ebcd8019 record_play_mixer: report Play and Record sessions
The state-report now contains all active Play and Record sessions
and will get updated whenever a session is created or destroyed.

Issue #5174.
2024-04-19 08:54:21 +02:00
Josef Söntgen
e0f5a2ddc5 record_play_mixer: report set version in state
Give the version in the state-report only if it is set.

Issue #5174.
2024-04-19 08:54:21 +02:00
Christian Helmuth
f86bba3059 ps2: probe for working i8042
If no working controller is detected the driver just enters sleep
forever.

Issue #5174
2024-04-19 08:54:21 +02:00
Stefan Kalkowski
1bdff41544 genode_c_api usb: always return valid capability
Instead of returning an invalid capability whenever an interface is
requested that does not exist, create a disconnected interface component.
It is also possible that a client requests an interface that got removed
at the same time. When an invalid capability gets returned, a client
can stumble about invoking it.
Moreover, this commit marks either invalid interface or device components
as disconnected objects to optimize their handling.

Ref genodelabs/genode#5021
2024-04-19 08:54:21 +02:00
Norman Feske
49f3eca476 os: recipe and launcher for pkg/waveform_player 2024-04-19 08:54:20 +02:00
Alexander Boettcher
4c79f948ab platform/pc: support to suspend via system_control
When the "system" ROM state turns to "suspend",
the S3 state information of the sleep_states ROM are determined and
are used to invoke the privileged Pd::system_control call.

Issue #5180
2024-04-19 08:54:20 +02:00
Alexander Boettcher
3af3773c60 record_play_mixer: avoid warning on halted session
Issue #5175
2024-04-12 16:14:52 +02:00
Christian Helmuth
dc0e78cdf8 depot: update recipe hashes 2024-04-12 15:08:01 +02:00
Johannes Schlatow
8b43554a27 gpu/intel: do not clflush on MMIO but on ppgtt
Executing a clflush operation on MMIO memory freezes embedded
platforms such as the Celeron N3450 used on the ZimaBlade. Looking into
the current linux code confirms that clflush is only used for ppgtt
entries and not on MMIO memory.

Fixes #5176
2024-04-12 15:08:01 +02:00
Johannes Schlatow
7a042925fc platform: catch denied IO_MEM-session
In case core denies an IO_MEM session, the platform driver should
survive and hand out an invalid capability instead.

genodelabs/genode#5174
2024-04-12 15:08:01 +02:00
Christian Helmuth
fd5f8c0ee1 fb_sdl: filter key-repeat events (fixes #5172) 2024-04-12 15:08:00 +02:00
Josef Söntgen
b2a68211a4 black_hole: add Play and Record session
This commit introduces support for the Play and Record session to
the black hole component in the most minimal way possible.

Fixes #5157.
2024-04-12 15:08:00 +02:00
Josef Söntgen
600e5424a5 os: add pkg for record_player_mixer
Issue genodelabs/genode#5167.
2024-04-12 15:05:47 +02:00
Josef Söntgen
2da94bb702 os: add record_rom pkg recipe
Issue genodelabs/genode#5167.
2024-04-12 15:05:46 +02:00
Stefan Kalkowski
2f0fe562ec os: packet_allocator needs size for free
Unlike the previous return value of
`Genode::Packet_allocator::need_size_for_free()` indicated, it does need
the size of the object it has to free to work properly.
2024-04-12 15:05:14 +02:00
Christian Prochaska
2eae70d3cd os/vfs.h: add support for symlink creation
Fixes #5162
2024-04-12 15:00:44 +02:00
Christian Helmuth
960670b16c decorator: fix handling of back-most window
Before, the current back-most window was not restacked if it was part of
the already, which lead to partially inconsistent view of the window
stack between decorator and nitpicker.
2024-04-12 15:00:44 +02:00
Josef Söntgen
ff728eb6ce usb_block: fix 'Request_sense_repsonse' MMIO size
Due to a bug in the original implementation, the size of the MMIO
range covering the 'Request_sense_response' data was set too large
during the MMIO boundary change. This rendered devices that were not
yet ready and required an 'Request_sense' command unusable.

The commit also adapts all other commands where the MMIO size does
not match the expected one.

Fixes #5133.
2024-04-12 15:00:44 +02:00
Alexander Boettcher
d0d9cb6a73 uplink: support batching in client base header
Add support for Uplink drivers to batch requests.

Fixes #5149
2024-04-12 15:00:43 +02:00
Norman Feske
956ec2f84c pkg/test-read_only_rom: adjust quota for sel4 2024-04-12 12:57:30 +02:00
Norman Feske
3052260249 Adjust terminal_crosslink RAM quota for seL4
The dynamic buffer allocation increases the RAM demand slightly beyond
1M on seL4. Use 2M, as is already the default in pkg/terminal_crosslink.

Issue #5135
2024-04-12 12:57:30 +02:00
Stefan Kalkowski
7ec08af6d9 usb: session renewal & new client API
Replace the USB session API by one that provides a devices ROM only,
which contains information about all USB devices available for this client,
as well as methods to acquire and release a single device.

The acquisition of an USB device returns the capability to a device session
that includes a packet stream buffer to communicate control transfers
in between the client and the USB host controller driver. Moreover,
additional methods to acquire and release an USB interface can be used.

The acquisition of an USB interface returns the capability to an interface
session that includes a packet stream buffer to communicate either
bulk, interrupt, or isochronous transfers in between the client and the
USB host controller driver.

This commit implements the API changes in behalf of the Genode C API's
USB server and client side. Addtionally, it provides Usb::Device,
Usb::Interface, and Usb::Endpoint utilities that can be used by native
C++ clients to use the new API and hide the sophisticated packet stream API.

The adaptations necessary target the following areas:

* lx_emul layer for USB host and client side
* Linux USB host controller driver port for PC
* Linux USB client ports: usb_hid_drv and usb_net_drv, additionally
  reduce the Linux tasks used inside these drivers
* Native usb_block_drv
* black_hole component
* Port of libusb, including smartcard and usb_webcam driver depending on it
* Port of Qemu XHCI model library, including vbox5 & vbox6 depending on it
* Adapt all run-scripts and drivers_interactive recipes to work
  with the new policy rules of the USB host controller driver

Fix genodelabs/genode#5021
2024-04-12 12:57:30 +02:00
Christian Prochaska
7ae7b8481a monitor: send a notification when an inferior vanished
Fixes #5139
2024-04-12 12:57:28 +02:00
Norman Feske
913196e2dc record_play_mixer: smoothen time-window allocation
This patch modifies the mixer's time window allocation by modelling the
drift of the period length over time. This yields a much better
stability of the detected sample rates in the presence of jitter.

Issue #5132
2024-04-12 12:57:28 +02:00
Christian Prochaska
3dbe398252 test-monitor: increase buffer size
Issue #5137
2024-04-12 12:57:28 +02:00
Christian Prochaska
d1a750c528 monitor: make maximum GDB response size configurable
Fixes #5137
2024-04-12 12:57:28 +02:00
Christian Prochaska
011a521968 os: make 'terminal_crosslink' buffer size configurable
Fixes #5135
2024-04-12 12:57:27 +02:00
Alexander Boettcher
32cb245cb8 ahci: enable conversion error checking
Fixes #5134
2024-04-12 12:55:39 +02:00
Christian Helmuth
706e341d3a trace_logger: read 'buffer' as Number_of_bytes 2024-03-04 15:50:03 +01:00
Christian Helmuth
9c7a303caf depot: update recipe hashes 2024-02-29 11:08:28 +01:00
Christian Prochaska
ea51f1ffda monitor: limit the 'm' command response size
Fixes #5119
2024-02-28 16:31:46 +01:00
Christian Prochaska
aa6f99b0a4 monitor: report all stopped threads on '?' command
Fixes #5120
2024-02-28 16:31:46 +01:00
Alexander Boettcher
12df9bf450 gpu/intel: make aperture configurable
Fixes #5124
2024-02-28 16:31:46 +01:00
Alexander Boettcher
77f5ef3bcd nvme: release device before suspend
- monitor system ROM changes
- stop processing of new Jobs before suspend
- destruct platform device before suspend, but keep platform DMA buffers
- re-construct platform device and reinit resources (mmio, irq) on resume
- re-start block job scheduling on resume

Fixes #5101
2024-02-28 16:31:46 +01:00
Alexander Boettcher
9d15735bc6 ahci: release device before suspend
- monitor system ROM changes
- stop processing of new Jobs before suspend
- destruct platform device before suspend, but keep platform DMA buffers
- re-construct platform device and reinit resources (mmio, irq) on resume
- re-start block job scheduling on resume

Issue #5101
2024-02-28 16:31:46 +01:00
Alexander Boettcher
cde4d4aee0 ahci: refactor code for suspend/resume
This commit is a preparation commit for suspend/resume. The commit
refactors the code in order to consolidate all Platform resources into one
instance. All users within the driver should access the resources with
with_* functions, which checks whether the device resource is usable. The
callers are not allowed to store any references to the provided resources.

Issue #5101
2024-02-28 16:31:46 +01:00
Alexander Boettcher
bf6c484c13 gpu/intel: use with(fn, fn_error) pattern
Issue #5081
2024-02-28 16:31:45 +01:00
Alexander Boettcher
0684101ff0 gpu/intel: release device before suspend
- monitor system ROM changes
- stop processing of new Jobs before suspend
- destruct platform device before suspend, but keep platform DMA buffers
- re-construct platform device and reinit resources (mmio, irq) on resume
- re-start GPU job scheduling on resume

Fixes #5081
2024-02-28 16:31:45 +01:00
Norman Feske
07669ac991 os: record-and-play session interfaces and mixer
- New session interfaces:
  - os/include/play_session   (for audio playing   / mic-input driver)
  - os/include/record_session (for audio recording / audio-output driver)
- Mixer at os/src/record_play_mixer providing both play and record services
- Simple waveform player at os/src/app/waveform_player
- Simple audio-signal capturing component at os/src/app/record_rom
- Simple oscilloscpe at gems/src/app/rom_osci (using record_rom)
- Simple test-audio_play for playing raw stereo f32 data

The _gems/run/waveform_player.run_ script illustrates the use of the new
components and interfaces.

Issue #5097
2024-02-28 16:31:45 +01:00
Christian Prochaska
080d3b6b63 vfs: support watch handlers on application signal level
Fixes #4092
2024-02-26 08:59:10 +01:00
Christian Prochaska
fb2e0b50c8 os: 'Path_base::strip_double_dot_dirs()' improvements
Issue #5106
2024-02-26 08:59:10 +01:00
Christian Prochaska
7651c94bf5 os: add test for 'Genode::Path'
Issue #5106
2024-02-26 08:59:10 +01:00
Sebastian Sumpf
f86cd6899c ahci: add port count vs. ports implemented check
Check if controllers port count matches number of ports found in the
port implemented register. In case counts don't match print a diagnostic
message for debugging purposes.

issue #4081
2024-02-26 08:59:09 +01:00
Christian Helmuth
a0e0000108 genode_c_api/event: absolute-motion events
Absolute motion events are generated by "tablet" devices, e.g., Qemu
usb-tablet and IP-KVM appliances like PiKVM.

Issue #5105
2024-02-26 08:59:09 +01:00
Christian Helmuth
5f2691a65b event_filter: transformation of motion coordinates
The <transform> filter configurably transforms touch and absolute-motion event
coordinates by a sequence of translation (move), scaling, rotation, and flipping
primitives in sub-nodes.

Issue #5105
2024-02-26 08:59:09 +01:00
Christian Helmuth
7304a019e7 event_filter: <log motion="true"> attribute
Per default, only key presses and releases are logged. The optional
'motion' attribute (boolean) enables logging of motion and touch events.

Issue #5105
2024-02-26 08:59:09 +01:00
Christian Prochaska
0bc2e240bf monitor: always respond to qXfer:memory-map:read
Fixes #5109
2024-02-26 08:59:08 +01:00
Sebastian Sumpf
240819b708 black_hole: add support for Uplink client
The uplink client simply drops and acknowledges packets it receives.

issue #5104
2024-02-26 08:59:08 +01:00
Martin Stein
1336b0a751 mmio: upper-bounds checks
The classes Genode::Mmio, Genode::Register_set, Genode::Attached_mmio, and
Platform::Device::Mmio now receive a template parameter 'size_t SIZE'. In each
type that derives from one of these classes, it is now statically checked that
the range of each Genode::Register::Register- and
Genode::Register_set::Register_array-deriving sub-type is within [0..SIZE).

That said, SIZE is the minimum size of the memory region provided to the above
mentioned Mmio classes in order to avoid page faults or memory corruption when
accessing the registers and register arrays declared inside.

Note, that the range end of a register array is not the end of the last item
but the end of integer access that is used for accessing the last bit in the
last item.

The constructors of Genode::Mmio, Genode::Attached_mmio, and
Platform::Device::Mmio now receive an argument 'Byte_range_ptr range' that is
expected to be the range of the backing memory region. In each type that derives
from on of these classes, it is now dynamically checked that 'range.num_bytes
>= SIZE', thereby implementing the above mention protection against page faults
and memory corruption.

The rest of the commit adapts the code throughout the Genode Labs repositories
regarding the changes. Note that for that code inside Core, the commits mostly
uses a simplified approach by constructing MMIO objects with range
[base..base+SIZE) and not with a mapping- or specification-related range size.
This should be fixed in the future.

Furthermore, there are types that derive from an MMIO class but don't declare
any registers or register arrays (especially with Platform::Device::Mmio). In
this case SIZE is set to 0. This way, the parameters must be actively corrected
by someone who later wants to add registers or register arrays, plus the places
can be easily found by grep'ing for Mmio<0>.

Fix #4081
2024-02-26 08:59:07 +01:00
Pirmin Duss
55007f5bd9 i2c: bus speed configuration node
I2C EEPROMs of the type at24xxx are really slow (ca. 10 kHZ).

This adds the `bus_speed_khz` attribute to the config of the driver and
adapts the i.MX8 driver to support the feature.

Issue gapfruit#1996
Fixes genodelabs#5090
2024-02-26 08:31:05 +01:00
Norman Feske
0d34988929 test.run: remove obsolete boot-module heuristic
The ROMs of built executables and shared objects are now covered by the
[build_artifacts].

Issue #4860
2024-02-26 08:31:04 +01:00
Christian Helmuth
092e4a001f usb_hid: mode led handling to shadow input-leds.c
The former implementation relied on input drvdata always pointing to
struct hid_device, which is not true for Wacom touch devices (at least).
Now, we implement the input handler for devices providing LEDs
(evbit[EV_LED] set) only and use input_inject_event() to set the LED
states.
2024-02-26 08:31:04 +01:00
Alexander Boettcher
c2cd4102d8 gpu/intel: prepare GPU structures for resume
The commit is a preparation commit for suspend/resume. It prepares the GPU
structures relying on gmadr.cap() (MMIO) to be re-constructible by applying
the with* pattern to context, ring_buffer and ggtt mmio map. It removes
the managed dataspace handling of gmadr subsets to make the with_* pattern
possible.

Issue #5081
2024-02-26 08:31:03 +01:00
Alexander Boettcher
d02f4866ea gpu/intel: make platform resources reconstructible
This commit is a preparation commit for suspend/resume. The commit
refactors the code in order to consolidate all Platform resources into one
instance. All users within the GPU driver should access the resources with
with_* functions, which checks whether the device resource is usable. The
callers are not allowed to store any references to the provided resources.

With this change, it will be possible in follow up commits, to release
the platform device and to re-acquire it and its resources, e.g. mmio, irq,
gmadr.

Issue #5081
2024-02-26 08:31:03 +01:00
Norman Feske
87993a864c input/event.h: axis ids LX, LY, LT, RX, RY, and RT
The axis IDs correspond to 2x analog sticks with 2 axes and 2x triggers.
While being at it, the commit changes the Axis_id type to Axis::Id.

Fixes #3669
2024-02-26 08:31:03 +01:00
Christian Prochaska
602f9b5670 monitor: remove 'flush_thread()' error message
Fixes #5082
2024-02-26 08:31:03 +01:00
Christian Helmuth
4a2319a4d6 os: limit backtrace to stack of current thread
The frame-pointer-based backtrace does not work without enabling
-fno-omit-frame-pointer explicitly and in most cases leads to page
faults because non-pointer stack values are dereferenced during the
walk. The best we can do is to limit the backtrace walk to the stack of
the current thread to prevent page faults unrelated to the system state
without the use of the backtrace utility.

This commit introduces a printable Backtrace class usable in
Genode::log(), Genode::trace(), etc. The class is based on the new
function for_each_return_address(auto const &fn) that walks the stack in
its limits and calls fn() for each discovered return address on the
stack in the new os/include/os/backtrace.h. Archtecture-specific
stack-pointer retrieval and walk loops are implemented in dedicated
os/include/spec/<arch>/os/for_each_return_address.h files. Also, the
well-known Genode::backtrace() function (which logs the return-address
values) is provided for backwards compatibility.

Fixes #5078
2024-02-26 08:31:02 +01:00
Norman Feske
c4679e7af6 depot: update recipe hashes 2023-12-13 12:33:05 +01:00
Norman Feske
77b0e10e88 vfs/ram_file_system: deferred unlink
This patch changes the unlink operation of the ram fs to defer the
destruction of a file until it is no longer referenced by any VFS handle.
When unlinked, the file no longer appears in the directory. But it can
still be opened and accessed.

With this change, a parent process of a Unix-like subsystem becomes able
to pass the content of an unlinked file to a forked child process. This
mechanism is required when using the 'exec' command in Tcl scripts.

Another use case is the 'tmpfile()' function.

Fixes #3577
2023-12-13 12:33:05 +01:00
Norman Feske
cb74956d06 os/run/test.run: build libs listed in <content> 2023-12-13 12:33:05 +01:00
Norman Feske
713659cea5 test-trace: adjust rate of top passing tracepoints
The traced top instance was configured to be active every two seconds
whereas the trace test uses a grace time of only 1.5 seconds before
raising the FOREIGN state of a trace subject as an error.

The state of a trace subject can change only whenever the traced thread
passes a trace point. Hence, with the original configuration, the
release of top as trace subject can take up to two seconds. The patch
reduces the rate to 0.5 seconds to satisfy the expectation of
test-trace.
2023-12-13 12:33:05 +01:00
Christian Helmuth
636f5dda29 nic_router: specify ICMP Destination (host) unreachable
According to RFC 1812 ICMP Destination unreachable (Network unreachable)
does not quite our case of clients directly behind the router.

  If a packet is to be forwarded to a host on a network that is directly
  connected to the router (i.e., the router is the last-hop router) and
  the router has ascertained that there is no path to the destination
  host then the router MUST generate a Destination Unreachable, Code 1
  (Host Unreachable) ICMP message.

Issue #4729
2023-12-13 12:33:05 +01:00
Norman Feske
f57da7e645 trace: remove parent_levels session argument
The argument was originally designated to restrict the reach of the
trace monitor but the idea remained unimplemented. It is now superseded
by the use of the trace-session label as trace-subject filter.

Issue #847
2023-12-13 12:28:52 +01:00
Norman Feske
f66ce025d3 Adapt run scripts to trace-subject filtering
Issue #847
2023-12-13 12:28:52 +01:00
Norman Feske
bfe88307de core: filter trace subjects by TRACE session label
This patch changes core's TRACE service to expose trace subjects only if
their PD label matches the label of the TRACE monitor. Hence, by default,
a trace monitor can only observe itself and its child components. Only
if the trace monitor's parent rewrites the trace-session's label, the
view of trace monitor can become broader. For example, when rewriting
the trace label to an empty string "", the trace monitor becomes able to
observe the sibling components hosted in the same init instance as the
trace monitor.

To grant a trace session the special privilege of obtaining a global
system view (including the kernel's trace subjects), the top-level init
has to rewrite the session's label to an empty string. At core, this
specific label "init -> " is handled as a special case that discharges
the filtering/namespacing of trace subjects.

Note that the trace-subject label as reported as subject info is now
given relative to the label of the trace session. As a nice side effect
of this change, the pkg/test-trace_logger works now when executed by the
depot_autopilot as well as via the test.run script.

Issue #847
2023-12-13 12:28:52 +01:00
Norman Feske
66160e6bd3 os/run/test.run: adapt to changed runtime format
Issue #4922
2023-12-13 12:28:05 +01:00
Norman Feske
e2d1888f52 trace_logger: priority config attr in config.xsd 2023-12-13 12:28:05 +01:00
Christian Prochaska
2aeea45c30 os: build 'lib/ld' in 'monitor_gdb.inc'
Fixes #5068
2023-12-13 12:28:05 +01:00
Christian Helmuth
8baf19022c depot: update recipe hashes 2023-11-30 15:11:36 +01:00
Johannes Schlatow
1f1437747c platform_drv: don't copy Bdf
genodelabs/genode#5002
2023-11-30 14:22:54 +01:00
Johannes Schlatow
3f1e1323f0 pc/platform: enable IOMMU with default mappings
genodelabs/genode#5002
2023-11-30 14:22:54 +01:00
Johannes Schlatow
bc09ff7498 platform_drv: add default DMA mappings interface
genodelabs/genode#5002
2023-11-30 14:21:51 +01:00
Johannes Schlatow
c06b53e52e acpi_drv: add config for ignoring DMAR table
By not evaluating the DMAR table, we disable the IOMMU.

genodelabs/genode#5002
2023-11-30 14:20:53 +01:00
Johannes Schlatow
196133c582 platform_drv: use guard pages for DMA buffers
genodelabs/genode#5002
2023-11-30 14:20:53 +01:00
Johannes Schlatow
d018cb62f3 platform_drv: guard against Out_of_* exceptions
In the scope of alloc_dma_buffer(), Out_of_* exceptions might be thrown
at different stages. By adding a Guard object, we make sure to rollback
already created objects accordingly.

genodelabs/genode#5002
2023-11-30 14:20:53 +01:00
Johannes Schlatow
350a3d9ae4 platform_session: increase RAM and CAP quota
As a consequence of the adding IOMMU support to the platform driver,
additional RAM and CAPs are needed for setting up IO page-table
structures.

genodelabs/genode#5002
2023-11-30 14:20:53 +01:00
Johannes Schlatow
855147a021 pc/platform: add intel IOMMU support
Add DMA remapping support for Intel devices to the platform driver.

genodelabs/genode#5002
2023-11-30 14:20:49 +01:00
Johannes Schlatow
70b1ae3d1b platform: move enable/disable_pci_device
genodelabs/genode#5002
2023-11-30 14:19:45 +01:00
Johannes Schlatow
eefaa07024 base: add irq_type session argument
By adding the `irq_type` argument, one can explicitly specify whether to
use LEGACY, MSI or MSI-X interrupts. We formerly used the
`device_phys_config` to implicitly select MSI, however, with the
addition of IOMMU support to the platform driver there is at least one
instance where we need an MSI for a non-PCI device.

Yet, by adding another session argument to the Irq session, we exceed
the character limit for session args. Since not all arguments are
relevant for LEGACY interrupts resp. MSI, we can split the Irq_connection
constructor to handle the two cases separately and omit unneeded
arguments.

genodelabs/genode#5002
2023-11-28 19:35:16 +01:00
Johannes Schlatow
a80464299a platform_drv: add phys_addr to add_range()
We need the physical address of a DMA range in order to insert it into
the translation table.

genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
0182e81b51 platform_drv: map actual DMA dataspace size
DMA buffer allocations are always performed as full pages. However, they
got mapped into the IOMMU domain using the requested size, which may not
be a multiple of the page size. This behaviour was introduced as a regression
by #4761 and is corrected by this commit.

genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
ae7e461452 platform_drv: move IOMMU domain destruction
Destruction of IOMMU domain should happen after the PCI device was
disabled in order to prevent faulty DMA transactions.

genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
d7b9cd0654 platform_drv: move add_range calls from base class
The virtual add_range()-method must not be called from the base-class
constructor since the derived class is not be fully initialized at
this point.

genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
022762605b pci_decode: add <irq/> to drhd devices
genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
7c5b59556a pci_decode: add <iommu> node to devices
genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
e816020346 pci_decode: add intel_iommu devices to devices ROM
genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Johannes Schlatow
7b99a43c9e acpi_drv: add size attribute to drhd
genodelabs/genode#5002
2023-11-28 19:01:28 +01:00
Norman Feske
1e166c7236 Supplement the build of shared libs where needed
This is a follow-up commit to the adaptation of the run scripts to the
consistent use of [build_artifacts] (issue #4860).

The missing build of libm remained undetected until the recent removal
of implicit shared-library builds (issue #5061).
2023-11-28 14:44:29 +01:00