Commit Graph

1063 Commits

Author SHA1 Message Date
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
Norman Feske
5a6c4d6ff2 base-hw: handle cap-slab exhaust in Thread::start
This interim solution for issue #5256 solves the problem for the
thread.run script.

Issue #5256
2024-07-02 11:59:16 +02:00
Stefan Kalkowski
d9d2a7584e base-hw: remove cortex spec directories
For consistency reasons, remove the cortex_a8, cortex_a9, and cortex_a15
spec directories. Such SPEC variables do not exist since a while.
Also rename remaining translation_table.h header to page_table.h to
stay consistent with the class names inside.

Fix genodelabs/genode#5253
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
Stefan Kalkowski
e93f5fe8e0 base-hw: move imx53-specifics to imx repository
Ref genodelabs/genode#5252
2024-06-20 13:25:06 +02:00
Stefan Kalkowski
5a8d149fe3 hw: move all imx7d specifics to imx repository
Ref genodelabs/genode#5252
2024-06-20 13:24:41 +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
0d7d60a1f4 Remove exceptions from Pd_session interface
This patch replaces exceptions of the PD session RPC interface with
result types.
The change of the quota-transfer RPC functions required the adaptation
of base/quota_transfer.h and base/child.h.
The 'alloc_signal_source' method has been renamed to 'signal_source'
to avoid an exceedingly long name of the corresponding result type.
The Pd_session::map function takes a 'Virt_range' instead of basic-type
arguments.
The 'Signal_source_capability' alias for 'Capability<Signal_source>' has
been removed.

Issue #5245
2024-06-20 12:56:19 +02:00
Norman Feske
24342db476 base/signal.h: remove pointers from API
This patch updates the signal API to avoid raw pointers, and
replaces the Context_already_in_use and Context_not_associated
exceptions by diagnostic messages.

Fixes #5247
2024-06-20 12:56:19 +02:00
Norman Feske
8a0689d832 Remove Pd_session::Invalid_signal_source exception
While changing 'Pd_session::alloc_context', this patch also tightens the
type of the imprint argument.

Issue #5245
2024-06-20 12:56:19 +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
Benjamin Lamowski
b83b53d3b2 hw: abstract nested paging on x86
The initial SVM implementation (correctly) just used another standard
x86_64 page table for nested paging. The EPT implementation is for Intel
VMX only. Since we don't know the underlying virtualization technology
at compile time, we need to pick the correct page table implementation
at runtime.

Add add a AMD-compatible HPT page table implementation using the same
base implementation and (more importantly) allocator as the EPT
implementation. Add a Vm_page_table implementation that determines the
used virtualization technology at runtime and internally defers insert
and remove operations to the correct page table implementation.

Issue #5218
2024-05-29 09:18:11 +02:00
Benjamin Lamowski
221d0c6c48 hw: implement EPT page table
Implement a nested page table to use with x86 virtualization.

Fixes #5218
2024-05-29 09:18:11 +02:00
Benjamin Lamowski
58e9856eb8 base: move page flags interface to base
On hw, `Page_flags` is used throughout architectures. At the same time,
it is used by the Intel IOMMU page table implementation in the pc
platform driver.

Consolidate the definition in base so it is available for all users.

Issue #5217
2024-05-29 09:18:11 +02:00
Benjamin Lamowski
aad80e81da hw: add support for VMX
Add support for Intel's Virtual Machine Extensions with nested paging.

Fixes #5128
2024-05-29 08:37:08 +02:00
Benjamin Lamowski
dbd070b815 hw: add kernel panic function to x86_64
Add a kernel panic function to x86_64 that mirrors the functionality
available for ARM.

Issue #5128
2024-05-29 08:37:07 +02:00
Benjamin Lamowski
5049f03f5b hw: generic interface for x86 virtualization
Create a generic interface for x86 virtualization.
Split the VMCB data structure in `Vmcb_buf` to represent the physical
VMCB page and `VMCB` as a control interface.

Issue #5113
2024-05-29 08:37:07 +02:00
Benjamin Lamowski
b4fe9154b9 hw: access VMCB State Save Area via Mmio framework
So far, the VMCB data structure was generated from it's parts (most
prominently VMCB Control Area and VMCB State Save Area) with the VMCB Control
Area accessed via the Mmio framework, while the VMCB State Save Area
struct used directly defined members.

Unify the VMCB structure and uniformly use the Mmio framework to access
the VMCB. Separate the controlling structure from the VMCB page.

Issue #5113
2024-05-29 08:37:07 +02:00
Benjamin Lamowski
0d1716b07d hw: prepare SVM implementation for generic virtualization support
The SVM implementation did not lend itself to a runtime selection of the
x86 virtualization technology.

Encapsulate functionality in the VMCB class to facilitate adding support
for Intel's VMX.

Issue #5113
2024-05-29 08:37:07 +02:00
Benjamin Lamowski
3a88d133ed hw: generalize virtualization memory
The initial vCPU memory was written for AMD's SVM.

Make the vCPU memory provider virtualization technology agnostic.

Issue #5113
2024-05-29 08:37:07 +02:00
Benjamin Lamowski
e82859444e hw: clean up Intel TSC frequency deduction
The initial algorithm ported to hw seems to be correct in principle,
however it does not work with nested virtualization.

Clean up the code to make the different methods of obtaining the TSC
frequencies more clear, and add warnings if a particular
method has failed although it should be available.

Fixes #5210
2024-05-13 15:52:22 +02:00
Christian Helmuth
59b85cc672 depot: update recipe hashes 2024-04-26 09:59:36 +02:00
Stefan Kalkowski
d9420c618c hw: take over ACPI hardware from SMI
Fix #5196
2024-04-25 15:43:03 +02:00
Stefan Kalkowski
68de550090 hw: ignore stale data in fresh signal
When a new signal arrives, which means a formerly non-pending one,
we should ignore old signal numbers of that context, but only
evaluate newly received data by the last kernel-call.

Fix #5193
2024-04-25 15:43:03 +02:00
Christian Helmuth
85c99c238d depot: update recipe hashes 2024-04-19 08:54:22 +02:00
Stefan Kalkowski
aefbc47c56 hw: preserve slack time, favor activated jobs
In the scheduler's implementation preserve the consumed slack-time
over periods of activation/deactivation, but instead of appending
activated jobs to the end of the slack queue, insert it as new head.
Thereby, the extreme discrimination of threads with short execution
times and frequent blocking behaviour against long running computations
gets avoided.

Fix genodelabs/genode#4796
2024-04-19 08:54:21 +02:00
Christian Helmuth
dc0e78cdf8 depot: update recipe hashes 2024-04-12 15:08:01 +02:00
Johannes Schlatow
536048592b hw: propagate write combining to page flags
Fixes #4799
2024-04-12 15:08:01 +02:00
Christian Helmuth
2f1520b4c1 base-hw: fix EPIT duration calculation on roll-over
If Ocif was not reset between two calls to _duration(), the returned
value exceeded _max_value().
2024-04-12 12:57:30 +02:00
Norman Feske
f3313b6603 base-hw: new timer implementation
Issue #5138
2024-04-12 12:57:28 +02:00
Norman Feske
a0290f8c51 base-hw: preserve usec accuracy in us_to_ticks
The kernel timer used to truncated timeouts to the next lower
millisecond, which not only limits the wakeup accuracy but also results
in situations where a user-level timeout is triggered earlier than
expected. The latter effect results in the observation of a spurious
timeouts and the subsequent programming of another timeout.

The patch solves the problem by preserving the sub-milliseconds bits
in the 'us_to_ticks' implementation(s).

Issue #5142
2024-04-12 12:57:28 +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
Stefan Kalkowski
394801c998 hw: re-name scheduler files according to class
Fix genodelabs/genode#5115
2024-02-26 08:59:10 +01:00
Stefan Kalkowski
79167d8f5c hw: re-organize scheduler internals & API
* Move Kernel::Cpu_scheduler to Kernel::Scheduler
  (we only have that one scheduler)
* Move Kernel::Cpu_share to Kernel::Scheduler::Context
* Move Kernel::Cpu_priority to Kernel::Scheduler::Priority
* Rename all functions and variables refereing to `claims` to
  `prioritzed`, because claims is not that common
* Rename occurrences of `fill(s)` to `slack` to name the time portions
  outside of the prioritized quantum
* Get rid of some two-liner sub-functions with only one occurrence
  (like `_quota_introduction`, `_quota_revokation`,...)

Ref genodelabs/genode#5115
2024-02-26 08:59:10 +01:00
Stefan Kalkowski
c8380c1447 hw: remove Cpu_scheduler::_trim_consumption
This private, internal function is used only in one scope,
and therefore not neccessary. But it has nasty side-effects as
it takes the parameter `duration` as reference and changes its
value. Just remove it completely.

Ref genodelabs/genode#5115
2024-02-26 08:59:10 +01:00
Stefan Kalkowski
1c4078f23a hw: merge booleans in scheduler into one state
Instead of having `_yield` and `_need_to_schedule` booleans, use one
consistent state variable.

Ref genodelabs/genode#5115
2024-02-26 08:59:10 +01:00
Stefan Kalkowski
9d72c21894 hw: rename head in scheduler to current
The name head is already extensively used in the context of the lists
managed by the scheduler. This terminology duplications does not simplify
reading the code. Instead we keep head for the first item in the list,
but use `current` in the variable name and API of the `Cpu_scheduler`
class to refer to the current scheduled share.

Moreover, the `_head_quota` is now `_current_time_left`, because it does
not denote quota but time left for the current schedule. The boolean
variable `_head_claims` gets removed at all. It duplicated the state of
whether a current share ist set, and whether it has so-called claim time
left.

Ref genodelabs/genode#5115
2024-02-26 08:59:10 +01:00
Stefan Kalkowski
2f727fb5c6 hw: rename Cpu_scheduler variables
Give certain scheduler class wide variables and functions clear names:

* quota => super_period_length
* residual => super_period_left

Ref genodelabs/genode#5115
2024-02-26 08:59:10 +01:00
Stefan Kalkowski
8e2c95e5e4 hw: replace double_list implementation
Replace double linked list by normal Genode::List with an additional
pointer to last list member to efficiently handle the scheduler share lists.
Moreover, move it into the private part of the Cpu_scheduler class,
the only scope where it is used anymore.

Ref genodelabs/genode#5115
2024-02-26 08:59:09 +01:00
Stefan Kalkowski
0055438257 hw: improve readability of scheduler
Minor changes that should not change any semantics:

* Remove `_next_fill()` its short and only used in one context,
  in which it is good to know what that code actually does
* Turn boolean values into actual boolean values
* Remove some brackets around one-liner pathes

Ref genodelabs/genode#5115
2024-02-26 08:59:09 +01:00
Stefan Kalkowski
776c2a6046 hw: avoid state & code duplication in scheduler
The `_head_was_removed` variable got introduced in solving #4710, but it
reflects only whether `_head` is a valid pointer or not, thereby it
duplicates state.

Ref genodelabs/genode#5115
2024-02-26 08:59:09 +01:00
Martin Stein
1336b0a751 mmio: upper-bounds checks
The classes Genode::Mmio, Genode::Register_set, Genode::Attached_mmio, and
Platform::Device::Mmio now receive a template parameter 'size_t SIZE'. In each
type that derives from one of these classes, it is now statically checked that
the range of each Genode::Register::Register- and
Genode::Register_set::Register_array-deriving sub-type is within [0..SIZE).

That said, SIZE is the minimum size of the memory region provided to the above
mentioned Mmio classes in order to avoid page faults or memory corruption when
accessing the registers and register arrays declared inside.

Note, that the range end of a register array is not the end of the last item
but the end of integer access that is used for accessing the last bit in the
last item.

The constructors of Genode::Mmio, Genode::Attached_mmio, and
Platform::Device::Mmio now receive an argument 'Byte_range_ptr range' that is
expected to be the range of the backing memory region. In each type that derives
from on of these classes, it is now dynamically checked that 'range.num_bytes
>= SIZE', thereby implementing the above mention protection against page faults
and memory corruption.

The rest of the commit adapts the code throughout the Genode Labs repositories
regarding the changes. Note that for that code inside Core, the commits mostly
uses a simplified approach by constructing MMIO objects with range
[base..base+SIZE) and not with a mapping- or specification-related range size.
This should be fixed in the future.

Furthermore, there are types that derive from an MMIO class but don't declare
any registers or register arrays (especially with Platform::Device::Mmio). In
this case SIZE is set to 0. This way, the parameters must be actively corrected
by someone who later wants to add registers or register arrays, plus the places
can be easily found by grep'ing for Mmio<0>.

Fix #4081
2024-02-26 08:59:07 +01:00
Benjamin Lamowski
8540b4c9d1 hw: rename Vm_data to Vcpu_data
Rename Vm_data to Vcpu_data to make it clear that the allocated data is
per vCPU, not per VM.

Issue #5100
2024-02-26 08:31:05 +01:00