452 Commits

Author SHA1 Message Date
Norman Feske
016d63703d depot: update recipe hashes 2025-04-10 14:55:59 +02:00
Norman Feske
1ef80e86e2 base: introduce Local_rm for local Region_map
The new 'Local_rm' type offers a narrow interface for the interaction
with the component-local address space, managing the lifetime of
attachments by using the 'Allocation' API.

Fixes #5516
2025-04-10 14:55:57 +02:00
Norman Feske
84eb264786 util/attempt.h: mark 'Attempt' types as nodiscard
This catches bugs early on. E.g., when leaving an 'Allocation'
unused, it gets immediately deallocated, which is most probably not
intended. For regular 'Attempt' objects, this change encourages
the proper propagation of errors, or at least the logging of unexpected
conditions.

Fixes #5513
2025-04-10 14:55:21 +02:00
Norman Feske
e380d0da95 base: use 'Allocation' interface for mem alloc
This patch converts the memory-allocator interfaces ('Allocator',
'Range_allocator') and their implementations ('Heap', 'Sliced heap',
'Slab', 'Allocator_avl', 'Synced_allocator') to the new 'Allocation'
utility. The new interface resides at base/memory.h whereas the
traditional allocators implement the new interface.

Down the road, the traditional allocators can successively be decoupled
from the traditional 'Allocator' and 'Range_allocator' interfaces.

Issue #5502
Issue #5245
2025-04-10 14:55:21 +02:00
Norman Feske
689fc1eb93 Introduce new 'Ram' API types
The new types in base/ram.h model different allocation scenarios and
error cases by mere C++ types without using exceptions. They are meant
to replace the former 'Ram_allocator' interface. As of now, the
'Unmapped_allocator' closely captures the former 'Ram_allocator'
semantics. The 'Constrained_allocator' is currently an alias for
'Unmapped_allocator' but is designated for eventually allocating
mapped RAM.

In contrast to the 'Ram_allocator' interface, which talked about
dataspace capabilites but left the lifetime management of the
allocated RAM to the caller, the new API represents an allocation
as a guard type 'Allocation', which deallocates on destruction by
default.

Allocation errors are captured by a 'Result' type that follows
the 'Attempt' pattern.

As a transitionary feature, the patch largely maintains API
compatibility with the original 'Ram_allocator' by providing
the original (exception-based) 'Ram_allocator::alloc' and
'Ram_allocator::free' methods as a wrapper around the new
'Ram::Constrained_allocator'. So components can be gradually
updated to the new 'Ram::' interface.

Issue #5502
2025-04-10 14:55:15 +02:00
Norman Feske
7e420a68a6 Remove C++ exceptions from 'Thread' API
After constructed, a 'Thread' object may remain in a dysfunctional state
should the stack allocation have failed. This condition is no longer
reflected as a C++ exception but as result value of 'Thread::info()'.

Keep 'Thread::name' as public constant because the stack is not always
available for storing the name.

The 'stack_top' accessor has been removed because this information is
already provided by 'Thread::info()'.

Issue #5245
2025-04-10 14:27:21 +02:00
Norman Feske
ff83de2bbc base: decouple 'Pd_session' from 'Ram_allocator'
With this patch, the 'Pd_session' interface no longer implements the
'Ram_allocator' interface, which allows us to change the
'Genode::Ram_allocator' semantics (as a subsequent step) without
affecting core's PD service.

The patch also replaces the client-local implementation of
'Pd_session_client::dataspace_size' by the proper RPC call 'ram_size' to
core, which mitigates the potential risk of de-referencing a dataspace
cap of an untrusted origin. E.g., in scenarios where the monitor
component requests the size of a dataspace allocated by the debugging
target.

Since 'ram_size' is an RPC call, it cannot be const. Hence, the
'Ram_alloctor::dataspace_size' has become non-const.

The new 'Pd_ram_allocator' implements the 'Ram_allocator' interface by
using a PD session.

Issue #5502
2025-04-10 14:24:31 +02:00
Norman Feske
aa9ff3894c base: scoped access of Native_thread
With planned removal of Thread:: exceptions, we need to consider that a
'Thread' object may exist without a valid 'Stack' and therefore without
a valid 'Native_thread', which is hosted as part of the 'Stack'.

This patch reworks the code that accesses the 'Native_thread' to use the
new 'Thread::with_native_thread' interface. Within the local scope,
the native thread is referred to as 'nt'.

The _init_platform_thread and _deinit_platform_thread() have been
replaced by _init_native_thread and _deinit_native_thread, which take
a 'Stack &' as argument.

As a safety caution, 'Native_thread' objects can no longer be copied.

Issue #5245
2025-04-10 14:24:11 +02:00
Norman Feske
af3e8725ca Rename 'Constrained_ram_*' to 'Accounted_ram_*'
Fixes #5495
2025-04-10 14:24:11 +02:00
Christian Helmuth
2d89b53b0c depot: update recipe hashes 2025-02-27 12:53:40 +01:00
Alexander Boettcher
c6e8acc037 sel4: avoid unsynchronized vm state tracking
Remove _extra_dispatch_up which is not required and racy which may lead
to hangs between ep and vcpu thread.

Issue #5461
2025-02-24 16:39:56 +01:00
Christian Helmuth
5076554f20 depot: update recipe hashes 2025-01-30 16:32:35 +01:00
Alexander Boettcher
2ad1c450ee sel4: add MSI support for x86
Fixes #5423
2025-01-30 16:30:14 +01:00
Norman Feske
d1c4bc5115 vm_session: use Callable for with_state
Issue #5420
2025-01-30 16:30:14 +01:00
Alexander Boettcher
0d81a104ad base: use Map_local_result in io_mem _map_local(...)
Issue #5406
2025-01-30 16:30:13 +01:00
Norman Feske
fc11e26511 core: pass ram, rm, io-ports to local services
This patch replaces the use of 'core_env()' in 'platform_services.cc' by
the function arguments 'core_ram', 'core_rm', and 'io_port_ranges'.

It also removes the 'Pd_session' argument from 'Io_port_root' and
'Irq_root' to avoid the reliance on the 'Pd_session' interface within
core,

Issue #5408
2025-01-30 16:24:36 +01:00
Norman Feske
43d7c3bd11 core: don't rely on Core_env in platform.cc
Replace the use of the global 'core_env()' accessor by the explicit
delegation of interfaces.

- For allocating UTCBs in base-hw, 'Platform_thread' requires
  a way to allocate dataspaces ('Ram_allocator') accounted to the
  corresponding CPU session, a way to locally map the allocated
  dataspaces (core's 'Region_map'), and a way to determine the
  physical address (via 'Rpc_entrypoint') used for the initial
  UTCB mapping of main threads. Hence those interfaces must be
  passed to 'Platform_thread'.

- NOVA's pager code needs to look up 'Cpu_thread_component'
  objects using a map item as key. The lookup requires the
  'Rpc_entrypoint' that hold the 'Cpu_thread_component' objects.
  To make this 'Rpc_entrypoint' available, this patch adds
  the 'init_page_fault_handing' function.

- The 'Region_map_mmap' for Linux requires a way to look up
  'Linux_dataspace' objects for given dataspace capabilities.
  This lookup requires the 'Rpc_entrypoint' holding the dataspaces,
  which is now passed to 'platform.cc' via the new Linux-specific
  'Core_region_map::init' function.

Issue #5408
2025-01-30 16:24:35 +01:00
Benjamin Lamowski
5e3a898109 base: add create_vcpu to Vm_session interface
`Vm_session_component::create_vcpu()` is present across all supported
kernels, yet until now it was not part of the `Vm_session` interface.

Add the method to the `Vm_session` interface. This unifies calls in the
base library and is the basis to remove the need for a common base class
for separate `Vm_session` implementations for SVM and VMX on x86_64.

Issue #5221
2025-01-30 16:20:39 +01:00
Christian Helmuth
cd6701c483 depot: update recipe hashes 2024-12-11 08:35:22 +01:00
Benjamin Lamowski
b21c8729ea base: provide core_ram_allocator via platform_add_local_services()
This is a prerequisite to rework the allocation of core data structures
for VM sessions in hw.

Issue #5221
2024-12-10 14:11:57 +01:00
Christian Helmuth
011b44c282 depot: update recipe hashes 2024-11-20 08:58:39 +01:00
Christian Helmuth
61c9706353 depot: update recipe hashes 2024-10-08 11:30:26 +02:00
Christian Helmuth
26002a5482 depot: update recipe hashes 2024-08-29 12:32:25 +02:00
Norman Feske
19c13877ca Replace use of 'typedef' by 'using'
Issue #5227
2024-07-02 12:00:11 +02:00
Norman Feske
361557e1f0 base-*: omit () for lambas w/o argument
Issue #5227
2024-07-02 12:00:11 +02:00
Norman Feske
a2b0553c51 base-*: use C++20 function template syntax
Issue #5227
2024-07-02 12:00:11 +02:00
Norman Feske
d44ec53cd3 core: tie Platform_thread to Platform_pd
This patch tightens the coupling of the 'Platform_thread' objects
with their corresponding 'Platform_pd' objects by specifying the
'Platform_pd' as constructor argument, keeping the relationship
as a reference (instead of a pointer), and constraining the
lifetime of 'Platform_pd' objects to the lifetime of the PD.

It thereby clears the way to simplify the thread creation since all
PD-related information (like quota budgets) are now known at the
construction time of the 'Platform_thread'.

The return value of 'Platform_thread::start' has been removed because it
is not evaluated by 'Cpu_thread_component'.

Related to #5256
2024-07-02 11:59:16 +02:00
Alexander Boettcher
462718bcf0 epit: move timer to imx repository
Issue #5138
2024-07-02 11:59:16 +02:00
Norman Feske
0105494223 Rework Region_map interface
- Remove exceptions
- Use 'Attr' struct for attach arguments
- Let 'attach' return 'Range' instead of 'Local_addr'
- Renamed 'Region_map::State' to 'Region_map::Fault'

Issue #5245
Fixes #5070
2024-07-02 11:59:16 +02:00
Norman Feske
d866b6b053 Remove exceptions from Cpu_session interface
The 'Thread_creation_failed' error is now reflected as
'Thread::Start_result' return value. This change also removes the
use of 'Invalid_thread' within core as this exception is an alias
of Cpu_session::Thread_creation_failed.

Issue #5245
2024-07-02 11:59:16 +02:00
Norman Feske
299951ced5 depot: update recipe hashes 2024-06-20 12:59:00 +02:00
Norman Feske
14d3c4cb5e Remove Cpu_session::State_access_failed exception
This patch removes the exception formerly thrown by 'Cpu_thread::state'
and turns the 'Thread_state' structure into a plain compound type w/o a
constructor.

Issue #5245
Fixes #5250
2024-06-20 12:56:20 +02:00
Norman Feske
8943a3e949 Remove '_drv' suffix
Issue #4420
2024-06-20 12:54:30 +02:00
Christian Helmuth
4b9f4d8c38 depot: update recipe hashes 2024-05-30 08:20:21 +02:00
Norman Feske
f79ff59619 sel4: reduce cache_invalidate_data warnings
Warn only once about the missing 'cache_invalidate_data'
implementation to prevent the fec nic driver from spamming the
log.
2024-05-29 09:18:12 +02:00
Christian Helmuth
59b85cc672 depot: update recipe hashes 2024-04-26 09:59:36 +02:00
Christian Helmuth
dc0e78cdf8 depot: update recipe hashes 2024-04-12 15:08:01 +02:00
Christian Helmuth
f3610dc3a8 sel4: prevent stdout/stderr truncation in cmake
Remove the "excellent" idea to re-open /dev/stdout etc. for redirection as
cmake uses open(O_TRUNC) and, thus, truncates log output of outer
redirections.
2024-04-12 15:00:46 +02:00
Christian Helmuth
9c7a303caf depot: update recipe hashes 2024-02-29 11:08:28 +01:00
Christian Prochaska
32e7ec7b9b core: implement 'Vm_session_component::reserve_and_flush()'
Issue #5069
2024-02-28 16:32:23 +01:00
Norman Feske
c4679e7af6 depot: update recipe hashes 2023-12-13 12:33:05 +01:00
Christian Prochaska
9a049789de core: mark implicitly detached regions as reserved
Fixes #5069
2023-12-13 12:32:19 +01:00
Christian Helmuth
8baf19022c depot: update recipe hashes 2023-11-30 15:11:36 +01:00
Johannes Schlatow
eefaa07024 base: add irq_type session argument
By adding the `irq_type` argument, one can explicitly specify whether to
use LEGACY, MSI or MSI-X interrupts. We formerly used the
`device_phys_config` to implicitly select MSI, however, with the
addition of IOMMU support to the platform driver there is at least one
instance where we need an MSI for a non-PCI device.

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

genodelabs/genode#5002
2023-11-28 19:35:16 +01:00
Christian Helmuth
b634549722 depot: update recipe hashes 2023-10-25 14:01:40 +02:00
Christian Helmuth
07c4b92335 depot: update recipe hashes 2023-10-04 13:22:08 +02:00
Benjamin Lamowski
1515a0a51e base-sel4: port to new VMM library API
Ref #4968
2023-10-04 13:22:04 +02:00
Christian Helmuth
134a785fe0 depot: update recipe hashes 2023-08-24 11:01:40 +02:00
Norman Feske
7aa301361d depot: update recipe hashes 2023-07-14 12:06:32 +02:00
Norman Feske
de99945af0 base: pass 'Platform &' to 'bootstrap_component'
This eliminates the need of component.cc to pull the platform resources
out of thin air (calling 'env_deprecated()').

Issue #4784
2023-07-14 12:06:31 +02:00