Commit Graph

326 Commits

Author SHA1 Message Date
Stefan Kalkowski 5fc9f68941 hw_x86_64: do not reference any muen specifics
Do not build core-muen_on library without the muen soecifier set.
Do not reference files of the muen contrib directory in the first
pass of make's rule analysis, when parding the muen specific kernel
makefile.

Fix #1859
2016-01-26 16:20:47 +01:00
Stefan Kalkowski c3d4802ac8 hw: re-implement lazy FPU context switch
The new implementation of the FPU and FPU context is taken out to
separate architecture-dependent header files. The generic Cpu_lazy_state
is deleted. There is no hint about the existence of something like an
FPU in the generic non-architexture-dependent code anymore. Instead the
architecture-dependent CPU context of a thread is extended by an FPU
context where supported.

Moreover, the current FPU implementations are enhanced so that threads
that get deleted now release the FPU when still obtaining it.

Fix #1855
2016-01-26 16:20:38 +01:00
Stefan Kalkowski f539cf1231 hw: adjust core's signal thread's stack size
The stack size should be architecture dependent.

Fix #1854
2016-01-26 16:20:37 +01:00
Stefan Kalkowski 5afad64586 hw: preserve core's context-area (Fix #1853)
Remove core's context-area from its virtual memory allocator
2016-01-26 16:20:37 +01:00
Stefan Kalkowski 7aff1895bf hw: enable SMP for ARM Cortex A9
This commit enables multi-processing for all Cortex A9 SoCs we currently
support. Moreover, it thereby enables the L2 cache for i.MX6 that was not
enabled until now. However, the QEMU variants hw_pbxa9 and hw_zynq still
only use 1 core, because the busy cpu synchronization used when initializing
multiple Cortex A9 cores leads to horrible boot times on QEMU.

During this work the CPU initialization in general was reworked. From now
on lots of hardware specifics were put into the 'spec' specific files, some
generic hook functions and abstractions thereby were eliminated. This
results to more lean implementations for instance on non-SMP platforms,
or in the x86 case where cache maintainance is a non-issue.

Due to the fact that memory/cache coherency and SMP are closely coupled
on ARM Cortex A9 this commit combines so different aspects.

Fix #1312
Fix #1807
2016-01-26 16:20:18 +01:00
Martin Stein 2b2007bc3f hw: add Pl310::Debug register definitions
Ref #1312
2016-01-15 16:42:12 +01:00
Martin Stein c58de0d80e hw_panda: driver for Cortex-A9 wakeup generator
Ref #1312
2016-01-15 16:42:12 +01:00
Martin Stein 5755245609 hw: end interrupts SMP-safe on ARM (Ref #1312) 2016-01-15 16:42:12 +01:00
Stefan Kalkowski 166672fe16 hw: l2 cache initialization is platform specific
On ARM Cortex A9 platforms the external PL310 L2 cache controller
needs to be initialized dependent on the SoC. For instance on Pandaboard
it needs to call the firmware running in TrustZone's secure world,
on i.MX6 it initializes it directly, on other boards it doesn't need
to be initialized at all, because the bootloader already did so.
Therefore, we should implement the PL310 intialization in board specific
code and not in the base class implementation.

Ref #1312
2016-01-15 16:42:12 +01:00
Stefan Kalkowski e05d26567d hw: make 'smp' property an aspect (Ref #1312)
This commit separates certain SMP aspects into 'spec/smp' subdirectories.
Thereby it simplifies non-SMP implementations again, where no locking
and several platform specific maintainance operations are not needed.
Moreover, it moves several platform specifics to appropriated places,
removes dead code from x86, and starts to turn global static pointers
into references that are handed over.
2016-01-15 16:42:12 +01:00
Adrian-Ken Rueegsegger b1b3c7bf34 doc: Extend Muen tutorial to match new build process 2016-01-08 14:37:57 +01:00
Adrian-Ken Rueegsegger cb68f9a320 hw: Add kernel/spec/muen/target.mk to build Muen SK
This adds the automated compilation of the Muen Separation Kernel and
the required components to the hw_x86_64_muen build process.
2016-01-08 14:37:56 +01:00
Adrian-Ken Rueegsegger 8d2f2b0101 hw: Add port for Muen Separation Kernel
For additional information about the Muen SK refer to the project page
at [1].

[1] - http://muen.codelabs.ch/
2016-01-08 14:37:56 +01:00
Stefan Kalkowski 2316937e58 hw: remove main thread's initial UTCB from vm area
The main thread's UTCB, used during bootstrap of the main thread before
it allocates its context area, needs to be outside the virtual memory
area controlled by the RM session, because it is needed before the main
thread can access its RM session.

Fix #1804
2015-12-10 13:16:27 +01:00
Martin Stein 227b539193 cpu_quota x86_64: fix RAM quota and stack size
The test threads previously used a stack size independent from the machine
word width. Qemu was previously configured to provide 64Mb of RAM which isn't
sufficient for x86_64.

Ref #1805
2015-12-10 13:16:26 +01:00
Martin Stein 02ef3d13a3 hw: explain misleading "Quota exceeded"
Upgrading the quota of a PD session on HW always triggers a "Quota
exceeded" warning. To prevent unecessary debugging effort in the future,
we explain in an in-code comment that the warning is normal.

Ref #1805
2015-12-10 13:16:26 +01:00
Stefan Kalkowski 60ba210a6b hw: reference count capabilities in UTCBs
When capabilities are delegated to components, they are added to the UTCB of the
target thread. Before the thread is able to take out the capability id out of
the UTCB and adapt the user-level capability reference counter, it might happen
that another thread of the same component deletes the same capability because
its user-level reference counter reached zero. If the kernel then destroys the
capability, before the same capability id is taken out of all UTCBs, an
inconsitent view in the component is the result.  To keep an consistent view in
the multi-threading scenario, the kernel now counts how often it puts a
capability into a UTCB. The threads on the other hand hint the kernel when they
took capabilities out of the UTCB, so the kernel can decrement the counter
again. Only when the counter is zero, capabilities can get destructed.

Fix #1623
2015-12-10 13:16:25 +01:00
Stefan Kalkowski ee4619687b hw: remove 1:1 I/O mappings from virtual memory
Likewise on the x86 branch, we have to remove all virtual memory ranges from the
virtual memory allocator that are used by one-by-one mappings of I/O regions
used by the kernel.

Fix #1797
2015-12-10 13:16:24 +01:00
Martin Stein bed04f1f16 hw & imx53: kernel Trustzone config for USB armory
On the USB Armory, we want to secure different devices than on other i.MX53
implementations. Thus, add a board specific configuration that is interpreted
by the kernel Trustzone initialization.

Ref #1497
2015-11-29 18:17:04 +01:00
Martin Stein 85ba3259f8 hw & imx53: IRQ injection via Vm::proceed
Enhance the VM state, that can be accessed by a VMM, by a member
'unsigned irq_injection'. In Kernel::Vm::proceed check, whether
irq_injection is set.  If so, check whether irq_injection is a
non-secure IRQ.  If so, let the PIC raise this IRQ in the VM and reset
irq_injection.

Ref #1497
2015-11-29 18:17:04 +01:00
Sebastian Sumpf 0c3dfbad65 base-hw: use signal context list for pending signals
'block_for_signal' and 'pending_signal' now set pending flag in signal context
in order to determine pending signal. The context list is also used by the
'Signal_receiver' during destruction.

Fixes #1738
2015-11-27 12:18:50 +01:00
Alexander Boettcher 826c81ac18 hw_x86: discover all physical memory in core
Fixes #1741
2015-11-04 14:09:28 +01:00
Sebastian Sumpf 2b429ee84c base: Dispatch server signal in entry point
Currently, when a signal arrives in the main thread, the signal dispatcher is
retrieved and called from the main thread, the dispatcher uses a proxy object
that in turn sends an RPC to the entry point. This becomes a problem when the
entry point destroys the dispatcher object, before the dispatch function has
been called by the main thread. Therefore, the main thread should simply send an
RPC to the entry point upon signal arrival and the dispatching should be handled
solely by the entry point.

Issue #1738
2015-10-28 15:06:22 +01:00
Stefan Kalkowski b585583ec7 core: do not destroy in object pool's apply scope
Destroying an object within the scope of a lambda/functor executed
in the object pool's apply function leads potentially to memory corruption.
Within the scope the corresponding object is locked and unlocked when
leaving the scope. Therefore, it is illegal to free the object's memory meanwhile.
This commit eliminates several places in core that destroyed wrongly in
the object pool's scope.

Fix #1713
2015-09-30 12:20:40 +02:00
Stefan Kalkowski ccb968ff7d safeguard the synchronized allocator template
* Move the Synced_interface from os -> base
* Align the naming of "synchronized" helpers to "Synced_*"
* Move Synced_range_allocator to core's private headers
* Remove the raw() and lock() members from Synced_allocator and
  Synced_range_allocator, and re-use the Synced_interface for them
* Make core's Mapped_mem_allocator a friend class of Synced_range_allocator
  to enable the needed "unsafe" access of its physical and virtual allocators

Fix #1697
2015-09-30 12:20:39 +02:00
Stefan Kalkowski 53eb666ed0 hw: invalidate all caps of a thread in destruction
Fix #1682
2015-09-30 12:20:39 +02:00
Stefan Kalkowski 37bae7bc1f hw: simplify IPC node's state model (fix #1691)
Merge the Ipc_node class' state PREPARE_AND_AWAIT_REPLY and AWAIT_REPLY,
as well as PREPARE_REPLY ans INACTIVE into one.
2015-09-30 12:20:39 +02:00
Stefan Kalkowski 8c168d7943 hw: use weak pointer when resolving a page-fault
Fix #1674
2015-09-30 12:20:35 +02:00
Stefan Kalkowski ed52d5a211 Introduce 'spec' subdirectories to outline aspects
Instead of holding SPEC-variable dependent files and directories inline
within the repository structure, move them into 'spec' subdirectories
at the corresponding levels, e.g.:

  repos/base/include/spec
  repos/base/mk/spec
  repos/base/lib/mk/spec
  repos/base/src/core/spec
  ...

Moreover, this commit removes the 'platform' directories. That term was
used in an overloaded sense. All SPEC-relative 'platform' directories are
now named 'spec'. Other files, like for instance those related to the
kernel/architecture specific startup library, where moved from 'platform'
directories to explicit, more meaningful places like e.g.: 'src/lib/startup'.

Fix #1673
2015-09-16 13:58:50 +02:00
Johannes Schlatow 40b31876d2 base-hw: Add basic Zynq-7000 support (QEMU)
Ref #1599
2015-09-09 15:14:28 +02:00
Stefan Kalkowski 458b4d6fc4 base: redesign object pool using lambda interface
Instead of returning pointers to locked objects via a lookup function,
the new object pool implementation restricts object access to
functors resp. lambda expressions that are applied to the objects
within the pool itself.

Fix #884
Fix #1658
2015-09-09 15:14:28 +02:00
Martin Stein 555835c95b hw: unlock kernel before context propagation
Propagating the user context-pointer from C++ code to the mode
transition assembly doesn't touch any CPU global data. Thus, we can
reduce the in-sync window.

Fixes #1223
2015-09-09 15:14:27 +02:00
Martin Stein 91cb3decdb hw_x86_64: move Cpu_context stuff to extra unit
Other platforms implement Kernel::Cpu_context stuff in
kernel/cpu_context.cc. On x86_64, it was implemented in
kernel/thread.cc. The commit fixes this inconsistency to the other
platforms.

Ref #1652
2015-09-09 15:14:27 +02:00
Martin Stein 4e98a0f64a hw: get rid of kernel/thread_* files
The distinction between Kernel::Thread and Kernel::Thread_base is
unnecessary as currently all Hw platforms would have the same content in
the latter class. Thus I've merged Kernel::Thread_base into
Kernel::Thread. Thereby, Kernel::Thread_event can be moved to
kernel/thread.h.

Ref #1652
2015-09-09 15:14:27 +02:00
Alexander Boettcher dd9793cdc7 hw: show ip and sp during unresolvable pagefault
Issue #1652
2015-09-09 15:14:27 +02:00
Alexander Boettcher c5877b5575 hw: remove access_thread_regs syscall
Issue #1652
2015-09-09 15:14:27 +02:00
Christian Helmuth 30db0c5364 hw: prevent compiler warning 2015-08-31 09:09:23 +02:00
Stefan Kalkowski 9f1beaa036 hw_x86_64: use 'muen' SPEC to implement aspect 2015-08-31 09:09:22 +02:00
Reto Buerki 750c4ad81d Add tutorial for base-hw on Muen
The tutorial describes how to build a Genode scenario using the
base-hw x86_64_muen target and run it as a subject on the Muen SK.
2015-08-27 13:48:26 +02:00
Reto Buerki ad411e1a90 hw_x86_64_muen: Implement PIC take_request()
The Muen-specific PIC implementation provides the irq_occurred()
function which is used to register an IRQ with the PIC upon thread
exception.

The occurred IRQs are stored in a boolean array internally and handed
out to a CPU via take_request().
2015-08-27 13:48:25 +02:00
Reto Buerki fa26805fd7 hw_x86_64_muen: Implement paravirt timer driver
The driver uses the timer page containing a vector and timer value to
implement the start_one_shot() and value() functions. The timer value
designates the absolute tick count of the next event.

The address of the time page is acquired using the get_memregion_info
Sinfo API function.
2015-08-27 13:48:25 +02:00
Reto Buerki 4a51f933ce hw_x86_64_muen: Add initial pagetables file
The initial pagetables for hw_x86_64_muen specify an identity mapping
from 2MiB to 1GiB plus mappings for the paravirt pages (sinfo, timer,
...).
2015-08-27 13:48:25 +02:00
Reto Buerki c434a5ceec hw_x86_64_muen: Add C++ implementation of Sinfo API
The Muen Sinfo API is used to retrieve information about the execution
environment of a subject running on the Muen Separation Kernel.

While the C++ API is defined in sinfo.h, musinfo.h specifies the
internal format of the information stored in the Sinfo pages provided by
the Muen SK. It is a copy of the file contained in the libmusinfo
library of the Muen project. That is the reason why the coding style in
this file differs from the official style.
2015-08-27 13:48:25 +02:00
Reto Buerki 5036b96c11 hw_x86_64_muen: Add fake Timer::ms_to_tics impl
This makes the scheduler happy and it starts scheduling threads:

Booting Muen kernel v0.6.0-329-gdd545fe-UNCLEAN
0004|kernel initialized
0004|Genode 14.11-400-gecee95b
0004|int main(): --- start init ---
0004|[init -> test-printf] -1 = -1 = -1
2015-08-27 13:48:25 +02:00
Adrian-Ken Rueegsegger 21fb356cd4 hw_x86_64_muen: Provide Muen-specific serial
Subjects on Muen are not allowed to access the BIOS data area. Instead a
serial console is emulated on the fixed I/O port 0x3f8.
2015-08-27 13:48:25 +02:00
Reto Buerki 96a0820e89 Add Muen-specific platform_support.cc
The file specifies Muen-specific MMIO regions: Sinfo and paravirt timer
pages.
2015-08-27 13:48:25 +02:00
Adrian-Ken Rueegsegger c310e335ae hw_x86_64: Enable more specialized setup_irq_mode()
Move Platform::setup_irq_mode function from x86 platform_support.cc to
x86_64 specific file. This will enable the upcoming x86_64_muen platform
to provide a separate implementation.
2015-08-27 13:48:25 +02:00
Reto Buerki dcd20f1566 hw: skeleton for building x86_64_muen
The hw_x86_64_muen platform is a x86/64 base-hw kernel which runs as
isolated subject (guest) on the Muen Separation Kernel (SK) [1].

The platform is implemented as an extension to hw_x86_64 replacing the
PIC and timer drivers with paravirtualized variants. The skeleton
contains a dummy PIC and timer implementation for now.

[1] - http://muen.sk
2015-08-27 13:48:24 +02:00
Alexander Boettcher 9cd85ddcf7 hw: call lock_for_destruction in platform_pd
Issue #1607
2015-08-25 10:11:07 +02:00
Adrian-Ken Rueegsegger ec92e9c3df hw_x86_64: Only handle masking of I/O APIC IRQs
Ignore toggle requests for vectors not assigned to the I/O APIC.

Fixes #1651
2015-08-21 11:00:59 +02:00