Commit Graph

10480 Commits

Author SHA1 Message Date
Martin Stein
b247def09a base-hw: Core main-thread as Main member
Let the Core main-thread object be a member of the one Kernel::Main object
instead of having it as global static variable.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
2b89cd66cb base-hw: kernel CPU-pool as Main member
Let the kernel CPU-pool be a member of the one Kernel::Main object instead of
having it as global static variable.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
be3d5232c8 base-hw: kernel-data lock as Main member
Let the global kernel-data lock be a member of the one Kernel::Main object
instead of having it as global static variable.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
82cf31ac27 base-hw: introduce Kernel::Main class
This commit introduces the Kernel::Main class that replaces the former way of
initializing the kernel (former 'kernel_init' function) and calling the C++
kernel entry handler (former 'kernel' function). These two are now
'Main::initialize_and_handle_kernel_entry' and 'Main::handle_kernel_entry'.
Also reading the execution time of the idle threads was already moved to
'Main'. The one static Main instance is meant to successivly replace all the
global static objects of the base-hw kernel with data members of the Main
instance making the data model of the kernel much more comprehensible. The
instance and most of its interface are hidden in kernel/main.cc. There are only
rare cases where parts of the Main interface must be accessible from the
outside. This should be done in the most specific way possible (see main.h)
and, if possible, without handing out references to Main data members or the
Main instance itself.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
9de43a48b6 base-hw: conform pc board header
Normally, the board header can be found for each supported board under
'src/core/board/<BOARD>/board.h'. This was not the case for the board 'pc'
that was located under 'src/core/spec/x86_64/board.h'. The commit fixes this.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
a9563bfd4c base-hw: rename Core_thread Core_main_thread
The class name Core_thread in Kernel for the object of the first thread of
core is too generic as there can be an arbitrary number of threads in core
besides this one. Furthermore, creating a core thread has its own syscall
'new_core_thread' that isn't related in any way to Core_thread. Therefore
this commit introduces the more specific name Core_main_thread as replacement
for Core_thread.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
693a2b5421 base-hw: get rid of cpu_pool() in platform.cc
The function was only still used for reading the execution time of idle threads
of CPUs. Certainly, it is technically fine and more performant to read these
values directly from the kernel objects without doing a syscall. However,
calling cpu_pool() for it provides read and write access to a lot more than
only the execution time values. The interface via which Core directly reads
state of the kernel should be as narrow and specific as possible.
Perspectively, we want to get rid of the cpu_pool() accessor anyway. Therefore
this commit introduces Kernel::read_idle_thread_execution_time(cpu_idx) as
replacement. The function is implemented in kernel code and called by Core in
platform.cc.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
277adcacb0 base-hw: make Trace_source in Platform() a class
Apparently, there is no need for exposing the data members of Trace_source, so,
we sould better make them private before someone gets the impression that they
are meant to be accessed directly.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
aa6a7db50a base-hw: communicate kernel irqs via boot info
Core used to read the kernel-reserved IRQs from the timer objects in the
kernel's CPU objects and the PIC class (inter-processor IRQ). Besides not
being "good style" to access a kernel object in Core, this becomes a problem
when trying to prevent CPU pool from being accessed via global functions.

As a solution, this commit extends the boot info to also carry an array of all
kernel-reserved IRQs.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
8b69bc96f9 base-hw: separate variants of Kernel_object(...)
For the constructor of Kernel_object<T> there are two variants. One for the
case that it is called from Core where the kernel object (type T) must be
created via a syscall and one when it is called from within the kernel and the
kernel object can be created directly. Selecting one of these variants was done
using a bool argument to the constructor. However, this implies that the
constructor of Kernel_object<T> and that of T have the same signature in the
variadic arguments, even in the syscall case, although technically it would
then not be necessary.

This becomes a problem as soon as kernel objects created by Core shall receive
additional arguments from the kernel, for instance a reference to the global
CPU pool, and therefore stands in the way when wanting to get rid of global
statics in the kernel. Therefore, this commit introduces two constructors that
are selected through enum arguments:

! Kernel_object(Called_from_kernel, ...);
! Kernel_object(Called_from_core, ...);

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
6e4ef43bf0 base-hw: always use 'unsigned' for priorities
At some points in the code, 'signed' was used instead of the more appropriate
'unsigned' type.

Ref #4217
2021-10-13 14:46:52 +02:00
Martin Stein
b922dc5c10 base-hw: fix self-include in kernel/types.h
That this header apparently used to include itself didn't cause any problems
so far but still remained bad style.

Ref #4217
2021-10-13 14:46:52 +02:00
Josef Söntgen
cacb83b163 gpu: introduce mapping attributes
The various mapping methods are modelled after the requirements of
the Intel GPUs or rather the Mesa driver back end.

With upcoming support for other driver back ends, we need to
sequeeze their requirements in as well. For now hijack 'map_buffer'
to provide for specifying the kind of attributes the client needs.

For now all buffers mapped in the GGTT for Intel GPUs are treated
as RW.

Issue #4265.
2021-10-13 14:46:52 +02:00
Josef Söntgen
90e151e2c4 gpu: add 'complete' RPC call
This call allows for checking if the given execution buffer has been
completed and complements the completion signal. Initially the GPU
multiplexer always sent such a signal when the currently scheduled
execution buffer has been completed. During enablement of the 'iris'
driver it became necessary to properly check of sequence number.

In case of the Intel GPU multiplexer the sequence numbers are
continous, which prompted the greater-than-or-equal check in the
DRM back end. By hidding this implementation detail behind the
interface, GPU drivers are free to deal with sequence numbers any
way they like and allows for polling in the client, where the
completion signal is now more of a progress signal.

Issue #4265.
2021-10-13 14:46:52 +02:00
Josef Söntgen
e37792ce94 gpu: introduce information dataspace
The current info implementation (as RPC) is limited in a few ways:

  * The amount of data that may be transferred is constrained by the
    underlying base platform
  * Most information never changes during run time but is copied
    nonetheless
  * The information differs depending on the used GPU device and
    in its current implementation only contains Intel GPU specific
    details

With this commit the 'info' RPC call is replaced with the
'info_dataspace' call that transfers the capability for the dataspace
containing the information only. This is complemented by a client
local 'attached_info' call that allows for getting typed access to
the information. The layout of the information is moved to its own
and GPU-specific header file, e.g., 'gpu/info_intel.h'

Issue #4265.
2021-10-13 14:46:52 +02:00
Josef Söntgen
cfb170c719 gpu: move exec sequence number to Gpu namespace
Moving the type definition removes the aritifial linkage to the Gpu
information structure.

Issue #4265.
2021-10-13 14:46:52 +02:00
Josef Söntgen
3b40790e02 gpu: use Buffer_id to identify buffers
Rather than using the dataspace capability directly, let the client
choose its own local identifier that is linked to the underlying
capability.

Fixes #4265.
2021-10-13 14:46:52 +02:00
Stefan Kalkowski
9a80c3a618 depot: suppress error when copying empty package
Instead of failing, ignore empty packages when copying over
depot packages to a run-script environment.

Fix #4271
2021-10-13 14:46:52 +02:00
Josef Söntgen
ba430dfeac libdrm/iris: destroy Buffer_handle object
When the client frees the buffer, destroy the corresponding
Buffer_handle as well.

Fixes #4266.
2021-10-13 14:46:52 +02:00
Piotr Tworek
b157256a2b uplink client: Add missing space in warning message.
Right now the warning about failure to forward packet from driver to
uplink RX connection reads:

  "exception while trying to forward packet from driverto Uplink
   connection TX"

Add missing space between "driver" and "to".

Issue #4264
2021-10-13 14:46:52 +02:00
Piotr Tworek
60980045ea virtio_nic: Increase default TX & RX virtqueue sizes.
32KB is a rather small value. The driver can cope with it now, but
it does not perform as well as it should. This visible especially
in scenarions like nic_router_flood where we still often hit
synchronous wait path. Bump the size to 256kB.

Issue #4264
2021-10-13 14:46:51 +02:00
Piotr Tworek
880cd3a490 virtio_nic: Fix packet transmission handling.
The problem can be seen when running nic_router_flood scenarion on arm
qemu_virt boards. With the amount of data this scenario tries to send
the driver quickly complains it has failed to push data into TX VirtIO
queue. After this warning message is printed nothing really happens and
after a while the test scenario fails.

The fact that we can't write all available data to the device is not
unexpected. VirtIO queue size is slected at initialization time and we
don't change it during driver lifetime. It can be tweaked via driver
config, but this does not change the fact that we'll always be able to
produce more data packets than we have free space in the VirtIO queue.

IMO the expected behavior of the driver in such case should be to:
1. Notify the device there is data to process.
2. Wait for the device to process at least part of it.
3. Retry sending queued packets.

One could expect returning Transmit_result::RETRY from _drv_transmit_pkt
would produce such result. Unfortunately it seems that Uplink_client_base
treats RETRY return value as indication of link being down. It'll retry
sending the packet only after the device notifies it the link is once
again up. This is the reason why nothing happens when running
nic_router_flood on top of virtio_nic driver. The link never goes down
in this case so once we fill the TX VirtIO queue and tell the base class
to retry the send, we'll be stuck waiting for link up change event
which will never arrive.

To fix this problem, when sending a packet to the device fails, do a
synchrnonus TX VirtIO queue flush (tell device there is data to process
and wait until its done with it).

With this fix in place nic_router_flood test scenario passes on both arm
qemu_virt boards.

Issue #4264
2021-10-13 14:46:51 +02:00
Piotr Tworek
b7f66626c2 virtio: Make avail and used ring pointers volatile
The contents of those descriptor rings can be modified by the device.
Mark them as volatile so the compiler does not make any assumptions
about them.

Issue #4264
2021-10-13 14:46:51 +02:00
Christian Helmuth
c0a7696c71 tool/dts/extract: convert regex strings to latin1
The former encoding was UTF-8, which works quite well if LC_CTYPE is
ensured to be an UTF-8 codeset (e.g., en_US.UTF-8 or C.UTF-8 . But, if
LC_CTYPE is set to C or latin1 for example, the Tcl regex library enters
an infinite loop because of unexpected characters used as markers
n the strings (e.g., SECTION SIGN U+00A7).

Therefore, the extract tool was converted to latin1 with the following
commands and now works for LC_CTYPE C and UTF-8 codesets.

   iconv -f utf-8 -t latin1 tool/dts/extract > /tmp/e
   cp /tmp/e tool/dts/extract
2021-10-13 14:46:51 +02:00
Alexander Boettcher
d85a448c52 gpu/intel: provide supported devices as config
Adjust drivers_managed and sculpt accordingly.

Issue #4260
2021-10-13 14:46:51 +02:00
Sebastian Sumpf
d67899be95 gpu/intel: enable 32 bit CPU support
* use Gpu::addr_t (64 Bit) where necessary instead of Genode::addr_t.

issue #4260
2021-10-13 14:46:51 +02:00
Alexander Boettcher
6112c0df6d mesa: rename gpu-* pkg to mesa_gpu-*
for easier linking by user with the Mesa client ROM requests, which will be
mesa_gpu-drv.lib.so. Adjust mesa-gears demo accordingly.

Issue #4263
2021-10-13 14:46:51 +02:00
Alexander Boettcher
367385aed7 gpu/intel: add more supported Intel GPUs
- Lenovo T470p, T490, T490s

Issue #4260
2021-10-13 14:46:51 +02:00
Alexander Boettcher
0f72356570 gpu/intel: use read out gttm size
and don't assume 8M, which leads to Region_conflicts if size is >8M (X201).

Issue #4260
2021-10-13 14:46:51 +02:00
Christian Helmuth
727fa86088 autopilot: support additional repo directories
-a <repo-dir> appends repo-dir to REPOSITORIES in build.conf
2021-10-13 14:46:51 +02:00
Christian Helmuth
32394c0733 hello: fix resource config / add to autopilot list 2021-10-13 14:46:51 +02:00
Alexander Boettcher
5aa3c56e5c mesa: add gears package
Issue #4263
2021-10-13 14:46:51 +02:00
Alexander Boettcher
0c2edce8ac sculpt: add Gpu service support
Fixes #4263
2021-10-13 14:46:51 +02:00
Alexander Boettcher
2d2ef2a763 mesa: add gpu-iris package providing IRIS driver
Issue #4263
2021-10-13 14:46:51 +02:00
Alexander Boettcher
b6beff673a mesa: add gpu-cpu package providing SWRAST driver
Issue #4263
2021-10-13 14:46:51 +02:00
Sebastian Sumpf
07881f90a9 mesa/libdrm: remove signal EP
This is a left over from Mesa-11 and we exchanged it with a
'wait_and_dispatch_one_io_signal' for synchronous signal waits.

issue #4260
2021-10-13 14:46:50 +02:00
Sebastian Sumpf
3daa94ff2e gpu/intel: Add support for Gen9+
This commit contains features and buf fixes:

* Catch errors during resource allocation

* Because Mesa tries to allocate fence (hardware) registers for each
  batch buffer execution, do not allocate new fences for buffer objects
  that are already fenced

* Add support for global hardware status page. Each context additionally
  has a per-process hardware status page, which we used to set the
  global hardware status page during Vgpu switch. This was obviously
  wrong. There is only one global hardware status page (set once during
  initialization) and a distinct per-process page for contexts.

* Write the sequence number of the currently executing batch buffer to
  dword 52 of the per-process hardware status page. We use the pipe line
  command with QW_WRITE (quad word write), GLOBAL_GTT_IVB disabled
  (address space is per-process address space), and STORE_DATA_INDEX
  enabled (write goes to offset of hardware status page). This command
  used to write to the scratch page. But Linux now uses the first
  reserved word of the per-process hardware status page.

* Add Gen9+ WaEnableGapsTsvCreditFix workaround. This sets the "GAPS TSV
  Credit fix Enable" bit of the Arbiter control register (GARBCNTLREG)
  as described by the documentation this bit should be set by the BIOS
  but is not on most Gen9/9.5 platforms. Not setting this bit leads to
  random GPU hangs.

* Increase the context size from 20 to 22 pages for Gen9. On Gen8 the
  hardware context is 20 pages (1 hardware status page + 19 ring context
  register pages). On Gen9 the size of the ring context registers has
  increased by two pages to 21 pages or 81.3125 KBytes as the IGD
  documentation states.

* The logical ring size in the ring buffer control of the execlist
  context has to be programmed with number of pages - 1. So 0 is 1 page.
  We programmed the actual number of pages before, leading to ring
  buffer execution of NOOPs if page behind our ring buffer was empty or
  GPU hangs if there was data on the page.

issue #4260
2021-10-13 14:46:50 +02:00
Sebastian Sumpf
59b23bc7e1 libdrm: Iris - execute batch buffer synchronous
* Wait for for completion before return from 'execbuffer2'. This makes
  buffer execution synchronous.

* Because the Iris driver manages the virtual address space of the GPU
  and creates one GEM context for each batch buffer we have to map/unmap
  all buffer objects before and after batch buffer execution.

issue #4260
2021-10-13 14:46:50 +02:00
Norman Feske
b7bb6869b4 drivers_interactive-pc: remove platform service
The platform driver should better stay internal to the drivers subsystem
to reinforce the consistency with other drivers_interactive packages.
2021-10-13 14:45:24 +02:00
Norman Feske
e6cdaafb20 tool/ports: use current time as modification time
Fixes #4262
2021-10-13 14:02:16 +02:00
Norman Feske
d072c408ab dde_linux: call init_page_count for each page
The lx_emul_virt_to_pages implementation initialized the page ref
counter only for the first page, leaving the remaining elements in
uninitialized state. This, in turn, rendered the Linux page_pool (as
used by the emac network driver) ineffective, ultimately leading the a
memory leak. The fix changes the call of 'init_page_count' to take the
loop variable as argument.

Issue #4225
2021-10-13 14:02:16 +02:00
Johannes Schlatow
4dacac3dbb depot_autopilot: fix test-trace
Increased number of trace subjects since the test sporadically fails on
some platforms.

Also added a sanity check to print an error message in case we run into
the same issue again.

Fixes genodelabs/genode#4261
2021-10-13 14:02:16 +02:00
Norman Feske
914a41a8bd dde_linux: adjustments for Linux 5.14.1
Issue #4259
2021-10-13 14:01:03 +02:00
Tomasz Gajewski
e6c915ae06 libssh port: immediate mode for ssh poll
This patch adds a switch to internal poll function in libssh that
allows to force this function to immediately return without actually
polling for data and in consequence processing this data. This switch
is used to avoid calling callback functions when flushing output
streams which caused locks due to recursive access to internal
ssh_terminal sessions registry.

Issue #4258
2021-10-13 14:01:02 +02:00
Tomasz Gajewski
6ef6f16cb3 libssh port: backported sftp_server_free
sftp_server_free function was added in 0.9 version of libssh and is
required to avoid memory leaks when clients are disconnecting.

Issue #4258
2021-10-13 14:01:02 +02:00
Tomasz Gajewski
f327a40bbb libssh port: required modifications for sftp
This patch allows to replace sftp packet read and write with
completely asynchronous versions needed to properly hook in existing
ssh_terminal implementation.

Issue #4258
2021-10-13 14:01:02 +02:00
Tomasz Gajewski
e34d1550a4 ssh_terminal: added missing include
Issue #4258
2021-10-13 14:01:02 +02:00
Christian Helmuth
77a5cf7fd4 vbox6: enable audio via OSS plugin 2021-10-13 14:01:02 +02:00
Christian Helmuth
2ba5e4a5b1 libc/oss: check argp per ioctl
... as some ioctls do not require a valid pointer.
2021-10-13 14:01:02 +02:00
Christian Helmuth
5c82045170 vbox6: enable mouse wheel reporting 2021-10-13 14:01:02 +02:00