Commit Graph

2853 Commits

Author SHA1 Message Date
Sebastian Sumpf
7f0c89f378 pci_decode: enable all bridges
set I/O port, MMIO, and bus master to enabled for bridges where
disabled.

issue #4578
2022-10-12 12:09:37 +02:00
Christian Helmuth
e7ba0b7371 pci: initialize BAR config on demand only
On-demand initialization prevents read-write operations on BARs of
invalid devices at construction time, which may result in surprising
behavior later on, for example, when resetting X260 notebooks via ACPI
information.
2022-10-12 12:09:37 +02:00
Stefan Kalkowski
ba97415ef9 pci_decode: prefer MSI over MSI-x
Ref genodelabs/genode#4578
2022-10-12 12:09:36 +02:00
Norman Feske
eb6a745a18 platform: add Guard utils for Clock/Reset/Power
These utilities simplify the control of clocks, resets, and power
domains from within the platform driver.

This is needed when driving a low-level device directly from the
platform driver, for example for driving the mbox mechanism to access
the system-control processor of the PinePhone.
2022-10-12 12:09:36 +02:00
Stefan Kalkowski
3841ee1d51 platform_drv: implement MSI-x support
Ref genodelabs/genode#4578
2022-10-12 12:09:36 +02:00
Josef Söntgen
a78a7e1f67 platform_drv: disable no snoop for ATI/AMD HDA
Implemented as depicted in the OpenBSD driver, register description
found in 'AMD SB700/710/750 Register Reference Guide'
(43009_sb7xx_rrg_pub_1.00.pdf).

Issue #4629.
2022-10-12 12:09:36 +02:00
Stefan Kalkowski
243c819257 pci_decode: use MSI enumerator as function value
Instead of using a global value to enumerate the MSIs, use a function argument
instead. Whenever the process of PCI device reporting gets started again,
due to an initially too small report buffer, the MSI enumeration value is reset
again. Formerly, we wasted MSI numbers.

Ref genodelabs/genode#4628
2022-10-12 12:09:35 +02:00
Christian Helmuth
08f1f94fcb pci_decode: IRQ reporting for MSI/MSI-X only devices
Don't skip IRQ reporting if legacy IRQ/GSIs are not supported as the
device may support MSI/MSI-X exclusively.

The commit also enables reserved_memory reporting of devices without
IRQs.

Ref genodelabs/genode#4578
2022-10-12 12:09:35 +02:00
Sebastian Sumpf
8855e5bfc9 Revert "usb_block_drv: allow for using UAS devices via BOT"
This reverts commit 87021d9fb1.

Commit breaks some USB storage devices, mostly Intenso, on Sculpt

issue #4494
2022-10-12 12:09:35 +02:00
Stefan Kalkowski
2ccdbf1050 platform_drv: implement shared interrupt support
Ref genodelabs/genode#4578
2022-10-12 12:09:35 +02:00
Stefan Kalkowski
00c9ac363f platform_drv: add EHCI PCI quirk, apply in order
* Add EHCI PCI quirk
* Add UHCI reset to UHCI quirk
* Apply all PCI quirks in order of the PCI bus numbering
  otherwise the machine might stall

Ref genodelabs/genode#4578
2022-10-12 12:09:35 +02:00
Christian Helmuth
b20cabb6e4 pci: fix PCIe extended capability definition
Also removed the warning about unhandled capability IDs.

Ref genodelabs/genode#4578
2022-10-12 12:09:34 +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
7334128a2e pci_decode: export prefetchable attribute of BARs
Memory descriptors in PCI BARs have a prefetchable bit, which can
be used to optimize memory access when setting, e.g. write-combined
in page-table entries.

Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
6a36e8a8dc pci_decode: count MSI numbers beginning from one
Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Sebastian Sumpf
e1e70dd927 platform_drv: fix Intel graphics PCI infos
GMCH is at offset 50 on Gen8+.

Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Martin Stein
f59ee209d2 nic_router: use exact packet sizes in dhcp client
The DHCP client used to always send packets with a size of 1024 regardless of
the size of the actual content, which was always significantly lower. 1024
bytes was simply a guess to provide enough space for all types of DHCP client
packets. As we know the exact size of each packet the DHCP client sends even
before packet creation, this commit makes use of the knowledge resulting in
much smaller packets sent by the DHCP client.

Fixes #4619
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
c7c460f6e0 os: add include/pci/* to os api
Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Johannes Schlatow
32efbdfb32 vfs_tap: fix README (mode attribute) 2022-10-12 12:09:34 +02:00
Stefan Kalkowski
afa0bed5fc platform_drv: add USB4 pci class, update README
Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
ec6f89111e virtio_pci: use generic platform API
Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
fdba7259ab platform_drv: provide Virtio PCI information
Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
de0c339e0b pci: remove pci test of legacy platform API
Ref genodelabs/genode#4578
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
c8f055c9e3 smbios_decoder.run: remove legacy platform_drv
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
250275fbfb gpu_drv: use generic platform API
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
feaaaa3e8b drivers_interactive-pc: use generic platform_drv
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
ed8f71e459 ahci_drv: use generic platform API
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
9f9a5186e0 ps2_drv: use generic platform API
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
71129fca2d nvme_drv: use generic platform API
Ref genodelabs/genode#4578
2022-10-12 12:09:33 +02:00
Stefan Kalkowski
5e42f347d8 platform_drv: attach reserved memory to device PD
Consumes the information about reserved memory region reports from
the devices ROM, and adds appropriated mappings to the corresponding
device PD.

Ref genodelabs/genode#4578
2022-10-12 11:59:09 +02:00
Stefan Kalkowski
85dc2e5b9b pci_decode: interpret reserved memory from ACPI
We need the information about reserved memory region reports
from the ACPI tables within the platform driver to pre-fill
IOMMU tables with the corresponding mappings. Therefore,
the pci_decode component now parses the information from the
ACPI ROM, and adds "reserved_memory" nodes to all related
devices in the devices report.

Ref genodelabs/genode#4578
2022-10-12 11:59:08 +02:00
Stefan Kalkowski
281785f6bd platform API: make MMIO dataspace cap accessible
In case of the GPU multiplexer, we need to delegate MMIO memory
to the framebuffer client in form of a managed dataspace. To be
able to attach a given Platform::Device::Mmio object to a region map
we need to access its capability.

Ref genodelabs/genode#4578
2022-10-12 11:59:08 +02:00
Stefan Kalkowski
c583446ade platform_drv: add HDAUDIO PCI quirks
Ref genodelabs/genode#4578
2022-10-12 11:59:08 +02:00
Christian Helmuth
ef269ea2e0 sd_card_bench: disable on rpi 2022-10-12 11:59:08 +02:00
Martin Stein
88cddc35dd nic_router: use the dictionary data structure
This commit gets rid of the router-local wrapper of Genode's AVL string tree
and replaces it with Genode's new Dictionary structure. The Dictionary is now
used for managing domains and NIC clients. Due to this change, the formerly
necessary helper classes Domain_base and Nic_client_base could be removed as
well.

Ref #4610
2022-10-12 11:59:08 +02:00
Martin Stein
3a616fed4d nic_router: rename is_ready() to ready()
Ref #4612
2022-09-21 14:03:31 +02:00
Christian Helmuth
3f1870841c depot: update recipe hashes 2022-09-21 12:19:10 +02:00
Christian Helmuth
548c3b46ad test-trace_buffer: increase thread stack to 8K
Prevents warnings on x86_32/linux.
2022-09-21 12:19:10 +02:00
Stefan Kalkowski
dda168fc10 platform API: simplify _wait_for_device
Fix genodelabs/genode#4615
2022-09-21 12:19:10 +02:00
Sebastian Sumpf
0370b0fa23 platform_drv: fix reference count in "Switch" class
Only decrement by 1 in the "unuse" function.
2022-09-21 12:19:10 +02:00
Stefan Kalkowski
4b9fb10fdb platform_drv: aquire_single_device return first
* Only acquire and return the first device

Fix genodelabs/genode#4614
2022-09-21 12:19:10 +02:00
Norman Feske
8bccc6e68f cached_fs_rom: increase fs buffer size to 4 MiB
The default file-system communication-buffer size of 128 KiB combined
with the clamping of requests to 1/4th the buffer size results in the
fragementation of read operations into 32 KiB chunks. This is overly
conservative and causes high context-switch overhead down the storage
stack (vfs server -> part_block -> block driver).

Related to #4613
2022-09-21 12:19:10 +02:00
Martin Stein
99254b4d52 nic_router: bind link state to remote DNS config
The NIC router README claims that the 'dns_config_from' attribute in a DHCP
server configuration binds the propagated link state of all interfaces at the
domain of the server to the validity of the IP config of the domain that is
given through 'dns_config_from'.

However, this was not true. The router missed to implement this detail which
led to clients of such a DHCP server sending DHCP DISCOVER packets too early.
These early DHCP DISCOVER packets were dropped by the router potentially
causing a big delay until the client started a new attempt. Unnecessary long
network boot-up delays were observed with at least the lwip run script and
Sculpt on the PinePhone and could be tracked down to this former
inconsistency in the router.

This commit fixes the inconsistency.

Fixes #4612
2022-09-21 12:19:09 +02:00
Norman Feske
3be0136901 base: add util/dictionary.h utility
The new 'Dictionary' provides an easy way to access objects using
strings as key. The 'String' received the 'operator >' to simplify the
organization of strings in an AVL tree.

The patch removes the former definition of the 'operator >' from the
platform driver because it would be ambigious now.

Fixes #4610
2022-09-19 14:00:35 +02:00
Sebastian Sumpf
e0c4d5068d audio_out_session: reset changes to 'pos = tail'
In case a driver is waiting for data, is should only investigate 'pos'.
It should not advance the ring in any way until there is data available.

issue #4609
2022-09-19 14:00:35 +02:00
Norman Feske
907641f6ea lx_fs: improve safety when using dir handles
This patch consolidates the repetitive error handling across the RPC
functions, which take node handles or directory handles as arguments.

During this change, I noticed that directory handles - which are values
provided by the client - were not checked for their type before being
used. A misbehaving client may open a file, manually construct a
directory handle using the number of the file handle, and invoke a
directory operation at lx_fs, which would then wrongly access a file
node as directory node.

This patch solves this issue by introducing two distinct methods
_with_open_node and _with_open_dir_node, which perform the respective
safety checks.

Fixes #4608
2022-09-19 14:00:35 +02:00
Martin Stein
79cc9af212 nic_router: intf. con/destruct reports link state
Creating and destructing an interface was not considered a change of its real
link state as defined in the description of the <report link_state_triggers="">
config attribute in the router's README. In case of Uplink sessions this is
obviously a problem as they communicate their real link state through session
lifetime. But also in case of NIC sessions it's a possible to create an
interface that is immediately "up" after creation or destruct an interface
without its link state going "down" beforehand.

Taking into account also the practical application of the
<report link_state_triggers=""> attribute, reporting only on destruction and
construction of interfaces that are "up" seems shorthanded. This is because a
report-receiver most likely needs to be able to synchronize the lifetime of
the objects that keep track of the link states with the lifetime of the
corresponding sessions.

That said, with this commit, the router triggers a report update on each
session construction/destruction when <report link_state_triggers=""> is
set.

Fixes #4462
2022-09-19 14:00:35 +02:00
Martin Stein
aff1db1543 nic_router: generate reports asynchronously
The NIC router used to generate reports triggered by IP config changes or link
state changes synchonously, i.e., inline with the activation context that
caused the change. This has two disadvantages. First, it can lead to an
excessive number of report updates in situations with quick bursts of
triggering changes. In such situations it is preferable to collect the changes
and reflect them with only one final report update.

Second, synchronous reporting may happen while the router is in a state that
leads to an incorrect report (e.g. during reconfiguration). To prevent this
from happening, the router so far explicitely switched off reporting when
entering incoherent states and back on when leaving them. However, this
solution is error-prone as the exclusion windows must be maintained manually.

Both issues can be solved by not directly generating a report when necessary
but instead submitting a signal and letting the signal handler do the work in
a dedicated activation context.

Ref #4462
2022-09-19 14:00:35 +02:00
Christian Helmuth
82f96668fa Increase cpu_burner RAM quota in test-trace_logger
Now, the test also succeeds on sel4.
2022-09-19 14:00:35 +02:00
Norman Feske
cc9368ccb4 os: add File_system_session::num_entries RPC
This patch splits the querying of the number of directory entries from
the directory's 'status' information. Subsuming the number of directory
entries as part of the status makes 'stat' calls too costly for some
file systems that need to read a directory for determining the number of
entries. So when stat'ing the entries of one directory that contains sub
directories, all entries of each sub directory are visited.

Thanks to Cedric Degea for pointing out this performance bottleneck!

With this change, the 'status' function returns a 'Status::size' value
of 0 when called for a directory handle.

Fixes #4603
2022-09-19 14:00:35 +02:00
Martin Stein
b82d83e271 nic_router: handle bad DNS in DHCP ACK gracefully
The DHCP client of the NIC router used to end up in an uncaught exception if
an IP address in the DNS server option of a DHCP ACK was invalid. This commit
makes the 'Dns_server' constructor (where the exception originated from)
private and instead introduces a public lambda method 'construct' that calls
one lambda argument on success and another on failure. This is also in line
with the most recent changes to the 'find_by_*' methods of other classes in
the NIC router and contributes to the goal of reducing expensive exception
handling.

Fixes #4465
2022-09-19 14:00:34 +02:00
Martin Stein
054990aafa nic_router: fix net session aliases
The Interface class of the router is an abstraction for NIC client sessions,
NIC server sessions, and Uplink sessions. Nonetheless, Interface generally used
to use the packet stream types of the Nic namespace and it worked because the
Uplink packet stream types are factually the same (the are typedef'd from the
same base type templates with the same parameters).

The initial intention of this issue was to remove dependency on the diverse
packet stream stream types from Interface. However, this turned out to be more
tricky than thought. The Interface class calls function templates on the packet
stream types, making a generic virtual interface impossible. And moving the
calling code to the session classes as well would produce a lot of redundancy.

Therefore, this commit removes only the use of the Nic namespace in the
interface.* files by typedef'ing the packet stream types from the generic
Genode type templates with the same parameters as in Nic and Uplink.

Fixes #4385
2022-09-19 14:00:34 +02:00
Christian Helmuth
8186a1d7f8 Support seconds in vfs/rtc plugin and libc backend
Fixes #3886
2022-09-19 14:00:33 +02:00
Johannes Schlatow
7d143087c9 xml_node: change with_sub_node signature
The `with_sub_node` method is renamed to `with_optional_sub_node` to
better reflect that the non-existence of a sub node with the desired type is
ignored.
At the same time, the new `with_sub_node` now takes a second functor that is
called when no sub node of the desired type exists.

genodelabs/genode#4600
2022-09-19 14:00:33 +02:00
Stefan Kalkowski
f2c52d1570 usb c-api: manage lifetime of session handles
Fix genodelabs/genode#4602
2022-09-19 14:00:33 +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
Norman Feske
f50971b6a9 os: src/lib/trace/policy -> src/trace/policy
The target.mk files for building the trace policies are no longer
reachable under src/lib/ by the build system.

Issue #4599
2022-09-19 13:59:27 +02:00
Johannes Schlatow
bc57e9e647 vfs: add Append_file class
This reverts commit cf904e0a5d and
introduces the Append_file class instead.

genodelabs/genode#4352
2022-09-19 13:59:27 +02:00
Alexander Boettcher
adc4d47251 usb_host: use Expanding reporter for device report
Issue #4596
2022-08-31 15:09:23 +02:00
Christian Helmuth
4dddc41b71 depot: update recipe hashes 2022-08-31 09:32:09 +02:00
Norman Feske
236ebecf44 event_filter: new touch-key filter
The new <touch-key> filter type can be used to trigger artificial
press/release events for predefined touch-screen areas.

Fixes #4587
2022-08-31 09:32:09 +02:00
Christian Helmuth
d82d67a4b2 part_block depot package
Usable via Sculpt /config/deploy, e.g.,

  <start name="nvme-0.part_block" pkg="part_block">
    <route>
      <service name="Block">
        <parent label="nvme-0"/>
      </service>
      <service name="Report" label="partitions">
        <parent/>
      </service>
    </route>
  </start>

Issue #4590
2022-08-31 09:32:09 +02:00
Christian Helmuth
6fbc953dbd Declare missing exception types thrown in USB session 2022-08-31 09:32:09 +02:00
Norman Feske
08279e6288 Create Point, Area, Rect via 'from_xml' functions
By using the new functions provided by the base API, this patch removes
the dependency of several components from include/decorator/xml_utils.h.

Issue #4584
2022-08-31 09:32:08 +02:00
Norman Feske
42edac8a34 util/geometry: support 'Rect::from_xml'
This patch eases the creation of 'Point', 'Area', and 'Rect' objects
from XML attribute values.

Fixes #4584
2022-08-17 14:28:12 +02:00
Roland Bär
8f228e3035 nic_router: no ICMP on unroutable IPv4 multicast
The NIC router used to send an ICMP "Destination Unreachable" packet as
response to every unroutable IPv4 packet. However, RFC 1812 section 4.3.2.7
defines certain properties that must be fullfilled by an incoming packet in
order to be answered with this type of ICMP. One requirement is that the packet
is no IPv4 multicast.

This commit prevents sending the mentioned ICMP response for unroutable IPv4
multicasts and instead drops them silently.

Fixes #4563
2022-08-17 12:26:01 +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
Johannes Schlatow
810bbc0484 nic_router: add trace_packets config option
genodelabs/genode#4352
2022-08-17 12:03:26 +02:00
Johannes Schlatow
086f3efef2 trace: add trace_eth_packet event
genodelabs/genode#4352
2022-08-17 12:03:07 +02:00
Johannes Schlatow
73dad70356 trace: add checkpoint event
genodelabs/genode#4352
2022-08-17 11:54:19 +02:00
Johannes Schlatow
cf904e0a5d vfs: add append mode to New_file
genodelabs/genode#4352
2022-08-17 11:54:19 +02:00
Peter Krummenacher
11b964b759 audio_in_session: fix wrong buffer in content
Fixes #4573
2022-08-10 13:33:04 +02:00
Martin Stein
a4ec06a3b7 nic_router: no empty DNS servers opt in DHCP reply
The NIC router used to add the DNS servers field to DHCP replies regardless of
whether there were DNS servers or not. As reported by a Genode user, the empty
DNS server field irritated at least Windows 10 guests (Vbox 6) that connected
to the NIC router. This resulted in Windows 10 ignoring DHCP offers from the
router with such characteristic.

With this commit adding the DNS server DHCP option is skipped if there are no
DNS servers at the corresponding DHCP server or the domain IP config the server
shall fetch its DNS servers from.

Fixes #4581
2022-08-10 13:33:04 +02:00
Stefan Kalkowski
8255053242 platform_drv: export Intel graphics PCI infos
Provide additional PCI register information inside the pci-config part
of the devices ROM for clients able to access an Intel graphic card,
namely the GMCH control register content, which contains for instance
the GTT size and stolen memory size.

Ref genodelabs/genode#4578
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
9dfc2caa11 platform_drv: add UHCI PCI quirks
Implement BIOS handover and Intel resume register update
apart from device driver to circumvent export of PCI
config space to drivers.

Ref genodelabs/genode#4578
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
413e2baa1c platform_drv: PCI assignment failure is no error
When there is no I/O MMU available the assignment is failing too,
although this is no error but normal behaviour.

Ref genodelabs/genode#4578
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
8f9b5e9bd2 depot: src package for pci_decode
Ref genodelabs/genode#4578
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
2cc6c1adef pci: export BAR indices, sub-vendor, -product, rev
The pci_decode has to extract the additional fields from the PCI configuration
space. The platform driver again has to parse and forward the knowledge too.
The PCI BAR indices are exported when info="yes" is set in the policy node for
the corresponding session.

Fix genodelabs/genode#4577
2022-08-10 13:33:03 +02:00
Stefan Kalkowski
5bf3e72d37 pci: return correct I/O port base from BAR
The base address of I/O ports has a different encoding than
those of I/O memory. This needs to be encountered in the PCI
config helper utilities.

Fix genodelabs/genode#4576
2022-08-10 13:33:03 +02:00
Martin Stein
3868df9f8b nic_router_dhcp_*: raise timeouts
On okl4, pistachio, sel4 the test didn't come up fast enough in order to still
experience the first configuration of NIC router #1. This commit doubles the
lifetime of the first configuration of NIC router #1 to 4 seconds and raises
the overall test timeout accordingly.

Ref #4555
2022-08-10 13:33:03 +02:00
Martin Stein
e32157e21b nic_router: packet allocation w/o exceptions
In overload situations, i.e. when a sender fills up the entire buffer, we land
in situations where the sender receives an ack_avail signal, releases one
packet, allocates and sends a packet and fails to allocate a second packet.
This is especially relevant if the receiver does not batch ack_avail signals
(such as vfs_lwip). In those ping-pong scheduling scenarios, the overhead from
catching the Packet_alloc_failed exception becomes significant. In case of the
NIC router, we will land in an overload situation if the sender is faster than
the receiver. The packet buffer will be filled up at some point and the NIC
router starts to drop packets. For every dropped packet, we currently have to
catch the Packet_alloc_failed exception.

This commit adds a new method alloc_packet_attempt to Packet_stream_source that
has almost the same signature as the older alloc_packet method but returns
an Attempt<Packet_descriptor, Alloc_packet_error> object. As the method already
used the allocator back end exception-less, changes on lower levels were not
needed. Furthermore, the NIC router was modified to use the new exception-less
alloc_packet_attempt instead of alloc_packet.

Ref #4555
2022-08-10 13:33:03 +02:00
Martin Stein
433029c3a6 nic_router: find ARP cache entries w/o exceptions
Replaces the former implementation of the 'find_by_ip' method at the data
structure for ARP cache entries. This method used to return a reference to the
found object and threw an exception if no matching object was found.

The new implementation doesn't return anything and doesn't throw exceptions. It
takes two lambda arguments instead. One for handling the case that a match was
found with a reference to the matching object as argument and another for
handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Ref #4555
2022-08-10 13:33:03 +02:00
Johannes Schlatow
e2086ac8e4 nic_router: change max_packets_per_signal default
According to a benchmarking series on Zynq (base-hw) and x260 (base-nova) using
test-nic_perf_router, increasing the 'max_packets_per_signal' has a significant
effect on the packet throughput. By increasing the default value from 32
to 150, we could gain a few hundred Mbit/s. Increasing the value further
does not seem to have such a strong effect, though.

genodelabs/genode#4555
2022-08-10 13:33:03 +02:00
Johannes Schlatow
a2b74af59a depot: add nic_perf recipes
genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
3e562bc9bb os: add nic_perf component
The nic_perf component is used for benchmarking the throughput of Nic
and Uplink sessions.

genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
8df8f78fe2 nic_router_dhcp: fix signal handler in test client
The test client did not react upon packet_avail and ack_avail signals.

genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Martin Stein
9a37ccfe29 nic_router: incremental L4 checksum updates
The checksums for forwarded/routed UDP, TCP and ICMP, used to be always
re-calculated from scratch in the NIC router although the router changes only
a few packet fields. This commit replaces the old approach whereever sensible
with an algorithm for incremental checksum updates suggested in RFC 1071.
The goal is to improve router performance.

Ref #4555
2022-08-10 13:33:02 +02:00
Martin Stein
b6d15fa3ab nic_router: incremental IPv4 checksum updates
The checksums for forwarded/routed IPv4, used to be always re-calculated from
scratch in the NIC router although the router changes only a few packet fields.
This commit replaces the old approach whereever sensible with an algorithm for
incremental checksum updates suggested in RFC 1071. The goal is to improve
router performance.

Ref #4555
2022-08-10 13:33:02 +02:00
Martin Stein
d69e89f5cb internet checksum: use signed long for accumulator
We used to use 'unsigned long' for the accumulating variable when calculating
internet checksums. However, 'signed long' is more in accordance with RFC 1071
and will allow us to share the same back end for folding, once we implement
incremental updating of internet checksums.

Ref #4555
2022-08-10 13:33:02 +02:00
Martin Stein
6b3ed6c75b internet checksum: no default arg value
Prevent public reflection of the only internally used 'init_sum' argument in
'uint16_t internet_checksum(...)' that, in addition, added a default value to
the function interface.

Ref #4555
2022-08-10 13:33:02 +02:00
Martin Stein
07d4a7c11f nic_router: no IPv4 checksum update on ICMP echo
When sending an ICMP ECHO reply, the router merely swaps SRC and DST of the
IPv4 header of the corresponding request and these changes cancel each other
out in checksum calculation. Therefore, with this commit, the router skips
updating the IPv4 checksum in this context.

Ref #4555
2022-08-10 13:33:02 +02:00
Martin Stein
865ee192b4 nic_router: no checksum update on IP routing
The router used to update IPv4 checksums when routing via an <ip> rule
despite the fact that it doesn't change any IPv4 header fields in this case.

Ref #4555
2022-08-10 13:33:02 +02:00
Martin Stein
95b3b36cd9 nic_router: update checksums only once per packet
The NIC router used to update IPv4 and layer 4 checksums of a packet for each
interface it was sent to (say, all interfaces of the domain the packet was
routed to). However, there was and is no technical reason for not doing it
only once and then iterating over the interfaces with the already updated
packet. This is what this commit does in an intent to raise the router's
performance.

Ref #4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
01c9c32573 nic_router: relax timer accuracy for timestamps
The NIC router uses the timer for relatively coarse-grained timeouts.
It therefore suffices to update and store the current time when the NIC router
is signalled and use the cached time instead. This prevents frequent
syscalls or RPCs when acquiring the current time for every packet.

genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
735abca1b6 nic_router: avoid marginal timeout updates
The link dissolve timeout is updated for every packet, which leads to
trigger_once() RPCs that only marginally change the scheduled timeout but
significantly slow down the packet throughput.

genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
3ea910bf83 packet_stream: reset wakeup_needed on wakeup()
The wakeup call only emits a single signal as it assumed both are
handled by the same signal handler. However, the original implementation
did not reset the wakeup_needed variable properly.

genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
6a308dacd7 packet_stream: always emit ack_avail
When using signal batching, ack_avail and packet_avail should always
be emitted and preferred over ready_to_submit and ready_to_ack.
A signal receiver might decide to not register the ready_to_* signals when it
handles congestion by dropping packets. The Nic router is an example of
such a signal receiver.

genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Johannes Schlatow
8193f5571a nic_router: batch packet stream signals
genodelabs/genode#4555
2022-08-10 13:33:02 +02:00
Peter Krummenacher
f859cd11bd rom_filter: support sub nodes outside of <inline>
Fixes #4560
2022-08-10 13:33:00 +02:00
Josef Söntgen
9183870b9e gpu: add information for lima driver
Issue #4559.
2022-08-10 13:33:00 +02:00
Josef Söntgen
b6cfb5a8fe gpu_session: add PPGTT address query function
Using the 'query_buffer_ppgtt()' function allows for retrieving the
virtual address of the buffer in the PPGTT.

This is for components that manage the GPU virtual addresses rather than
the client as is the case with the lima driver.

Issue #4559.
2022-08-10 13:33:00 +02:00
Christian Helmuth
9a47f7bf71 sandbox: prevent non-empty list model on destruction
The parent-provides model is destroyed if no <parent-provides> node is
found in the configuration, which resulted in

  Warning: list model not empty at destruction time

and leaking memory for the allocated nodes. The commit now explicitly
empties the list model in the destructor of ~Parent_provides_model.

Note, the case is implicitly tested in pkg/test-init by step "denial of
forwarded session request" and <init_config version="empty">.

Thanks to Peter for reporting this issue.

Fixes #4547
2022-08-10 13:33:00 +02:00
Christian Helmuth
4550ec4716 genode_c_api: key-press/release and relative-motion events
Issue #4543
2022-08-10 13:33:00 +02:00
Christian Helmuth
393766a931 legacy_platform_drv: ACPI devices in configuration
Known ACPI device resources can be statically configured on startup like
follows.

  <config>
    <policy label_prefix="driver">
      <device name="ACPI0000"/>
    </policy>
    <device name="ACPI0000" typee="acpi">
      <irq number="99" mode="level" polarity="low"/>
      <io_mem        address="0xfc000000" size="0x100000"/>
      <io_port_range address="0x4000"     size="4"/>
    </device>
  </config>

Fixes #4545
2022-08-10 13:33:00 +02:00
Martin Stein
d5b1d9466a nic_router: clear ARP cache when domain is down
Whenever a domain looses all its interfaces or the link state of all attached
interfaces is down at once, the domain potentially moves to another Ethernet
segment and should therefore consider its ARP cache to be outdated.

RFC 826 states that "... If a host moves, any connections initiated by that
host will work, assuming its own address resolution table is cleared when it
moves. ...".

Therefore, this commit introduces clearing the ARP cache and the initially
stated events.

This commit was motivated by an issue with the PinePhone Modem and USB NIC.
On the PinePhone, the Modem has its own OS and acts as direct gateway to the
outer world for the USB NIC that is driven by Genode. However, whenever the
Modem gets restarted, Modem and USB NIC receive a new MAC address. This used
to conflict with the NIC routers ARP entry for the Modem that didn't cease to
be valid.

With this commit, the integrator of such a scenario at least has a convenient
way of fixing this by ensuring that all interfaces at the USB NIC domain go
down when resetting (e.g. by ensuring that the USB NIC is the only interface at
that domain).

Fixes #4558
2022-08-10 13:32:59 +02:00
Roland Bär
18b022bf6b rtc_drv: log 'set time' message on verbose
The "verbose" config attribute instructs the driver to log 'set time'
messages when the RTC updated initially or from the 'set_rtc' ROM.

Fixes #4526
2022-08-10 13:32:59 +02:00
Martin Stein
925d229d67 nic_router: find AVL string nodes w/o exceptions
Replaces the former use of the 'find_by_name' method of the AVL string tree.
This method returned a reference to the found object and threw an exception if
no matching object was found.

The locally implemented replacement doesn't return anything and doesn't throw
exceptions. It takes two lambda arguments instead. One for handling the case
that a match was found with a reference to the matching object as argument and
another for handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Furthermore, this commit modifies the local wrapper for the  insert method of
the AVL string tree, so, that it follows the above mentioned concept as well.

Ref #4536
2022-08-10 13:32:59 +02:00
Martin Stein
6294167eff nic_router: find nat rules w/o exceptions
Replaces the former implementation of the 'find_by_domain' method at the data
structure for NAT rules. This method used to return a reference to the found
object and threw an exception if no matching object was found.

The new implementation doesn't return anything and doesn't throw exceptions. It
takes two lambda arguments instead. One for handling the case that a match was
found with a reference to the matching object as argument and another for
handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Ref #4536
2022-08-10 13:32:58 +02:00
Martin Stein
65955601f0 nic_router: find permit rules w/o exceptions
Replaces the former implementation of the 'find_by_port' method at the data
structure for permit rules. This method used to return a reference to the found
object and threw an exception if no matching object was found.

The new implementation doesn't return anything and doesn't throw exceptions. It
takes two lambda arguments instead. One for handling the case that a match was
found with a reference to the matching object as argument and another for
handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Furthermore, the commit introduces a convenience wrapper for finding the best
matching pair of transport rule and corresponding permit rule for a given
destination IP and port. This method as well follows the above mentioned
concept.

Ref #4536
2022-08-10 13:32:58 +02:00
Martin Stein
0f6714c6d7 nic_router: find forward rules w/o exceptions
Replaces the former implementation of the 'find_longest_prefix_match' method at
the data structure for direct rules. This method used to return a reference to
the found object and threw an exception if no matching object was found.

The new implementation doesn't return anything and doesn't throw exceptions. It
takes two lambda arguments instead. One for handling the case that a match was
found with a reference to the matching object as argument and another for
handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Ref #4536
2022-08-10 13:32:58 +02:00
Martin Stein
5d14adebb5 nic_router: find direct rules w/o exceptions
Replaces the former implementation of the 'find_longest_prefix_match' method at
the data structure for direct rules. This method used to return a reference to
the found object and threw an exception if no matching object was found.

The new implementation doesn't return anything and doesn't throw exceptions. It
takes two lambda arguments instead. One for handling the case that a match was
found with a reference to the matching object as argument and another for
handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Ref #4536
2022-08-10 13:32:58 +02:00
Martin Stein
baf4a85d23 nic_router: find link sides w/o exceptions
Replaces the former implementation of find_by_id at the data structure for
links. This method used to return a reference to the found object and threw an
exception if no matching object was found.

The new implementation doesn't return anything and doesn't throw exceptions. It
takes two lambda arguments instead. One for handling the case that a match was
found with a reference to the matching object as argument and another for
handling the case that no object matches.

This way, expensive exception handling can be avoided and object references
stay in a local scope.

Ref #4536
2022-08-10 13:32:58 +02:00
Stefan Kalkowski
4234659cac pci_decode: fix iteration bounds of PCI buses
Fix #4539
2022-08-10 13:32:58 +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
Piotr Tworek
9d417ee2f5 os: Allow VirtIO drivers to be built for RISC-V
Just add riscv spec files. The riscv versions should use MMIO transport
as ARM versions do. They also should work fine for riscv_qemu machine
from genode-riscv repository.
2022-08-10 13:32:58 +02:00
Piotr Tworek
e7fb38834a virtdev_rom: Add RISC-V platform support.
The location of the VirtIO device block is different on RISC-V virt qemu
machine.
2022-08-10 13:32:58 +02:00
Alexander Boettcher
c2d9fbca9b acpi_drv: report Intel opregion copy
acpica and the Intel display driver tries to use the Intel Opregion
simultaneously on Genode, which is not supported nor wanted for IO_MEM region as
which it is handled.

Attempts to remove the access to the region was not successful, since some
SSDT table contains ACPI AML code which is executed regularly and read/write
the Opregion.

The patch adds support to make a copy of the Intel Opregion and report it as
is. The copy was sufficient to make the Intel display driver working to find
and lookup the Intel VBT (video bios table) information to setup all
connectors on a Fujitsu U7411 docking station.

Issue #4531
2022-08-10 13:32:57 +02:00
Alexander Boettcher
b1195508ba platform_drv: avoid filtering of dev in ALL policy
ACPICA needs access to the host bridge 0:0.0 on Intel, which is also
accessed by the Intel display driver. Since for the Intel display driver the
PCI device is specified in the policy explicitly, the PCI device is filtered
out for the ACPICA driver which uses the policy "ALL".

Issue #4532
2022-08-10 13:32:57 +02:00
Josef Söntgen
b77f59286f gpu/intel: abort client on accounting mismatch
Issue #4525.
2022-08-10 13:32:57 +02:00
Josef Söntgen
1010267dee gpu/intel: increase worst case CAP estimate
It may happen that 1 additional CAP is used during buffer allocation.

Fixes #4525.
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
Christian Helmuth
a037fac5c5 depot: update recipe hashes 2022-05-31 10:52:11 +02:00
Christian Helmuth
3105fa9e0f depot: update recipe hashes 2022-05-25 12:23:04 +02:00
Johannes Schlatow
3b0995cb49 platform_drv: fix uncaught exception
Calling alloc_dma_buffer() with size=0 will cause an exception in the
ram allocator.

genodelabs/genode#4518
2022-05-25 12:23:04 +02:00
Johannes Schlatow
c38b71146b trace_buffer: only iterate after initialization
There is a race between the trace subject doing the buffer
initialization and the monitor trying to iterate the buffer entries. If
the monitor tries to iterate entries of an uninitialized buffer, it will
read the very first entry twice. The monitor should therefore only start
iteration when the buffer has been initialised.

genodelabs/genode#4513
2022-05-25 12:23:04 +02:00
Norman Feske
1f3b6490f2 nitpicker: update hover state on touch events
The hover state is evaluated for the routing of input events. When
routing a touch event, the decision should be based on the most recently
observed touch position. Without this patch, however, the hover state kept
referring to the initial pointer position (screen center) in the absence
of any other motion events.

Issue #4514
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
bd501404db net: add methods required for WireGuard port
* Adds methods for copying raw data to the data field of Ethernet frames and
  UDP packets. This is used in the port to wrap the higher-layer packet data
  prepared by the contrib code with the additionally required headers before
  sending it at a network session.
* Adds a method to cast raw data to an IPv4 packet. This is required in the
  port in order to check values in stand-alone IP packets produced by the
  contrib code before sending them at a network session.
* Adds methods for setting UDP ports given big endian port values without
  having to convert to little endian in the app and then back to big endian in
  the net lib.

Ref #4397
2022-05-25 12:23:02 +02:00
Martin Stein
679be47def net: fix conversion compiler errors
Ref #4397
2022-05-25 12:23:02 +02:00
Martin Stein
99eca9fa7e nic_router: fix bad gateway values in README
Gateway configuration values contained a subnet prefix-length which is
not required nor accepted by the router.

Ref #4397
2022-05-25 12:23:02 +02:00
Stefan Kalkowski
f9a29f291e pci: extend Pci utilities for bridge drivers 2022-05-25 12:22:10 +02:00
Stefan Kalkowski
19f50a9a45 platform_drv: enhance coding practice
* more constness where possible
* hide device reporter functionality in Device_reporter interface
2022-05-25 12:19:33 +02:00
Stefan Kalkowski
e9b666d1a8 platform_drv: some small and cosmetic fixups
* Some fixups for the README
* Make config ROM const when used for the session policies
* Turn Reporter into Expanding_reporter
* Always first register ROM signal handler before parsing it the first time
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
14f192fb00 platform_drv: make devices ROM name configureable
Fix genodelabs/genode#4504
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
438870e223 platform_drv: outsource common parts for derivate
Outsource parts of the Main object into a common compound object,
common parts of the Makefile description and depot source package.

Fix genodelabs/genode#4503
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
9370e5e4d0 platform_drv: add PCI device support
* Parse PCI specific information from devices ROM
* Enable DMA, I/O memory and I/O port access dependent on BARs in config space
* Introduce device PD for Nova + IOMMU support
* Enable MSIs if available
* Add PCI specific policy rules

Fixes genodelabs/genode#4502
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
6b92006565 platform_drv: consider IRQ type, mode, polarity
Parse the devices ROM for additional interrupt information, and
pass them to the IRQ connection when needed.

Fix genodelabs/genode#4497
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
de7fdd3e1a platform_drv: wait for device's availability
Instead of returning an invalid device capability when a device
is (not yet) available, e.g. a PCI device is requested before the
PCI bus got parsed accordingly, we check the device capability
within the Platform::Connection utilities, and register temporarily
an Io_signal_handler to wait for changes of the devices ROM, and
try the device aquisition again. Thereby, simple drivers so not have
to take the burden to do so.

To enable this feature for all drivers, we always have to export a
devices ROM, but limit the information about physical resources
(I/O memory addresses, IRQ numbers, I/O port ranges) to clients with
'info=yes' in their policy description.

Fix genodelabs/genode#4496
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
a1564d1826 platform_drv: add report facility
By adding a 'report' node to the platform driver's configuration
one can enable either devices or config reports. The devices
report contains all devices and their detailed state, as well as
whether it is already in use or not. The config report contains
one by one the current configuration of the platform driver.
Moreover, this commit adds a README file describing the facilities
of the platform driver.

Fix genodelabs/genode#4386
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
d0694b3e0b platform_drv: separate devices info from config
Fix genodelabs/genode#4491
2022-05-25 12:19:32 +02:00
Christian Helmuth
f032bdf81c legacy_platform_drv: configurable PCI BAR remapping
If PCI devices happen to miss complete configuration after boot, the
platform driver supports <pci-fixup> nodes for concrete devices
(specified by bus-device-functions tuples). The
<bar> node instructs the platform driver to remap BAR id 0 to address
0x4017002000, which amends the BIOS configuration and is stringently
required for BARs with address 0.

! <pci-fixup bus="0" device="0x15" function="3">
!   <bar id="0" address="0x4017002000"/>
! </pci-fixup>

The issue was discovered with Intel LPSS devices in Fujitsu notebooks.

Fixes #4501
2022-05-25 12:19:32 +02:00
Stefan Kalkowski
cacb6136fa app/pci_decode: prepare pci device information
To discharge the generic platform driver from certain PCI bus scanning,
and ACPI + kernel specifics, this commit introduces a new component,
which consumes the acpi drivers report and the platform_info from core
to prepare a devices ROM for the platform driver that contains all
PCI devices and its resources.

Fix genodelabs/genode#4495
2022-05-25 12:19:32 +02:00
Josef Söntgen
87021d9fb1 usb_block_drv: allow for using UAS devices via BOT
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.

Fixes #4494.
2022-05-25 12:19:32 +02:00
Christian Helmuth
65d7b3e652 Remove unused Nic::Root implementation (nic/root.h)
Issue #3961
2022-05-25 12:19:31 +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
e3d08893b7 lan9118_nic_drv: remove deprecated server mode
Ref genodelabs/genode#3961
2022-05-25 12:19:31 +02:00
Stefan Kalkowski
0ba911bf12 virtio_nic_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