Commit Graph

185 Commits

Author SHA1 Message Date
Alexander Boettcher
c1493b2ed2 usb: avoid pagefault during session destruction
due to pointer to object allocated in context of the session object.

Fixes #2565
2017-11-09 12:18:05 +01:00
Josef Söntgen
2f32308c0b wifi_drv: use task for sending frames
Until now the client called the Linux code directly through the EP
when sending ethernet frames and was not part of the driver's internal
task scheduling. This will lead to problems if the sending code needs
to grab a lock as those depend on running from within a Lx::Task.
Although this has only happend recently when using 8260 devices, this
is an issue that needs to be fix.

This commit addresses the issue by using a dedicated transmit task
in whose context the Linux code sends the ethernet frame or rather
newly allocated skb.

Fixes #2559.
2017-11-06 13:57:24 +01:00
Josef Söntgen
bb95121ee5 wifi_drv: remove unnecessary debug message
AFAICT, we do the right thing by calling 'consume_skb()'.

Issue #2559.
2017-11-06 13:57:24 +01:00
Sebastian Sumpf
3409eeeb34 wifi_drv: occasionally crashes during session destruction
Drop rx-packets in case there is no client session

fixes #2557
2017-11-06 13:57:21 +01:00
Emery Hemingway
6aba4871a7 lib/vfs/lxip: allow missing nameserver configuration
Ref #2535
2017-11-06 13:57:17 +01:00
Emery Hemingway
8ca63d4a6e libc: reintegrate libc_resolv library
Remove getaddrinfo and freeaddrinfo from the Libc::Plugin and get rid of
the extra libc_resolv library. Remove getaddrinfo/freeaddrinfo symbol
hiding patch for FreeBSD sources. Remove libc_resolv from Makefiles and
run scenarios.

Fix #2273
2017-10-05 17:40:04 +02:00
Christian Helmuth
7b9edcf90c lxip: fix timer deletion and modification
Linux del_timer() and mod_timer() return if the timer was pending before
the modification. Additionally, these functions are potentially called
from handler function of the timer to modify and, therefore, checking
for timeout != INVALID_TIMEOUT is not sufficient as the timeout is
indeed valid when the handler is executed.
2017-10-05 17:40:03 +02:00
Christian Helmuth
9ff82d76c0 lxip: fix timer handling and jiffies update 2017-10-05 17:40:03 +02:00
Martin Stein
570b5a6920 libc_resolv/_lxip: fix undefined references...
... to Libc::Plugin::getdirentries, Libc::Plugin::mmap, and
Libc::Plugin::msync.

Ref #2490
2017-08-30 10:01:35 +02:00
Emery Hemingway
1fce8d0d74 default ahci_drv and part_blk Block sessions to read-only
Add a "writeable" policy option to the ahci_drv and part_blk Block
servers and default from writeable to ready-only. Should a policy
permit write acesss the session request argument "writeable" may still
downgrade a session to ready-only.

Fix #2469
2017-08-28 16:49:51 +02:00
Christian Prochaska
b0935ef9b2 VFS: nonblocking interface
The VFS library can be used in single-threaded or multi-threaded
environments and depending on that, signals are handled by the same thread
which uses the VFS library or possibly by a different thread. If a VFS
plugin needs to block to wait for a signal, there is currently no way
which works reliably in both environments.

For this reason, this commit makes the interface of the VFS library
nonblocking, similar to the File_system session interface.

The most important changes are:

- Directories are created and opened with the 'opendir()' function and the
  directory entries are read with the recently introduced 'queue_read()'
  and 'complete_read()' functions.

- Symbolic links are created and opened with the 'openlink()' function and
  the link target is read with the 'queue_read()' and 'complete_read()'
  functions and written with the 'write()' function.

- The 'write()' function does not wait for signals anymore. This can have
  the effect that data written by a VFS library user has not been
  processed by a file system server yet when the library user asks for the
  size of the file or closes it (both done with RPC functions at the file
  system server). For this reason, a user of the VFS library should
  request synchronization before calling 'stat()' or 'close()'. To make
  sure that a file system server has processed all write request packets
  which a client submitted before the synchronization request,
  synchronization is now requested at the file system server with a
  synchronization packet instead of an RPC function. Because of this
  change, the synchronization interface of the VFS library is now split
  into 'queue_sync()' and 'complete_sync()' functions.

Fixes #2399
2017-08-28 16:49:38 +02:00
Martin Stein
47dc708887 usb rpi: get rid of local hardware timer
We used a hardware timer locally in the RPI USB driver because a timer
connection was not precise enough to fullfill the host controllers
requirements.

With the modern timer connection interface, however, reading out time at
a connection is microseconds precise and we can remove the local timer.
But we cannot use the same timer connection for doing legacy-interface
stuff like usleep (currently used in LX kit) and modern-interface stuff
like curr_time. Thus, we open two connections for now.

Ref #2400
2017-08-23 14:08:37 +02:00
Sebastian Sumpf
5adda2d934 usb: add asynchronous interface release
This became necessary, since URBs may still be pending upon interface
release.

Fixes #2466
2017-08-17 11:04:22 +02:00
Christian Helmuth
a431657851 lxip: correct msghdr initialization 2017-05-31 13:16:21 +02:00
Emery Hemingway
c1edfa5d46 lib/vfs/lxip: return READ_QUEUED from read_queued and complete_read
Ref #2406
2017-05-31 13:16:17 +02:00
Christian Helmuth
d0bc389e93 vfs_lxip: correctly initialize iov on remote-file read 2017-05-31 13:16:16 +02:00
Josef Söntgen
5b6735e1c9 lxip: fix iovec iter operations 2017-05-31 13:16:15 +02:00
Martin Stein
c70fed29f7 os/timer: interpolate time via timestamps
Previously, the Genode::Timer::curr_time always used the
Timer_session::elapsed_ms RPC as back end.  Now, Genode::Timer reads
this remote time only in a periodic fashion independently from the calls
to Genode::Timer::curr_time. If now one calls Genode::Timer::curr_time,
the function takes the last read remote time value and adapts it using
the timestamp difference since the remote-time read. The conversion
factor from timestamps to time is estimated on every remote-time read
using the last read remote-time value and the timestamp difference since
the last remote time read.

This commit also re-works the timeout test. The test now has two stages.
In the first stage, it tests fast polling of the
Genode::Timer::curr_time. This stage checks the error between locally
interpolated and timer-driver time as well as wether the locally
interpolated time is monotone and sufficiently homogeneous. In the
second stage several periodic and one-shot timeouts are scheduled at
once. This stage checks if the timeouts trigger sufficiently precise.

This commit adds the new Kernel::time syscall to base-hw. The syscall is
solely used by the Genode::Timer on base-hw as substitute for the
timestamp. This is because on ARM, the timestamp function uses the ARM
performance counter that stops counting when the WFI (wait for
interrupt) instruction is active. This instruction, however is used by
the base-hw idle contexts that get active when no user thread needs to
be scheduled.  Thus, the ARM performance counter is not a good choice for
time interpolation and we use the kernel internal time instead.

With this commit, the timeout library becomes a basic library. That means
that it is linked against the LDSO which then provides it to the program it
serves. Furthermore, you can't use the timeout library anymore without the
LDSO because through the kernel-dependent LDSO make-files we can achieve a
kernel-dependent timeout implementation.

This commit introduces a structured Duration type that shall successively
replace the use of Microseconds, Milliseconds, and integer types for duration
values.

Open issues:

* The timeout test fails on Raspberry PI because of precision errors in the
  first stage. However, this does not render the framework unusable in general
  on the RPI but merely is an issue when speaking of microseconds precision.

* If we run on ARM with another Kernel than HW the timestamp speed may
  continuously vary from almost 0 up to CPU speed. The Timer, however,
  only uses interpolation if the timestamp speed remained stable (12.5%
  tolerance) for at least 3 observation periods. Currently, one period is
  100ms, so its 300ms. As long as this is not the case,
  Timer_session::elapsed_ms is called instead.

  Anyway, it might happen that the CPU load was stable for some time so
  interpolation becomes active and now the timestamp speed drops. In the
  worst case, we would now have 100ms of slowed down time. The bad thing
  about it would be, that this also affects the timeout of the period.
  Thus, it might "freeze" the local time for more than 100ms.

  On the other hand, if the timestamp speed suddenly raises after some
  stable time, interpolated time can get too fast. This would shorten the
  period but nonetheless may result in drifting away into the far future.
  Now we would have the problem that we can't deliver the real time
  anymore until it has caught up because the output of Timer::curr_time
  shall be monotone. So, effectively local time might "freeze" again for
  more than 100ms.

  It would be a solution to not use the Trace::timestamp on ARM w/o HW but
  a function whose return value causes the Timer to never use
  interpolation because of its stability policy.

Fixes #2400
2017-05-31 13:16:11 +02:00
Norman Feske
4d442bca30 Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.

Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.

This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-31 13:16:07 +02:00
Norman Feske
6609aafb05 Replace Quota_exceeded by Insufficient_ram_quota
This patch replaces the 'Parent::Quota_exceeded',
'Service::Quota_exceeded', and 'Root::Quota_exceeded' exceptions
by the single 'Insufficient_ram_quota' exception type.

Furthermore, the 'Parent' interface distinguished now between
'Out_of_ram' (the child's RAM is exhausted) from
'Insufficient_ram_quota' (the child's RAM donation does not suffice to
establish the session).

This eliminates ambiguities and removes the need to convert exception
types along the path of the session creation.

Issue #2398
2017-05-31 13:16:05 +02:00
Stefan Kalkowski
6106e64aac base: remove include/spec/* other than ISA
This commit moves the headers residing in `repos/base/include/spec/*/drivers`
to `repos/base/include/drivers/defs` or repos/base/include/drivers/uart`
respectively. The first one contains definitions about board-specific MMIO
iand RAM addresses, or IRQ lines. While the latter contains device driver
code for UART devices. Those definitions are used by driver implementations
in `repos/base-hw`, `repos/os`, and `repos/dde-linux`, which now need to
include them more explicitely.

This work is a step in the direction of reducing 'SPEC' identifiers overall.

Ref #2403
2017-05-31 13:16:01 +02:00
Alexander Boettcher
80eddd8731 usb: add OHCI support
Fixes #2357
2017-05-31 13:16:00 +02:00
Christian Helmuth
3b5c16e307 lxip: poll/read_ready for all socket fs files 2017-05-31 13:15:58 +02:00
Christian Helmuth
1d99e7ede9 base: classify signals as I/O and application level
Fixes #2363
2017-05-31 13:15:58 +02:00
Christian Helmuth
f7313e841d vfs_lxip: always allow broadcast packets for UDP 2017-05-31 13:15:57 +02:00
Norman Feske
075c32409a usb_drv: Add missing definition of __aligned macro
This macro is implicitly pulled in by libc-setjmp (via the libc's
cdefs.h). However, apparently not all sources include <setjmp.h>.
Unfortunately, for sources that do, this change produces a
double-definition warning. We should fix it by removing the dependency
from the libc's setjmp.
2017-05-02 15:29:02 +02:00
Alexander Boettcher
2668a55688 usb_drv: fix various nullpointer in raw binding
during reset of a VM, usb device ejected before hand:

ded! amount=27941, size=4096, consumed=24576
Warning: could not allocate metadata
[init -> nit_fb1] using xywh=(0,0,2560,1440)
[init -> usb_drv] dev_info: new SuperSpeed USB device number 2 using xhci_hcd
[init -> vbox1] Attach USB device 0002:0002 (vendor=951, product=16a5)
Warning: Quota exceeded! amount=36133, size=4096, consumed=32768
Warning: could not allocate metadata
[init -> nit_fb1] using xywh=(0,0,2560,1440)
[init -> vbox1] EMT-0    VMMDev: Guest Additions capability report: (0x5 -> 0x5) seamless: yes, hostWindowMapping: no, graphics: yes
[init -> vbox1] EMT-0    VMMDev: Guest Additions capability report: (0x5 -> 0x0) seamless: no, hostWindowMapping: no, graphics: no
[init -> vbox1] EMT-0    VMMDev: Guest Additions capability report: (0x0 -> 0x0) seamless: no, hostWindowMapping: no, graphics: no
[init -> vbox1] EMT-1    VMMDev: Guest Additions capability report: (0x0 -> 0x0) seamless: no, hostWindowMapping: no, graphics: no
Warning: Quota exceeded! amount=44325, size=4096, consumed=40960
Warning: could not allocate metadata
[init -> vbox1] fb resize : [0] 2560x1440 -> 1024x768
no RM attachment (READ pf_addr=0x4 pf_ip=0x105367e from pager_object: pd='init -> usb_drv' thread='ep')
page fault, pd='init -> usb_drv' thread='ep' cpu=0 ip=0x105367e address=0x4 stack pointer=0xa07fef18 qualifiers=0x4 irUwp reason=1

Seen during #2338
2017-05-02 15:28:55 +02:00
Christian Helmuth
88db3c0df7 Fix some deprecated warnings
Issue #1987
2017-03-24 16:20:03 +01:00
Sebastian Sumpf
c707713be8 usb/rpi: fix inconsistency between C and C++
Change fiq_enable from 'int' to 'char' (is bool/_BOOL in C) so data does
not get overwritten accidentally.
2017-02-28 13:00:44 +01:00
Norman Feske
29b8d609c9 Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
Martin Stein
335685b7fe usb: get rid of combined specs
Issue #2280.
2017-02-28 12:59:18 +01:00
Josef Söntgen
15821e32ec nic: remove usage of deprecated env()
This commit includes changes to the Nic::Session_component interface.
We now pass the entire env to the component instead of only ram, rm and
the ep because we need the env to open connections from within the
Session_component implemenation. So far only the cadence_gem driver
needs this, though.

Issue #2280.
2017-02-28 12:59:18 +01:00
Josef Söntgen
3c57a8b3c2 usb_session: pass Region_map explicitly
Issue #2280.
2017-02-28 12:59:17 +01:00
Josef Söntgen
a2cff03539 dde_linux: remove usage of deprecated env()
Fixes #2280.
2017-02-28 12:59:17 +01:00
Sebastian Sumpf
304f2eaf38 lxip: VFS plugin
Provides file-system compatible to libc socket-fs requirements. This
includes pseudo file for network configuration.
2017-02-28 12:59:15 +01:00
Christian Helmuth
1f29e1854a lxip: poll_does_not_wait() for non-blocking API 2017-02-27 15:37:50 +01:00
Sebastian Sumpf
3048017d90 lxip: schedule timeout + poll wait
* poll_wait + schedule_timeout +  block on wait_and_dispatch_one_signal
2017-02-23 14:54:50 +01:00
Christian Prochaska
2d700d0b2d lxip: return zero-initialized memory in '__alloc_percpu()' 2017-02-23 14:54:49 +01:00
Christian Prochaska
59f38fe38c lxip: implement 'rt_genid_ipv4()' and "rt_genid_bump_ipv4()' 2017-02-23 14:54:49 +01:00
Sebastian Sumpf
b8b34efef9 lxip: dhcp update on link state change 2017-02-23 14:54:49 +01:00
Christian Prochaska
a1453d83ff lxip: network reconfiguration support 2017-02-23 14:54:48 +01:00
Christian Prochaska
8025f5f570 lxip: allow network reconfiguration
This commit adds the public functions 'lxip_configure_static()' and
'lxip_configure_dhcp()' for reconfiguring the network.
2017-02-23 14:54:48 +01:00
Christian Prochaska
c5b58a2df4 lxip: implement more needed functions
- rtnl_notify()
- round_jiffies()
- round_jiffies_relative()
- round_jiffies_up()
- schedule_delayed_work()

Fixes #2261
2017-02-23 14:54:47 +01:00
Christian Prochaska
8fcfcbce0e lxip: implement 'mod_delayed_work()'
Fixes #2258
2017-02-23 14:54:47 +01:00
Sebastian Sumpf
6f5c839df7 lxip/libc_lxip: adjust to new Genode API 2017-02-23 14:54:46 +01:00
Sebastian Sumpf
549c6db064 lxip: restore entrypoints + remove sig_rec 2017-02-23 14:54:46 +01:00
Emery Hemingway
48150a706b update Reporter constructors
The Reporter utility needs a reference to the environment at
construction to establish Report connections.

Ref #1987
Fix #2232
2017-02-07 19:20:29 +01:00
Norman Feske
cd3a5852d6 Warn about the use of deprecated headers
This commit enables compile-time warnings displayed whenever a deprecated
API header is included, and adjusts the existing #include directives
accordingly.

Issue #1987
2017-01-31 12:01:18 +01:00
Christian Prochaska
344f6f9e53 os/include/block: API transition (fix 'deprecated' warnings)
...and adaptation of the users of 'Block::Driver', 'Block::Root' and
'Block::Session_component' to the modified interface.

Issue #1987
2017-01-20 16:46:57 +01:00
Christian Prochaska
9be07d2244 os/include/nic: API transition (fix 'deprecated' warnings)
...and adaptation of the users of 'Nic::Root' and 'Nic::Session_component'
to the modified interface.

Issue #1987
2017-01-20 16:46:56 +01:00