Compare commits

...

334 Commits

Author SHA1 Message Date
Christian Helmuth
abc9a2f232 depot: update recipe hashes 2021-10-14 13:46:25 +02:00
Norman Feske
0a35e02961 sculpt: documentation update
Issue #4281
2021-10-14 13:22:18 +02:00
Christian Helmuth
98ffa60577 Increase cap quota for system-shell terminal 2021-10-14 11:48:23 +02:00
Josef Söntgen
9980718c92 libyuv: build unoptimized on ARMv8 2021-10-14 11:46:42 +02:00
Josef Söntgen
2e0d9c8521 libdrm: short-cut tiling in iris back end
Apparently the iris driver does not make use of tiling by the kernel, so
we shortcut the 'SET_TILING' call to keep iris happy with this quickfix.

However, tiling information may get lost, if the iris driver ever calls
'MMAP_GTT' and no fence is configured for the buffer. A follow-up commit
should address this shortcoming in the future.

Issue #4284
2021-10-14 11:40:39 +02:00
Norman Feske
31567c8e46 sculpt: curate default index / installation
- CPU-architecture annotations
- Change order of top-level menu, moving Mesa driver to the end
- Add black_hole, recall_fs, file_fault
- Add usb_webcam, test-capture
- Add audio driver and mixer
- Add vbox6, keeping vbox5-nova-sculpt as fallback
- Remove recall_fs launcher, which is obsolete with the recall_fs pkg
- Replace system_clock by system_clock-pc pkg

Issue #4281
2021-10-14 11:02:18 +02:00
Norman Feske
006e807103 sculpt: version 21.10 2021-10-14 11:02:18 +02:00
Norman Feske
4dac2fd008 sculpt: increase RAM of leitzentrale nitpicker
This follow-up commit to "sculpt: avoid flickering of leitzentrale"
allows nitpicker to double-buffer pixels during resize operation on a
screen size of 1920x1200.
2021-10-14 11:02:17 +02:00
Norman Feske
68e8d1fd21 cached_fs_rom: remove diagnostic message
The message "defer transfer..." spams the log on Sculpt OS.

Issue #4281
2021-10-14 11:02:17 +02:00
Norman Feske
6a89f8b19e wm: fix key_cnt consistency glitch
This patch presents all press and release events to the pointer state,
fixing the problem that _key_cnt was decreased but never increased.
However, the inconsistency had no observable effects in practice.

Issue #4176
2021-10-14 11:02:17 +02:00
Norman Feske
ee463b21ae nitpicker: fix interplay of hover with dragging
This patch extends the notion of having only one uniquely hovered client
in the presence of held keys.

If motion occurs once a key is pressed (e.g., while dragging), the
receiver of the key sequence observes the motion events. In this case,
we have to submit an artificial leave event to the originally hovered
client so that no more than one client observes itself as being hovered
at the same time. Once the key sequence is finished, the hovering is
updated again, eventually presenting a motion event to the originally
hovered client and a leave event to the receiver of the key sequence.

Issue #4176
2021-10-14 11:02:17 +02:00
Norman Feske
1088035f8e wm: defer pointer report update
This patch ensures that the pointer report is updated not before all
input events are handled. The change does not solve any observed
practical issue but the potential problem was spotted while reviewing
the code.

Issue #4176
2021-10-14 11:02:17 +02:00
Christian Helmuth
b2ff2a2950 vbox6: configure OSS plugin only once (as /dev/dsp) 2021-10-14 11:02:16 +02:00
Stefan Kalkowski
c976a1d7e0 dde_linux: iterate over device names not types
To clearly identify the correct device use the unique device's name
not the type. Otherwise a driver cannot drive several devices of the
same type.

Fix #4297
2021-10-14 11:02:15 +02:00
Stefan Kalkowski
98400a68c9 os: extend ARM Platform::Device constructor
Enable construction by explicitely naming a specific device,
if more than one device of the same type exist.

Ref #4297
2021-10-14 11:02:15 +02:00
Josef Söntgen
8679f32d0b dde_linux: backport update event ring for usb_host
This commit contains a backport of commit [1] that deals with updating
the event ring dequeue pointer more often to prevent unnecessary
'Event Ring Full' errors.

  [1] 'usb: host: xhci: update event ring dequeue pointer on purpose'
      (dc0ffbea5729a3abafa577ebfce87f18b79e294b)

Fixes #4296.
2021-10-14 11:02:15 +02:00
Stefan Kalkowski
1d1379430a genode_c_api: safeguard session-policy parsing
Fix #4294
2021-10-14 11:02:15 +02:00
Stefan Kalkowski
b7a379546e genode_c_api: delay USB service announcement
Ref #4294
2021-10-14 11:02:14 +02:00
Stefan Kalkowski
873eb687b0 genode_c_api: reduce USB session ram requirements
Ref #4294
2021-10-14 11:02:14 +02:00
Stefan Kalkowski
1508fdc276 usb_block_drv: handle USB state at startup
Fix #4293
2021-10-14 11:02:14 +02:00
Sebastian Sumpf
c79cdc7b39 gpu/intel: use managed dataspace for aperture mappings
Use 'Region_map_client' for aperture mappings through the GGTT instead
of 'Io_mem_connections'.

issue #4284
2021-10-14 11:02:14 +02:00
Norman Feske
440debfc39 depot_query: filter index by CPU architecture
This patch changes the depot_query tool to filter the returned index
data depending on the 'arch' as specified for the query. This way, one
index file can support multiple CPU architectures while allowing
individual entries to be architecture-specific.

Fixes #4295
2021-10-14 11:02:14 +02:00
Norman Feske
28a71f4a73 cpu_balancer.run: adjust caps for sel4/x86_64 2021-10-14 11:02:14 +02:00
Christian Helmuth
4fd2c9c618 libuvc: exclude .git directory from src archive 2021-10-14 11:02:13 +02:00
Norman Feske
96997ead62 sculpt: fix warning during prepare step
This patch adds the missing definition of 'prio_levels' in the prepare
sub init, fixing the warning:

  [init -> runtime -> prepare] Warning: vfs: invalid priority, upgrading from -2 to 0

Issue #4281
2021-10-14 11:02:13 +02:00
Norman Feske
a12168e1bb pkg/mesa_gears: display frames per second 2021-10-14 11:02:13 +02:00
Sebastian Sumpf
d1461f6a72 vbox6: machine power-down support
Use 'StateChange' event to check for machine's 'PowerOff' state, close
Gui connections and submit exit signal to EP which in turns calls exit.

Fixes #4291
2021-10-14 11:02:13 +02:00
Christian Helmuth
c7abc9f983 vbox6: add pkg with webcam capture support
Issue #4281
Issue #4287
2021-10-14 11:02:13 +02:00
Christian Helmuth
d078f7db76 qemu-usb: adapt to webcam capture on/off changes
Issue #4287
2021-10-14 11:02:13 +02:00
Norman Feske
6f1d3862cd base: introduce Env::try_session
The new 'Env::try_session' method mirrors the existing 'Env::session'
without implicitly handling exceptions of the types 'Out_of_ram',
'Out_of_caps', 'Insufficient_ram_quota', and 'Insufficient_cap_quota'.
It enables runtime environments like init to reflect those exceptions to
their children instead of paying the costs of implicit session-quota
upgrades out of the own pocket.

By changing the 'Parent_service' to use 'try_session', this patch fixes
a resource-exhaustion problem of init in Sculpt OS that occurred when
the GPU multiplexer created a large batch of IO_MEM sessions, with each
session requiring a second attempt with the session quota upgraded by
4 KiB.

Issue #3767
2021-10-14 11:02:12 +02:00
Christian Prochaska
d5d7915b4d audio_in: fix compile errors when strict warnings are enabled
Fixes #4290
2021-10-14 11:02:11 +02:00
Christian Prochaska
b337ee2f2b vfs_oss: fix output fragment limit calculations
Fixes #4289
2021-10-14 11:02:11 +02:00
Johannes Schlatow
ef8a43c546 base-hw: cache maintenance
touch each page before flushing to ensure that it's present in the page table

genodelabs/genode#4279
2021-10-14 11:02:10 +02:00
Sebastian Sumpf
350353885e vbox6: add shared folder support
builds virtualbox6-sharedfolders.lib.so from unmodified VirtualBox6
sources.

fixes #4288
2021-10-14 11:02:10 +02:00
Norman Feske
eb80d6ce66 usb_webcam: on/off dependent on capture client
This commit removes the report service from the usb_webcam pkg, which
was used to enable or disable the webcam driver. The on/off state is
instead controlled by the presence of a capture client. That is, once a
capture client appears, the webcam driver is started. Vice versa, once
no capture client exists, the webcam driver is removed automatically.

Internally, the detection of presence of a capture client is based on
nitpicker's 'displays' report, which is consumed as input of the
rom_filter, which in turn generates the configuration of a dynamic sub
init.

Fixes #4287
2021-10-14 11:02:10 +02:00
Norman Feske
bc5a7eb495 rom_filter: support default input values
Fixes #4286
2021-10-14 11:02:10 +02:00
Stefan Kalkowski
cb67d07e61 lx_emul: be compliant to original softirq impl.
Ref #4268
2021-10-14 11:02:10 +02:00
Christian Helmuth
96ebed6c31 vbox6: use configuration from machine.vbox6
There are some subtle incompatibilities in VirtualBox 6 with settings we
used in version 5. Therefore, the vbox6 package uses machine.vbox6 as
configuration file. An example configuration is provided by the
raw/vbox6 package.

Issue #4281
2021-10-14 11:02:10 +02:00
Josef Söntgen
6093f8ad81 gpu/intel: deal with insufficient amount of CAPS
'Out_of_ram' was so far the only exception a client had to deal with
during buffer managment. Allocating memory, however, does not only
consume RAM quota but CAP quota as well.

This commit tries to mitigate that shortcoming by reflecting the
'Out_of_caps' state back to the client. Furthermore it allows for
resource accounting on certain client allocations, e.g. buffers.

Fixes #4284.
2021-10-14 11:02:09 +02:00
Josef Söntgen
f6d845e630 gpu: reflect CAP shortage during buffer management
Allocating and mapping buffers not only consumes RAM quota, it consumes
CAP quota as well. Extended the Gpu session to allow for dealing with
that on the client side.

On a side note, the amount of initial CAP quota needed to establish
a connection is increased to cover the current costs of the Intel
GPU multiplexer.

Issue #4284.
2021-10-14 11:02:09 +02:00
Josef Söntgen
27e55dab3e platform_drv: check quota before allocating buffer
The platform driver uses a 'Constrained_ram_allocator' to allocate
meta-data on behave of a client. It uses the PD session as
'Ram_allocator' back end that in return is implemented via the
'Expanding_pd_session_client'.

Whenever the PD client itselft comes into resource shortage it will
ask its parent unconditionally. However, depending on the integration,
such a request may be left unanswered.

This commit introduces a check to prevent that situation from
occurring. In case the platform driver notices the resource shortage
it will reflect that back to the client.

Issue #4284.
2021-10-14 11:02:09 +02:00
Norman Feske
05b451c563 pkg/mesa_gpu: use cached_fs_rom
By using the cached_fs_rom instead of fs_rom, each client obtains the
same (read-only) copy of the shared library, avoiding a RAM resource
request when running mulitple GPU applications at the same time.
With this patch, Sculpt is able to host at least 3 Mesa applications.

Issue #4263
Issue #4281
2021-10-14 11:02:09 +02:00
Sebastian Sumpf
2604c3cca6 vbox6: add mouse pointer shape support
Implement 'MousePointerShapeChanged' event, retrieve parameters from
COM pointer, and update shape report.

fixes #4283
2021-10-14 11:02:09 +02:00
Norman Feske
8ebc185caf depot: merge rtc_drv into system_clock runtime pkg
This new version of the system_clock pkg does no longer depend on the
presence of an external 'Rtc' service as previously provided by the
Sculpt base system. Instead, it hosts the rtc_drv inside the subsystem.
Because rtc_drv is board-dependent, the system_clock pkg is named
system_clock-pc now.

Issue #4281
2021-10-14 11:02:08 +02:00
Norman Feske
6e32102cc6 depot: add recall_fs runtime pkg
Issue #4281
2021-10-14 11:02:08 +02:00
Norman Feske
42541fcc92 sculpt: limit depot selection
This patch reduces the items of the default depot-selection menu to
users that actively maintain a Sculpt index.

Issue #4281
2021-10-14 11:02:08 +02:00
Norman Feske
7cae324726 sculpt: remove RTC driver from base system
The RTC driver is not needed by the base system and can thereby be
handled as a user-installable component.

Issue #4281
2021-10-13 14:50:46 +02:00
Sebastian Sumpf
1072a91592 qemu-usb: disable remote wake up in config descriptors
Some guests don't handle remote wake up correctly causing devices to
stop functioning. Therefore, we disable the remote wake up bit (5) in
`bmAttributes` of the device configuration descriptor.

Thanks to Peter for the initial fix.

Fixes #4278
2021-10-13 14:50:46 +02:00
Christian Helmuth
07bb3fc1ec Initial update of init-state ROM in init_loop test
ROM clients have to request an initial update of dynamic ROMs explicitly
and should not depend on artificial signals from the ROM session on
signal-handler registration.

Issue #4274
2021-10-13 14:50:46 +02:00
Johannes Schlatow
93583cce3b sequence: immediately stop child on exit
The sequence app should immediately stop the child when it called
parent().exit(). Otherwise, the child will continue execution which
causes a race condition: The child's ld.lib.so will eventually destruct
an Attached_rom_dataspace for the config rom. If sequence destructed the
corresponding service first, we will get an Ipc_error.

genodelabs/genode#4267
2021-10-13 14:50:46 +02:00
Josef Söntgen
e6bd9fd7da libc: implement SNDCTL_DSP_GETFMTS ioctl
This I/O control is used to query the audio format, e.g. AFMT_S16_LE
in our case.

Fixes #4276.
2021-10-13 14:50:46 +02:00
Martin Stein
870c5c7a81 file_vault: GUI control for encrypted virtual FS's
Warning!

The current version of the file vault is not thought for productive use but
for mere demonstrational purpose! Please refrain from storing sensitive data
with it!

The File Vault component implements a graphical frontend for setting up and
controlling encrypted virtual file systems using the Consistent Block Encrypter
(CBE) for encryption and snapshot management. For more details see
'repos/gems/src/app/file_vault/README'.

Fixes #4032
2021-10-13 14:50:46 +02:00
Martin Stein
3e375e4315 cbe tools: log less by default
Previously unconditional calls to Genode::log in cbe init and the cbe trust
anchor VFS plugin were made dependent on a verbosity flag that is set to
"false" by default.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
8dfa586462 vfs/cbe_trust_anchor: fix bug in key decrypt
The plugin used the ciphertext instead of the plaintext buffer for key
decryption which led to bogus ciphertext keys.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
a661aa79de vfs/cbe_trust_anchor: AES-key-wrap private key
Instead of simply encrypting the private key with AES-256 when storing it to
the 'encrypted_private_key' file, wrap it using the AES-key-wrap algorithm
described in RFC 3394 "Advanced Encryption Standard (AES) Key Wrap Algorithm".
This is more secure and enables us to directly check whether the passphrase
entered by the user was correct or not.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
94701eec09 vfs/cbe_trust_anchor: rename secured_superblock
As the file formerly named 'secured_superblock' actually contains the hash of
the superblock that was secured, it was renamed 'superblock_hash'.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
a28ca44101 vfs/cbe_trust_anchor: rename keyfile
As the file formerly named 'keyfile' actually contains the encrypted private
key of the Trust Anchor, it was renamed 'encrypted_private_key'.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
641a738e3d vfs/cbe_trust_anchor: encrypt symmetric keys
By now, the symmetric keys were only XOR'ed with the private key as placeholder
for a real encryption. Now they are encrypted using AES256 with the TA's
private key as key

Ref #4032.
2021-10-13 14:50:46 +02:00
Martin Stein
f41dec67e1 vfs/cbe_trust_anchor: use secure private key
A private key of 256 bits is generated pseudo-randomly using the jitterentropy
VFS plugin on initialization. The private key is stored in the key file
encrypted via AES256 using the SHA256 hash of the users passphrase. When
unlocking the CBE device, the encrypted private key is read from the key file
and decrypted with the hash of the users passphrase.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
75a55b62a3 vfs/cbe_trust_anchor: use hash of passphrase
Instead of using the user passphrase directly, use its SHA256 hash calculated
using libcrypto. The passphrase hash is still stored in the key file to be
used as base for the very primitive way of generating the private key.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
989b7f39e1 vfs/cbe_trust_anchor: use secure symmetric keys
Use the jitterentropy vfs plugin for the generation of new symmetric block
encryption keys in the cbe trust anchor vfs plugin.

Ref #4032
2021-10-13 14:50:46 +02:00
Martin Stein
a2d2b874ec vfs/cbe_trust_anchor: sync keyfile-handle close
Closing the keyfile handle after a write operation wasn't synchronised to the
actual end of the write operation.

Issuing a write operation at the back end returns successfull as soon as the
back end has acknowledged that it will execute the operation. However, the
actual writing of the data might still be in progress at this point. But the
plugin used to close the file handle and declare the operation finished at this
point which led to warnings about acks on unknown file handles and leaking
resources. Now, the plugin issues a sync operation directly after the write
operation and waits for the sync to complete. This ensures that the plugin
doesn't declare the operation finished too early.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
42490208c2 vfs/cbe_trust_anchor: fix unlocking
The unlocking operation in the trust anchor was broken wich caused bad keys in
the CBE. This rewrites the whole operation to work as desired. Note that this
doesn't make it more safe! The private key is still almost the same as the
passphrase and stored plaintext.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
95639a7492 vfs/cbe_trust_anchor: close handles correctly
The plugin used to close file handles via the 'vfs_env.root_dir.close'.
However, this lead to resource leaks and apparently isn't the right way to
do it. Other VFS plugins do it by calling 'close' directly on the handle and
doing it in the trust anchor plugin also, fixes the leaks.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
df7de17435 vfs/cbe_trust_anchor: sync hashfile-handle close
Closing the hashfile handle after a write operation wasn't synchronised to the
actual end of the write operation.

Issuing a write operation at the back end returns successfull as soon as the
back end has acknowledged that it will execute the operation. However, the
actual writing of the data might still be in progress at this point. But the
plugin used to close the file handle and declare the operation finished at this
point which led to warnings about acks on unknown file handles and leaking
resources. Now, the plugin issues a sync operation directly after the write
operation and waits for the sync to complete. This ensures that the plugin
doesn't declare the operation finished too early.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
1b4a80ffae vfs/cbe: control/deinitialize file
There were no means for issuing a Deinitialize request at the CBE using the
CBE VFS plugin. The new control/deinitialize file fixes this. When writing
"true" to the file, a Deinitialize request is submitted at the CBE. When
reading the file, the state of the operation is returned as a string of the
format "[current_state] last-result: [last_result]" where [current_state] can
be "idle" or "in-progress" and [last_result] can be "none", "success", or
"failed".

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
88e6991083 vfs/cbe: fix ID argument on discard_snap
When discarding a snapshot, the CBE VFS plugin didn't communicate the ID of
the snapshot to the CBE. Instead it set the ID argument to 0. Therefore the
operation never had any effect.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
9b953e79ba vfs/cbe: support watching the snapshots fs
The snapshots file system couldn't be watched. But it's of interest to watch
for appearing and disappearing snapshots.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
4c1eae97cf vfs/cbe: fix result of SnapshotsFS.num_dirent("/")
The snapshots file system used to return the number of snapshots on
'num_dirent' when called for the root directory although it was expected to
return 1. This confused the tooling ontop of the VFS.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
f051bfa90d vfs/cbe: support watching "rekey" file
The control/rekey file couldn't be watched although it was meant to be used
to watch the current state of the rekey operation.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
4ed45dd303 vfs/cbe: support watching "extend" file
The control/extend file couldn't be watched although it was meant to be used
to watch the current state of the extend operation.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
2d0ac161cb vfs/cbe: mark extend/rekey fs readable
Despite being readable, the files control/extend and control/rekey proclaimed
that they were not when asked. This caused the fs_query tool to not report the
content of the files although it could have.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
34245376ba vfs/cbe: fix size of extend/rekey fs
Stat calls on the control/extend and control/rekey files returned a bogus file
size that led to an error in the VFS File_content tool. The tool complained
that the size of the file determined while reading the content differs from the
one reported by the stat operation. Now, the stat call will always determine
the actual size of what would be read.  However, it isn't guaranteed that this
size doesn't change in the time after the stat operation and before the read
operation.

Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
bd79f93657 cbe/types: invalid generation, generation string
Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
731df4b037 recipes/src/cbe: build also cbe_init_trust_anchor
Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
d3cc5c9cd2 gems/recipes: api/cbe
Ref #4032
2021-10-13 14:50:45 +02:00
Martin Stein
ff656401b3 gems: update cbe port
This update fixes a bug when discarding snapshots.

Ref #4032
2021-10-13 14:50:45 +02:00
Christian Helmuth
46ee872b50 vbox6: shared clipboard service
The service is loaded dynamically VBoxSharedClipboard.so at runtime. The
VFS configuration mounts the shared object at /VBoxSharedClipboard.so as
the file is checked by contrib code before loading. An init
configuration in pkg/vbox6/runtime illustrates this and how to re-label
the VBoxSharedClipboard.so ROM to its real name
virtualbox6-sharedclipboard.lib.so.
2021-10-13 14:50:45 +02:00
Christian Helmuth
5aee693f70 vbox6: limit wait for ack to 15 ms in AHCI model
During Windows 10 boot with sequential block requests, the AHCI request
worker finished earlier than the EMT thread signals hEvtProcess and
begins waiting for hEvtProcessAck indefinitely. The timeouts helps to
survive this short phase.

A better solution would use conditional variables, which are not
provided in VirtualBox's runtime.
2021-10-13 14:50:45 +02:00
Josef Söntgen
f21cf3f8b1 mesa: name driver library appropriately
Rename the 'egl_drv' library and the various back ends to 'mesa_gpu_drv'
and 'mesa_gpu-<backend>'.

Fixes #4275.
2021-10-13 14:50:37 +02:00
Norman Feske
32c283d26f os: introduce C API for generating Genode events
This patch introduces a C API to be used by input drivers to generate
Genode events. The initial version is limited to multitouch events only.

Fixes #4273
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
f4cb5cc299 dde_linux: preserve Io_signal_handler for IRQs
Do not construct/destruct signal handlers for interrupts dynamically,
but only the Irq session to prevent a deadlock.

Fix #4272
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
6ae55d490b lx_emul: restrict allocations to minimal alignment
* Use the architecture-dependent minimal alignment for all allocations,
  e.g. on ARM it is necessary to have cacheline aligned allocations for DMA
* Remove the allocation functions without alignment from generic API
* Fix a warning

Fix #4268
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
2ac8620f44 lx_emul: invalidate cache for DMA-read only
After a DMA transaction do only invalidate cachelines from the
corresponding DMA buffers if data got transfered from device to
CPU, and not vice versa. Otherwise it might result in data corruption.

Ref #4268
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
d8c344f6b9 lx_emul: do not block kworkers unconditionally
Ref #4268
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
f8cf0442ed lx_emul: implement lookup of dma-addr to virt-addr
* Use the new Lx_kit::Map as lookup structure for virt-to-dma and vice versa,
  instead of a list-based registry

Ref #4268
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
9bc7ecb605 lx_emul: provide alignment for DMA allocations
Ref #4268
2021-10-13 14:46:54 +02:00
Christian Helmuth
4c4ce2f899 report_rom: versioning and explicit notification
The former implementation did not internally track ROM changes notified
vs. delivered to the client. We adapt the versioning implementation
implemented in dynamic_rom_session.h and enable explicit notification of
the current version.

The feature is used by the clipboard to notify permitted readers of the
clipboard ROM service on focus change via the newly created private
Rom::Module::_notify_permitted_readers() function.

Fixes #4274
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
4803937dd2 os: introduce C-API to provide USB service
Fix #4270
2021-10-13 14:46:54 +02:00
Stefan Kalkowski
6789b86871 base-hw: optimize cache maintainance for ARMv8
* Remove the data-synchronization barrier from the inner-loop
* Instead add a system-wide barrier at the end of the operation

Fix #4269
2021-10-13 14:46:54 +02:00
Martin Stein
9542bcf88c base-hw: reduce includes in board.h
The includes for the address-space-ID allocator and the translation table are
usually specific to the CPU in use. Therefore these includes can be moved from
their current location in the board header to the CPU headers. This reduces the
number of decisions a board maintainer has to make if the CPU model he's aiming
for is already available.

This can probably also be applied for other includes in the board headers but I
intentionally leave it for a future commit as I don't have the time to do it
all now.

Ref #4217
2021-10-13 14:46:54 +02:00
Martin Stein
ad059362d2 base-hw: reduce hardware-specific include paths
For base-hw Core, we used to add quite some hardware-specific include paths
to 'INC_DIR'. Generic code used to include, for instance, '<cpu.h>' and
'<translation_table.h>' using these implicit path resolutions. This commit
removes hardware-specific include paths except for

1) the '<board.h>' include paths (e.g., 'src/core/board/pbxa9'),
2) most architecture-specific include paths (e.g., 'src/core/spec/arm_v7'),
3) include paths that reflect usage of virtualization or ARM Trustzone
   (e.g., 'src/core/spec/arm/virtualization').

The first category is kept because, in contrast to the former "spec"-mechanism,
the board variable used for this type of resolution is not deprecated and the
board headers are meant to be the front end of hardware-specific headers
towards generic code which is why they must be available generically via
'<board.h>'.

The second category is kept because it was suggested by other maintainers that
simple arch-dependent headers (like for the declaration of a CPU state) should
not imply the inclusion of the whole '<board.h>' and because the architecture
is given also without the former "spec"-mechanism through the type of the build
directory. I think this is questionable but am fine with it.

The third category is kept because the whole way of saying whether
virtualization resp. ARM Trustzone is used is done in an out-dated manner and
changing it now would blow up this commit a lot and exceed the time that I'm
willing to spend. This category should be subject to a future issue.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
49b09702b8 base-hw: don't include board.h from hardw. headers
The 'src/core/board/<board>/board.h' header is thought as front end of
hardware-specific headers of a given board towards the generic base-hw Core
code. Therefore it leads to problems (circular includes) if the board.h header
is included from within another hardware-specific header.

If hardware-specific headers access declarations from namespace Board in a
definition, the definition should be moved to a compilation unit that may
include board.h. If hardware-specific headers access declarations from board.h
in a declaration, they should either use the primary declaration from the
original header or, if the declaration must be selected according to the board,
another board-specific header should be introduced to reflect this abstraction.

This is applied by this commit for the current state of base-hw.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
5d74509b2d base-hw: get rid of static perf counter object
It is not necessary to have a class, an object, and a generic header for the
perfomance counter. The kernel merely enables the counter using cpu registers
('msr' instructions, no MMIO) on arm_v6 and arm_v7 only. Therefore this commit
makes the header arm-specific and replaces class and global static object with
a function for enabling the counter.

Fixes #4217
2021-10-13 14:46:53 +02:00
Martin Stein
b817e1977c base-hw: serial output as Main member
Let the kernel's serial-output driver 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
910788313e base-hw: get rid of static variable in Kernel::Pd
Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
02f00a999c base-hw: global IRQ controller as Main member
Let the kernel's driver for the global IRQ controller be a member of the one
Kernel::Main object instead of having it as static variables in the drivers for
the local IRQ controllers. Note that this commit spares out renaming 'Pic' to
'Local_interrupt_controller' which would be more sensible now with the new
'Global_interrupt_controller' class. Furthermore, on ARM boards the commit
doesn't move 'Distributer' stuff to the new global IRQ controller class as they
don't have real data members (only MMIO) and can be instanciated for each CPU
anew. However, the right way would be to instanciate them only once in Main as
well.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
441d137482 base-hw: Address-Space-ID allocator as Main member
Let the kernel's Address-Space-ID allocator 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
0c61b25bcf base-hw: no unmanaged_singleton in kernel thread
The unmanaged-singleton approach was used in this context only because of the
alignment requirement of the Core main-UTCB. This, however can also be achieved
with the new 'Aligned' utility, allowing the UTCB to be a member of the Core
main-thread object.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
b6641eaa25 base-hw: Core PD as Main member
Let the Core protection-domain 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
d6e347163d base-hw: unnecessary unmanaged-singleton includes
Remove some deprecated include directives for the unmanaged-singleton header.

Ref #4217
2021-10-13 14:46:53 +02:00
Martin Stein
5dd8ee5840 base-hw: global IRQ pool as Main member
Let the global kernel IRQ-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
c49db16762 base-hw: don't use boot_info() outside main.cc
It's sufficient to access the boot info only on kernel initialization time.
Therfore, it can remain completely hidden to the rest of the kernel inside
kernel/main.cc in the initialization function.

Ref #4217
2021-10-13 14:46:53 +02:00
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
Christian Helmuth
4a87fcc4cf vbox6: fix TPR handling 2021-10-13 14:01:02 +02:00
Christian Helmuth
e5b828ae8f Switch to genodelabs depot in depot_download test 2021-10-13 14:01:02 +02:00
Martin Stein
f1b72d0281 cxx: define delete operator with alignm. arg
Using 'alignas' in declarations might cause GCC to request for an
implementation of 'operator delete(void*, unsigned long, std::align_val_t)'
although it might actually never be called. This commit adds a dummy
implementation to 'cxx/new_delete.cc' that does nothing more than printing an
error to the log that a proper implementation is missing. This approach is
coherent with our treatment of other global delete operators.

Ref #4217
2021-10-13 14:01:02 +02:00
Martin Stein
ebd140cacb reconstructible: respect alignment of payload
If one has an object X that has a minimum alignment requirement specified
through 'alignas' this requirement is normally inherited by objects that have
object X as member, and by those that have objects as member that have X as
member, and so on... . However, this chain used to get silently interrupted
(dropping the minimum alignment requirement to 8 again) at objects that are
managed with Genode::Reconstructible or Genode::Constructible. In order to fix
this, the commit ensures that Genode::Reconstructible (and therefore also
Genode::Constructible) has at least the minimum alignment requirement (using
'alignas') as the object it manages.

Ref #4217
2021-10-13 13:59:57 +02:00
Christian Helmuth
64e2912a2f version: 21.08 2021-08-31 12:02:22 +02:00
Norman Feske
339dda8b43 News item for version 21.08 2021-08-31 12:02:22 +02:00
Norman Feske
397a3e45d1 Release notes for version 21.08 2021-08-31 12:02:22 +02:00
Norman Feske
f8898f3a56 doc: add server/black_hole to components.txt 2021-08-31 12:02:22 +02:00
Christian Helmuth
83c5648d33 depot: update recipe hashes 2021-08-30 15:00:39 +02:00
Martin Stein
7fdebc6a09 nic_router: let DHCP client request domain name
The NIC router parses, stores and forwards DNS domain names from DHCP replies.
Yet the routers DHCP client used to not request DNS domain-name information on
DHCP requests. This caused DHCP servers to skip this information on their
replies although it was available. This commit fixes the issue by adding the
DNS domain name code to the request parameter list of requests from the routers
DHCP client.
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
4782f9376c recipe: Qt5 texedit adjust to new Mesa version
Add dependency to 'libdrm' as it is required by Mesa 21

issue #4254
2021-08-30 15:00:38 +02:00
Christian Helmuth
a362505e8a usb_host: report bInterfaceProtocol too
Thanks to Raphael for the patch.
2021-08-30 15:00:38 +02:00
Christian Prochaska
ece837e8b8 qt5: prepare QtWebEngine sndio backend
Fixes #4257
2021-08-30 15:00:38 +02:00
Christian Prochaska
eedbcf88ec os: add black hole component
The 'black_hole' component provides dummy implementations of common
session interfaces.

At this time, only the 'Audio_out' session is provided if enabled
in the configuration of the component:

<config>
	<audio_out/>
</config>

Issue #3653
2021-08-30 15:00:38 +02:00
Johannes Schlatow
2b0bb6dda0 trace: comment x86 timestamp() implementations
Fixes genodelabs/genode#4243
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
31b049864c qt5_opengl: Disable Vulkan feature
With Mesa-21, Qt5 detects Vulkan to be enabled, even though it is not
supported in Genode. Also add DRM library in Qt5 run script.

issue #4254
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
46be4f1145 mesa_demo: adjust to Mesa 21.0.0
* support argc/argv + double buffering (Alexander Boettcher)
* Route intel/gpu driver to platform driver
* Use Gui session instead of framebuffer session (Josef Söntgen)

issue #4254
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
e4ae817e82 ram_fb_drv: RAM framebuffer driver for Qemu
Enable "-device ramfb" to use in Qemu. Also add drivers interactive
using this framebuffer for the "virt_qemu" platform.

issue #4254
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
38d731bd79 libports: Add Mesa-21.0.0 support
* Switch mesa support from DRI to gallium
  Supported drivers are
    - softpipe (Sebstian Sumpf)
    - iris for Intel GPUs (Alexander Boetcher)
    - etnaviv for Vivante GPUs (Josef Söntgen)

* Mesa's generated files are placed into 'contrib/mesa-<hash>/generated'
  and are cloned per default from a separate Git repo in order to avoid
  hash updates upon package build. In case you need to generate files
  yourself use
  ! prepare_port mesa GENERATE_FILES=1

issue #4254
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
9041567f14 libports: Remove Mesa-11.2.2
issue #4254
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
b6ec4bdf05 libc/stdcxx ABI: symbols for Mesa-21.0.0
issue #4254
2021-08-30 15:00:38 +02:00
Josef Söntgen
dd90424129 libports: libdrm-2.4.105 update
Support for iris and etnvaviv

* entaviv:
  - libdrm on FreeBSD is not prepared for !PCI (and libc our is missing
    <sys/pciio.h>
  - missing <sys/types.h> include in xf86drmMode.c
  - etnaviv relies on linux header files - dummy in $(INC_DIR)
  - IOCTL FreeBSD ↔ Linux have swapped IO/OUT bit
  - O_CLOEXEC differs between FreeBSD ↔ Linux

issue #4254
2021-08-30 15:00:38 +02:00
Sebastian Sumpf
c26c50e59b libports: remove libdrm 2.4.21
issue #4254
2021-08-30 15:00:38 +02:00
Josef Söntgen
ac9e0947fd libc: add HM_REALMEM sysctl
Used by Mesa in the Gallium etnaviv driver.

issue #4254
2021-08-30 15:00:37 +02:00
Josef Söntgen
fb4d357b59 libc: pull in sys/pciio.h
This header is needed by recent versions of libdrm that feature
FreeBSD support.

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
7a4626861e gpu/intel: add w/a for gen9 kabylake a0-b0 stepping
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
bac7381be3 gpu/intel: adjust submit batch to linux 5.13 handling
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
6b1f1794c4 gpu/intel: add gen9 forcewake support
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
eab92f8d6f gpu/intel: add clock gating for kabylake
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
ee283c0d12 gpu/intel: dump more in error case
- show hardware read tail & head pointer of ring buffer

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
c5d8a43418 gpu/intel: sanity check tail pointer alignment
According to spec the tail pointer points to the next qword instructions
which will be used by the software.

p 1354, Doc Ref # IHD-OS-BDW-Vol 2c-11.15

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
cc2363d421 gpu/intel: report slice, subslice, eu via gpu info
used by libdrm & mesa-21 clients

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
b287c4888a gpu/intel: update context inhibit setup
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
66ac2dc635 gpu/intel: avoid one-by-off in ring buffer
during wrap.

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
6c7bcdd32e gpu/intel: add gen9 w/a for submit batch
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
b2440a72c3 gpu/intel: add more debug registers
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
8a285a7bee gpu/intel: add more debug registers
issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
c9809fde67 gpu/intel: remove unused superpage scratch code
Superpages (2M, 1G) are not supported by now, but partially copied over code
from base-hw was around. Remove unused register definitions and remove
non-working super page code do avoid confusion.

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
de8327c11a gpu/intel: add more supported chips
support for Gen > 8

+ determine platform, revision and stepping

issue #4254
2021-08-30 15:00:37 +02:00
Alexander Boettcher
0aa17661cc gpu/intel: avoid overlapping ggtt range allocation
Size argument of ggtt free range check is ignored, which leads to
overlapping allocations inside, which leads to unavailable IO-MEM exceptions
thrown by core.

issue #4254
2021-08-30 15:00:37 +02:00
Norman Feske
82a51d8eaa build: operate ccache in preprocessor mode
This avoids consistency problems when header files are shadowed.

Fixes #4256
2021-08-30 15:00:37 +02:00
Norman Feske
040628894c build: introduce GLOBAL_DEPS variable
The new varible can be used to trigger the rebuild of the entire target
whenever any of the listed files changes.

Fixes #4255
2021-08-30 15:00:37 +02:00
Johannes Schlatow
b5dd1dd01b trace: consolidate Trace_buffer implementations
Both, trace_logger and vfs_trace had their own trace_buffer.h. This
commit consolidates the existing implementations and provides the
resulting trace_buffer.h at 'include/trace/'. It thereby becomes part of
the trace api archive.

genodelabs/genode#4244
2021-08-30 15:00:37 +02:00
Johannes Schlatow
ffbd26d63f depot: add trace policy api
genodelabs/genode#4244
2021-08-30 15:00:36 +02:00
Johannes Schlatow
1416b2258f Trace_buffer: do not reprocess last read entry
genodelabs/genode#4244
2021-08-30 15:00:36 +02:00
Norman Feske
436d946300 recipes/api/genode_c_api: add src/lib/genode_c_api
The source codes are needed to use the API because they are statically
linked.
2021-08-30 15:00:36 +02:00
Norman Feske
324ad33736 lx_emul: prevent clk_disable_unused
Issue #4253
2021-08-30 15:00:36 +02:00
Norman Feske
2cb4157211 lx_emul: support IRQCHIP_DECLARE initcalls
Similar to CLK_OF_DECLARE, this patch extends lx_emul with ability to
extend the __irqchip_of_table with secondary interrupt controllers.

Issue #4253
2021-08-30 15:00:36 +02:00
Norman Feske
c95af254f4 lx_emul: sanitize size 0 for __kmalloc
Driver code such as mfd-core.c may pass 0 as argument n to kcalloc,
which eventually results in an allocation size 0.

  res = kcalloc(cell->num_resources, sizeof(*res), GFP_KERNEL);

Since 'res' is checked against NULL for success, kmalloc must not return
a NULL pointer in this case. The patch works around this issue by
forcing an allocation size of 1 byte in this case.

Issue #4253
2021-08-30 15:00:36 +02:00
Norman Feske
29032caf40 lx_emul: support CLK_OF_DECLARE initcall mechanism
Clock providers such as drivers/clk/sunxi-ng/ccu-sun8i-r.c don't use
regular init calls but declare their init functions via CLK_OF_DECLARE,
which fill the __clk_of_table. Linux populates the table statically by
using special sections declared in the linker script. In contrast, we
populate the table by expanding the macro to global constructor
functions.

The __clk_of_table is then processed by the call of of_clk_init(NULL).

Issue #4253
2021-08-30 15:00:36 +02:00
Norman Feske
36af114d78 lx_emul: enhance krealloc implementation
Issue #4253
2021-08-30 15:00:36 +02:00
Christian Prochaska
149bd999f3 vfs_oss: support more commands for VirtualBox 6 and sndio
Fixes #4252
2021-08-30 15:00:36 +02:00
Christian Helmuth
a6fb61dbf2 vbox6: support dynamic framebuffer resolution
Issue #4031
2021-08-30 15:00:36 +02:00
Johannes Schlatow
50cc51f132 tool: support new u-boot FIT image format
Fixes genodelabs/genode#4250
2021-08-30 15:00:36 +02:00
Christian Helmuth
c54473abea vbox6: update to version 6.1.26
Issue #4031
2021-08-30 15:00:35 +02:00
Christian Helmuth
611e93a5f2 vbox6: kick AHCI asynchronous IO thread
Issue #4031
2021-08-30 15:00:35 +02:00
Christian Helmuth
d6bde82894 vbox6: add libyuv to pkg recipe
Issue #4031
2021-08-30 15:00:35 +02:00
Johannes Schlatow
88b3880c77 base: fix shift overflow error in Bitfield::mask()
Fixes genodelabs/genode#4249
2021-08-30 15:00:35 +02:00
Christian Helmuth
7618c9410a depot: update recipe hashes 2021-08-18 15:06:12 +02:00
Johannes Schlatow
5e284bfb35 trace: disable tracing when owner disappears
* Disable trace source and release ownership on subject destruction.
* Note, since the policy module is also destroyed on descruction of the
  session component, the traced component must not access the policy
  module when acknowledging the disabled state (else: page fault).

Fixes genodelabs/genode#4247
2021-08-18 15:06:12 +02:00
Johannes Schlatow
81d939f947 test-trace: test destruction of trace subjects
If the trace subjects are not properly destructed when the TRACE client
disappears, enabled sources will be owned by a non-existing client.
In other words, when a TRACE client disappears all sources owned by the
client must be disabled.

genodelabs/genode#4247
2021-08-18 15:06:12 +02:00
Johannes Schlatow
9898341d4a depot_autopilot: fix ineffective test-trace
test-trace always passed, although tracing was never enabled because the
trace subject was not within the first 32 subjects.

* increase number of queried subjects
* output error if trace subject was not found

genodelabs/genode#4247
2021-08-18 15:06:12 +02:00
Martin Stein
812fdec27c nic_router: propagate dns domain name via dhcp
With this commit, the NIC router DHCP client reads out the first DNS domain
name (DHCP option 15) if any from a DHCP reply that generates an IPv4 config
for a domain and stores the name together with the IPv4 config for that domain.
DNS domain names are reported via the new report tag '<dns-domain>' if the
'config' attribute in the config tag '<report>' is set.

Furthermore, the NIC router DHCP server becomes able to obtain a DNS domain
name from another domain that has a DHCP client dynamically (given the config
attribute 'dns_config_from' is set and no static DNS config is given) or
statically from its configuration (new config tag '<dns-domain>') and propagate
this name with DHCP replies (DHCP option 15).

The 'nic_router_dhcp_*' tests are adapted to test the new feautures.

The commit also gets rid of some mirrored files in
'test/nic_router_dhcp/manager'.

Fixes #4246
2021-08-18 15:06:12 +02:00
Martin Stein
fa64aae7f8 nic_router: config attribute 'dns_config_from'
WARNING: BREAKS CONFIG COMPATIBILITY!

This commit changes the configuration interface of the NIC router in a way that
may break systems that use the component without proper adjustment!

How to adjust:
At each occurrence of the 'dns_server_from' attribute in a NIC router
configuration replace the attribute name with 'dns_config_from'. The attribute
value remains unaltered.

DETAILED DESCRIPTION

The new attribute name 'dns_config_from' reflects that also other aspects of
the DNS configuration of the denominated domain are used by the DHCP server
that holds the attribute. This commit is a preparation for forwarding also the
domain name (DHCP option 15) with the mechanism behind the attribute.

Ref #4246
2021-08-18 15:06:12 +02:00
Martin Stein
1111472af7 nic_router: make Ipv4_config a class
The fact that the IPv4 config was a struct with all data members public was a
mere leftover of an early state of the NIC router. Today, the router
implementation style is to avoid structs and public data members wherever
possible.

This commit slightly changes the behavior of the router regarding log output.
The router used to print malformed IPv4 configurations to the log only if
the 'verbose' config flag was set using this style:

! [my_domain] malformed dynamic IP config: interface 10.0.2.1/24 ...

Now, malformed IPv4 configurations are only printed if the
'verbose_domain_state' config flag is set (like with any IP4v configuration
states) using this style:

! [my_domain] dynamic IP config: malformed (interface 10.0.2.1/24 ...)

Fixes #4242
2021-08-18 15:06:12 +02:00
Martin Stein
9e6f7988c2 nic_router: list dns servers in one dhcp option 6
The NIC router DHCP server used to add an extra option 6 field to DHCP replies
for each DNS server address. This conflicts with RFC #2132 section 3.8 which
states that the addresses should be listed within one option 6 field without
delimiter. The discrepancy is fixed by this commit.

Ref #4242
2021-08-18 15:06:12 +02:00
Johannes Schlatow
80c1459e79 fs_query: catch File::Truncated_during_read
Fixes genodelabs/genode#4241
2021-08-18 15:06:12 +02:00
Johannes Schlatow
0840cfe834 vfs_trace: report correct size for value files
File size must be the same as the number of bytes that can be read from
the file. Otherwise, this will trigger a `Truncated_during_read`
exception.

Fixes genodelabs/genode#4240
2021-08-18 15:06:12 +02:00
Martin Stein
e648e7255a nic_router: optional icmp type 3 on fragm. ipv4
Via a new configuration attribute, the user can decide whether the router
should answer dropped fragmented IPv4 with an ICMP "destination unreachable"
packet and, if so, which value the ICMP code field of this packet should have.
The default is that the router doesn't send such responses (silently dropping
fragmented IPv4). The behavior is tested by the 'nic_router_ipv4_fragm' test.

Fixes #4236
2021-08-18 15:06:12 +02:00
Martin Stein
06a4608f4a nic_router: report dropped fragmented IPv4
If the new attribute 'dropped_fragm_ipv4' of the <report> tag in the NIC router
config is set "yes", the router will report the number of packets that were
dropped per interface respectively domain because fragmented IPv4 is not
supported. The default is not to report the counter. The behavior is tested by
the 'nic_router_ipv4_fragm' test.

Ref #4236
2021-08-18 15:06:12 +02:00
Martin Stein
619474bc90 nic_router: drop fragmented IPv4
The NIC router used to ignore the IPv4 header fields "More fragments" and
"Fragment offset" completely. Therefore higher-level protocols of fragmented
IPv4 were interpreted wrong because each fragment was considered a self-
standing packet, expecting, for instance UDP/TCP headers somewhere inside of
the UDP/TCP data field. Normally, such packets were dropped as soon as the
UDP/TCP checksum check failed because of the misinterpretation. However,
it was also possible for fragmented IPv4 to pass the router although normally
only partially.

IPv4 fragmentation support in the router would introduce some potential
security risks and is presumably not an easy endeavor. So, for now, we settled
on not supporting IPv4 fragmentation. With this commit, the router simply drops
all fragmented IPv4. This is reflected to the log for each fragment as "drop
packet (fragmented IPv4 not supported)" when 'verbose_packet_drop="yes"' is
configured.

The new test 'run/nic_router_ipv4_fragm' is an automated test for this
behavior. The test is added to the autopilot list.

Ref #4236
2021-08-18 15:06:12 +02:00
Martin Stein
b0e558f486 net/icmp: cast from integer to 'Code' enum
Add a function to the header for doing this cast.

Ref #4236
2021-08-18 15:06:12 +02:00
Christian Prochaska
d7a27c448d qt5: implement 'CancelableSyncSocket::Shutdown()'
Fixes #4239
2021-08-18 15:06:12 +02:00
Martin Stein
626b2f9cf2 run/libc_vfs_fs_fat: add to autopilot
Excludes board 'virt_qemu' from the test as we don't have block device drivers
for this board.

Ref #4220
2021-08-18 15:06:12 +02:00
Martin Stein
2533d7b4b6 vfs/fatfs: cleanup implementation
- remove redundant file system factory

- remove dead code block

  The code was guarded by preprocessor directives checking whether the
  contrib code define "_USE_MKFS" is 1. As "_USE_MKFS" is not set one
  for our port of FAT, the code was never executed and can be removed.

- remove uneffective config attributes

  Apparently, the former XML attributes to the plugin 'drive' and
  'codepage' had no effect. I tested them in a scenario with the VFS
  block server on a disk-image boot-module as back end. Regardless of
  the 'drive' value, the block session label was always "0". Regardless
  of the 'codepage' value, the FAT on the disk image succeeded to mount
  when not using '--codepage' for 'mkfs.fat' and failed to mount when
  using '--codepage' to specify a supported but foreign codepage for
  'mkfs.fat' (e.g. "720").

Ref #4220
2021-08-18 15:06:12 +02:00
Martin Stein
60c8369718 lib/fatfs: get rid of global static constructors
There was one global static constructor:

! namespace Fatfs { static Constructible<Platform> _platform; }

This caused applications that used the lib or the <fatfs> VFS plugin to end up
in an uncaught exception due to Genode::Component complaining that method
'construct' returned without executing pending static constructors if they
didn't call Genode::Env::exec_static_constructors().

As the use of Genode::Env::exec_static_constructors() is discouraged in Genode,
this commit rather moves the '_platform' object to the scope of the
initializing function and introduces a global static pointer to the object that
gets set by the initializing function. Although this prevents the exception, it
is, technically speaking even worse than the former solution as the new pointer
isn't checked for validity in contrast to the 'Constructible' object.

However, so far, I don't see a clean solution to this problem without the need
for Genode::Env::exec_static_constructors().

Fixes #4220
2021-08-18 15:06:12 +02:00
Christian Helmuth
b59e2ba677 microcode_intel: archive moved to GitHub finally
As version 20180807a is not provided on GitHub, I updated the port to
the most recent release 20210608.

Issue #2762
2021-08-18 15:06:12 +02:00
Sebastian Sumpf
c3e8c22a6d sculpt: integrate intel_gpu_drv
* the GPU multiplexer now offers the platform service to the Intel
  framebuffer driver (driver_manager)
* ajdusted drivers_managed-pc to hand out resources to the GPU driver
* adjust quotas

issue #4233
2021-08-18 15:06:11 +02:00
Sebastian Sumpf
2fe70f111b intel_fb_drv: Aperture exhaustion and display IRQ patch
* display an error in case the aperture is too small for all
  framebuffers
* handle display engine IRQs only

issue #4233
2021-08-18 15:06:11 +02:00
Sebastian Sumpf
1727de30b7 gpu/intel: free DMA, clear ggtt
* free DMA caps in case platform client's session is closed
* clear GGTT of platform client upon session close

issue #4233
2021-08-18 15:06:11 +02:00
Sebastian Sumpf
6c003a13d2 gpu/intel: add platform service for display handling
The platform services is intented to be used by dde_linux's intel_fb_drv
in order to initlialize displays.

* implement and announce platform session
* limit accessible GTT and aperture of client to 64 MB
* forward display engine IRQs to platform client
* move all PCI resources to 'Igd::Resources' class in order to make them
  accessible by the platform service and the GPU driver
* fix fence register allocation for id zero (return true)

issue #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
11192b18e6 gpu/intel: dump status context register bits
Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
fe867765a8 gpu/intel: support multiple exec buffer per client
required for mesa-21

Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
ffc89f3edf gpu/intel: let guard page handling up to client
For mesa-21 the client takes care and manages
the virtual address space of the vGPU by itself and the intel/gpu driver
can't add silently a guard page anymore. Move the patch to the drm/ioctl
of the former mesa version.

Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
067b7d7c67 gpu/intel: deny virtual address above 1 << 48
commit avoids memory corruption in the ppgtt page insertion code

Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Josef Söntgen
4b653fbac1 gpu/intel: handle double insertion in PPGTT
As the PPGTT is populated by the client, the client has to account for
guard pages and so forth.

Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Josef Söntgen
7dc997c8e6 gpu/intel: handle CSB correctly
As it turns out reading both dwords as qword results in mirrored
values, DDTT.

Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
5d6ea5ef22 gpu/intel: allocate vcpu/engine as part of session
Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
a721933771 gpu/intel: move context/ring handling into objects
Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
c949e5c90d gpu/intel: remove allocator_guard
Issue #3759 #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
243a9ec3ca gpu/intel: free up context/memory ring
_unmap_dataspace_ggtt requires the cap of Ggtt::Mapping (ring_map, ctx_map)
in order to find the right metadata and to free up the ggtt entries. Also the
pte range is removed already if the metadata was found.

Issue #4148 #4233
2021-08-18 15:06:11 +02:00
Alexander Boettcher
b3147050cc gpu/intel: add support to report finished batches
- extend gpu multiplexer to report last completed execution buffer
- on client side lookup finished buffers and disable busy state

issue #4233
2021-08-18 15:06:11 +02:00
Martin Stein
f8953de7ac nic_router: replace term "uplink" with "NIC client"
BREAKS CONFIG COMPATIBILITY:
This commit changes the configuration interface of the NIC router in a way that
may break systems that use the component without proper adjustment!

HOW TO ADJUST:
At each occurrence of the '<uplink ...>' tag in a NIC router configuration
replace the tag name 'uplink' with 'nic-client'. The rest of the tag stays the
same.

The term "uplink" for network interfaces in the router that have a NIC session
client as back end was introduced in a time when Uplink sessions didn't yet
exist. Now, they do and, although both an uplink and an Uplink session
normally describe a network session between router and network device driver,
they are based on two different service types (NIC and Uplink). This can easily
cause confusion when integrating the router (the <uplink> is not related to
Uplink sessions) or trying to understand its functioning (an 'Uplink' object
has nothing to do with the Uplink service).

Therefore, this commit introduces the more specific term "NIC client" for an
interface that is based on a NIC session requested by the router. This doesn't
imply any semantic changes at the NIC router. However, the commit also brings a
broader update of the router's README and removes the term "downlink" that was
used only in documentation to refer to interfaces backed by a NIC session
provided by the router. The term was only associated with this meaning because
it is the natural counterpart to an uplink. This isn't appropriate anymore as
the terms for interface types have moved to a more technical level.

The commit adjusts all scenarios in the basic Genode repositories properly.

Fixes #4238
2021-08-18 15:06:11 +02:00
Christian Helmuth
fce525f122 depot: update recipe hashes 2021-07-28 11:27:05 +02:00
Martin Stein
2afae7e7c1 nic_router: uncaught exc. on handling link state
An interface that received a signal for a link-state change accessed its
domain reference without assuming that it could not be attached to a domain
at that moment. This caused the NIC router to crash with an uncaught exception
of type 'Net::Pointer<Net::Domain>::Invalid'. The commit adds a catch
directive for this exception resulting in the handler doing nothing if not
attached to any domain.

Fixes #4222
2021-07-28 11:27:05 +02:00
Martin Stein
d06773b957 run/tz_vmm: remove usb_armory support
The test script failed during preparation of the on-target execution for
USB Armory with the following error:

! can't read "tz_vmm_block_irq": no such variable

Presumably, the script wasn't run anymore since the introduction of the
'tz_vmm_block_irq' variable for i.MX53 QSB. As we do not have infrastructure
for automated testing of the USB Armory and there seems to be not much
interest in using Genode on this platform, this commit simply removes the
support from the script.
2021-07-28 11:27:05 +02:00
Martin Stein
c8a8cbd7be run/tz_vmm: fix deprecated use of board specs
Filtering boards in a run script by specs isn't the right way anymore (the
specs do not exist anymore). Nowadays, we have to use [have_board] instead.

Ref #4229
2021-07-28 11:27:05 +02:00
Martin Stein
00e8e363d8 run/tz_vmm: fix broken network test
For unknown reasons, the former 'wget genode.org' call, that was meant to test
network in the Trustzone guest on imx53_qsb_tz, didn't succeed anymore although
the same call succeeded on my Sculpt VM Linux. However, 'ping 1.1.1.1' still
works, so, the script now uses this as test for networking instead.

Fixes #4229
2021-07-28 11:27:05 +02:00
Martin Stein
8bc861ca71 nic_router: do not re-use ARP request as reply
So far, in order to create an ARP reply, the NIC router merely created a copy
of the corresponding ARP request and modified only those values that differ.
This approach has the disadvantage of re-using bad parameters from a broken
request. The specific use-case that made this visible was an early version of
the Pine board network driver that used to forward ARP requests with a greater
size than required. The ARP replies of the router re-used this size and
confused other network nodes with that. In general, the NIC router should
rely on the data of incoming packets the least possible. Therefore, with this
commit, the router creates a new ARP reply from scratch and uses only those
values required from the corresponding ARP request.

Fixes #4235
2021-07-28 11:27:04 +02:00
Martin Stein
9384e075cb ipv4: get rid of C++ bitsets, add DF/MF flags
The former declaration of the IPv4 packet did not only use the questionable
tool of implementation-defined C++ bitsets but also lacked access to flags
"don't fragment" (DF) and "more fragments" (MF). This commit replaces the
C++ bitsets by using the register framework and introduces accessors for the
missing flags.

Ref #4236
2021-07-28 11:27:04 +02:00
rolandbaer
52011ec034 smbios_decoder: fix timer error message
added timer to run file to fix error message.

Fixes #4237
2021-07-28 11:27:04 +02:00
Alexander Boettcher
908d581a8c qemu-usb/webcam: reset delay packet state
on feature reset initiated by guest

Issue #4078
2021-07-28 11:27:04 +02:00
Johannes Schlatow
b38ec9f238 usb_webcam: correctly enable auto exposure mode
genodelabs/genode#4231
2021-07-28 11:27:04 +02:00
Stefan Kalkowski
9334ec09e2 sculpt: route non-usb block sessions to 'drivers' 2021-07-28 11:27:04 +02:00
Johannes Schlatow
1bfc828826 libuvc: add UVC 1.50 support
genodelabs/genode#4231
2021-07-28 11:27:04 +02:00
Johannes Schlatow
b51b9e1ef3 libusb: fix size of control messages
Fixes genodelabs/genode#4230
2021-07-28 11:27:04 +02:00
Norman Feske
3d36291d7f run/load/fastboot: support 64-bit ARM
This patch lifts the limitation for 32-bit ARM platforms and makes the
parameter --load-fastboot-device optional. If only one device is
present, it can be omitted.

Fixes #4232
2021-07-28 11:27:04 +02:00
Johannes Schlatow
2afb7c5567 nic_router: fix Tcp_packet header fields
data_offset and NS flag were incorrectly read due to missing endianess
conversion. Also fix name of CWR flag.

Fixes genodelabs/genode#4227

genodelabs/genode#4227
2021-07-28 11:27:04 +02:00
Stefan Kalkowski
ee045a68cc os: introduce C-API to Genode services
This commit introduces a C-API to the Uplink session, as well as to
serve as a Block service. It can be used by drivers ported from
C-only projects, like the Linux kernel, or BSD kernels for instance.

Fix #4226
2021-07-28 11:27:04 +02:00
Stefan Kalkowski
1a526e73a3 dde_linux: introduce new lx_emul/lx_kit library
The re-newed approach currently supports ARM 64-bit only.
It depends on the Platform API of the ARM architecture.
It tries to meet the original semantic of the Linux kernel
functions as far as possible. To achieve this, device drivers
using this library should reference the original Linux kernel
headers at foremost. Only the headers in `src/include/lx_emul/shadow`
have to shadow clone the original ones.

Fix #4225
2021-07-28 11:27:04 +02:00
Johannes Schlatow
1aba330ae6 dde_linux: fix packet size calc. of Nic drivers
skb_push() already increases the skb->len by ETH_HLEN, hence adding
ETH_HLEN to the packet_size is redundant.

A too large packet size becomes a problem for large MTUs. With a maximum
MTU of 1500, adding ETH_HLEN twice will lead to a packet size of 1528.
Since this is larger than what we expect for good-old Ethernet (max. 1522),
some clients (e.g. the e1000 model in vbox5) may drop these packets.

Fixes genodelabs/genode#4228
2021-07-28 11:27:04 +02:00
Christian Helmuth
119d72ad94 fetchurl: User-Agent header and HTTP response code
I discovered thinkbroadband.com requires the User-Agent header field and
rejects requests missing it with HTTP response code 403 "access to the
requested resource is forbidden". Now, fetchurl always adds the
User-Agent header fetchurl/LIBCURL_VERSION.

Also the error message now contains the HTTP response code.
2021-07-28 11:25:21 +02:00
Stefan Kalkowski
b16bb82f8b dde_linux: mark lx_emul and lx_kit as legacy
* Move headers in src/include into legacy sub-directory
* Move src/lx_kit to src/lib/legacy/

Fix #4223
2021-07-28 11:25:21 +02:00
Stefan Kalkowski
f939b9ffb5 base-hw: print addr as hex value in cache warning
Ref #4207
2021-07-28 11:25:21 +02:00
Norman Feske
45f5ed173a tool/run: use [board] for naming driver packages
This patch replaces the enumeration of boards in the drivers_nic_pkg and
drivers_interactive_pkg functions by inferring the package names from
the [board] name. This eases the addition of driver packages in external
repositories.

Fixes #4221
2021-07-28 11:25:21 +02:00
Norman Feske
6de19e4a9b tool_chain_auto.run: exercise 'ln -s'
as a regression test for issue #4219.
2021-07-28 11:25:21 +02:00
Norman Feske
5138aeba80 libc: fix nested monitor call in 'symlink'
The symlink implementation wrongly constructed a 'Sync' object within
the context of a monitor call. The 'Sync' constructor indirectly
depended on libc I/O for obtaining the current time, ultimately
resulting in a nested attempt of a monitor call. This could be
reproduced via the base.run script:

  $ cd /home
  $ ln -s a b

The 'ln' command resulted in the following log message:

  [init -> /bin/bash -> 7] Error: deadlock ahead, mutex=0x10ff8c70, return ip=0x500583a7

The patch fixes the problem by splitting the single monitor call into
two monitor calls and moving the construction of the 'Sync' object
in-between both monitor calls, thereby executing the constructor at the
libc application level.

Fixes #4219
2021-07-28 11:25:21 +02:00
Norman Feske
f3908b8283 tool: refine help text of list_dependencies
Issue #4204
2021-07-28 11:25:21 +02:00
Christian Helmuth
fdc4bd2f90 tool/run: absolute source path for load_tftp_inst_cmd 2021-07-28 11:25:21 +02:00
Sebastian Sumpf
4d4cc4fd02 libm: use libm from libc and remove openlibm
- enable libm for x86/arm
- update ieee754 to slightly changed output
- remove openlibm from port

fixes #4213
2021-07-28 11:25:21 +02:00
Sebastian Sumpf
4b10aa94ec base-hw: save/restore fpcr register for ARM_V8
The floating-point (fpcr) control register is user land accessible and
controls, for example, rounding mode.

fixes #3723 and related to #4213
2021-07-28 11:25:20 +02:00
Martin Stein
688379d1ed sel4: fix segmentation fault with CCACHE=yes
Building the elfloader in kernel-sel4.inc has a problem with Genodes CCACHE
make variable. When issuing ...

! ./tool/depot/create mstein/bin/*/base-sel4-* CCACHE=yes

..., building the elfloader used to consume all memory of the host system and
then run into a segmentation fault:

! make[6]: *** [elfloader/elfloader.o] Segmentation fault (core dumped)

This is because the other build system invokes the CCACHE variable as a command
in front of the compiler command. If CCACHE is set to 'yes', the 'yes' command
is called and produces an endless output into some output file. The problem
can be fixed by locally re-setting the CCACHE variable for the
'make ... elfloader' command to 'ccache' (Genode CCACHE==yes) or '' (Genode
CCACHE!=yes).

Fixes #4212
2021-07-28 11:25:20 +02:00
Martin Stein
0074a7c4ac tool/depot: fix forwarding of CCACHE
The depot tool 'build_bin_archive' used to ask only whether CCACHE is empty or
not and, if it wasn't empty, the tool added 'CCACHE := yes' to the build.conf
of the temporary build dir. This caused the sub-build processes to use ccache
even when the top-level CCACHE variable was set to a bogus value.

Also adds documentation of the CCACHE variable to the help message of the
'build' and 'build_bin_archive' tool.

Ref #4212
2021-07-28 11:24:56 +02:00
Martin Stein
388e2a0e6d fec nic driver: fix compiler warnings
Fixes #4178
2021-07-28 11:24:55 +02:00
Christian Prochaska
a856bfb4ab qt5: implement 'SyncSocket' with pipes on Genode
Fixes #4208
2021-07-28 11:24:55 +02:00
Christian Prochaska
3824c0ca5f qt5: ignore 'fcntl(F_SETLK)' error in sqlite3 implementation
Fixes #4194
2021-07-28 11:24:55 +02:00
Robin Eklind
40e2aa6617 builddir/run_x86: add note regarding missing -no-kvm switch
Also, add -enable-kvm notes as commented out QEMU_OPT option.

Updates #500.
2021-06-28 11:38:20 +02:00
Martin Stein
2d017ad7b7 nic_router: guard against exception in free_ip
Adds try-catch-statement with diagnostic errors in Dhcp_server::free_ip in
order to guard against exceptions from the underlying bit allocator. These
exceptions should never happen given that the router is programmed correctly
and always feeds Dhcp_server::free_ip with sane arguments (which it should).
However, should this not be the case, we can assume that the failed IP freeing
indicates that the IP isn't allocated anyway and it's fine to continue using
the router. Furthermore, IP allocations are a mere client service and not
relevant for the integrity or safety of the router.

Ref #4200
2021-06-25 11:57:28 +02:00
Martin Stein
be644098d7 nic_router: fix exc. in Interface::handle_config_3
When Interface::handle_config_3 (third step of applying a new configuration to
interfaces) tried to detach the interface from the current IP config because
the old and new IP config differed, it did so using the new domain. The former
steps of the reconfiguration already installed the new domain reference at the
interface. Therefore, also the DHCP server of the new domain was used. This,
however caused uncaught exceptions because detaching from an IP config
includes dissolving all DHCP allocations. This dissolving of DHCP allocations
now operated on a DHCP server (the one of the new domain) that wasn't related
to the allocations and, in the worst case, caused an uncaught exception
because the IPs were out of its range.

That said, this commit ensures that detaching an interface from an IP config
is always done on the domain from which the IP config originated. Normally,
this is the domain the interface is attached to. But in the case of
Interface::handle_config_3, it is another - the former domain the interface
was attached to.

The commit also adapts the nic_router_dhcp_* tests in a way that they
reconfigure the router in a way that would trigger the uncaught exception
without the fix.

Fixes #4200
2021-06-25 11:57:24 +02:00
Sebastian Sumpf
fd9bc43be1 ldso: Fix RISC-V support with 21.05 tool chain
- force inlining of more functions
- force -O2 for RISC-V (even if -O0 is set globally)
- intialize cxx guard after self relocation

issue #4094
2021-06-25 11:56:22 +02:00
Sebastian Sumpf
a6fe6c90d4 tool_chain: add ENABLE_FEATURE support
default: "c c++ ada go gdb"

This allows to build a subset of the Genode tool chain

issue #4094
2021-06-25 11:55:41 +02:00
Christian Helmuth
ece33d37f8 depot: update recipe hashes 2021-06-25 11:46:37 +02:00
Stefan Kalkowski
e7067050be base: extend cache maintainance functionality
Introduce two new cache maintainance functions:
* cache_clean_invalidate_data
* cache_invalidate_data
used to flush or invalidate data-cache lines.

Both functions are typically empty, accept for the ARM architecture.
The commit provides implementations for the base-hw kernel, and Fiasco.OC.

Fixes #4207
2021-06-25 11:43:41 +02:00
Stefan Kalkowski
ed0cc5330e tool/dde_linux: add list_dependencies utility
Fix #4204
2021-06-25 11:43:41 +02:00
Johannes Schlatow
b83c8f35c6 depot: ffi for x86_32
genodelabs/genode#4201
2021-06-25 11:43:41 +02:00
Sebastian Sumpf
a242bfce48 libports: ffi for x86_32
- Required by glib

issue #4201
2021-06-25 11:43:41 +02:00
Sebastian Sumpf
19a7997734 qemu-usb: consume device report during controller construction
Initially parse the USB devices report after the signal handler is
registered, do not rely on a signal to be triggered (issue #1788).

Fixes #4206
2021-06-25 11:43:41 +02:00
Sebastian Sumpf
a58473dece autopilot: add usb_hid_reconnect run script
- Adjust script to run on Qemu x86 only

fixes #4205
2021-06-25 11:43:41 +02:00
Christian Helmuth
cd25dc4e6a dde_bsd: prevent ‘nonnull’ argument warning
The implementation conflicted with the implicit declaration of bzero:

.../repos/dde_bsd/src/lib/audio/mem.cc: In function ‘void bzero(void*, size_t)’:
.../repos/dde_bsd/src/lib/audio/mem.cc:377:2: warning: ‘nonnull’ argument ‘b’ compared to NULL [-Wnonnull-compare]
2021-06-25 11:41:46 +02:00
Christian Helmuth
c585e008b1 acpica: prevent recursive 'memset()' calls with gcc 10
Thanks to Peter for the patch.

Issue #4125
2021-06-25 11:41:45 +02:00
Norman Feske
5b85bd9602 mk: make LD_SCRIPT_DYN customizable
This way, a target.mk becomes able to override the default linker
script, e.g., for adding custom symbols.
2021-06-25 11:41:45 +02:00
Martin Stein
0dc7084b0f wifi_drv: fix compile warnings with gcc 10
Fixes #4202
2021-06-25 11:41:45 +02:00
Martin Stein
16c4aacf34 vfs/dir_fs: allow opening empty dirs
Adapts Dir_file_system::open_composite_dirs in a way that it returns "success"
when the leaf node of the path is an empty directory but "lookup failed", as
usual, if one of the other directories on the way to the leaf node is empty.

I couldn't find a technical reason why we used to return "lookup failed" when
only the leaf node was empty.

The commit also adds a test for en empty root directory and empty
sub-directories to the fs_query run script.

Fixes #4198
2021-06-25 11:41:45 +02:00
Martin Stein
6bfdddd0b5 fs_query: gracefully deal with missing directories
The fs_query component used to exit with an uncaught exception if a queried
directory didn't exist. Now, fs_query will catch this event and simply skip the
affected query, thereby indicating to the user the inexistence of the
queried directory.

Ref #4032
2021-06-25 11:41:45 +02:00
Johannes Schlatow
026b117a63 separate sandbox api from os
genodelabs/genode#4191
2021-06-25 11:41:45 +02:00
Norman Feske
e5600fea06 dde_linux/extract_initcall_order: support v5.12
This patch adjusts the 'extract_initcall_order' utility to the changed
initcall symbol syntax introduced in Linux by the following commit:

   https://github.com/torvalds/linux/commit/a8cccdd9

It uses an additional sed step to strip away the kmod prefix,
__COUNTER__, and __LINE__ information so that the symbol names match
those of earlier kernel versions.

Issue #4188
2021-06-25 11:41:45 +02:00
Norman Feske
f541668604 dde_linux/create_dummies: show objs for variables
Issue #4188
2021-06-25 11:41:45 +02:00
Norman Feske
bf7500ad7b dde_linux/create_dummies: out-of-tree build dir
This patch enables the tool/dde_linux/create_dummies tool to operate on
a out-of-tree build directory. The Linux source tree is determined by
examining the build directory's Makefile.

Issue #4188
2021-06-25 11:41:45 +02:00
Norman Feske
29b7c5a202 dde_linux/create_dummies: show symbol details
When combining the 'show' command with a defined LINUX_KERNEL_DIR,
each symbol gets annotated with the object file where it is defined.

Issue #4188
2021-06-25 11:41:45 +02:00
Johannes Schlatow
7346defc26 usb_modem_drv: remove nic_server mode
genodelabs/genode#4201
2021-06-25 11:41:45 +02:00
Johannes Schlatow
dff1df0b49 usb_modem: do not fail on netif_stop_queue
genodelabs/genode#4201
2021-06-25 11:41:45 +02:00
Johannes Schlatow
2c87c68a5d depot: add ffi api and src archives
Fixes genodelabs/genode#4201
2021-06-25 11:41:45 +02:00
Johannes Schlatow
52a4293bbc depot: add usb_modem_drv archives
genodelabs/genode#4201
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
ff57bf617b usb_webcam: webcam run script
Run script for quickly testing webcams in Qemu or on target.

issue #4196
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
818f1682ee qemu-usb: flush EP improve isochronous handling
- Patch the XHCI model in order to handle frame wrapping correctly. For
  this adjust 'mfindex_kick' to the correct period (same, before, or after
  'mfindex').

- Flush EP when it is stopped, this causes all pending packets for the EP
  to be acked. Correct counting of packets in flight.

- Add BEI patch by Josef.

issue #4196
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
eabda8907f usb_host: add support to flush EP transfers
This causes all pending transfers of a EP to be canceled and in turn to
be acked by the raw session.

issue #4196
2021-06-25 11:41:44 +02:00
Alexander Boettcher
4aa99fd1a9 qemu-usb: reduce cpu load by webcam model
if no new frame is available for capturing

Fixes #4078 #4196
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
ff452619e3 vbox5-nova-capture: Set camera to 640x480@30fps
Default to 30fps

issue #4196
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
19a5fee70b depot_deploy: add <capture> session announcement
Announce Capture session if node is present in runtime.

issue #4196
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
c66a196f76 usb_webcam: package recipes
- API packages for: libusb, libuvc, and libyuv
- Source packages for: API packages + USB webcam app
- Meta package for USB webcam
- Raw package for USB webcam configuration

issue #4196
2021-06-25 11:41:44 +02:00
Sebastian Sumpf
9165c7601d libyuv: make shared object
- Adjust port to Genode expected layout
- Make shared library
- Adjust dependent infrastructure to change

issue #4196
2021-06-25 11:41:44 +02:00
Martin Stein
ff128df131 dde_linux/fec: fix unsynchronized TX DMA write
Unfortunately, our current implementation of 'wmb()' doesn't seem to do what we
want it to do. On base-hw + imx6q_sabrelite, the write of bdp->cbd_sc seems to
get re-ordered after the write to txq->bd.reg_desc_active in the transmission
path of the contrib code. Due to this, the transmission of the packet is only
triggered the next time a packet is sent. However, we only quick-fix it by
enforcing the execution of the write with a volatile global read as we will
soon update the FEC NIC port with a new DDE approach anyway.

Fixes #4010
2021-06-25 11:41:44 +02:00
Christian Prochaska
747d01e854 qt5: adapt QtWebEngine contrib code for use of nss
Fixes #4192
2021-06-25 11:41:44 +02:00
Christian Helmuth
331844c979 vbox6: support capslock="rom" mode
In ROM mode the global CapsLock state is controlled by the capslock ROM
by virtual KEY_CAPSLOCK events.

Guests are easily confused by spurious KEY_CAPSLOCK input events in
caps="rom" mode. These spurious events may reach the VMM if KEY_CAPSLOCK
is not pressed as first key in a combination and, therefore, is not
filtered as global key. We filter KEY_CAPSLOCK in ROM mode in the VMM
explicitly, but let it pass in non-ROM mode.

Per default RAW mode is used and CapsLock key events are sent unfiltered
to the guest.
2021-06-25 11:41:44 +02:00
Christian Helmuth
434d007dc1 stdcxx: some missing symbols for basic_string
Revealed with -O0 when linking test/lx_fs_notify/file_writer.

Issue #4070
2021-06-25 11:41:44 +02:00
Pirmin Duss
7db6f457d4 lx_fs: enable watch
Enable watching files via the inotify interface of the Linux Kernel.

Delivery of watches to components is staggered in order to prevent an
overflow of the ACK queue in cases when a lot of changes are made to the
file system from the Linux side.

Fixes #4070
2021-06-25 11:41:44 +02:00
Christian Helmuth
37f1873f2e vbox5: drop KEY_CAPSLOCK events on capslock="rom"
Guests are easily confused by spurious KEY_CAPSLOCK input events in
caps="rom" mode. These spurious events may reach the VMM if KEY_CAPSLOCK
is not pressed as first key in a combination and, therefore, is not
filtered as global key. Now, we filter KEY_CAPSLOCK in ROM mode in the
VMM explicitly, but let it pass in non-ROM mode.

Fixes #4087
2021-06-25 11:41:43 +02:00
Christian Helmuth
002037ce15 vbox6: support MAC address overwrite 2021-06-25 11:41:43 +02:00
Christian Helmuth
2a1a47b598 vbox6: update to version 6.1.22 2021-06-25 11:41:43 +02:00
Alexander Boettcher
ab31de0f6a libc_integration: reduce rounds for x86_32
autopilot mode. The test machine is less powerful as the x86_64 one.

Issue #3967
2021-06-25 11:41:43 +02:00
Pirmin Duss
a37ff1d985 lx_fs: enable session quota upgrades
Issue #4070
2021-06-25 11:41:43 +02:00
Pirmin Duss
4053e1628b lx_fs: support for unlink
This is based on the work of @ehmry and @sidhussmann.

Issue #4070
2021-06-25 11:41:43 +02:00
Alexander Boettcher
27004e1fd5 usb: remove monolithic usb driver
+ adjust README files

Fixes #4173
2021-06-25 11:41:43 +02:00
Johannes Schlatow
b09e69a444 ports: change bashrc path
genodelabs/genode#4163
2021-06-04 11:29:04 +02:00
Johannes Schlatow
758c0a21cc depot: add jschlatow download and pubkey
Fixes #4185
2021-06-03 08:23:50 +02:00
Christian Prochaska
60eec251e0 qt5: increase stack size of QtWebEngine render thread
Fixes #4168
2021-06-02 10:36:01 +02:00
Stefan Kalkowski
336350fe60 sculpt: enable support for MNT Reform2 2021-06-01 15:53:48 +02:00
Stefan Kalkowski
8408bf6ac0 fec_nic_drv: remove nic_server mode
Issue #4133
2021-06-01 15:51:22 +02:00
Alexander Boettcher
73d87073af vbox5/6: avoid negative timeouts in xhci model
Fixes #4184
2021-05-31 15:36:53 +02:00
Sebastian Sumpf
cf2527269f qemu-usb: allocate host devices after webcam
Because qemu-usb allocated host devices after 'USB_HOST_DEVICE' in the
object array and 'USB_WEBCAM' is loacated after 'USB_HOST_DEVICE' the
webcam model can overwrite an already allocated pass-through device. As
a solution add the 'USB_FIRST_FREE' to make it clear from where host
devices can be allocated. Also increase the number of supported host
devices to eight.

fixes #4182
2021-05-31 15:19:46 +02:00
Christian Prochaska
520b69ef0d libports: update expat port
Fixes #4183
2021-05-31 15:19:44 +02:00
1612 changed files with 40882 additions and 23185 deletions

View File

@@ -1 +1 @@
21.05
21.08

1
depot/jschlatow/download Normal file
View File

@@ -0,0 +1 @@
https://depot.genode.org

59
depot/jschlatow/pubkey Normal file
View File

@@ -0,0 +1,59 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGBlsG4BEADBMY44lF/LYiZByj1clJa+aNCEMGtoulxhFgCLIt2DR9r5KRmi
iAiweobH6ofbSXYKTOZqhAcmmkw3ihIVCsd1mHbdAAhlsnJetHLgOPL90aXVwce/
CM5QDubFmSu1VuaCgp/GaPqtQ/yaIq4LPMK+w2BfNG2M5XBeM8qLzjIHF7KNN4nZ
CX48Gx7q2DtIYCMUdIP0oK4dNfPDy6tvXiYvcz3lA2SNa6kszW3/mgIsurUEUFF6
vtCjBS5f6vJikWsglvTXqS0Sw5aIPzvosL/U0fjM0BVdi2NK6dWfM4HUduzr5MTD
Xc26CETmZ/8Sl4+mj0oUAuHU0SKDm22LNc+qRzXZxtkryDbFuikwtioYf3nIDTiA
63YPsx1jHp3mitTQgvRlJdlncmKIxXIUyGXqWpc+QHGUsvbDFdsXRxtt3J+8QWso
yLlaeP54E0OTQqdm+EnWGHahEKIwsn8/Gfs87phQsaF8Dlw+A132RukxB6zD35xF
/rqu25/8B0tL603Z3TLIyLDNbh4xO/iNohTB1ps+ALRwu48MsXcTMGUeWuRt2YVJ
RPG3KfIfnd+KcvJa2XFuzZCk57Jc8qGPmINPY5fJ7F9qIT0/9O7dlxzdoksfKXMf
RdiSCiFgmgJTqpXyfEcV7GUHCj9e0WdCSmDIH13bbuUpaTQXxO5d+XkzGwARAQAB
tDVKb2hhbm5lcyBTY2hsYXRvdyA8am9oYW5uZXMuc2NobGF0b3dAZ2Vub2RlLWxh
YnMuY29tPokCVAQTAQgAPhYhBBHurPU5I/pstoojMcciWBOKaz+1BQJgZbBuAhsD
BQkJZgGABQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEMciWBOKaz+1L28P/R+T
usXX/AdgaTRSY3hFDVnhV+adcyFdmTKWey0lMUMWRGsALd1EIJbqk4HAA81jW68j
9XG/kZgkhGKz+vOwOD40Y6G6f1GfKIEknzWok5RgH4p0BT5+ZhbqfX3/Z6z0CsOD
mXAo1At9JvGmP6OnpHbCwutEa/KAB2fgrjjgGMZcBlDzIsBugbT+shEAE5et0b0J
TrsClqoO71wknMkNp0ijfvCT4VtiCq/UBD5XqYRtzDQC6dMic/dNXKp3JmcsYf17
DUNM7RVdVx+v9onWiUre9poVn9YgA/MYwVb4hMyjJEc9R8yQhENSJtdhX2pkXVF6
l4ONbkdaw3xJqVO1ouPBI68Ddirwfwk6kgvpkvJ+iCVQ2lWSvPbtrhmTGpeerfQD
vbFwtUX1OZhZma5Gq8n5r6VM7N29hQalYaKPBS9AoL3YBO51NsUwde/EmZydlYl6
C7Ny+2iuPgKCoXS2zAxM2t9Ar9K0ZhhaiEbSZHoT596M/cWnn483edt15CQZO5w0
QNBv5nNKh0J/GmM45TtbhUya9Cpc9Ad2SVYSlNB3KQgC/n+1UQm+8UHOBq/5nuC/
Ww2It8g1G9pkGijG/f7flh1qE7KqqYec3cMLWj8hHRYSak3omSYlt4aOJEQPinjo
XUw+WBi/Mjrnd6UxB6mNs0VADOHDrCmFBBHcfWIAiQEzBBABCAAdFiEEwNwMDXup
zMtoYvj6v6ZIQUWP8uIFAmBlu6wACgkQv6ZIQUWP8uKNqwf+IjqK19dU8zATB50s
x4aEqTF6U5J2xO4xiBJlWv55zewjmmOsjJZYKBJd4UzTHqG/0CRUiDzUmsn3q1o+
GEwC+bB/LQMi+MaSG4w901Hz2cZ/qXonHfOtISKxmW2wDcOlG8Xsds0X5gfLgIZv
4EYK+Nh1HqcEj2/RHRzfT8/WkDSC7AzSd8nuwQL03ZkAW5woh8vX5A/Fgj77mJb+
APi6flqnTXxsVnRLHP8ErWQ8Akg07xV5fsOt1bFpY0aKgw2HJCoFyPDzVR09QILo
Th3jiHBdNTlbd+Hb1kQJfIyhIpwkNRKBxdbM0wZoKdVMl7xiDMMDHkYpvNyBQTkJ
nug/1LkCDQRgZbBuARAAzwJSYFegsVTJxm/6N9gN3vcfbZkvxttQYhNefw2eog7a
UZq8Eog4LUuhDmuVt0CWZh5YOz7u4XwjxOzNk6fw630AKiWiNkYtiLYwPyT1tPcz
I0XI6EcIYShyOfVZ+egPUELkjdC+SVwIQttQCPpEYnzWjbg22n+XeNRUfAI4EGKj
H5bqhKx6sR2cmbB4FPUO1kpYoqhEVdk1wdZI7n93SDPSLsoJSO+xBMPj6HqfXeab
gvr3dpqNg05G5g5JQBznILEJBHZBuCfy01j7WNRftdwWCGfWAh53uq6ug1vilodd
T1jvWmIbFE66rljH+sbtkZwBuEbEDnwZxNK/g72aQkog3AeDljG1a8GjazN6/upe
JD8LfoE8gjlj9Ncg9eYvqnrGR3nv566i7cq7UO10Dl5d6bedpEIo2htm90AI3M8p
nmtAZ18cbQodwerFvdQcegdejlpYJmI/3xaPZQqPH0puhDpT3oA53ObmjPb12ztH
Za06+klrr1MYb+x4IQYAOO8wwVRY/+YS+YU+6mxePyPMUDJYnIgOcTkg04/O55MF
KghOumAY3KTFoE7VlWXrBbhE/MW+Owp8zbtyFovJbmo8H718JHBQwlxzd1cS2Fvd
7g7r5eqWZNl+bMJQmgA0ZTAI0gD5PJU+GJEhiky3e29H2tBKqozX539HCxdOJycA
EQEAAYkCPAQYAQgAJhYhBBHurPU5I/pstoojMcciWBOKaz+1BQJgZbBuAhsMBQkJ
ZgGAAAoJEMciWBOKaz+1y94QAMD//6IqvIQEvsmDsv0hDy/ryPgYA7+2gKQCrvsq
rdhXYrBYGwgUPAeuYKgIFQIE+UqFZDwMbZ38DozyXvg4QYTEYQtPOio5WZGMHsNa
VYXel8qOKAbSECuP6GFiyX+NsSKYzs+iQLCzzLJS2/N8U1TMbgOwpqcVovpKOHvE
XPTUTwnUP25ubY32ElslRACZ/REJIm1Ftmloef50qnFggfCQdSsjevl74Q2+QOHk
Nb5w+a+vM6CmTGM1kqEATSJfBkxS7jCnGH4H9t44cEYqECpOYm4eUjxpM/9rxMw8
itrVs8preL28zzgKydVLO1JAX4WAw+X1k1Q9EGcRcXRnlxptZ71Lgnv4qCshPAXk
Sm5acLgdoOOSDDCSGFtjenyDjoHWfDk22CBwmEtMDtQ02m0+IzkfpNizqKGHBpKm
/hsu36teJilJWdAQOmDyrb0VsRweWM+rqClq3GS1+r791836WxQlKvx0/eO0gZOP
QjQxOjeCzZ/H8h7HBZ4bwRjQzHGgIbl7k6WPIwmvM4vLQfB44YEi/zDW5ivBcDEo
2VnHwAC2EPiVRwhRB/9+I8U09Ngrg2SnO8MkgmZpob1amblnhItM1US8bq/KDKld
4sWgWcZO21jEqnEaep4n/9vaxvLHfFa7AYY2EbB+Dfrns80oAqHG78qFyzflnLxx
kLJD
=7iZV
-----END PGP PUBLIC KEY BLOCK-----

View File

@@ -162,10 +162,6 @@ capture-session and event-session interfaces respectively.
:_dde_linux/src/drivers/usb_hid/_:
USB Human Interface Device driver using the USB session interface.
:_os/src/drivers/usb_block/_:
USB storage driver that uses the USB session interface and provides
a block-session interface.
Timer drivers
=============
@@ -220,11 +216,6 @@ _os/include/block_session/_.
:_os/src/drivers/sd_card/spec/rpi/_:
Driver for SD-cards connected to the Raspberry Pi.
:_dde_linux/src/drivers/usb/_:
USB driver that makes USB storage devices available as block sessions.
For an example of using this driver, refer to the run script at
_dde_linux/run/usb_storage.run_.
:_os/src/drivers/ahci/_:
Driver for SATA disks and CD-ROMs on x86 PCs.
@@ -232,7 +223,8 @@ _os/include/block_session/_.
Driver for NVMe block devices on x86 PCs.
:_os/src/drivers/usb_block/_:
USB Mass Storage Bulk-Only driver using the USB session interface.
USB Mass Storage Bulk-Only driver using the USB session interface and provides
a block-session interface.
Network interface drivers
@@ -257,8 +249,8 @@ defined at _os/include/nic_session/_.
The wifi_drv component is a port of the Linux mac802.11 stack, including the
iwlwifi driver. It enables the use of Intel Wireless 6xxx and 7xxx cards.
:_dde_linux/src/drivers/usb/_:
For the OMAP4 platform, the USB driver contains the networking driver.
:_dde_linux/src/drivers/usb_net/_:
USB network driver using the USB session interface.
:_dde_linux/src/drivers/nic/fec/_:
Driver for ethernet NICs of the i.MX SoC family.
@@ -450,6 +442,9 @@ Separate components
A wrapper for nitpicker's GUI session interface that applies alpha-blending
to the of views a GUI client.
:_os/src/server/black_hole/_:
Mockup implementation of Genode session interfaces.
VFS plugins
===========

View File

@@ -4,6 +4,44 @@
===========
Genode OS Framework release 21.08 | 2021-08-31
##############################################
| The highlights of Genode 21.08 are revamped GPU support as well as new
| drivers for the Pinephone and MNT-Reform laptop based on a new streamlined
| approach for porting Linux kernel code. Further topics range from VirtualBox
| improvements, over media playback in the native web browser, to LTE
| connectivity in Sculpt OS.
For complex driver stacks, Genode largely relies on code ported from other
operating systems. The Linux kernel plays a special role because - being the
basis for Android - it is the de-facto reference for driving the peripherals
of most ARM SoCs. Up to now, however, the porting efforts of driver code from
Linux to Genode used to be a time-intensive affair, which forced a narrow
focus on very few SoCs on us. With the streamlined porting approach introduced
with the new release, we become able to dramatically reduce the costs,
creating the prospect of a much broader hardware support. The first success
stories of the new way of porting are added graphics drivers for the Pinephone
and the MNT-Reform laptop, a network driver for the Pine-A64-LTS board, and an
SD-card driver for the MNT-Reform.
The second spotlight of the release is the largely revamped support for Intel
GPUs. In contrast to our experimental GPU-related work of the past, we have
now identified a way to cleanly integrate GPU support into the GUI
architecture of sophisticated Genode systems such as Sculpt OS. This work is
accompanied with an up-to-date version of the Mesa library stack. In
combination with the improvements of our custom GPU multiplexer, we are now on
a good track to make the use of hardware-accelerated graphics a commodity on
Genode.
Even though most topics of the current release revolve around low-level
driver-related work, the new version improves higher-level functionality as
well. In particular, it adds the modular integration of mobile-data
connectivity to Sculpt OS and enables media playback for our port of the
Chromium web engine. Those and more topics are described in the detailed
[https:/documentation/release-notes/21.08 - release documentation of version 21.08...]
Genode OS Framework release 21.05 | 2021-05-31
##############################################

671
doc/release_notes/21-08.txt Normal file
View File

@@ -0,0 +1,671 @@
===============================================
Release notes for the Genode OS Framework 21.08
===============================================
Genode Labs
Genode 21.08 puts device drivers into the spotlight. It attacks the costs of
porting drivers from the Linux kernel and takes a leap forward with respect to
GPU support. This low-level work is complemented by several topics that
contribute to our vision of hosting video-conferencing scenarios natively on
Genode.
For those of you who follow Genode's release notes over the years, the
so-called DDE-Linux is a recurring topic. DDE is short for device-driver
environment and denotes our principal approach of running unmodified Linux
device-driver code inside Genode components. For over a decade, we iterated
many times to find a sustainable and scalable solution for satisfying Genode's
driver needs. Thanks to this enduring work, Genode enjoys support for modern
hardware such as Intel wireless chips or Intel graphics devices. However, when
looking beyond PC hardware, in particular at the plethora of ARM SoCs as
potential target platforms for Genode, we found our existing DDE-Linux
approach increasingly prohibitive because the investment of manual labour per
driver would become unbearable. It was time to recollect, draw from our
collective experience gathered over the past years, and re-envision what
DDE-Linux could be. Section [Linux-device-driver environment re-imagined]
presents the results of this recent line of development that promises to dwarf
the costs of driver-porting work compared to our time-tested approach. The
results have an immediate impact on our ambition to bring Genode to the
Pinephone as our added network and framebuffer drivers for the Allwinner A64
SoC leverage the new DDE already.
The challenge of using hardware-accelerated graphics (GPUs) on Genode makes a
guest appearance in the release notes on-and-off since version
[https://genode.org/documentation/release-notes/10.08#Gallium3D_and_Intel_s_Graphics_Execution_Manager - 10.08].
However, until now, GPU support has not become a commodity for Genode yet.
With the work presented in Section [Advancing GPU driver stack], we hope to
change that. For the first time, we identified a clear path to the
architectural integration of GPU support in sophisticated Genode scenarios
such as Sculpt OS. This outlook prompted us to revive the GPU stack in a
holistic way, including our custom Intel GPU multiplexer as well as the Mesa
stack.
Further highlights of the current release are an improved and updated version
of VirtualBox 6, refined user-level networking, the maturing integration with
host file systems when running Genode on top of Linux, and new media-playback
capabilities for our port of the Chromium web engine.
Linux-device-driver environment re-imagined
###########################################
Over more than a decade, the domestication of Linux device drivers for Genode
has evolved into a quest of almost epic proportions. This long-winded story
has been covered by a recent series of Genodians articles
([https://genodians.org/skalk/2021-04-06-dde-linux-experiments - first],
[https://genodians.org/skalk/2021-04-08-dde-linux-experiments-1 - second],
[https://genodians.org/skalk/2021-06-21-dde-linux-experiments-2 - third]),
which also goes into a technical deep dive of our recent developments.
On the one hand, we draw an enormous value from the device drivers of the
Linux kernel. Genode would be nowhere as useful without the Intel wireless
stack, USB host-controller drivers, or the Intel graphics driver that we
ported over from Linux. On the other hand, those porting efforts are draining
a lot of our energy. Linux kernel code is not designed for microkernel-based
systems after all. Consequently, the transplantation of such code does not
only require a solid understanding of Linux kernel internals, but also ways to
overcome the friction between two radically different operating-system-design
schools (monolithic and component-based) and friction between implementation
languages (C and C++).
Even though we are not short of evidence of successful driver ports, we are
very well aware of several elephants in the room:
Economically, each driver port must be understood as a distinct project of
non-trivial costs. E.g., the port of the i.MX8 graphics driver took us two
months. That's certainly minuscule compared to a driver written from scratch.
But it is still expensive and we feel that those expenses hold us back.
Second, once ported, later updates of drivers to a new kernel version are
costly and risky. But such updates are unavoidable to keep up with new
hardware. The larger the arsenal of device drivers, the bigger this problem
becomes.
Third, the skill set of the porting work is the cross point of Linux kernel
competence and Genode competence. In other words, it's rare. To make Genode
compatible to a broader spectrum of hardware in the long run, driver porting
must become an easily attainable skill rather than black art.
With the current release, we introduce a vastly improved approach to the reuse
of Linux device drivers on Genode. It entails three aspects:
:Code: Reusable building blocks for crafting custom runtime environments
to bring Linux kernel code to fly, and for interfacing Genode's session
interfaces with Linux kernel interfaces.
:Tooling: A custom tool set that automates repetitive work such as generating
dummy implementations of Linux kernel functions.
:Methodology: Consistent patterns and exemplary test scenarios serving as
guiding rails for the development work.
The following illustration maps out the first aspect, the various pieces of
code involved in hosting unmodified Linux driver code on Genode.
The clear separation of those parts reinforces a degree of formalism - in
particular about separating C and C++ - that was absent in our previous takes.
[image dde_linux_parts]
A driver is a Genode component. So the outer border of the picture is Genode's
bare-bones C++ API. At the lower end, the API provides access to device
resources such as interrupts and memory-mapped device registers. At the higher
end, the API allows the driver to play the role of a service for other
components through one of Genode's session interfaces.
The lower (blueish) part of the picture is concerned with the runtime
environment needed to make the Linux kernel code feel right at home. The gap
between Genode's API and Linux kernel interfaces is closed in two steps.
First, the so-called *lx_kit* library implements handy mechanisms for building
the meaty parts of the runtime in C++. For example, it provides a user-level
task scheduling model that satisfies the semantic needs of Linux. The lx_kit
is located at _dde_linux/src/include/lx_kit_ and _dde_linux/src/lib/lx_kit/_
Second, the *lx_emul* (short for Linux emulation) code wraps the lx_kit
functionality into C interfaces. The functions of those interfaces are
prefixed with 'lx_emul_' and serve as basic primitives for re-implementing
(parts of) the original Linux kernel-internal ABI. Although the previous
version of DDE Linux already featured the principle lx_kit and lx_emul
fragments, the new design applies the underlying idea much more stringent,
fostering the almost galvanic separation between C and C++ code. In
particular, C++ code never includes any Linux headers. The lx_emul code also
comprises driver-specific dummy implementations of unused kernel functions.
The handy tool at _tool/dde_linux/create_dummies_ automates the creation of
those dummy implementations now. Finally, the lx_emul code drives the startup
of the Linux kernel code by executing initcalls in the correct order. The
reusable building blocks of lx_emul are located at
_dde_linux/src/include/lx_emul/_ and _dde_linux/src/lib/lx_emul/_
When looking from the upper (greenish) end, the *genode_c_api* library is a
thin wrapper around Genode's session interfaces. It enables C code to
implement a Genode service such as block driver or network driver. The
genode_c_api library is located at _os/include/genode_c_api/_ and
_os/src/lib/genode_c_api/_.
The red area contains sole C code, most of which is unmodified Linux kernel
code. It is supplemented with a small *lx_user* part that uses both the
genode_c_api as well as Linux kernel interfaces to connect the unmodified
Linux kernel code with the Genode universe.
We address the second aspect - the tooling - by the growing tool set at
_tool/dde_linux/_. The biggest time saver is the _create_dummies_ tool, which
automates the formerly manual task of implementing dummy functions to quickly
attain a linkable binary. It is complemented with the _extract_initcall_order_
tool, which supplements lx_emul with the information needed to perform all
Linux initialization steps in the exact same order as a Linux kernel would do.
The third aspect - the methodology - is embodied in two source-code
repositories that leverage the new DDE-Linux approach for two distinct ARM
SoCs, namely i.MX8MQ and Allwinner A64.
:Genode support for i.MX8MQ SoC:
[https://github.com/skalk/genode-imx8mq]
:Genode support for Allwinner A64 SoC:
[https://github.com/nfeske/genode-allwinner]
The most pivotal methodological change is the way how we deal with the
Linux-internal API now. In our previous work, we used to mimic the content of
kernel headers by a custom-tailored emulation header _lx_emul.h_ per driver.
Whereas these driver-specific API flavors catered our urge to keep transitive
code complexity at bay, they required significant and boring manual labour.
Now we changed our minds to reusing the original Linux headers, thereby
greatly reducing the amount of repetitive work while reducing the likelihood
for subtle bugs.
Success stories
---------------
Both repositories linked above employ the re-imagined DDE-Linux approach to
resounding success. The i.MX8MQ repository features drivers for framebuffer
output and SD-card access,
[https://genodians.org/skalk/2021-08-02-mnt-reform2-sdcard - targeting the MNT Reform laptop].
The Allwinner repository contains a network driver for the Pine-A64-LTS board
and a new framebuffer driver for the Pinephone. No single line of Linux code
had to be changed.
We found that the development of those driver components took only a fraction
of time compared to our past experiences. The most unnerving aspects of the
driver porting work have simply vanished: Subtle incompatibilities between C
and C++ are ruled out by design now. The hunt for missing initcalls is no
more. No dummy function must be written by hand. The compilation of arbitrary
Linux compilation units works instantly without manual labour.
This - in turn - brings the experimental addition or removal of kernel
subsystems down from hours to seconds, turning the development work into an
exploratory experience.
That said, it is not all roses. Components based on Linux drivers have to
carry substantial Linux-specific bureaucracy along with them. The resulting
components tend to be somewhat obese given their relatively narrow purpose.
E.g., the executable binary of the framebuffer driver for the Pinephone is
1.5 MiB in size, most of which is presumably dead weight.
Transition
----------
Our existing and time-tested Linux-based drivers located in the _dde_linux_
repository have remained untouched by the current release.
We plan to successively update or replace those drivers using the new
approach. Until then, the original components refer to the old approach as
"legacy". E.g., the former implementation of lx_emul has been moved to
_dde_linux/src/include/legacy/lx_emul/_.
Advancing GPU driver stack
##########################
With release 21.08, we take a major leap towards 3D and GPU support on Genode.
This topic has been on the slow burner for a while now and we were happy to be
able to finally revive this topic. On the Mesa front, we conducted an update
to version 21.0.0 (Section [Mesa update]), while adding more features and new
platforms to our
[https://genode.org/documentation/release-notes/17.08 - Intel GPU multiplexer].
On Intel platforms, there exists no hardware distinction between the display
controller and 3D acceleration, as both functions are provided by the GPU.
Other platforms, e.g. ARM based SoCs, often contain a separate display and a
GPU device, making it possible to isolate display configuration within a
separate driver. Therefore, we are glad to report that we found a solution on
how to separate display and 3D acceleration on Intel systems.
Mesa update
-----------
Genode's port of the
[https://www.mesa3d.org - Mesa 3D graphics library] dates back to version
11.2.2 that was released in 2016 while the current version is past 21 by now.
Because of this version gap, we decided to start with a fresh port of Mesa
instead of solely updating from version 11. The more recent version enabled us
to switch from Mesa's DRI drivers (i965) to the
[https://de.wikipedia.org/wiki/Gallium3D - Gallium] version (Iris) for Intel
GPUs.
[https://xdc2018.x.org/slides/optimizing-i965-for-the-future.pdf - Iris]
is Intel's redesigned version of the dated i965 driver that aims to lower CPU
usage and improved performance. It is the only driver that supports Gen 12
(Intel's current Xe GPU architecture) while also removing support for old
Intel generations. As Genode supports Gen 8 (Broadwell) platforms only, we
felt that Iris is the driver of choice for the future.
GPU multiplexer improvements
----------------------------
The GPU multiplexer received stability improvements, new features required by
Mesa's Iris driver, i.e. context isolation and sync objects, and bug fixes
prompted by supporting newer GPU generations. These generations include Gen 9
(Skylake) and Gen 9.5 (Kaby Lake), with more versions to come. Please note
that this line of work is not finished and is as of now in a preliminary state
with ongoing efforts.
The GPU multiplexer as a platform service
-----------------------------------------
As stated at the beginning of this chapter, Intel PC platforms have no
distinction between the display device and the 3D rendering. Both functions
are integrated into the GPU as display engine and render engine. This implies
that Genode's Intel framebuffer/display driver has to share resources with the
GPU multiplexer. The co-location of both drivers in one component, however,
violates Genode's core principle of a minimally-complex trusted computing
base. Whereas the complex display driver should best be a disposable component
([https://fosdem.org/2021/schedule/event/microkernel_pluggable_device_drivers_for_genode/ - FOSDEM talk]),
the GPU driver must ideally be realized as a low-complexity resource
multiplexer.
We eventually found a way to solve this contradiction: On Genode, each driver
requests the hardware resources to program a device from the platform driver
via the platform session. As these resources cannot be shared, we came up with
the idea that the GPU multiplexer requests all GPU resources and itself
provides a platform service for the display driver. It hands out the subset of
resources that are related to display handling and forwards display
interrupts. This approach is completely transparent to Genode's Intel display
driver.
[image gpu_architecture]
System integration of the GPU driver/multiplexer and the framebuffer driver
as distinct components
We already have implemented this solution for Gen 8 and are working on newer
generations.
Future prospects
----------------
In the current state, we are still working on newer Intel (Gen9+) GPU support
and are planning to integrate this line of work into Sculpt release 21.09 with
a small demo scenario (e.g., [https://github.com/glmark2/glmark2 - Glmark2]
that is now available in Genode world).
Additionally, there is ongoing work to support
[https://www.verisilicon.com/en/IPPortfolio/VivanteGPUIP - Vivante] GPUs as
utilized by i.MX SoCs. As of now Mesa's etnaviv driver is included in our
Mesa update and a GPU multiplexer component based on the Linux DRM driver is
available as a preview on
[https://github.com/cnuke/genode/commits/21.08-etnaviv - this] topic branch.
Base framework and OS-level infrastructure
##########################################
Revised cache-maintenance interface
===================================
The base library used to expose a single cache-maintenance function to
user-level components, namely 'cache_coherent'. It is primarily needed to
accommodate self-modifying code, e.g., for JIT compilers, to write back
data-cache lines, and invalidate the corresponding instruction-cache lines.
However, we found that the proper support for cached DMA buffers in Linux
device-driver ports calls for two additional semantic flavours.
One is needed whenever driver code initially writes data to a DMA buffer
before handing over the buffer to the device. Linux driver code usually issues
a 'dma_map_*' call in this case to ensure that data gets written out to memory
and the data cache is invalidated. This scenario is now covered by the new
'cache_clean_invalidate_data' function.
The other flavor is needed to invalidate data-cache lines before reading
device-generated content from a DMA buffer. Linux driver code usually calls a
'dma_unmap_*' function in this case. This case is now covered by the new
'cache_invalidate_data' function.
Both functions are provided for the base-hw and Fiasco.OC kernels on the ARM
architecture.
Improved host file-system access on Genode/Linux
================================================
Genode has included a component for host file-system access on Linux for
years, but the state of the implementation and the feature set limited its
application to mere debugging or development scenarios. This release improves
*lx_fs* in certain areas to permit common use cases and scenarios.
First, the file-system server gets support for the unlinking of files, which
was left out in the past to prevent accidental deletion of files on the host.
The current version includes a robust implementation of the feature, which is
confined to the configured sub-directory.
Further, sessions track client-specific consumption of resources (namely RAM
and capabilities) and also support dynamic resource upgrades. Last, we added
file-watching support to lx_fs, which enables monitoring files for changes
based on the inotify interface of the Linux kernel. The implementation is
prepared to handle bursts of changes by limiting the rate of notifications to
the client.
These improvements were contributed by Pirmin Duss.
New black-hole component
========================
A commonly requested feature for Sculpt OS is that it would be nice to have
the ability to wire up various sessions of a deployed component to a dummy
version of the required service. This way, the user could easily start an
application that would normally require, for example, an audio-out session but
connect it to a "black hole" component that simply drops all audio data. This
would be especially useful if no hardware driver for a specific device is
available on a particular platform, but would also allow for more fine-grained
privacy control.
For this release, we created a first version of the black-hole component,
which provides a dummy implementation of the audio-out session when enabled in
the configuration:
! <config>
! <audio_out/>
! </config>
More session types are intended to be added in future releases.
NIC router
==========
With this release, the NIC router receives an enhancement of its feature for
forwarding DNS configurations via DHCP, a sensible way of dealing with
fragmented IPv4 packets, and some minor cleanups regarding its configuration
interface. The update changes the configuration interface of the NIC router in
a non-compatible way. Hence, systems that integrate the router might require
adaptation. At the end of this section, you can find an overview of how to
adapt systems properly.
The NIC router now interprets the IPv4 flags "More Fragments" and "Fragment
Offset" in order to determine whether an IPv4 packet is fragmented or not.
Fragmented packets are dropped safely while the unfragmented ones are routed
as usual. The decision to drop fragmented packets by default is the result of
a long discussion among users and developers of the NIC router. That
discussion came to the conclusion that the complexity overhead and security
risks of routing fragmented IPv4 outrun its relevance in modern world
networks. Therefore, we assume that for the common user of the router, a
simple rejection of fragmented IPv4 is the better deal.
The consideration of IPv4 fragmentation is accompanied by several ways of
communicating the router's decision to drop fragmented packets. If the config
flag 'verbose_packet_drop' is set, the router prints a message "drop packet
(fragmented IPv4 not supported)" for each dropped fragment to the log. If the
new attribute 'dropped_fragm_ipv4' in the config tag '<report>' is set, the
router will report the number of packets dropped due to fragmentation. Last
but not least, the NIC router can also be instructed to inform the sender of a
dropped IPv4 fragment by sending an ICMP "destination unreachable" reply. Like
the other feedback mechanisms, this is deactivated by default and can be
activated by setting the new config attribute 'icmp_type_3_code_on_fragm_ipv4'.
The attribute must be set to a valid ICMP code number that is then used for
the replies.
The run script 'nic_router_ipv4_fragm' demonstrates the router's behavior
regarding fragmented IPv4.
For many years, the DHCP server of the NIC router is capable of sending DNS
configuration attributes with its replies. At first, this was only a single
DNS server address. With
[https://genode.org/documentation/release-notes/21.02#NIC_router - Genode 21.02],
this has been extended to a list of DNS server addresses. Sending such address
lists has now been made more conforming to the RFCs in that the server will
list them all in one option 6 field instead of adding one option 6 field per
address. Consequently, the DHCP client of the router now also considers only
the first option 6 field of a reply but may parse multiple addresses from it.
Another new feature is that the DHCP client of the router now remembers the
domain name (option 15) of a DHCP reply that leads to an IPv4 configuration.
Analogously, the DHCP server will send a domain name with DHCP replies if such
a name is at hand. As with DNS server addresses, the DHCP server can obtain
the domain name either statically through its configuration (new config tag
'<dns-domain>') or dynamically from the results of a DHCP client of another
domain. The latter is achieved by setting the new config attribute
'dns_config_from' that replaces the former attribute 'dns_server_from'. If
'dns_config_from' is set to the name of another domain, the DHCP server will
use both the DNS server addresses and the DNS domain name of the domain.
DNS domain names that were stored with a dynamic IPv4 configuration in the
router are also reported via the new report tag '<dns-domain>' whenever the
'config' attribute in the config tag '<report>' is set. As with DNS server
addresses, this allows for manual forwarding and filtering through individual
management components (see
[https://genode.org/documentation/release-notes/21.02#NIC_router - Genode 21.02]).
As a delayed adaption to the
[https://genode.org/documentation/release-notes/21.02#Pluggable_network_device_drivers - introduction of the Uplink session]
two Genode releases ago, the term "Uplink", that was used in combination with
the NIC router to refer to NIC sessions that the router requested itself, has
been re-named more accurately to "NIC client". This is meant to prevent
confusion with the new session type and, most notable to users, implies that
the tag '<uplink>' in router configurations got re-named to '<nic-client>'.
How to adjust Genode 21.05 systems to the new NIC router
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* At each occurrence of the '<uplink ...>' tag in a NIC router configuration,
replace the tag name 'uplink' with 'nic-client'. The rest of the tag stays
the same. This does not yield any semantic changes.
* At each occurrence of the 'dns_server_from' attribute in a NIC router
configuration, replace the attribute name with 'dns_config_from'. The
attribute value remains unaltered. Be aware that this will add forwarding of
DNS domain names to your system. Forwarding DNS server addresses but not DNS
domain names is not supported anymore.
RAM framebuffer driver for Qemu
===============================
During graphical application development on ARMv8, it became obvious that
Genode still lacked framebuffer-driver support on Qemu for ARMv8, thus
rendering test execution on real hardware mandatory. In order to speedup test
and development time for graphical applications, we enabled RAM framebuffer
support for the "virt_qemu" board by adding a 'driver_interactive-virt_qemu'
package. The package contains a 'ram_fb_drv' that configures a RAM framebuffer
through Qemu's firmware interface and uses the capture session interface to
provide access to the framebuffer.
To test drive the driver, you can execute any Genode run script that requires
graphical applications. The following example shows how to execute the demo
run script in Qemu:
* In _<genode_dir>/build/arm_v8a/etc/build.conf_ change
! # use time-tested graphics backend
! QEMU_OPT += -display sdl
to
! QEMU_OPT += -device ramfb
* In _<genode_dir>/build/arm_v8a_ execute
! make KERNEL=hw BOARD=virt_qemu run/demo
Sandbox API
===========
When using [https://github.com/nfeske/goa - Goa], we noticed that using the os
API caused binaries to be always linked against 'sandbox.lib.so' because its
symbols were part of the api archive as well. We therefore decided to separate
the sandbox API from the os API by moving the header files to
_repos/os/include/sandbox/_ and providing them in a distinct api archive along
with the library symbols.
Libraries and applications
##########################
Updated and improved VirtualBox
===============================
Our ongoing development efforts with VirtualBox 6.1 extended the
implementation in various aspects. With this release, we updated the version
to 6.1.26 published in July to stay in sync with upstream developments. This
version especially improves the audio back end for the OSS interface and
graphics.
On the integration side, VirtualBox 6 now supports dynamic framebuffer
resolutions and the capslock ROM mode. The latter is important to provide the
user a consistent system-wide capslock state, which is controlled by a global
capslock ROM and virtual KEY_CAPSLOCK events forwarded to guest operating
systems. Per default, a raw mode is used and capslock input events are sent
unfiltered to the guest. For ROM mode, VirtualBox may be configured like
follows.
!<config capslock="rom">
The network-device model in VirtualBox 5 uses the MAC address from the
connected NIC session. We added this behavior also to VirtualBox 6. During the
past months, we also observed significant performance issues with the AHCI
model, which we address in this release. The background is that our port of
VirtualBox 6 limits changes to the original code and execution model to a bare
minimum. This renders updates of the upstream version less expensive, but on
the other hand, uncovers some inherent assumptions about the runtime behavior
(i.e., scheduling of threads) in the original implementation that must be
addressed.
Qt5 and QtWebEngine
===================
In this release, we enabled SSL server certificate validation and support for
multimedia playback in our ports of QtWebEngine and the Falkon web browser.
More specifically, we ported the 'nss' library for the SSL certificate
validation and the 'sndio' library as back end for the audio playback
functionality and enhanced our OSS audio VFS plugin accordingly.
The following screenshot shows an example use case of Falkon as a private
multimedia browser, which stores all session data, like cookies, in RAM only.
In the future, we also want to enable support for multimedia input and,
consequently, private video conferences.
[image falkon_youtube]
Modular integration of LTE modem stack in Sculpt OS
===================================================
In version [https://genode.org/documentation/release-notes/21.02#LTE_modem_stack - 21.02],
we announced the LTE modem support as a prerequisite for using Genode on the
Pinephone. Since most of our development laptops also come with LTE modems or
an extension slot for installing one, we explored ways to augment the Sculpt
scenario with mobile networking on demand, i.e., by the installation of
additional components. The result is documented by means of an
[https://genodians.org/jschlatow/2021-07-21-mobile-network - article on genodians.org].
Webcam improvements using libuvc
================================
With webcam support added by the previous release, we discovered some
complications with devices that implement the UVC spec in version 1.5. We
found one of those devices in a Thinkpad T490s. Since
[https://ken.tossell.net/libuvc/doc - libuvc] did not fully implement this
version of the spec, we added a patch for this. The main issue was the
different size of the video probe and commit control messages. Interestingly,
the problematic device is quite picky in this regard and only responds when
the size was set correctly. In connection with this, we fixed a bug in our
[https://libusb.info - libusb] back end, which caused the size of USB control
messages being wrongly calculated.
Apart from these device-specific issues, the webcam driver now enables auto
exposure in order to adapt to different lighting conditions.
Sndio audio library
===================
To complement the VFS OSS-plugin introduced in release
[https://genode.org/documentation/release-notes/20.11 - 20.11], we ported the
[https://sndio.org - sndio] library to Genode. It contains an OSS back end
that prompted us to broaden the functionality of our VFS plugin to satisfy
the requirements of the library. This is in line with the envisioned plan to
extend the OSS plugin incrementally to cover more use cases.
The sndio framework features a server component besides the library but for
the moment, we focus solely on using sndio in a client context. Here the
component, e.g., cmus and Falkon, uses the library to access the sound device
directly.
Build system and tools
######################
Tool-chain support for RISC-V
=============================
As one might have noticed, Genode's RISC-V tool chain is absent in tool-chain
release
[https://sourceforge.net/projects/genode/files/genode-toolchain/21.05/genode-toolchain-21.05-x86_64.tar.xz/download - 21.05]
because it still had issues at the release time. These issues, namely the
problem of the dynamic linker's self relocation during program startup have
been resolved during this release cycle. The RISC-V tool chain can now be
built manually using Genode's regular 'tool_chain' script:
! <genode-dir>/tool/tool_chain riscv ENABLE_FEATURES="c c++ gdb"
Run tool
========
Genode's custom workflow automation tool called 'run' received the following
enhancements.
To ease the hosting of driver packages outside of Genode's main repository -
an emerging pattern for supporting new SoCs - we replaced the formerly
built-in names of board-specific 'drivers_nic' and 'drivers_interactive' depot
packages by the convention of appending the board name as a suffix, e.g.,
'drivers_nic-pine_a64lts'. Hence, new hardware support can now be added
without touching the run tool.
The ARM fastboot plugin can now be used on 64-bit ARM platforms in addition to
32-bit ARM. Its formerly mandatory parameter '--load-fastboot-device' has
become optional and can be omitted if only one device is present.
A new _image/uboot_fit_ plugin enables the use of U-Boot's new FIT (flattened
image tree) image format (carrying the extension 'itb'), which supersedes the
uImage format. The new format simplifies the booting of a Linux system, which
typically requires not only a kernel image but also a device-tree binary and a
RAM disk. A FIT image combines all ingredients into a single file and adds
some metadata like checksums. Note, however, that booting an _image.itb_,
which doesn't contain a device-tree binary may cause U-Boot's 'bootm' command
to fail. A workaround for this is to execute the individual boot steps
separately, which skips the Linux-specific preparatory steps that depend on
the device-tree binary:
! bootm start
! bootm loados
! bootm go
Removal of deprecated components
################################
In the release notes of version
[https://genode.org/documentation/release-notes/20.11#Retiring_the_monolithic_USB_driver - 20.11],
we announced the retirement of our traditional monolithic USB-driver
component, which used to combine host-controller drivers together with USB
storage, HID, and networking drivers in a single component. With the current
release, we ultimately completed the transition to our multi-component USB
stack and removed the deprecated monolithic USB driver.

View File

@@ -1 +1 @@
2021-05-27 d8e59b010b60eba516a0e20b3aab18e05c85a977
2021-10-13 05c76f8a5e76e0cc76fd7336c7cf63836ecec35d

View File

@@ -1 +1 @@
2021-05-27 8cfe2fe4913b79b6b58ae5dc1e47e4c96881b9fb
2021-10-13 0e3f2b9302333cb9bcabfb933a0ab142f41d070c

View File

@@ -1 +1 @@
2021-05-27 af377c6c3dcc0adcd59cd2e8668f47bdcc12d4c1
2021-10-13 af7ceb5c77e20a66ed9f394526766b31a205d89d

View File

@@ -1 +1 @@
2021-05-27 475462d2565c1eb0cb0df6c3ba4f58007f73ac04
2021-10-13 62af5bc4ad5747f1552f1c03882f756ec7f1d63c

View File

@@ -1 +1 @@
2021-05-27 778e2a540f54b8164db8f459931211964cafeb58
2021-10-13 6bd8c055af6f1031539124d93164d0ae24f956c8

View File

@@ -1 +1 @@
2021-05-27 d977d90dd21a266a9325b355da80def7bf26cd0f
2021-10-13 dabb150f6be49ee72d2d5db160e8885ac7faddd0

View File

@@ -21,3 +21,15 @@ void Genode::cache_coherent(addr_t addr, size_t size)
{
Foc::l4_cache_coherent(addr, addr + size);
}
void Genode::cache_clean_invalidate_data(Genode::addr_t addr, Genode::size_t size)
{
Foc::l4_cache_flush_data(addr, addr + size);
}
void Genode::cache_invalidate_data(Genode::addr_t addr, Genode::size_t size)
{
Foc::l4_cache_inv_data(addr, addr + size);
}

View File

@@ -37,13 +37,15 @@ namespace Kernel {
constexpr Call_arg call_id_ack_signal() { return 11; }
constexpr Call_arg call_id_print_char() { return 12; }
constexpr Call_arg call_id_cache_coherent_region() { return 13; }
constexpr Call_arg call_id_ack_cap() { return 14; }
constexpr Call_arg call_id_delete_cap() { return 15; }
constexpr Call_arg call_id_timeout() { return 16; }
constexpr Call_arg call_id_timeout_max_us() { return 17; }
constexpr Call_arg call_id_time() { return 18; }
constexpr Call_arg call_id_run_vm() { return 19; }
constexpr Call_arg call_id_pause_vm() { return 20; }
constexpr Call_arg call_id_cache_clean_inv_region() { return 14; }
constexpr Call_arg call_id_cache_inv_region() { return 15; }
constexpr Call_arg call_id_ack_cap() { return 16; }
constexpr Call_arg call_id_delete_cap() { return 17; }
constexpr Call_arg call_id_timeout() { return 18; }
constexpr Call_arg call_id_timeout_max_us() { return 19; }
constexpr Call_arg call_id_time() { return 20; }
constexpr Call_arg call_id_run_vm() { return 21; }
constexpr Call_arg call_id_pause_vm() { return 22; }
/*****************************************************************
@@ -188,6 +190,32 @@ namespace Kernel {
}
/**
* Clean and invalidate D-Cache lines of the given memory region
*
* \param base base of the region within the current domain
* \param size size of the region
*/
inline void cache_clean_invalidate_data_region(addr_t const base,
size_t const size)
{
call(call_id_cache_clean_inv_region(), (Call_arg)base, (Call_arg)size);
}
/**
* Invalidate D-Cache lines of the given memory region
*
* \param base base of the region within the current domain
* \param size size of the region
*/
inline void cache_invalidate_data_region(addr_t const base,
size_t const size)
{
call(call_id_cache_inv_region(), (Call_arg)base, (Call_arg)size);
}
/**
* Send request message and await receipt of corresponding reply message
*

View File

@@ -15,7 +15,6 @@
#define _KERNEL__TYPES_H_
/* base-hw includes */
#include <kernel/types.h>
#include <kernel/interface_support.h>
namespace Kernel {

View File

@@ -51,10 +51,9 @@ SRC_CC += pager.cc
SRC_CC += _main.cc
SRC_CC += kernel/cpu.cc
SRC_CC += kernel/cpu_scheduler.cc
SRC_CC += kernel/init.cc
SRC_CC += kernel/ipc_node.cc
SRC_CC += kernel/irq.cc
SRC_CC += kernel/kernel.cc
SRC_CC += kernel/main.cc
SRC_CC += kernel/object.cc
SRC_CC += kernel/signal_receiver.cc
SRC_CC += kernel/thread.cc

View File

@@ -15,6 +15,7 @@ SRC_CC += spec/arm/kernel/cpu.cc
SRC_CC += spec/arm/kernel/pd.cc
SRC_CC += spec/arm/cpu.cc
SRC_CC += spec/arm/kernel/thread.cc
SRC_CC += spec/arm/kernel/thread_caches.cc
SRC_CC += spec/arm/platform_support.cc
# add assembly sources

View File

@@ -4,9 +4,6 @@
# \date 2014-12-15
#
# add include paths
REP_INC_DIR += src/core/spec/zynq
# add C++ sources
SRC_CC += platform_services.cc

View File

@@ -1,5 +1,10 @@
REP_INC_DIR += src/core/spec/arm_v8
#
# \brief Build config for Genodes core process
# \author Stefan Kalkowski
# \date 2019-05-21
#
# add libraries
LIBS += syscall-hw
# add C++ sources
@@ -7,6 +12,7 @@ SRC_CC += kernel/cpu_mp.cc
SRC_CC += spec/64bit/memory_map.cc
SRC_CC += spec/arm/generic_timer.cc
SRC_CC += spec/arm/kernel/lock.cc
SRC_CC += spec/arm/kernel/thread_caches.cc
SRC_CC += spec/arm/platform_support.cc
SRC_CC += spec/arm_v8/cpu.cc
SRC_CC += spec/arm_v8/kernel/cpu.cc

View File

@@ -4,9 +4,6 @@
# \date 2014-09-02
#
# add include paths
REP_INC_DIR += src/core/spec/cortex_a15
# add C++ sources
SRC_CC += spec/cortex_a15/cpu.cc
SRC_CC += kernel/cpu_mp.cc

View File

@@ -4,9 +4,6 @@
# \date 2014-09-02
#
# add include paths
REP_INC_DIR += src/core/spec/cortex_a8
# add C++ sources
SRC_CC += kernel/cpu_up.cc
SRC_CC += kernel/lock.cc

View File

@@ -4,11 +4,9 @@
# \date 2014-09-02
#
# add include paths
REP_INC_DIR += src/core/spec/cortex_a9
# add C++ sources
SRC_CC += spec/cortex_a9/board.cc
SRC_CC += spec/cortex_a9/cpu.cc
SRC_CC += spec/arm/cortex_a9_private_timer.cc
SRC_CC += spec/arm/gicv2.cc
SRC_CC += spec/arm/kernel/lock.cc

View File

@@ -6,6 +6,7 @@
#
# add include paths
REP_INC_DIR += src/core/board/pc
REP_INC_DIR += src/core/spec/x86_64
LIBS += syscall-hw

View File

@@ -1 +1 @@
2021-02-22 8418c32c327c1c69414891ae813d904cbf7f9c64
2021-10-13 e4a9e369a9c321759fdc73d5e2b2b9ac1e2d7795

View File

@@ -1 +1 @@
2021-05-27 602a4250ab4812d355255f87600ae5b2d058ff6c
2021-10-13 11943f5bc31d6ebd43c67e008cf12cc7e2ca2934

View File

@@ -1 +1 @@
2021-05-27 5a92bddc377068791d0eb704411e8f64f408b7a3
2021-10-13 69215f704c6797b15bcacfc11a2709d5b65019e9

View File

@@ -1 +1 @@
2021-05-27 03207ecbb46d304aecf94b491dd7f5f18434a3ba
2021-10-13 78f942508805ec6afc8d75550d5b67f38664b5f6

View File

@@ -1 +1 @@
2021-05-27 e561b3c3024c5e66fc47a14741ad51f94772023d
2021-10-13 85df38295bad953fc194078cc22d31f1acfa4c08

View File

@@ -1 +1 @@
2021-05-27 a45306f7af1fbe6b5414fc79d6d7df72d90cc051
2021-10-13 e23737af156d1967b1d59c690b62f5538856a85c

View File

@@ -1 +1 @@
2021-05-27 0e52b14f12fb8387836c1d282c5b3bdd43308a33
2021-10-13 cf4e82d22cc8f343aa16f5b996e4cf3cc9608d69

View File

@@ -1 +1 @@
2021-05-27 04b1d602e9705d398191f25bd5650df55e02d15e
2021-10-13 ec5754c900404b3d4e1594fa5e36630afb58df0e

View File

@@ -1 +1 @@
2021-05-27 6a261650e7781a3fe05b2884c3222c4a684989b9
2021-10-13 910b8cd795a9326fc0b3fcd9afef8d35abd60c8b

View File

@@ -1 +1 @@
2021-05-27 6a7d93057760db316c708ed862f57552e1d30076
2021-10-13 67dab318aac08eb348e660cfe11c711a9aea1198

View File

@@ -1 +1 @@
2021-05-27 f297a9e79ff7645be095431c9b4d8a6caeea84e3
2021-10-13 e43c142340fd7f0fcae846c5203c308fe50a979e

View File

@@ -1 +1 @@
2021-05-27 a461ab6e948dd5d96a908bec57a9eecbf7088f3b
2021-10-13 ae6959ca0ea79c0b8611c7e4a56e5cdb634cfaf1

View File

@@ -1 +1 @@
2021-05-27 f2aa981b5a6eee8a4f246b2f03c785558e001f09
2021-10-13 0aed7db811134981a69cf1f4bb5cef3ba7e9a7c2

View File

@@ -1 +1 @@
2021-05-27 c2d6204ae3de07ef6bca3aceacb7cc0df6b8939a
2021-10-13 3233ce8f7b5f3246ace4fbdf810b1632cb147a1a

View File

@@ -15,10 +15,14 @@
#ifndef _CORE__SPEC__IMX53_QSB__BOARD_H_
#define _CORE__SPEC__IMX53_QSB__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/imx_tzic.h>
#include <hw/spec/arm/imx53_qsb_board.h>
/* base-hw Core includes */
#include <spec/arm/imx_epit.h>
#include <spec/arm/trustzone_board.h>
#include <spec/cortex_a8/cpu.h>
namespace Board { using namespace Hw::Imx53_qsb_board; }

View File

@@ -14,15 +14,21 @@
#ifndef _CORE__SPEC__IMX6Q_SABRELITE__BOARD_H_
#define _CORE__SPEC__IMX6Q_SABRELITE__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/gicv2.h>
#include <hw/spec/arm/imx6q_sabrelite_board.h>
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/cortex_a9/cpu.h>
namespace Board {
using namespace Hw::Imx6q_sabrelite_board;
using Pic = Hw::Gicv2;
class Global_interrupt_controller { };
class Pic : public Hw::Gicv2 { public: Pic(Global_interrupt_controller &) { } };
using L2_cache = Hw::Pl310;
L2_cache & l2_cache();

View File

@@ -14,11 +14,15 @@
#ifndef _CORE__SPEC__IMX7D_SABRE__BOARD_H_
#define _CORE__SPEC__IMX7D_SABRE__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/imx7d_sabre_board.h>
/* base-hw Core includes */
#include <spec/arm/virtualization/gicv2.h>
#include <spec/arm/generic_timer.h>
#include <spec/arm/cpu/vm_state_virtualization.h>
#include <spec/arm/virtualization/board.h>
#include <spec/cortex_a15/cpu.h>
namespace Board {

View File

@@ -14,10 +14,18 @@
#ifndef _CORE__SPEC__IMX8Q_EVK__BOARD_H_
#define _CORE__SPEC__IMX8Q_EVK__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm_64/imx8q_evk_board.h>
/* base-hw Core includes */
#include <spec/arm/generic_timer.h>
#include <spec/arm/virtualization/gicv3.h>
#include <spec/arm_v8/cpu.h>
/* base-hw includes */
#include <spec/arm_64/cpu/vm_state_virtualization.h>
/* base-hw Core includes */
#include <spec/arm/virtualization/board.h>
namespace Board {

View File

@@ -14,15 +14,21 @@
#ifndef _CORE__SPEC__NIT6_SOLOX__BOARD_H_
#define _CORE__SPEC__NIT6_SOLOX__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/gicv2.h>
#include <hw/spec/arm/nit6_solox_board.h>
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/cortex_a9/cpu.h>
namespace Board {
using namespace Hw::Nit6_solox_board;
using Pic = Hw::Gicv2;
class Global_interrupt_controller { };
class Pic : public Hw::Gicv2 { public: Pic(Global_interrupt_controller &) { } };
using L2_cache = Hw::Pl310;
L2_cache & l2_cache();

View File

@@ -14,15 +14,20 @@
#ifndef _CORE__SPEC__PBXA9__BOARD_H_
#define _CORE__SPEC__PBXA9__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/gicv2.h>
#include <hw/spec/arm/pbxa9_board.h>
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/cortex_a9/cpu.h>
namespace Board {
using namespace Hw::Pbxa9_board;
using Pic = Hw::Gicv2;
class Global_interrupt_controller { };
class Pic : public Hw::Gicv2 { public: Pic(Global_interrupt_controller &) { } };
L2_cache & l2_cache();
}

View File

@@ -11,17 +11,23 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__SPEC__X86_64__BOARD_H_
#define _CORE__SPEC__X86_64__BOARD_H_
#ifndef _BOARD_H_
#define _BOARD_H_
/* base-hw internal includes */
#include <hw/spec/x86_64/pc_board.h>
/* base-hw Core includes */
#include <spec/x86_64/pic.h>
#include <spec/x86_64/pit.h>
#include <spec/x86_64/cpu.h>
namespace Board {
using namespace Hw::Pc_board;
class Pic : public Local_interrupt_controller { };
enum {
VECTOR_REMAP_BASE = 48,
TIMER_VECTOR_KERNEL = 32,
@@ -30,4 +36,4 @@ namespace Board {
};
}
#endif /* _CORE__SPEC__X86_64__BOARD_H_ */
#endif /* _BOARD_H_ */

View File

@@ -14,13 +14,14 @@
#ifndef _CORE__SPEC__RISCV_QEMU__BOARD_H_
#define _CORE__SPEC__RISCV_QEMU__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/riscv/qemu_board.h>
/* base-hw Core includes */
#include <spec/riscv/pic.h>
#include <spec/riscv/cpu.h>
#include <spec/riscv/timer.h>
namespace Board { using namespace Hw::Riscv_board; }
#include <spec/riscv/timer.h>
#endif /* _CORE__SPEC__RISCV_QEMU__BOARD_H_ */

View File

@@ -15,9 +15,13 @@
#ifndef _CORE__SPEC__RPI__BOARD_H_
#define _CORE__SPEC__RPI__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/rpi_board.h>
/* base-hw Core includes */
#include <spec/arm/bcm2835_pic.h>
#include <spec/arm/bcm2835_system_timer.h>
#include <spec/arm_v6/cpu.h>
namespace Board { using namespace Hw::Rpi_board; };

View File

@@ -14,9 +14,13 @@
#ifndef _CORE__SPEC__RPI3__BOARD_H_
#define _CORE__SPEC__RPI3__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm_64/rpi3_board.h>
/* base-hw Core includes */
#include <spec/arm/bcm2837_pic.h>
#include <spec/arm/generic_timer.h>
#include <spec/arm_v8/cpu.h>
namespace Board {

View File

@@ -15,10 +15,14 @@
#ifndef _CORE__SPEC__USB_ARMORY__BOARD_H_
#define _CORE__SPEC__USB_ARMORY__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/imx_tzic.h>
#include <hw/spec/arm/usb_armory_board.h>
/* base-hw Core includes */
#include <spec/arm/imx_epit.h>
#include <spec/arm/trustzone_board.h>
#include <spec/cortex_a8/cpu.h>
namespace Board { using namespace Hw::Usb_armory_board; }

View File

@@ -14,11 +14,19 @@
#ifndef _SRC__CORE__SPEC__VIRT__QEMU_H_
#define _SRC__CORE__SPEC__VIRT__QEMU_H_
/* base-hw internal includes */
#include <hw/spec/arm/virt_qemu_board.h>
/* base-hw Core includes */
#include <spec/arm/virtualization/gicv2.h>
#include <spec/arm/generic_timer.h>
/* base-hw includes */
#include <spec/arm/cpu/vm_state_virtualization.h>
/* base-hw Core includes */
#include <spec/arm/virtualization/board.h>
#include <spec/cortex_a15/cpu.h>
namespace Kernel { class Cpu; }

View File

@@ -14,13 +14,20 @@
#ifndef _SRC__CORE__SPEC__VIRT_QEMU_64_H_
#define _SRC__CORE__SPEC__VIRT_QEMU_64_H_
/* base-hw internal includes */
#include <hw/spec/arm/virt_qemu_board.h>
/* base-hw Core includes */
#include <spec/arm/generic_timer.h>
#include <spec/arm/virtualization/gicv3.h>
/* base-hw includes */
#include <spec/arm_64/cpu/vm_state_virtualization.h>
#include <translation_table.h>
/* base-hw Core includes */
#include <kernel/configuration.h>
#include <kernel/irq.h>
#include <spec/arm_v8/cpu.h>
namespace Board {
@@ -51,13 +58,21 @@ namespace Kernel {
struct Board::Vcpu_context
{
struct Vm_irq : Kernel::Irq
class Vm_irq : public Kernel::Irq
{
Vm_irq(unsigned const irq, Kernel::Cpu &);
virtual ~Vm_irq() {};
private:
virtual void handle(Kernel::Cpu &, Kernel::Vm & vm, unsigned irq);
void occurred() override;
Kernel::Cpu &_cpu;
public:
Vm_irq(unsigned const irq, Kernel::Cpu &cpu);
virtual ~Vm_irq() {};
virtual void handle(Kernel::Vm &vm, unsigned irq);
void occurred() override;
};
@@ -65,7 +80,7 @@ struct Board::Vcpu_context
{
Pic_maintainance_irq(Kernel::Cpu &);
void handle(Kernel::Cpu &, Kernel::Vm &, unsigned) override { }
void handle(Kernel::Vm &, unsigned) override { }
};

View File

@@ -15,17 +15,23 @@
#ifndef _CORE__SPEC__WAND_QUAD__BOARD_H_
#define _CORE__SPEC__WAND_QUAD__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/gicv2.h>
#include <hw/spec/arm/wand_quad_board.h>
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/cortex_a9/cpu.h>
namespace Board {
using namespace Hw::Wand_quad_board;
using L2_cache = Hw::Pl310;
using Pic = Hw::Gicv2;
class Global_interrupt_controller { };
class Pic : public Hw::Gicv2 { public: Pic(Global_interrupt_controller &) { } };
L2_cache & l2_cache();
enum {

View File

@@ -16,15 +16,20 @@
#ifndef _CORE__SPEC__ZYNQ_QEMU__BOARD_H_
#define _CORE__SPEC__ZYNQ_QEMU__BOARD_H_
/* base-hw internal includes */
#include <hw/spec/arm/gicv2.h>
#include <hw/spec/arm/zynq_qemu_board.h>
/* base-hw Core includes */
#include <spec/arm/cortex_a9_private_timer.h>
#include <spec/cortex_a9/cpu.h>
namespace Board {
using namespace Hw::Zynq_qemu_board;
using Pic = Hw::Gicv2;
class Global_interrupt_controller { };
class Pic : public Hw::Gicv2 { public: Pic(Global_interrupt_controller &) { } };
L2_cache & l2_cache();
}

View File

@@ -14,7 +14,6 @@
/* core includes */
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include <kernel/thread.h>
#include <kernel/irq.h>
#include <kernel/pd.h>
@@ -22,15 +21,9 @@
#include <hw/assert.h>
#include <hw/boot_info.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
using namespace Kernel;
Kernel::Cpu_pool &Kernel::cpu_pool() { return *unmanaged_singleton<Cpu_pool>(); }
/*************
** Cpu_job **
*************/
@@ -52,22 +45,22 @@ void Cpu_job::_yield()
}
void Cpu_job::_interrupt(unsigned const /* cpu_id */)
void Cpu_job::_interrupt(Irq::Pool &user_irq_pool, unsigned const /* cpu_id */)
{
/* determine handling for specific interrupt */
/* let the IRQ controller take a pending IRQ for handling, if any */
unsigned irq_id;
if (_cpu->pic().take_request(irq_id))
/* is the interrupt a cpu-local one */
if (!_cpu->interrupt(irq_id)) {
/* let the CPU of this job handle the IRQ if it is a CPU-local one */
if (!_cpu->handle_if_cpu_local_interrupt(irq_id)) {
/* it needs to be a user interrupt */
User_irq * irq = User_irq::object(irq_id);
/* it isn't a CPU-local IRQ, so, it must be a user IRQ */
User_irq * irq = User_irq::object(user_irq_pool, irq_id);
if (irq) irq->occurred();
else Genode::raw("Unknown interrupt ", irq_id);
}
/* end interrupt request at controller */
/* let the IRQ controller finish the currently taken IRQ */
_cpu->pic().finish_request();
}
@@ -110,14 +103,18 @@ Cpu_job::~Cpu_job()
extern "C" void idle_thread_main(void);
Cpu::Idle_thread::Idle_thread(Cpu &cpu)
Cpu::Idle_thread::Idle_thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Cpu &cpu,
Pd &core_pd)
:
Thread("idle")
Thread { addr_space_id_alloc, user_irq_pool, cpu_pool, core_pd, "idle" }
{
regs->ip = (addr_t)&idle_thread_main;
affinity(cpu);
Thread::_pd = &core_pd();
Thread::_pd = &core_pd;
}
@@ -134,7 +131,7 @@ void Cpu::schedule(Job * const job)
}
bool Cpu::interrupt(unsigned const irq_id)
bool Cpu::handle_if_cpu_local_interrupt(unsigned const irq_id)
{
Irq * const irq = object(irq_id);
@@ -177,12 +174,21 @@ addr_t Cpu::stack_start()
}
Cpu::Cpu(unsigned const id, Inter_processor_work_list & global_work_list)
Cpu::Cpu(unsigned const id,
Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd,
Board::Global_interrupt_controller &global_irq_ctrl)
:
_id(id), _timer(*this),
_scheduler(_idle, _quota(), _fill()), _idle(*this),
_ipi_irq(*this),
_global_work_list(global_work_list)
_id { id },
_pic { global_irq_ctrl },
_timer { *this },
_scheduler { _idle, _quota(), _fill() },
_idle { addr_space_id_alloc, user_irq_pool, cpu_pool, *this,
core_pd },
_ipi_irq { *this },
_global_work_list { cpu_pool.work_list() }
{
_arch_init();
}
@@ -192,17 +198,22 @@ Cpu::Cpu(unsigned const id, Inter_processor_work_list & global_work_list)
** Cpu_pool **
**************/
bool Cpu_pool::initialize()
void
Cpu_pool::
initialize_executing_cpu(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Pd &core_pd,
Board::Global_interrupt_controller &global_irq_ctrl)
{
unsigned id = Cpu::executing_id();
_cpus[id].construct(id, _global_work_list);
return --_initialized == 0;
_cpus[id].construct(
id, addr_space_id_alloc, user_irq_pool, *this, core_pd, global_irq_ctrl);
}
Cpu & Cpu_pool::cpu(unsigned const id)
{
assert(id < _count && _cpus[id].constructed());
assert(id < _nr_of_cpus && _cpus[id].constructed());
return *_cpus[id];
}
@@ -210,7 +221,7 @@ Cpu & Cpu_pool::cpu(unsigned const id)
using Boot_info = Hw::Boot_info<Board::Boot_info>;
Cpu_pool::Cpu_pool()
Cpu_pool::Cpu_pool(unsigned nr_of_cpus)
:
_count(reinterpret_cast<Boot_info*>(Hw::Mm::boot_info().base)->cpus)
_nr_of_cpus(nr_of_cpus)
{ }

View File

@@ -35,11 +35,6 @@ namespace Kernel {
* Provides a CPU object for every available CPU
*/
class Cpu_pool;
/**
* Return singleton of CPU pool
*/
Cpu_pool &cpu_pool();
}
@@ -107,12 +102,16 @@ class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout
/**
* Construct idle context for CPU 'cpu'
*/
Idle_thread(Cpu &cpu);
Idle_thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Cpu &cpu,
Pd &core_pd);
};
unsigned const _id;
Board::Pic _pic {};
Board::Pic _pic;
Timer _timer;
Cpu_scheduler _scheduler;
Idle_thread _idle;
@@ -132,8 +131,12 @@ class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout
/**
* Construct object for CPU 'id'
*/
Cpu(unsigned const id,
Inter_processor_work_list & global_work_list);
Cpu(unsigned const id,
Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd,
Board::Global_interrupt_controller &global_irq_ctrl);
static inline unsigned primary_id() { return 0; }
@@ -148,7 +151,7 @@ class Kernel::Cpu : public Genode::Cpu, private Irq::Pool, private Timeout
* \param irq_id id of the interrupt that occured
* \returns true if the interrupt belongs to this CPU, otherwise false
*/
bool interrupt(unsigned const irq_id);
bool handle_if_cpu_local_interrupt(unsigned const irq_id);
/**
* Schedule 'job' at this CPU
@@ -197,15 +200,18 @@ class Kernel::Cpu_pool
private:
Inter_processor_work_list _global_work_list {};
unsigned _count;
unsigned _initialized { _count };
unsigned _nr_of_cpus;
Genode::Constructible<Cpu> _cpus[NR_OF_CPUS];
public:
Cpu_pool();
Cpu_pool(unsigned nr_of_cpus);
bool initialize();
void
initialize_executing_cpu(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Pd &core_pd,
Board::Global_interrupt_controller &global_irq_ctrl);
/**
* Return object of CPU 'id'
@@ -225,11 +231,13 @@ class Kernel::Cpu_pool
template <typename FUNC>
void for_each_cpu(FUNC const &func)
{
for (unsigned i = 0; i < _count; i++) func(cpu(i));
for (unsigned i = 0; i < _nr_of_cpus; i++) func(cpu(i));
}
Inter_processor_work_list & work_list() {
return _global_work_list; }
unsigned nr_of_cpus() { return _nr_of_cpus; }
};
#endif /* _CORE__KERNEL__CPU_H_ */

View File

@@ -51,7 +51,7 @@ class Kernel::Cpu_job : private Cpu_share
/**
* Handle interrupt exception that occured during execution on CPU 'id'
*/
void _interrupt(unsigned const id);
void _interrupt(Irq::Pool &user_irq_pool, unsigned const id);
/**
* Activate our own CPU-share

View File

@@ -50,7 +50,7 @@ void Cpu::trigger_ip_interrupt()
Cpu::Ipi::Ipi(Cpu & cpu)
:
Irq(Board::Pic::IPI, cpu), cpu(cpu)
Irq(Board::Pic::IPI, cpu, cpu.pic()), cpu(cpu)
{
cpu.pic().unmask(Board::Pic::IPI, cpu.id());
}

View File

@@ -34,7 +34,7 @@ void Cpu_scheduler::_reset_claims(unsigned const p)
void Cpu_scheduler::_next_round()
{
_residual = _quota;
_for_each_prio([&] (unsigned const p) { _reset_claims(p); });
_for_each_prio([&] (Cpu_priority const p, bool &) { _reset_claims(p); });
}
@@ -90,21 +90,23 @@ void Cpu_scheduler::_head_filled(unsigned const r)
bool Cpu_scheduler::_claim_for_head()
{
for (signed p = Prio::MAX; p > Prio::MIN - 1; p--) {
bool result { false };
_for_each_prio([&] (Cpu_priority const p, bool &cancel_for_each_prio) {
Double_list_item<Cpu_share> *const item { _rcl[p].head() };
if (!item)
continue;
return;
Cpu_share &share { item->payload() };
if (!share._claim)
continue;
return;
_set_head(share, share._claim, 1);
return 1;
}
return 0;
result = true;
cancel_for_each_prio = true;
});
return result;
}

View File

@@ -47,27 +47,28 @@ class Kernel::Cpu_priority
public:
enum {
MIN = 0,
MAX = cpu_priorities - 1,
};
static constexpr unsigned min() { return 0; }
static constexpr unsigned max() { return cpu_priorities - 1; }
/**
* Construct priority with value 'v'
*/
Cpu_priority(signed const v) : _value(Genode::min(v, MAX)) { }
Cpu_priority(unsigned const v)
:
_value { Genode::min(v, max()) }
{ }
/*
* Standard operators
*/
Cpu_priority &operator =(signed const v)
Cpu_priority &operator =(unsigned const v)
{
_value = Genode::min(v, MAX);
_value = Genode::min(v, max());
return *this;
}
operator signed() const { return _value; }
operator unsigned() const { return _value; }
};
@@ -79,7 +80,7 @@ class Kernel::Cpu_share
Double_list_item<Cpu_share> _fill_item { *this };
Double_list_item<Cpu_share> _claim_item { *this };
signed const _prio;
Cpu_priority const _prio;
unsigned _quota;
unsigned _claim;
unsigned _fill { 0 };
@@ -93,7 +94,7 @@ class Kernel::Cpu_share
* \param p claimed priority
* \param q claimed quota
*/
Cpu_share(signed const p, unsigned const q)
Cpu_share(Cpu_priority const p, unsigned const q)
: _prio(p), _quota(q), _claim(q) { }
/*
@@ -111,8 +112,8 @@ class Kernel::Cpu_scheduler
typedef Cpu_share Share;
typedef Cpu_priority Prio;
Double_list<Cpu_share> _rcl[Prio::MAX + 1]; /* ready claims */
Double_list<Cpu_share> _ucl[Prio::MAX + 1]; /* unready claims */
Double_list<Cpu_share> _rcl[Prio::max() + 1]; /* ready claims */
Double_list<Cpu_share> _ucl[Prio::max() + 1]; /* unready claims */
Double_list<Cpu_share> _fills { }; /* ready fills */
Share &_idle;
Share *_head = nullptr;
@@ -125,8 +126,15 @@ class Kernel::Cpu_scheduler
bool _need_to_schedule { true };
time_t _last_time { 0 };
template <typename F> void _for_each_prio(F f) {
for (signed p = Prio::MAX; p > Prio::MIN - 1; p--) { f(p); } }
template <typename F> void _for_each_prio(F f)
{
bool cancel_for_each_prio { false };
for (unsigned p = Prio::max(); p != Prio::min() - 1; p--) {
f(p, cancel_for_each_prio);
if (cancel_for_each_prio)
return;
}
}
static void _reset(Cpu_share &share);

View File

@@ -19,4 +19,7 @@ void Kernel::Cpu::Ipi::occurred() { }
void Kernel::Cpu::trigger_ip_interrupt() { }
Kernel::Cpu::Ipi::Ipi(Kernel::Cpu & cpu) : Irq(~0U, cpu), cpu(cpu) { }
Kernel::Cpu::Ipi::Ipi(Kernel::Cpu & cpu)
:
Irq(~0U, cpu, cpu.pic()), cpu(cpu)
{ }

View File

@@ -1,85 +0,0 @@
/*
* \brief Common kernel initialization
* \author Martin Stein
* \author Stefan Kalkowski
* \date 2015-12-20
*/
/*
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* core includes */
#include <kernel/pd.h>
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include <kernel/lock.h>
#include <platform_pd.h>
#include <board.h>
#include <platform_thread.h>
/* base includes */
#include <base/internal/unmanaged_singleton.h>
using namespace Kernel;
static_assert(sizeof(Genode::sizet_arithm_t) >= 2 * sizeof(size_t),
"Bad result type for size_t arithmetics.");
Pd &Kernel::core_pd() {
return unmanaged_singleton<Genode::Core_platform_pd>()->kernel_pd(); }
extern "C" void kernel_init();
/**
* Setup kernel environment
*/
extern "C" void kernel_init()
{
static volatile bool lock_ready = false;
static volatile bool pool_ready = false;
static volatile bool kernel_ready = false;
/**
* It is essential to guard the initialization of the data_lock object
* in the SMP case, because otherwise the __cxa_guard_aquire of the cxx
* library contention path might get called, which ends up in
* calling a Semaphore, which will call Kernel::stop_thread() or
* Kernel::yield() system-calls in this code
*/
while (Cpu::executing_id() != Cpu::primary_id() && !lock_ready) { ; }
{
Lock::Guard guard(data_lock());
lock_ready = true;
/* initialize current cpu */
pool_ready = cpu_pool().initialize();
};
/* wait until all cpus have initialized their corresponding cpu object */
while (!pool_ready) { ; }
/* the boot-cpu initializes the rest of the kernel */
if (Cpu::executing_id() == Cpu::primary_id()) {
Lock::Guard guard(data_lock());
Genode::log("");
Genode::log("kernel initialized");
Core_thread::singleton();
kernel_ready = true;
} else {
/* secondary cpus spin until the kernel is initialized */
while (!kernel_ready) {;}
}
kernel();
}

View File

@@ -20,7 +20,6 @@
/* core includes */
#include <kernel/ipc_node.h>
#include <kernel/kernel.h>
#include <kernel/thread.h>
using namespace Kernel;

View File

@@ -12,37 +12,32 @@
*/
/* core includes */
#include <kernel/kernel.h>
#include <kernel/cpu.h>
#include <kernel/irq.h>
void Kernel::Irq::disable() const
{
cpu_pool().executing_cpu().pic().mask(_irq_nr);
_pic.mask(_irq_nr);
}
void Kernel::Irq::enable() const
{
cpu_pool().executing_cpu().pic().unmask(_irq_nr, Cpu::executing_id());
_pic.unmask(_irq_nr, Cpu::executing_id());
}
Kernel::Irq::Pool &Kernel::User_irq::_pool()
{
static Irq::Pool p;
return p;
}
Kernel::User_irq::User_irq(unsigned const irq,
Genode::Irq_session::Trigger trigger,
Genode::Irq_session::Polarity polarity,
Signal_context & context)
Kernel::User_irq::User_irq(unsigned const irq,
Genode::Irq_session::Trigger trigger,
Genode::Irq_session::Polarity polarity,
Signal_context &context,
Board::Pic &pic,
Irq::Pool &user_irq_pool)
:
Irq(irq, _pool()), _context(context)
Irq { irq, user_irq_pool, pic },
_context { context }
{
disable();
cpu_pool().executing_cpu().pic().irq_mode(_irq_nr, trigger, polarity);
_pic.irq_mode(_irq_nr, trigger, polarity);
}

View File

@@ -19,12 +19,15 @@
#include <irq_session/irq_session.h>
#include <util/avl_tree.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
/* core includes */
#include <kernel/signal_receiver.h>
namespace Board {
class Pic;
}
namespace Kernel {
/**
@@ -67,8 +70,9 @@ class Kernel::Irq : Genode::Avl_node<Irq>
protected:
unsigned _irq_nr; /* kernel name of the interrupt */
Pool &_pool;
unsigned _irq_nr; /* kernel name of the interrupt */
Pool &_irq_pool;
Board::Pic &_pic;
public:
@@ -78,14 +82,18 @@ class Kernel::Irq : Genode::Avl_node<Irq>
* \param irq interrupt number
* \param pool pool this interrupt shall belong to
*/
Irq(unsigned const irq, Pool &pool)
Irq(unsigned const irq,
Pool &irq_pool,
Board::Pic &pic)
:
_irq_nr(irq), _pool(pool)
_irq_nr { irq },
_irq_pool { irq_pool },
_pic { pic }
{
_pool.insert(this);
_irq_pool.insert(this);
}
virtual ~Irq() { _pool.remove(this); }
virtual ~Irq() { _irq_pool.remove(this); }
/**
* Handle occurence of the interrupt
@@ -131,20 +139,17 @@ class Kernel::User_irq : public Kernel::Irq
Kernel::Object _kernel_object { *this };
Signal_context &_context;
/**
* Get map that provides all user interrupts by their kernel names
*/
static Irq::Pool &_pool();
public:
/**
* Construct object that signals interrupt 'irq' via signal 'context'
*/
User_irq(unsigned const irq,
Genode::Irq_session::Trigger trigger,
Genode::Irq_session::Polarity polarity,
Signal_context & context);
User_irq(unsigned const irq,
Genode::Irq_session::Trigger trigger,
Genode::Irq_session::Polarity polarity,
Signal_context &context,
Board::Pic &pic,
Irq::Pool &user_irq_pool);
/**
* Destructor
@@ -165,8 +170,8 @@ class Kernel::User_irq : public Kernel::Irq
/**
* Handle occurence of interrupt 'irq'
*/
static User_irq * object(unsigned const irq) {
return dynamic_cast<User_irq*>(_pool().object(irq)); }
static User_irq * object(Irq::Pool &user_irq_pool, unsigned const irq) {
return dynamic_cast<User_irq*>(user_irq_pool.object(irq)); }
/**
* Syscall to create user irq object

View File

@@ -1,35 +0,0 @@
/*
* \brief Kernel entrypoint
* \author Martin Stein
* \author Stefan Kalkowski
* \date 2011-10-20
*/
/*
* Copyright (C) 2011-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* core includes */
#include <kernel/cpu.h>
#include <kernel/lock.h>
#include <kernel/kernel.h>
extern "C" void kernel()
{
using namespace Kernel;
Cpu &cpu = cpu_pool().cpu(Cpu::executing_id());
Cpu_job * new_job;
{
Lock::Guard guard(data_lock());
new_job = &cpu.schedule();
}
new_job->proceed(cpu);
}

View File

@@ -1,31 +0,0 @@
/*
* \brief Singlethreaded minimalistic kernel
* \author Martin Stein
* \author Stefan Kalkowski
* \date 2013-09-30
*/
/*
* Copyright (C) 2013-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _CORE__KERNEL__KERNEL_H_
#define _CORE__KERNEL__KERNEL_H_
/**
* Main routine of every kernel pass
*/
extern "C" void kernel();
namespace Kernel {
class Pd;
Pd &core_pd();
}
#endif /* _CORE__KERNEL__KERNEL_H_ */

View File

@@ -11,19 +11,13 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/lock_guard.h>
/* Genode includes */
#include <cpu/atomic.h>
#include <cpu/memory_barrier.h>
/* base-hw Core includes */
#include <kernel/cpu.h>
#include <kernel/lock.h>
#include <kernel/kernel.h>
Kernel::Lock & Kernel::data_lock()
{
static Kernel::Lock lock;
return lock;
}
void Kernel::Lock::lock()

View File

@@ -15,12 +15,10 @@
#ifndef _CORE__SPEC__SMP__KERNEL__LOCK_H_
#define _CORE__SPEC__SMP__KERNEL__LOCK_H_
namespace Kernel {
/* Genode includes */
#include <base/lock_guard.h>
class Lock;
Lock & data_lock();
}
namespace Kernel { class Lock; }
class Kernel::Lock

View File

@@ -0,0 +1,239 @@
/*
* \brief Main object of the kernel
* \author Martin Stein
* \author Stefan Kalkowski
* \date 2021-07-09
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* base includes */
#include <util/reconstructible.h>
/* base Core includes */
#include <map_local.h>
/* base-hw Core includes */
#include <kernel/cpu.h>
#include <kernel/lock.h>
#include <kernel/main.h>
#include <platform_pd.h>
#include <platform_thread.h>
/* base-hw-internal includes */
#include <hw/boot_info.h>
namespace Kernel {
class Main;
}
class Kernel::Main
{
private:
friend void main_handle_kernel_entry();
friend void main_initialize_and_handle_kernel_entry();
friend time_t main_read_idle_thread_execution_time(unsigned cpu_idx);
friend void main_print_char(char c);
enum { SERIAL_BAUD_RATE = 115200 };
static Main *_instance;
Lock _data_lock { };
Cpu_pool _cpu_pool;
Irq::Pool _user_irq_pool { };
Board::Address_space_id_allocator _addr_space_id_alloc { };
Genode::Core_platform_pd _core_platform_pd { _addr_space_id_alloc };
Genode::Constructible<Core_main_thread> _core_main_thread { };
Board::Global_interrupt_controller _global_irq_ctrl { };
Board::Serial _serial { Genode::Platform::mmio_to_virt(Board::UART_BASE),
Board::UART_CLOCK,
SERIAL_BAUD_RATE };
void _handle_kernel_entry();
Main(unsigned nr_of_cpus);
public:
static Genode::Platform_pd &core_platform_pd();
};
Kernel::Main *Kernel::Main::_instance;
Kernel::Main::Main(unsigned nr_of_cpus)
:
_cpu_pool { nr_of_cpus }
{ }
void Kernel::Main::_handle_kernel_entry()
{
Cpu &cpu = _cpu_pool.cpu(Cpu::executing_id());
Cpu_job * new_job;
{
Lock::Guard guard(_data_lock);
new_job = &cpu.schedule();
}
new_job->proceed(cpu);
}
void Kernel::main_handle_kernel_entry()
{
Main::_instance->_handle_kernel_entry();
}
void Kernel::main_initialize_and_handle_kernel_entry()
{
static_assert(sizeof(Genode::sizet_arithm_t) >= 2 * sizeof(size_t),
"Bad result type for size_t arithmetics.");
using Boot_info = Hw::Boot_info<Board::Boot_info>;
static volatile bool instance_initialized { false };
static volatile unsigned nr_of_initialized_cpus { 0 };
static volatile bool kernel_initialized { false };
Boot_info &boot_info {
*reinterpret_cast<Boot_info*>(Hw::Mm::boot_info().base) };
unsigned const nr_of_cpus { boot_info.cpus };
bool const primary_cpu { Cpu::executing_id() == Cpu::primary_id() };
if (primary_cpu) {
/**
* Let the primary CPU create a Main object and initialize the static
* reference to it.
*/
static Main instance { nr_of_cpus };
Main::_instance = &instance;
} else {
/**
* Let secondary CPUs block until the primary CPU has managed to set
* up the Main instance.
*/
while (!instance_initialized) { }
}
{
/**
* Let each CPU initialize its corresponding CPU object in the
* CPU pool.
*/
Lock::Guard guard(Main::_instance->_data_lock);
instance_initialized = true;
Main::_instance->_cpu_pool.initialize_executing_cpu(
Main::_instance->_addr_space_id_alloc,
Main::_instance->_user_irq_pool,
Main::_instance->_core_platform_pd.kernel_pd(),
Main::_instance->_global_irq_ctrl);
nr_of_initialized_cpus++;
};
/**
* Let all CPUs block until each CPU object in the CPU pool has been
* initialized by the corresponding CPU.
*/
while (nr_of_initialized_cpus < nr_of_cpus) { }
if (primary_cpu) {
/**
* Let the primary CPU initialize the core main thread and finish
* initialization of the boot info.
*/
Lock::Guard guard(Main::_instance->_data_lock);
Main::_instance->_cpu_pool.for_each_cpu([&] (Kernel::Cpu &cpu) {
boot_info.kernel_irqs.add(cpu.timer().interrupt_id());
});
boot_info.kernel_irqs.add((unsigned)Board::Pic::IPI);
Main::_instance->_core_main_thread.construct(
Main::_instance->_addr_space_id_alloc,
Main::_instance->_user_irq_pool,
Main::_instance->_cpu_pool,
Main::_instance->_core_platform_pd.kernel_pd());
boot_info.core_main_thread_utcb =
(addr_t)Main::_instance->_core_main_thread->utcb();
Genode::log("");
Genode::log("kernel initialized");
kernel_initialized = true;
} else {
/**
* Let secondary CPUs block until the primary CPU has initialized the
* core main thread and finished initialization of the boot info.
*/
while (!kernel_initialized) {;}
}
Main::_instance->_handle_kernel_entry();
}
Genode::Platform_pd &Kernel::Main::core_platform_pd()
{
return _instance->_core_platform_pd;
}
void Kernel::main_print_char(char c)
{
Main::_instance->_serial.put_char(c);
}
Kernel::time_t Kernel::main_read_idle_thread_execution_time(unsigned cpu_idx)
{
return Main::_instance->_cpu_pool.cpu(cpu_idx).idle_thread().execution_time();
}
Genode::Platform_pd &
Genode::Platform_thread::_kernel_main_get_core_platform_pd()
{
return Kernel::Main::core_platform_pd();
}
bool Genode::map_local(addr_t from_phys, addr_t to_virt, size_t num_pages,
Page_flags flags)
{
return
Kernel::Main::core_platform_pd().insert_translation(
to_virt, from_phys, num_pages * get_page_size(), flags);
}
bool Genode::unmap_local(addr_t virt_addr, size_t num_pages)
{
Kernel::Main::core_platform_pd().flush(
virt_addr, num_pages * get_page_size());
return true;
}

View File

@@ -0,0 +1,33 @@
/*
* \brief Main object of the kernel
* \author Martin Stein
* \date 2021-07-09
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _KERNEL__MAIN_H_
#define _KERNEL__MAIN_H_
/* base-hw Core includes */
#include <kernel/types.h>
namespace Kernel {
void main_print_char(char const c);
void main_handle_kernel_entry();
void main_initialize_and_handle_kernel_entry();
time_t main_read_idle_thread_execution_time(unsigned cpu_idx);
void main_print_char(char c);
}
#endif /* _KERNEL__MAIN_H_ */

View File

@@ -1,6 +1,5 @@
#include <kernel/object.h>
#include <kernel/pd.h>
#include <kernel/kernel.h>
#include <util/construct_at.h>

View File

@@ -23,7 +23,6 @@
/* core includes */
#include <kernel/core_interface.h>
#include <kernel/interface.h>
#include <kernel/kernel.h>
namespace Kernel {
@@ -228,9 +227,24 @@ class Kernel::Core_object_identity : public Object_identity,
{
public:
Core_object_identity(T & object)
: Object_identity(object.kernel_object()),
Object_identity_reference(this, core_pd()) { }
/**
* Constructor used for objects other than the Core PD
*/
Core_object_identity(Pd &core_pd,
T &object)
:
Object_identity(object.kernel_object()),
Object_identity_reference(this, core_pd)
{ }
/**
* Constructor used for Core PD object
*/
Core_object_identity(T &core_pd)
:
Object_identity(core_pd.kernel_object()),
Object_identity_reference(this, core_pd)
{ }
capid_t core_capid() { return capid(); }
@@ -248,9 +262,26 @@ class Kernel::Core_object : public T, Kernel::Core_object_identity<T>
{
public:
/**
* Constructor used for objects other than the Core PD
*/
template <typename... ARGS>
Core_object(Pd &core_pd,
ARGS &&... args)
:
T(args...),
Core_object_identity<T>(core_pd, *static_cast<T*>(this))
{ }
/**
* Constructor used for Core PD object
*/
template <typename... ARGS>
Core_object(ARGS &&... args)
: T(args...), Core_object_identity<T>(*static_cast<T*>(this)) { }
:
T(args...),
Core_object_identity<T>(*static_cast<T*>(this))
{ }
using Kernel::Core_object_identity<T>::core_capid;
using Kernel::Core_object_identity<T>::capid;

View File

@@ -15,13 +15,13 @@
#ifndef _CORE__KERNEL__PD_H_
#define _CORE__KERNEL__PD_H_
/* core includes */
/* base-hw Core includes */
#include <hw/assert.h>
#include <cpu.h>
#include <kernel/core_interface.h>
#include <object.h>
#include <translation_table.h>
#include <board.h>
/* base includes */
#include <util/reconstructible.h>
namespace Genode { class Platform_pd; }
@@ -53,7 +53,6 @@ class Kernel::Pd
Genode::Platform_pd &_platform_pd;
Capid_allocator _capid_alloc { };
Object_identity_reference_tree _cap_tree { };
bool _core_pd { false };
public:
@@ -65,19 +64,16 @@ class Kernel::Pd
* \param table translation table of the PD
* \param platform_pd core object of the PD
*/
Pd(Hw::Page_table &table,
Genode::Platform_pd &platform_pd)
Pd(Hw::Page_table &table,
Genode::Platform_pd &platform_pd,
Board::Address_space_id_allocator &addr_space_id_alloc)
:
_table(table), _platform_pd(platform_pd), mmu_regs((addr_t)&table)
_table(table),
_platform_pd(platform_pd),
mmu_regs((addr_t)&table, addr_space_id_alloc)
{
capid_t invalid = _capid_alloc.alloc();
assert(invalid == cap_id_invalid());
static bool first_pd = true;
if (first_pd) {
_core_pd = true;
first_pd = false;
}
}
~Pd()
@@ -113,15 +109,6 @@ class Kernel::Pd
Hw::Page_table &translation_table() { return _table; }
Capid_allocator &capid_alloc() { return _capid_alloc; }
Object_identity_reference_tree &cap_tree() { return _cap_tree; }
bool core_pd() const { return _core_pd; }
};
template<>
inline Kernel::Core_object_identity<Kernel::Pd>::Core_object_identity(Kernel::Pd & pd)
:
Object_identity(pd.kernel_object()),
Object_identity_reference(this, pd.core_pd() ? pd : core_pd())
{ }
#endif /* _CORE__KERNEL__PD_H_ */

View File

@@ -17,14 +17,11 @@
#include <cpu_session/cpu_session.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
#include <base/internal/native_utcb.h>
#include <base/internal/crt0.h>
/* core includes */
#include <hw/assert.h>
#include <kernel/cpu.h>
#include <kernel/kernel.h>
#include <kernel/thread.h>
#include <kernel/irq.h>
#include <kernel/log.h>
@@ -98,7 +95,7 @@ void Thread::ipc_copy_msg(Thread &sender)
Reference *dst_oir = oir->find(pd());
/* if it is not found, and the target is not core, create a reference */
if (!dst_oir && (&pd() != &core_pd())) {
if (!dst_oir && (&pd() != &_core_pd)) {
dst_oir = oir->factory(_obj_id_ref_ptr[i], pd());
if (dst_oir) _obj_id_ref_ptr[i] = nullptr;
}
@@ -111,13 +108,22 @@ void Thread::ipc_copy_msg(Thread &sender)
}
Thread::Tlb_invalidation::Tlb_invalidation(Thread & caller, Pd & pd,
addr_t addr, size_t size,
unsigned cnt)
Thread::
Tlb_invalidation::Tlb_invalidation(Inter_processor_work_list &global_work_list,
Thread &caller,
Pd &pd,
addr_t addr,
size_t size,
unsigned cnt)
:
caller(caller), pd(pd), addr(addr), size(size), cnt(cnt)
global_work_list { global_work_list },
caller { caller },
pd { pd },
addr { addr },
size { size },
cnt { cnt }
{
cpu_pool().work_list().insert(&_le);
global_work_list.insert(&_le);
caller._become_inactive(AWAITS_RESTART);
}
@@ -131,10 +137,11 @@ Thread::Destroy::Destroy(Thread & caller, Genode::Kernel_object<Thread> & to_del
}
void Thread::Destroy::execute()
void
Thread::Destroy::execute()
{
thread_to_destroy->_cpu->work_list().remove(&_le);
thread_to_destroy.destruct();
cpu_pool().executing_cpu().work_list().remove(&_le);
caller._restart();
}
@@ -280,7 +287,7 @@ void Thread::_call_thread_quota()
void Thread::_call_start_thread()
{
/* lookup CPU */
Cpu & cpu = cpu_pool().cpu(user_arg_2());
Cpu & cpu = _cpu_pool.cpu(user_arg_2());
user_arg_0(0);
Thread &thread = *(Thread*)user_arg_1();
@@ -648,7 +655,9 @@ void Thread::_call_new_irq()
Genode::Irq_session::Polarity polarity =
(Genode::Irq_session::Polarity) (user_arg_3() & 0b11);
_call_new<User_irq>((unsigned)user_arg_2(), trigger, polarity, *c);
_call_new<User_irq>(
(unsigned)user_arg_2(), trigger, polarity, *c,
_cpu_pool.executing_cpu().pic(), _user_irq_pool);
}
@@ -671,7 +680,7 @@ void Thread::_call_new_obj()
using Thread_identity = Genode::Constructible<Core_object_identity<Thread>>;
Thread_identity & coi = *(Thread_identity*)user_arg_1();
coi.construct(*thread);
coi.construct(_core_pd, *thread);
user_arg_0(coi->core_capid());
}
@@ -709,12 +718,15 @@ void Kernel::Thread::_call_invalidate_tlb()
size_t size = (size_t) user_arg_3();
unsigned cnt = 0;
cpu_pool().for_each_cpu([&] (Cpu & cpu) {
_cpu_pool.for_each_cpu([&] (Cpu & cpu) {
/* if a cpu needs to update increase the counter */
if (pd->invalidate_tlb(cpu, addr, size)) cnt++; });
/* insert the work item in the list if there are outstanding cpus */
if (cnt) _tlb_invalidation.construct(*this, *pd, addr, size, cnt);
if (cnt) {
_tlb_invalidation.construct(
_cpu_pool.work_list(), *this, *pd, addr, size, cnt);
}
}
@@ -726,6 +738,8 @@ void Thread::_call()
unsigned const call_id = user_arg_0();
switch (call_id) {
case call_id_cache_coherent_region(): _call_cache_coherent_region(); return;
case call_id_cache_clean_inv_region(): _call_cache_clean_invalidate_data_region(); return;
case call_id_cache_inv_region(): _call_cache_invalidate_data_region(); return;
case call_id_stop_thread(): _call_stop_thread(); return;
case call_id_restart_thread(): _call_restart_thread(); return;
case call_id_yield_thread(): _call_yield_thread(); return;
@@ -757,12 +771,14 @@ void Thread::_call()
/* switch over kernel calls that are restricted to core */
switch (call_id) {
case call_id_new_thread():
_call_new<Thread>((unsigned) user_arg_2(),
_call_new<Thread>(_addr_space_id_alloc, _user_irq_pool, _cpu_pool,
_core_pd, (unsigned) user_arg_2(),
(unsigned) _core_to_kernel_quota(user_arg_3()),
(char const *) user_arg_4());
return;
case call_id_new_core_thread():
_call_new<Thread>((char const *) user_arg_2());
_call_new<Thread>(_addr_space_id_alloc, _user_irq_pool, _cpu_pool,
_core_pd, (char const *) user_arg_2());
return;
case call_id_thread_quota(): _call_thread_quota(); return;
case call_id_delete_thread(): _call_delete_thread(); return;
@@ -772,7 +788,8 @@ void Thread::_call()
case call_id_invalidate_tlb(): _call_invalidate_tlb(); return;
case call_id_new_pd():
_call_new<Pd>(*(Hw::Page_table *) user_arg_2(),
*(Genode::Platform_pd *) user_arg_3());
*(Genode::Platform_pd *) user_arg_3(),
_addr_space_id_alloc);
return;
case call_id_delete_pd(): _call_delete<Pd>(); return;
case call_id_new_signal_receiver(): _call_new<Signal_receiver>(); return;
@@ -819,12 +836,26 @@ void Thread::_mmu_exception()
}
Thread::Thread(unsigned const priority, unsigned const quota,
char const * const label, bool core)
Thread::Thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd,
unsigned const priority,
unsigned const quota,
char const *const label,
bool core)
:
Kernel::Object { *this },
Cpu_job(priority, quota), _ipc_node(*this), _state(AWAITS_START),
_label(label), _core(core), regs(core)
Kernel::Object { *this },
Cpu_job { priority, quota },
_addr_space_id_alloc { addr_space_id_alloc },
_user_irq_pool { user_irq_pool },
_cpu_pool { cpu_pool },
_core_pd { core_pd },
_ipc_node { *this },
_state { AWAITS_START },
_label { label },
_core { core },
regs { core }
{ }
@@ -842,41 +873,35 @@ void Thread::print(Genode::Output &out) const
Genode::uint8_t __initial_stack_base[DEFAULT_STACK_SIZE];
/*****************
** Core_thread **
*****************/
/**********************
** Core_main_thread **
**********************/
Core_thread::Core_thread()
Core_main_thread::
Core_main_thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd)
:
Core_object<Thread>("core")
Core_object<Thread>(
core_pd, addr_space_id_alloc, user_irq_pool, cpu_pool, core_pd, "core")
{
using namespace Genode;
static Native_utcb * const utcb =
unmanaged_singleton<Native_utcb, get_page_size()>();
static addr_t const utcb_phys = Platform::core_phys_addr((addr_t)utcb);
/* map UTCB */
Genode::map_local(utcb_phys, (addr_t)utcb_main_thread(),
Genode::map_local(Platform::core_phys_addr((addr_t)&_utcb_instance),
(addr_t)utcb_main_thread(),
sizeof(Native_utcb) / get_page_size());
utcb->cap_add(core_capid());
utcb->cap_add(cap_id_invalid());
utcb->cap_add(cap_id_invalid());
_utcb_instance.cap_add(core_capid());
_utcb_instance.cap_add(cap_id_invalid());
_utcb_instance.cap_add(cap_id_invalid());
/* start thread with stack pointer at the top of stack */
regs->sp = (addr_t)&__initial_stack_base[0] + DEFAULT_STACK_SIZE;
regs->ip = (addr_t)&_core_start;
affinity(cpu_pool().primary_cpu());
_utcb = utcb;
Thread::_pd = &core_pd();
affinity(_cpu_pool.primary_cpu());
_utcb = &_utcb_instance;
Thread::_pd = &core_pd;
_become_active();
}
Thread & Core_thread::singleton()
{
static Core_thread ct;
return ct;
}

View File

@@ -19,8 +19,7 @@
#include <base/signal.h>
#include <util/reconstructible.h>
/* core includes */
#include <cpu.h>
/* base-hw Core includes */
#include <kernel/cpu_context.h>
#include <kernel/inter_processor_work.h>
#include <kernel/signal_receiver.h>
@@ -29,13 +28,15 @@
#include <kernel/interface.h>
#include <assertion.h>
/* base-local includes */
/* base internal includes */
#include <base/internal/native_utcb.h>
namespace Kernel {
class Cpu_pool;
struct Thread_fault;
class Thread;
class Core_thread;
class Core_main_thread;
}
@@ -69,14 +70,19 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
*/
struct Tlb_invalidation : Inter_processor_work
{
Thread & caller; /* the caller gets blocked until all finished */
Pd & pd; /* the corresponding pd */
addr_t addr;
size_t size;
unsigned cnt; /* count of cpus left */
Inter_processor_work_list &global_work_list;
Thread &caller; /* the caller gets blocked until all finished */
Pd &pd; /* the corresponding pd */
addr_t addr;
size_t size;
unsigned cnt; /* count of cpus left */
Tlb_invalidation(Thread & caller, Pd & pd, addr_t addr, size_t size,
unsigned cnt);
Tlb_invalidation(Inter_processor_work_list &global_work_list,
Thread &caller,
Pd &pd,
addr_t addr,
size_t size,
unsigned cnt);
/************************************
** Inter_processor_work interface **
@@ -124,22 +130,26 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
enum { MAX_RCV_CAPS = Genode::Msgbuf_base::MAX_CAPS_PER_MSG };
void *_obj_id_ref_ptr[MAX_RCV_CAPS] { nullptr };
Ipc_node _ipc_node;
capid_t _ipc_capid { cap_id_invalid() };
size_t _ipc_rcv_caps { 0 };
Genode::Native_utcb *_utcb { nullptr };
Pd *_pd { nullptr };
Signal_context *_pager { nullptr };
Thread_fault _fault { };
State _state;
Signal_handler _signal_handler { *this };
Signal_context_killer _signal_context_killer { *this };
char const *const _label;
capid_t _timeout_sigid { 0 };
bool _paused { false };
bool _cancel_next_await_signal { false };
bool const _core { false };
Board::Address_space_id_allocator &_addr_space_id_alloc;
Irq::Pool &_user_irq_pool;
Cpu_pool &_cpu_pool;
Pd &_core_pd;
void *_obj_id_ref_ptr[MAX_RCV_CAPS] { nullptr };
Ipc_node _ipc_node;
capid_t _ipc_capid { cap_id_invalid() };
size_t _ipc_rcv_caps { 0 };
Genode::Native_utcb *_utcb { nullptr };
Pd *_pd { nullptr };
Signal_context *_pager { nullptr };
Thread_fault _fault { };
State _state;
Signal_handler _signal_handler { *this };
Signal_context_killer _signal_context_killer { *this };
char const *const _label;
capid_t _timeout_sigid { 0 };
bool _paused { false };
bool _cancel_next_await_signal { false };
bool const _core { false };
Genode::Constructible<Tlb_invalidation> _tlb_invalidation {};
Genode::Constructible<Destroy> _destroy {};
@@ -225,6 +235,8 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
void _call_send_reply_msg();
void _call_invalidate_tlb();
void _call_cache_coherent_region();
void _call_cache_clean_invalidate_data_region();
void _call_cache_invalidate_data_region();
void _call_print_char();
void _call_await_signal();
void _call_pending_signal();
@@ -253,7 +265,7 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
{
Genode::Kernel_object<T> & kobj =
*(Genode::Kernel_object<T>*)user_arg_1();
kobj.construct(args...);
kobj.construct(_core_pd, args...);
user_arg_0(kobj->core_capid());
}
@@ -282,16 +294,29 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
* \param label debugging label
* \param core whether it is a core thread or not
*/
Thread(unsigned const priority, unsigned const quota,
char const * const label, bool core = false);
Thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd,
unsigned const priority,
unsigned const quota,
char const *const label,
bool core = false);
/**
* Constructor for core/kernel thread
*
* \param label debugging label
*/
Thread(char const * const label)
: Thread(Cpu_priority::MIN, 0, label, true) { }
Thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd,
char const *const label)
:
Thread(addr_space_id_alloc, user_irq_pool, cpu_pool, core_pd,
Cpu_priority::min(), 0, label, true)
{ }
~Thread();
@@ -420,11 +445,18 @@ class Kernel::Thread : private Kernel::Object, public Cpu_job, private Timeout
/**
* The first core thread in the system bootstrapped by the Kernel
*/
struct Kernel::Core_thread : Core_object<Kernel::Thread>
class Kernel::Core_main_thread : public Core_object<Kernel::Thread>
{
Core_thread();
private:
static Thread & singleton();
Native_utcb _utcb_instance alignas(Hw::get_page_size()) { };
public:
Core_main_thread(Board::Address_space_id_allocator &addr_space_id_alloc,
Irq::Pool &user_irq_pool,
Cpu_pool &cpu_pool,
Pd &core_pd);
};
#endif /* _CORE__KERNEL__THREAD_H_ */

View File

@@ -25,7 +25,8 @@ void Timer::Irq::occurred() { _cpu.scheduler().timeout(); }
Timer::Irq::Irq(unsigned id, Cpu &cpu)
:
Kernel::Irq(id, cpu.irq_pool()), _cpu(cpu)
Kernel::Irq { id, cpu.irq_pool(), cpu.pic() },
_cpu { cpu }
{ }

View File

@@ -18,7 +18,6 @@ namespace Genode { class Vm_state; }
/* core includes */
#include <kernel/cpu_context.h>
#include <kernel/kernel.h>
#include <kernel/pd.h>
#include <kernel/signal_receiver.h>
@@ -55,6 +54,7 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
enum Scheduler_state { ACTIVE, INACTIVE };
Irq::Pool & _user_irq_pool;
Object _kernel_object { *this };
State & _state;
Signal_context & _context;
@@ -71,10 +71,11 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
* \param state initial CPU state
* \param context signal for VM exceptions other than interrupts
*/
Vm(unsigned cpu,
State & state,
Signal_context & context,
Identity & id);
Vm(Irq::Pool & user_irq_pool,
Cpu & cpu,
Genode::Vm_state & state,
Kernel::Signal_context & context,
Identity & id);
/**
* Inject an interrupt to this VM

View File

@@ -14,6 +14,7 @@
/* core includes */
#include <kernel/thread.h>
#include <kernel/vm.h>
#include <kernel/cpu.h>
void Kernel::Thread::_call_new_vm()
{
@@ -24,7 +25,8 @@ void Kernel::Thread::_call_new_vm()
return;
}
_call_new<Vm>((unsigned)user_arg_2(), *(Board::Vm_state*)user_arg_3(),
_call_new<Vm>(_user_irq_pool, _cpu_pool.cpu((unsigned)user_arg_2()),
*(Board::Vm_state*)user_arg_3(),
*context, *(Vm::Identity*)user_arg_4());
}

View File

@@ -12,29 +12,20 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
#include <board.h>
#include <platform.h>
/* base-hw Core includes */
#include <kernel/main.h>
#include <kernel/log.h>
void Kernel::log(char const c)
{
using namespace Board;
enum {
ASCII_LINE_FEED = 10,
ASCII_CARRIAGE_RETURN = 13,
BAUD_RATE = 115200
};
static Serial serial { Genode::Platform::mmio_to_virt(UART_BASE),
UART_CLOCK, BAUD_RATE };
if (c == ASCII_LINE_FEED)
serial.put_char(ASCII_CARRIAGE_RETURN);
main_print_char(ASCII_CARRIAGE_RETURN);
serial.put_char(c);
main_print_char(c);
}

View File

@@ -44,19 +44,29 @@ class Genode::Kernel_object : public Genode::Constructible<Kernel::Core_object<T
public:
enum Called_from_core { CALLED_FROM_CORE };
enum Called_from_kernel { CALLED_FROM_KERNEL };
Kernel_object() {}
/**
* Creates a kernel object either via a syscall or directly
* Creates a kernel object via a syscall
*/
template <typename... ARGS>
Kernel_object(bool syscall, ARGS &&... args)
Kernel_object(Called_from_core, ARGS &&... args)
:
_cap(Capability_space::import(syscall ? T::syscall_create(*this, args...)
: Kernel::cap_id_invalid()))
_cap(Capability_space::import(T::syscall_create(*this, args...)))
{ }
/**
* Creates a kernel object directly
*/
template <typename... ARGS>
Kernel_object(Called_from_kernel, ARGS &&... args)
:
_cap(Capability_space::import(Kernel::cap_id_invalid()))
{
if (!syscall)
Genode::Constructible<Kernel::Core_object<T>>::construct(args...);
Genode::Constructible<Kernel::Core_object<T>>::construct(args...);
}
~Kernel_object()

View File

@@ -110,7 +110,8 @@ Pager_entrypoint::Pager_entrypoint(Rpc_cap_factory &)
:
Thread(Weight::DEFAULT_WEIGHT, "pager_ep", PAGER_EP_STACK_SIZE,
Type::NORMAL),
_kobj(true)
_kobj(_kobj.CALLED_FROM_CORE)
{
start();
}

View File

@@ -21,9 +21,6 @@
#include <base/signal.h>
#include <pager/capability.h>
/* base-internal includes */
#include <base/internal/unmanaged_singleton.h>
/* core-local includes */
#include <kernel/signal_receiver.h>
#include <hw/mapping.h>

View File

@@ -13,24 +13,27 @@
*/
/* core includes */
/* base Core includes */
#include <boot_modules.h>
#include <core_log.h>
#include <hw/memory_region.h>
/* base-hw Core includes */
#include <map_local.h>
#include <platform.h>
#include <platform_pd.h>
#include <kernel/main.h>
/* base-hw internal includes */
#include <hw/page_flags.h>
#include <hw/util.h>
#include <kernel/kernel.h>
#include <translation_table.h>
#include <kernel/cpu.h>
#include <hw/memory_region.h>
/* base-internal includes */
/* base internal includes */
#include <base/internal/crt0.h>
#include <base/internal/stack_area.h>
#include <base/internal/unmanaged_singleton.h>
/* Genode includes */
/* base includes */
#include <base/log.h>
#include <trace/source_registry.h>
@@ -63,6 +66,11 @@ Hw::Page_table::Allocator & Platform::core_page_table_allocator()
}
addr_t Platform::core_main_thread_phys_utcb()
{
return core_phys_addr(_boot_info().core_main_thread_utcb);
}
void Platform::_init_io_mem_alloc()
{
/* add entire adress space minus the RAM memory regions */
@@ -177,14 +185,12 @@ Platform::Platform()
/* make all non-kernel interrupts available to the interrupt allocator */
for (unsigned i = 0; i < Board::Pic::NR_OF_IRQ; i++) {
bool kernel_resource = false;
Kernel::cpu_pool().for_each_cpu([&] (Kernel::Cpu & cpu) {
if (i == cpu.timer().interrupt_id()) {
_boot_info().kernel_irqs.for_each([&] (unsigned /*idx*/,
unsigned kernel_irq) {
if (i == kernel_irq) {
kernel_resource = true;
}
});
if (i == Board::Pic::IPI) {
kernel_resource = true;
}
if (kernel_resource) {
continue;
}
@@ -218,39 +224,47 @@ Platform::Platform()
init_core_log(Core_log_range { core_local_addr, log_size } );
}
struct Trace_source : public Trace::Source::Info_accessor,
private Trace::Control,
private Trace::Source
class Idle_thread_trace_source : public Trace::Source::Info_accessor,
private Trace::Control,
private Trace::Source
{
Kernel::Thread &thread;
Affinity::Location const affinity;
private:
/**
* Trace::Source::Info_accessor interface
*/
Info trace_source_info() const override
{
Trace::Execution_time execution_time { thread.execution_time(), 0 };
return { Session_label("kernel"), thread.label(), execution_time,
affinity };
}
Affinity::Location const _affinity;
Trace_source(Trace::Source_registry &registry,
Kernel::Thread &thread, Affinity::Location affinity)
:
Trace::Control(),
Trace::Source(*this, *this),
thread(thread), affinity(affinity)
{
registry.insert(this);
}
public:
/**
* Trace::Source::Info_accessor interface
*/
Info trace_source_info() const override
{
Trace::Execution_time execution_time {
Kernel::main_read_idle_thread_execution_time(
_affinity.xpos()), 0 };
return { Session_label("kernel"), "idle",
execution_time, _affinity };
}
Idle_thread_trace_source(Trace::Source_registry &registry,
Affinity::Location affinity)
:
Trace::Control { },
Trace::Source { *this, *this },
_affinity { affinity }
{
registry.insert(this);
}
};
/* create trace sources for idle threads */
Kernel::cpu_pool().for_each_cpu([&] (Kernel::Cpu & cpu) {
new (core_mem_alloc()) Trace_source(Trace::sources(), cpu.idle_thread(),
Affinity::Location(cpu.id(), 0));
});
for (unsigned cpu_idx = 0; cpu_idx < _boot_info().cpus; cpu_idx++) {
new (core_mem_alloc())
Idle_thread_trace_source(
Trace::sources(), Affinity::Location(cpu_idx, 0));
}
log(_rom_fs);
}
@@ -260,23 +274,6 @@ Platform::Platform()
** Support for core memory management **
****************************************/
bool Genode::map_local(addr_t from_phys, addr_t to_virt, size_t num_pages,
Page_flags flags)
{
Platform_pd &pd = Kernel::core_pd().platform_pd();
return pd.insert_translation(to_virt, from_phys,
num_pages * get_page_size(), flags);
}
bool Genode::unmap_local(addr_t virt_addr, size_t num_pages)
{
Platform_pd &pd = Kernel::core_pd().platform_pd();
pd.flush(virt_addr, num_pages * get_page_size());
return true;
}
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr,
unsigned size) {
return ::map_local(phys_addr, virt_addr, size / get_page_size()); }

View File

@@ -15,24 +15,25 @@
#ifndef _CORE__PLATFORM_H_
#define _CORE__PLATFORM_H_
/* Genode includes */
/* base includes */
#include <base/synced_allocator.h>
#include <base/allocator_avl.h>
#include <irq_session/irq_session.h>
#include <util/xml_generator.h>
/* base-hw includes */
/* base-hw internal includes */
#include <hw/boot_info.h>
#include <hw/memory_region.h>
/* base-hw includes */
#include <kernel/configuration.h>
#include <kernel/core_interface.h>
#include <kernel/pd.h>
/* core includes */
/* base-hw Core includes */
#include <platform_generic.h>
#include <core_region_map.h>
#include <core_mem_alloc.h>
#include <translation_table.h>
#include <assertion.h>
#include <board.h>
@@ -143,6 +144,8 @@ class Genode::Platform : public Genode::Platform_generic
* by core's local capability space.
*/
size_t max_caps() const override { return Kernel::Pd::max_cap_ids; }
static addr_t core_main_thread_phys_utcb();
};
#endif /* _CORE__PLATFORM_H_ */

View File

@@ -89,14 +89,18 @@ void Hw::Address_space::flush(addr_t virt, size_t size, Core_local_addr)
}
Hw::Address_space::Address_space(Page_table & tt,
Page_table::Allocator & tt_alloc,
Platform_pd & pd)
Hw::Address_space::
Address_space(Page_table &tt,
Page_table::Allocator &tt_alloc,
Platform_pd &pd,
Board::Address_space_id_allocator &addr_space_id_alloc)
:
_tt(tt),
_tt_phys(Platform::core_page_table()),
_tt_alloc(tt_alloc),
_kobj(false, *(Page_table*)translation_table_phys(), pd)
_kobj(_kobj.CALLED_FROM_KERNEL,
*(Page_table*)translation_table_phys(),
pd, addr_space_id_alloc)
{ }
@@ -107,7 +111,9 @@ Hw::Address_space::Address_space(Platform_pd & pd)
_tt_array(new (_cma()) Array([] (void * virt) {
return (addr_t)_cma().phys_addr(virt);})),
_tt_alloc(_tt_array->alloc()),
_kobj(true, *(Page_table*)translation_table_phys(), pd)
_kobj(_kobj.CALLED_FROM_CORE,
*(Page_table*)translation_table_phys(),
pd)
{ }
@@ -156,10 +162,12 @@ void Platform_pd::assign_parent(Native_capability parent)
}
Platform_pd::Platform_pd(Page_table & tt,
Page_table::Allocator & alloc)
Platform_pd::
Platform_pd(Page_table &tt,
Page_table::Allocator &alloc,
Board::Address_space_id_allocator &addr_space_id_alloc)
:
Hw::Address_space(tt, alloc, *this), _label("core")
Hw::Address_space(tt, alloc, *this, addr_space_id_alloc), _label("core")
{ }
@@ -185,8 +193,9 @@ Platform_pd::~Platform_pd()
** Core_platform_pd implementation **
*************************************/
Core_platform_pd::Core_platform_pd()
Core_platform_pd::
Core_platform_pd(Board::Address_space_id_allocator &addr_space_id_alloc)
:
Platform_pd(*(Hw::Page_table*)Hw::Mm::core_page_tables().base,
Platform::core_page_table_allocator())
Platform::core_page_table_allocator(), addr_space_id_alloc)
{ }

View File

@@ -15,16 +15,17 @@
#ifndef _CORE__PLATFORM_PD_H_
#define _CORE__PLATFORM_PD_H_
/* Core includes */
#include <translation_table.h>
/* base-hw Core includes */
#include <platform.h>
#include <address_space.h>
#include <hw/page_table_allocator.h>
#include <object.h>
#include <kernel/configuration.h>
#include <kernel/object.h>
#include <kernel/pd.h>
/* base-hw internal includes */
#include <hw/page_table_allocator.h>
namespace Hw {
using namespace Kernel;
@@ -88,20 +89,21 @@ class Hw::Address_space : public Genode::Address_space
Kernel_object<Kernel::Pd> _kobj;
/**
* Core-specific constructor
* Constructor used for the Core PD object
*
* \param tt reference to translation table
* \param tt_alloc reference to translation table allocator
* \param pd reference to platform pd object
*/
Address_space(Hw::Page_table & tt,
Hw::Page_table::Allocator & tt_alloc,
Platform_pd & pd);
Address_space(Hw::Page_table &tt,
Hw::Page_table::Allocator &tt_alloc,
Platform_pd &pd,
Board::Address_space_id_allocator &addr_space_id_alloc);
public:
/**
* Constructor
* Constructor used for objects other than the Core PD
*
* \param pd reference to platform pd object
*/
@@ -182,18 +184,19 @@ class Genode::Platform_pd : public Hw::Address_space,
protected:
/**
* Constructor for core pd
* Constructor used for the Core PD object
*
* \param tt translation table address
* \param tt_alloc translation table allocator
*/
Platform_pd(Hw::Page_table & tt,
Hw::Page_table::Allocator & tt_alloc);
Platform_pd(Hw::Page_table &tt,
Hw::Page_table::Allocator &tt_alloc,
Board::Address_space_id_allocator &addr_space_id_alloc);
public:
/**
* Constructor for non-core pd
* Constructor used for objects other than the Core PD
*
* \param label name of protection domain
*/
@@ -229,7 +232,7 @@ class Genode::Platform_pd : public Hw::Address_space,
struct Genode::Core_platform_pd : Genode::Platform_pd
{
Core_platform_pd();
Core_platform_pd(Board::Address_space_id_allocator &addr_space_id_alloc);
};
#endif /* _CORE__PLATFORM_PD_H_ */

View File

@@ -25,7 +25,7 @@
/* kernel includes */
#include <kernel/pd.h>
#include <kernel/kernel.h>
#include <kernel/main.h>
using namespace Genode;
@@ -62,13 +62,13 @@ void Platform_thread::quota(size_t const quota)
Platform_thread::Platform_thread(Label const &label, Native_utcb &utcb)
:
_label(label),
_pd(&Kernel::core_pd().platform_pd()),
_pd(&_kernel_main_get_core_platform_pd()),
_pager(nullptr),
_utcb_core_addr(&utcb),
_utcb_pd_addr(&utcb),
_main_thread(false),
_location(Affinity::Location()),
_kobj(true, _label.string())
_kobj(_kobj.CALLED_FROM_CORE, _label.string())
{
/* create UTCB for a core thread */
void *utcb_phys;
@@ -95,7 +95,7 @@ Platform_thread::Platform_thread(size_t const quota,
_quota(quota),
_main_thread(false),
_location(location),
_kobj(true, _priority, _quota, _label.string())
_kobj(_kobj.CALLED_FROM_CORE, _priority, _quota, _label.string())
{
try {
_utcb = core_env().pd_session()->alloc(sizeof(Native_utcb), CACHED);

View File

@@ -89,10 +89,12 @@ class Genode::Platform_thread : Noncopyable
unsigned _scale_priority(unsigned virt_prio)
{
return Cpu_session::scale_priority(Kernel::Cpu_priority::MAX,
return Cpu_session::scale_priority(Kernel::Cpu_priority::max(),
virt_prio);
}
Platform_pd &_kernel_main_get_core_platform_pd();
public:
/**

View File

@@ -12,13 +12,10 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* core includes */
/* base-hw Core includes */
#include <pager.h>
#include <platform_pd.h>
#include <platform_thread.h>
#include <translation_table.h>
/* base-internal includes */
using namespace Genode;

View File

@@ -56,7 +56,7 @@ struct Genode::Signal_source_component : private Kernel_object<Kernel::Signal_re
Signal_source_component()
:
Kernel_object<Kernel::Signal_receiver>(true),
Kernel_object<Kernel::Signal_receiver>(CALLED_FROM_CORE),
Signal_source_pool::Entry(Kernel_object<Kernel::Signal_receiver>::cap())
{ }
@@ -70,7 +70,10 @@ struct Genode::Signal_source_component : private Kernel_object<Kernel::Signal_re
Genode::Signal_context_component::Signal_context_component(Signal_source_component &s,
addr_t const imprint)
:
Kernel_object<Kernel::Signal_context>(true, s.signal_receiver(), imprint),
Kernel_object<Kernel::Signal_context>(CALLED_FROM_CORE,
s.signal_receiver(),
imprint),
Signal_context_pool::Entry(Kernel_object<Kernel::Signal_context>::_cap)
{ }

View File

@@ -0,0 +1,25 @@
/*
* \brief Allocator for hardware-specific address-space identifiers
* \author Martin Stein
* \date 2021-07-21
*/
/*
* Copyright (C) 2021 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _ARM__ADDRESS_SPACE_ID_ALLOCATOR_H_
#define _ARM__ADDRESS_SPACE_ID_ALLOCATOR_H_
/* base includes */
#include <util/bit_allocator.h>
namespace Board {
class Address_space_id_allocator : public Genode::Bit_allocator<256> { };
}
#endif /* _ARM__ADDRESS_SPACE_ID_ALLOCATOR_H_ */

View File

@@ -37,9 +37,11 @@ bool Board::Pic::Usb_dwc_otg::_need_trigger_sof(uint32_t host_frame,
}
Board::Pic::Usb_dwc_otg::Usb_dwc_otg()
Board::Pic::
Usb_dwc_otg::Usb_dwc_otg(Global_interrupt_controller &global_irq_ctrl)
:
Mmio(Platform::mmio_to_virt(Board::USB_DWC_OTG_BASE))
Mmio { Platform::mmio_to_virt(Board::USB_DWC_OTG_BASE) },
_global_irq_ctrl { global_irq_ctrl }
{
write<Guid::Num>(0);
write<Guid::Num_valid>(false);
@@ -52,10 +54,8 @@ bool Board::Pic::Usb_dwc_otg::handle_sof()
if (!_is_sof())
return false;
static int cnt = 0;
if (++cnt == 8*20) {
cnt = 0;
if (_global_irq_ctrl.increment_and_return_sof_cnt() == 8*20) {
_global_irq_ctrl.reset_sof_cnt();
return false;
}
@@ -72,9 +72,10 @@ bool Board::Pic::Usb_dwc_otg::handle_sof()
}
Board::Pic::Pic()
Board::Pic::Pic(Global_interrupt_controller &global_irq_ctrl)
:
Mmio(Platform::mmio_to_virt(Board::IRQ_CONTROLLER_BASE))
Mmio { Platform::mmio_to_virt(Board::IRQ_CONTROLLER_BASE) },
_usb { global_irq_ctrl }
{
mask();
}

View File

@@ -17,7 +17,25 @@
/* Genode includes */
#include <util/mmio.h>
namespace Board { class Pic; }
namespace Board {
class Global_interrupt_controller;
class Pic;
}
class Board::Global_interrupt_controller
{
private:
int _sof_cnt { 0 };
public:
int increment_and_return_sof_cnt() { return ++_sof_cnt; }
void reset_sof_cnt() { _sof_cnt = 0; }
};
class Board::Pic : Genode::Mmio
@@ -80,6 +98,8 @@ class Board::Pic : Genode::Mmio
struct Num : Bitfield<0, 14> { };
};
Global_interrupt_controller &_global_irq_ctrl;
bool _is_sof() const
{
return read<Core_irq_status::Sof>();
@@ -90,12 +110,12 @@ class Board::Pic : Genode::Mmio
public:
Usb_dwc_otg();
Usb_dwc_otg(Global_interrupt_controller &global_irq_ctrl);
bool handle_sof();
};
Usb_dwc_otg _usb { };
Usb_dwc_otg _usb;
/**
* Return true if specified interrupt is pending
@@ -108,7 +128,7 @@ class Board::Pic : Genode::Mmio
public:
Pic();
Pic(Global_interrupt_controller &global_irq_ctrl);
bool take_request(unsigned &irq);
void finish_request() { }

View File

@@ -11,12 +11,12 @@
* under the terms of the GNU Affero General Public License version 3.
*/
/* base-hw Core includes */
#include <board.h>
#include <cpu.h>
#include <platform.h>
Board::Pic::Pic()
Board::Pic::Pic(Global_interrupt_controller &)
:
Genode::Mmio(Genode::Platform::mmio_to_virt(Board::LOCAL_IRQ_CONTROLLER_BASE))
{ }

View File

@@ -16,7 +16,11 @@
#include <util/mmio.h>
namespace Board { class Pic; }
namespace Board {
class Global_interrupt_controller { };
class Pic;
}
class Board::Pic : Genode::Mmio
@@ -54,7 +58,7 @@ class Board::Pic : Genode::Mmio
public:
Pic();
Pic(Global_interrupt_controller &);
bool take_request(unsigned &irq);
void finish_request() { }

View File

@@ -11,10 +11,10 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <util/bit_allocator.h>
/* base includes */
#include <cpu/memory_barrier.h>
#include <base/internal/unmanaged_singleton.h>
/* base-hw Core includes */
#include <kernel/cpu.h>
#include <kernel/thread.h>
#include <spec/arm/cpu_support.h>
@@ -36,21 +36,21 @@ Arm_cpu::Context::Context(bool privileged)
}
using Asid_allocator = Bit_allocator<256>;
static Asid_allocator &alloc() {
return *unmanaged_singleton<Asid_allocator>(); }
Arm_cpu::Mmu_context::Mmu_context(addr_t table)
: cidr((uint8_t)alloc().alloc()), ttbr0(Ttbr::init(table)) { }
Arm_cpu::Mmu_context::
Mmu_context(addr_t table,
Board::Address_space_id_allocator &addr_space_id_alloc)
:
_addr_space_id_alloc(addr_space_id_alloc),
cidr((uint8_t)_addr_space_id_alloc.alloc()),
ttbr0(Ttbr::init(table))
{ }
Genode::Arm_cpu::Mmu_context::~Mmu_context()
{
/* flush TLB by ASID */
Cpu::Tlbiasid::write(id());
alloc().free(id());
_addr_space_id_alloc.free(id());
}
@@ -152,16 +152,24 @@ void Arm_cpu::cache_coherent_region(addr_t const base,
}
void Arm_cpu::clean_data_cache_by_virt_region(addr_t const base,
size_t const size)
void Arm_cpu::cache_invalidate_data_region(addr_t const base,
size_t const size)
{
auto lambda = [] (addr_t const base) { Dcimvac::write(base); };
cache_maintainance(base, size, Cpu::data_cache_line_size(), lambda);
}
void Arm_cpu::cache_clean_data_region(addr_t const base,
size_t const size)
{
auto lambda = [] (addr_t const base) { Dccmvac::write(base); };
cache_maintainance(base, size, Cpu::data_cache_line_size(), lambda);
}
void Arm_cpu::clean_invalidate_data_cache_by_virt_region(addr_t const base,
size_t const size)
void Arm_cpu::cache_clean_invalidate_data_region(addr_t const base,
size_t const size)
{
auto lambda = [] (addr_t const base) { Dccimvac::write(base); };
cache_maintainance(base, size, Cpu::data_cache_line_size(), lambda);
@@ -197,7 +205,7 @@ void Arm_cpu::clear_memory_region(addr_t const addr,
* DMA memory, which needs to be evicted from the D-cache
*/
if (changed_cache_properties) {
Cpu::clean_invalidate_data_cache_by_virt_region(addr, size);
Cpu::cache_clean_invalidate_data_region(addr, size);
}
/**

View File

@@ -15,17 +15,19 @@
#ifndef _CORE__SPEC__ARM__CPU_SUPPORT_H_
#define _CORE__SPEC__ARM__CPU_SUPPORT_H_
/* Genode includes */
/* base includes */
#include <util/register.h>
#include <cpu/cpu_state.h>
/* base internal includes */
#include <base/internal/align_at.h>
/* base-hw internal includes */
#include <hw/spec/arm/cpu.h>
/* local includes */
/* base-hw Core includes */
#include <spec/arm/address_space_id_allocator.h>
#include <kernel/interface_support.h>
#include <kernel/kernel.h>
#include <board.h>
#include <util.h>
namespace Kernel { struct Thread_fault; }
@@ -53,15 +55,23 @@ struct Genode::Arm_cpu : public Hw::Arm_cpu
/**
* This class comprises ARM specific protection domain attributes
*/
struct Mmu_context
class Mmu_context
{
Cidr::access_t cidr;
Ttbr0::access_t ttbr0;
private:
Mmu_context(addr_t page_table_base);
~Mmu_context();
Board::Address_space_id_allocator &_addr_space_id_alloc;
uint8_t id() { return cidr; }
public:
Cidr::access_t cidr;
Ttbr0::access_t ttbr0;
Mmu_context(addr_t page_table_base,
Board::Address_space_id_allocator &addr_space_id_alloc);
~Mmu_context();
uint8_t id() { return cidr; }
};
/**
@@ -70,19 +80,6 @@ struct Genode::Arm_cpu : public Hw::Arm_cpu
static void invalidate_instr_cache() {
asm volatile ("mcr p15, 0, %0, c7, c5, 0" :: "r" (0) : ); }
/**
* Clean data-cache for virtual region 'base' - 'base + size'
*/
static void clean_data_cache_by_virt_region(addr_t const base,
size_t const size);
/**
* Clean and invalidate data-cache for virtual region
* 'base' - 'base + size'
*/
static void clean_invalidate_data_cache_by_virt_region(addr_t const base,
size_t const size);
static void clear_memory_region(addr_t const addr,
size_t const size,
bool changed_cache_properties);
@@ -90,6 +87,15 @@ struct Genode::Arm_cpu : public Hw::Arm_cpu
static void cache_coherent_region(addr_t const addr,
size_t const size);
static void cache_clean_data_region(addr_t const base,
size_t const size);
static void cache_clean_invalidate_data_region(addr_t const addr,
size_t const size);
static void cache_invalidate_data_region(addr_t const addr,
size_t const size);
/**
* Invalidate TLB regarding the given address space id
*/

View File

@@ -31,7 +31,7 @@
add sp, r1, r0
/* jump into init C code */
b kernel_init
b _ZN6Kernel39main_initialize_and_handle_kernel_entryEv
_kernel_stack: .long kernel_stack
_kernel_stack_size: .long kernel_stack_size

View File

@@ -134,7 +134,7 @@
bx lr
_kernel_entry:
.long kernel
.long _ZN6Kernel24main_handle_kernel_entryEv
_fpu_save:
.long vfp_save_fpu_context

View File

@@ -19,8 +19,7 @@
void Kernel::Cpu::_arch_init()
{
/* enable performance counter */
perf_counter()->enable();
enable_performance_counter();
/* enable timer interrupt */
_pic.unmask(_timer.interrupt_id(), id());

View File

@@ -11,20 +11,13 @@
* under the terms of the GNU Affero General Public License version 3.
*/
#include <base/lock_guard.h>
/* Genode includes */
#include <cpu/atomic.h>
#include <cpu/memory_barrier.h>
/* base-hw Core includes */
#include <kernel/cpu.h>
#include <kernel/lock.h>
#include <kernel/kernel.h>
Kernel::Lock & Kernel::data_lock()
{
static Kernel::Lock lock;
return lock;
}
void Kernel::Lock::lock()

Some files were not shown because too many files have changed in this diff Show More