Commit Graph

919 Commits

Author SHA1 Message Date
Christian Helmuth
b033b30f95 depot: update recipe hashes 2022-11-29 12:32:49 +01:00
Christian Prochaska
acb6bbb649 hw: fix 'Kernel::time()' deviation in RISC-V timer
Issue #4360
2022-11-29 12:29:57 +01:00
Christian Prochaska
345c01677d hw: fix 'Kernel::time()' deviation in ARM generic timer
Issue #4360
2022-11-29 12:29:57 +01:00
Christian Helmuth
c58d799f16 depot: update recipe hashes 2022-11-17 08:00:37 +01:00
Stefan Kalkowski
759ed40d98 hw: implement MSI support for x86
Fix genodelabs/genode#4633
2022-11-17 08:00:34 +01:00
Christian Helmuth
847266d027 depot: update recipe hashes 2022-10-12 14:31:50 +02:00
Martin Stein
665a551fcd base-hw & cortex_a9: consider timer IRQ unreliable
On some Cortex A9 platforms (Qemu 4.2.1 PBXA9), the IRQ status register is not
reliable. Sometimes, it indicates an IRQ too early, i.e., shortly before the
counter wraps. Therefore we have to accomplish wrap detection via counter
comparison only. We check whether the current counter value is higher than the
start counter value of the current timeout.

However, this implies that we have to take care to always read out the counter
before it hits the max timout value again. And, therefore, the max timeout
value has to be far away from the first value the counter has after wrapping.
Consequently, we propagate a max timeout value of half the max counter value.

Fixes #4209
2022-10-12 12:09:34 +02:00
Stefan Kalkowski
b85b3abe20 base-hw: update cpu_scheduler unit test
* Modernize routines, eliminate pointers, use constructibles, etc.
* Use absolute time instead of relative time consumption when
  updating the scheduler

Ref genodelabs/genode#4151
2022-10-12 11:59:08 +02:00
Stefan Kalkowski
debd41081e base-hw: optimize & cleanup scheduler
* Remove useless `ready_check` function
* Implement fine-grained checking when schedule updating is necessary

Ref genodelabs/genode#4151
2022-10-12 11:59:08 +02:00
Martin Stein
c23b74e150 base-hw: problems with timeout lib in src recipe
This commit fixes two issues with the timeout lib and the base-hw src recipe:

* Add source files of timeout lib to recipe content.
  The files weren't copied to the depot until now. However, the archive
  nonetheless built successfully because of the second issue that is described
  below.

* Get rid of the usage of the BASE_DIR variable in the timeout lib.
  The BASE_DIR variable always resolves to the repos/base directory even when
  building in a depot. That said, the use of BASE_DIR in make-files that are
  not part of the build system itself must be avoided. Instead, REP_DIR,
  REP_INC_DIR, and $(call select_from_repositories, ...) should be used.

Ref #4209
2022-10-12 11:59:08 +02:00
Stefan Kalkowski
0231ee4ad3 hw: don't halt kernel due to unknown cpu exception
Fix genodelabs/genode#4617
2022-10-12 11:59:08 +02:00
Christian Helmuth
3f1870841c depot: update recipe hashes 2022-09-21 12:19:10 +02:00
Norman Feske
7c3b9c843f base-hw: tighten src-archive content of lib/mk/
This patch refines the rules for generating a base-hw src archive
for a given board by enumerating the content of the lib/mk/spec/*
directories instead of including entire directories. This avoids
the inclusion of lib.mk files found in SoC-specific repositories
(like genode-allwinner) in the kernel source archives.

When building a binary archive from such a src archive with the changes
of issue #4599, the build system would otherwise try (and fail) to build
the libraries for the accidentally included lib.mk files.
2022-09-19 14:00:33 +02:00
Norman Feske
dd9e12601e Remove pseudo targets for building shared libs
Thanks to the change "build: support library builds via lib/<libname>",
shared libraries can now be built directly by the build system.

Issue #4599
2022-09-19 14:00:32 +02:00
Christian Helmuth
4dddc41b71 depot: update recipe hashes 2022-08-31 09:32:09 +02:00
Christian Helmuth
44e2cd14a0 depot: update recipe hashes 2022-08-17 12:03:26 +02:00
Sebastian Sumpf
b5c780993c board: Rename virt_qemu to virt_qemu_<arch>
Instead of having a generic "virt_qemu" board use "virt_qemu_<arch>" in
order to have a clean distinction between boards. Current supported
boards are "virt_qemu_arm_v7a", "virt_qemu_arm_v8a", and
"virt_qemu_riscv".

issue #4034
2022-08-17 12:03:26 +02:00
Stefan Kalkowski
f4f2b456b6 base-hw: invalidate VM TLB entries in deletion
This commit introduces a hypervisor calling interface. The host kernel can
use it to either switch to a guest VM, or to invalidate the TLB with
regard to a specified VM id.
The VM-specific TLB invalidation is called whenever a VM (Vcpu)
gets destroyed.

Fix genodelabs/genode#4528
2022-08-10 13:32:57 +02:00
Stefan Kalkowski
4382d29422 base-hw: invalidate TLB only once on ARMv8
Fix genodelabs/genode#4529
2022-08-10 13:32:57 +02:00
Stefan Kalkowski
d6592ca2cb base-hw: unset deleted PD values in MMU
When a PD gets deleted check whether it is active on the current CPU resp. MMU.
If yes, switch to core/kernel's PD to prevent that invalid page-tables or
address-space IDs are still in use. Moreover, whenever we switch to an idle
thread, we switch to kernel/core's PD too. Thereby, we prevent that vanished
PDs are still active on CPUs different from the one, where the core entrypoint
is active, which does the PD deletion.
This whole scheme is only valid under the assumption that core has only one
entrypoint running on one CPU.

Fix genodelabs/genode#4527
2022-08-10 13:32:57 +02:00
Stefan Kalkowski
5cfb9e3e9d base-hw: distinguish core, idle, user threads
Do not only distinguish core and user threads, but the idle threads too.
Instead of a boolean value, introduce a new thread type.

Ref genodelabs/genode#4527
2022-08-10 13:32:57 +02:00
Christian Helmuth
3105fa9e0f depot: update recipe hashes 2022-05-25 12:23:04 +02:00
Christian Helmuth
8ece236635 depot: update recipe hashes 2022-04-13 11:54:46 +02:00
Johannes Schlatow
d372afd81e base-hw: add bitfield to pl310
Enabling double linefills improves memcpy throughput.

genodelabs/genode#4456
2022-04-13 08:08:01 +02:00
Norman Feske
f3984ba5a9 base: declare build artifact for core
This is a generalization of the recent commit "base-hw: declare build
artifact for core".
2022-04-13 08:07:58 +02:00
Christian Helmuth
2b3370c8d8 depot: update recipe hashes 2022-02-28 11:46:35 +01:00
Stefan Kalkowski
b5b958c276 hw: unify architectural kernel interface header
Fix genodelabs/genode#4345
2022-02-28 11:45:18 +01:00
Piotr Tworek
e595b0b782 base-hw: Make sure MMU is initially disabled on ARMv8.
Genode code already expects MMU to be disabled when starting the
kernel. It is enabled eventually in Bootstrap::Platform::enable_mmu,
after setting up translation tables. Unfortunately nothing ensures
this is actually the case. If MMU happens to be enabled when entering
the kernel things go downhill pretty fast after we start messing with
TTBR.

This patch ensures MMU is disabled for EL1, EL2, EL3 dependent on the
exception level of the CPU core, which is entering the kernel.

This should allow base-hw to start correctly on Quartz64 A board.
2022-02-21 15:47:51 +01:00
Stefan Kalkowski
0c67d0838a hw: restrict page-table lookup to rw-pages
The `lookup_translation` function got introduced and is used only in the
context to proof whether a cache maintainance function can be executed
safely by the kernel. Unfortunately, it did not checked write permissions,
which can lead to permission faults. This commit restricts the lookup
function to only succeed when the target page is writeable. Consequently,
the lookup function gets renamed to `lookup_rw_translation`.

Fix genodelabs/genode#4348
2022-02-21 15:47:51 +01:00
Piotr Tworek
bade0a85e7 base-hw: Implement CPU core identification for Cortex-A55.
According to ARM Cortex-A55 Core Technical Reference Manual r1p0 the
lowest 8 bits (Aff0) of MPIDR register represent thread IDs within a
multi-threaded core. The actual core identification bits are in Aff1.
This layout can be identified by checking the MT bit of MPIDR register.
Basically, if MT=1 core id is in Aff1, if MT=0 core id is in Aff0.

Without this change Genode will identify all CPU cores on A55 as primary
(0) core.

Its worth to mention that Cortex-A55 by itself is not a multi-threaded
CPU. Aff0 values are always expected to be 0 for pure A55 cores. A55
cores can however be paired with cores that are multi-threaded. To
support such big.LITTLE CPUs in Genode we'd probably need to add a
different mechanism for mapping MPIDR values to logical, contignous
core IDs which Genode expects.

Ref:
https://developer.arm.com/documentation/100442/0100/register-descriptions/aarch64-system-registers/mpidr-el1--multiprocessor-affinity-register--el1?lang=en
2022-02-15 15:27:29 +01:00
Norman Feske
649647538b depot: update recipe hashes 2022-02-15 10:23:59 +01:00
Piotr Tworek
5e93a5806b base-hw: Use softfp ABI on virt_qemu ARMv7.
The soft ABI implies purely software floating point implementation.
This is not the case for Genode however. For example core's
exception_vector.S uses vmsr instruction. This builds fine with with
GCC based toolchain, but clang with integrated-as complains:

src/core/spec/arm/exception_vector.S:122:2: error: instruction requires: VFP2
 vmsr fpexc, r1
 ^

Fix this by passing softfp to mfloat-abi command on ARMv7. This allows
usage of FP HW, but implies soft-floating point ABI.

Issue #4421
2022-02-15 10:23:58 +01:00
Piotr Tworek
4ae78639f5 base-hw: Fix invalid structure alignments.
According to C++11 reference:

  "If the strictest (largest) alignas on a declaration is weaker than
   the alignment it would have without any alignas specifiers (that is,
   weaker than its natural alignment or weaker than alignas on another
   declaration of the same object or type), the program is ill-formed:"

https://en.cppreference.com/w/cpp/language/alignas

The code requests 4 byte alignment for Genode::Arm_cpu::Context.
The Context structure inherits Genode::Arm_cpu::Fpu_context which
has minimum alignment requirement of 8 bytes, due to uint64_t d0_d31
member. This makes the 4 byte value in Context's alignas specifier
invalid (smaller than allowed minimum).

Similar situation takes place in Arm_64 case. The claimed minimum
alignment of Context is 8 bytes, but the fpu_state member imposes 16
bytes alignment (explicitly specified in Fpu_state declaration).

In both cases the code builds fine with GCC 8.3.0, but fails with
clang which claims that "requested alignment is less than minimum
alignment of X for type", where X is 8 on ARM and 16 on AArch64.

Ref: https://eel.is/c++draft/dcl.align#5

Issue #4421
2022-02-15 10:23:58 +01:00
Norman Feske
33b038e8a7 Consistent spelling of "writeable"
Fixes #4425
2022-02-15 10:23:58 +01:00
Norman Feske
50c2b0066f Remove 'Env::reinit' and 'Env::reinit_main_thread'
Fixes #4404
2022-02-15 10:17:28 +01:00
Norman Feske
ab0cba8ead base-hw: improve comments in kernel/interface.h 2022-02-15 10:10:02 +01:00
Norman Feske
90c446e565 base-hw: remove throw from ipc_reply_wait
Even though the use of the C++ exception mechanism (and the implicit use
of the cxx heap) is not a problem at the server side, this patch
nevertheless replaces the exception-based return-value handling to make
the code consistent with the ipc_call path.

Issue #3612
2022-02-15 10:10:02 +01:00
Norman Feske
3e4af3a567 base-hw: remove throw from ipc_call code path
This eliminates the dependency of the IPC-call operation from the cxx
heap.

Fixes #3612
2022-02-15 10:10:02 +01:00
Christian Helmuth
65284b29f8 depot: update recipe hashes 2022-01-19 12:38:13 +01:00
Norman Feske
3ba316b015 base-hw: declare build artifact for core 2022-01-19 12:38:12 +01:00
Stefan Kalkowski
426f52068b hw: avoid 'cps' instruction in ARM hyp mode
On some boards or emulators a CPU might be executing in hyp mode
when entering Genode's bootstrap code. In that mode the 'cps' instruction
is not defined. Therefore, we change the way the boot cpu is identified.

Ref #3415
2022-01-19 12:38:12 +01:00
Stefan Kalkowski
6bd7f167a4 hw: remove rpi1/3 board support
The code moved to https://github.com/skalk/genode-rpi

Ref #4363
2022-01-19 12:38:12 +01:00
Tomasz Gajewski
f79d5d640f hw: irq controller and timer improvements for Rpi
* renamed rpi pic to Bcm2835_pic
* renamed rpi3 pic to Bcm2837_pic
* added bcm2837 control for setting prescaler value (to fix timer_accuracy)
* changed handling of all interrupts for rpi3 by cascading to bcm2835 pic
* rpi3 irq controller base address made consistent with rpi
* added usb controller memory region for pic on rpi3 (for SOF interrupts)

Ref #3415
2022-01-19 12:38:12 +01:00
Norman Feske
5611fd2355 depot: update recipe hashes 2021-12-17 15:06:38 +01:00
Norman Feske
3cc6df3116 base: tighten affinity handling
This patch improves the robustness of the CPU-affinity handling.

- The types in base/affinity.h received the accessors
  'Location::within(space)' and 'Affinity::valid', which alleviates
  the fiddling with coordinates when sanity checking the values,
  in init or core.

- The 'Affinity::Location::valid' method got removed because its
  meaning was too vague. For sanity checks of affinity configurations,
  the new 'within' method is approriate. In cases where only the x,y
  values are used for selecting a physical CPU (during thread creation),
  the validity check (width*height > 0) was not meaningful anyway.

- The 'Affinity::Location::from_xml' requires a 'Affinity::Space'
  as argument because a location always relates to the bounds of
  a specific space. This function now implements the selection of
  whole rows or columns, which has previously a feature of the
  sandbox library only.

- Whenever the sandbox library (init) encounters an invalid affinity
  configuration, it prints a warning message as a diagnostic aid.

- A new 'Affinity::unrestricted' function constructs an affinity that
  covers the whole affinity space. The named functions clarifies
  the meaning over the previous use of the default constructor.

- Core's CPU service denies session requests with an invalid
  affinity parameter. Previously, it would fall back to an
  unrestricted affinity.

Issue #4300
2021-12-17 15:06:38 +01:00
Sebastian Sumpf
75509d77b5 base-hw: Remove 'riscv_qemu' and move to 'genode-riscv'
issue #4312
2021-12-17 15:04:48 +01:00
Norman Feske
890842dce2 base-hw/lib/mk/spec/cortex_a8/core-hw.inc (usb_armory) 2021-12-17 15:04:47 +01:00
Norman Feske
03047009b1 base: avoid implicit conversions
This patch is a prerequisite for compiling the code with
the warnings -Wconversion enabled.

Issue #23
2021-12-17 15:04:44 +01:00
Christian Helmuth
92b7be4d11 depot: update recipe hashes 2021-11-30 12:08:54 +01:00
Stefan Kalkowski
7eb3da71b5 base-hw: check managing_system property for SMC
* When issuing a secure-monitor-call on behalf of a PD session client
  first check the permission via the 'managing_system' property.

Fix #4321
2021-11-29 15:11:53 +01:00