Commit Graph

248 Commits

Author SHA1 Message Date
Martin Stein 8a99c08ae4 hw: always panic on removal of scheduler head
Because of helping, it is possible that a core thread that wants to
destroy another thread at the kernel is using the scheduling context of
the thread that shall be destroyed at this point in time. When building
without GENODE_RELEASE defined, this always triggers an assertion in the
kernel. But when building with GENODE_RELEASE defined, this might silently
lead to kernel-memory corruption. This commit eliminates the latter case.
Should be reverted as soon as the scheduler is able to remove its head.

Ref #1537
2015-05-26 09:40:04 +02:00
Stefan Kalkowski e081554731 hw: kernel backed capabilities (Fix #1443) 2015-05-26 09:40:04 +02:00
Stefan Kalkowski 4431ab7354 hw_x86_64: fix kernel stack initialization
Fix #1533
2015-05-26 09:40:04 +02:00
Stefan Kalkowski db5e4f70f1 hw: replace 'placement new' with 'construct_at<>'
Placement new can be misleading, as we already overload the new operator
to construct objects via pointers to allocators. To prohibit any problems here,
and to use one consistent approach, we can explicitely construct the object
with the already available 'construct_at' template function.

Ref #1443
2015-05-26 09:40:03 +02:00
Stefan Kalkowski b8f178e647 hw: move MMU-related functions into Address_space
* Introduce a hw specific Address_space interface for protection
  domains, which combines all memory-virtualization related functionality
* Introduce a core-specific Platform_pd object that solves all the hen-egg
  problems formerly distributed in kernel and core-platform code

Ref #595
Ref #1443
2015-05-26 09:40:03 +02:00
Stefan Kalkowski d4c55bec2a hw: implement 'Address_space' interface
Ref #595
Ref #1443
2015-05-26 09:40:03 +02:00
Stefan Kalkowski 73c3a81e0b base: make PD session upgradeable
Ref #1443
2015-05-26 09:40:02 +02:00
Reto Buerki 58178949ef hw_x86_64: Make AHCI driver work
The assumption that IRQs in the legacy ISA range are always
edge-triggered is wrong. For the free-for-use IRQs it depends on the
actual device which uses the specific IRQ. Therefore, treat IRQs 9, 10
and 11 as level-triggered.
2015-05-26 09:39:50 +02:00
Reto Buerki afec233f50 hw_x86_64: Use _edge_triggered() in _create_irt_entry() 2015-05-26 09:39:50 +02:00
Reto Buerki 5eed6de910 hw_x86_64: Let _edge_triggered() operate on IRQ
Use the base IRQ in the _edge_triggered() utility function, not the
remapped vector.
2015-05-26 09:39:50 +02:00
Reto Buerki 6af893123e hw_x86_64: Only block masking of legacy IRQs
Allow legacy IRQ unmasking. Initially, all IRQs are masked and must be
explicitly unmasked by a driver.
2015-05-26 09:39:50 +02:00
Reto Buerki e034846f32 hw_x86_64: Initially mask IRQs in _create_irt_entry 2015-05-26 09:39:50 +02:00
Christian Prochaska e7f869611c hw: static constexpr function when reinterpret cast is used
Issue #1511
2015-05-26 09:39:47 +02:00
Alexander Boettcher e84284c0cd base: remove shared irq from core
Cleanup commit after all relevant drivers got adapted to use the x86 platform
driver (pci_drv).

Issue #1471
2015-05-26 09:39:47 +02:00
Martin Stein c6417051ce hw & x86: Use register framework for IRTEs
Ref #1494
2015-05-26 09:39:45 +02:00
Martin Stein 6ec39d8df5 hw & x86: Style fixes for cpu_support.h
Ref #1494
2015-05-26 09:39:45 +02:00
Adrian-Ken Rueegsegger f99fab544a hw_x86_64: Add x86-specific I/O mem allocator init
Enable a platform to specify how the MMIO memory allocator is to be
initialized. On ARM the existing behavior is kept while on x86 the I/O
memory is defined as the entire address space excluding the core only
RAM regions. This aligns the hw_x86_64 I/O memory allocator
initialization with how it is done for other x86 kernels such as NOVA or
Fiasco.
2015-05-26 09:39:45 +02:00
Adrian-Ken Rueegsegger 36b2cf932b hw_x86_64: Initialize complete I/O APIC IRT entries
Also set high 32 bits of I/O APIC redirection table entries.
2015-05-20 17:53:00 +02:00
Adrian-Ken Rueegsegger f2fe0eccb8 hw_x86_64: Explicitly initialize MXCSR
The assures that the MXCSR is initialized to the recommended value.
2015-05-20 17:52:59 +02:00
Adrian-Ken Rueegsegger ded302c61c hw_x86_64: Perform lazy FPU state initialization
Perform lazy-initialization of FPU state when it is enabled for the
first time. This assures that the FXSAVE area (including the stored
MXCSR) is always properly setup and initialized to the platform default
values.
2015-05-20 17:52:59 +02:00
Adrian-Ken Rueegsegger a0ec317753 hw_x86_64: Explicitly set all FPU-related CR flags
Perform all FPU-related setup in the Cpu class' init_fpu function instead of
the general system bring-up assembly code.

Set all required control register 0 and 4 flags according to Intel SDM Vol. 3A,
sections 9.2 and 9.6 instead of only enabling FPU error reporting and OSFXSR.
2015-05-20 17:52:59 +02:00
Adrian-Ken Rueegsegger 5eb75e9e81 hw_x86_64: Add control register 4 to Cpu class 2015-05-20 17:52:59 +02:00
Adrian-Ken Rueegsegger fdbb073414 hw_x86_64: Log ip on unknown exception 2015-05-20 17:52:59 +02:00
Adrian-Ken Rueegsegger 4d700fe2ae hw_x86_64: Emit debug message on #UD
Print information when handling an undefined instruction exception.
2015-05-20 17:52:59 +02:00
Adrian-Ken Rueegsegger 370271324e hw_x86_64: Simplify kernel physical init
Merge finish_init_phys_kernel into init_phys_kernel function.
2015-05-20 17:52:58 +02:00
Reto Buerki bb06826c95 hw_x86_64: Factor out initial PT to separate file
This allows the specification of different initial pagetables for a
platform based on x86_64 (e.g. Muen).
2015-05-20 17:52:58 +02:00
Alexander Boettcher d998df3b7f base: extend irq session to support MSIs
Works on base-nova and base-foc, the other kernels have no MSI support.

Issue #1216
2015-05-20 17:39:14 +02:00
Martin Stein 7c133add52 hw: acknowledge IRQs via Kernel::ack_irq
In the past, when the user blocked for an IRQ signal, the last signal was
acknowledged automatically thereby unmasking the IRQ. Now, the signal session
got a dedicated RPC for acknowledging IRQs and the HW back-end of that RPC
acknowledged the IRQ signal too. This led to the situation that IRQs were
unmasked twice. However, drivers expect an interrupt to be unmasked only on
the Irq_session::ack_irq and thus IRQ unmasking was moved from
Kernel::ack_signal to a dedicated kernel call.

Fixes #1493
2015-05-06 10:55:23 +02:00
Stefan Kalkowski e61a3db30d hw: separate function declaration/implementation
Move kernel object functions from its headers to compilation units,
thereby reducing the kernel's text section, cache, and TLB footprint.

Fix #1492
2015-05-06 10:55:23 +02:00
Christian Helmuth 98def2488a thread: move Thread_base::myself() to separate file
The thread library (thread.cc) in base-foc shared 95% of the code with
the generic implementation except myself(). Therefore, its
implementation is now separated from the other generic sources into
myself.cc, which allows base-foc to use a foc-specific primitive to
enable our base libraries in L4Linux.

Issue #1491
2015-05-06 10:55:17 +02:00
Martin Stein c9272937e7 CPU session: apply quota via relative weightings
Physical CPU quota was previously given to a thread on construction only
by directly specifying a percentage of the quota of the according CPU
session. Now, a new thread is given a weighting that can be any value.
The physical counter-value of such a weighting depends on the weightings
of the other threads at the CPU session. Thus, the physical quota of all
threads of a CPU session must be updated when a weighting is added or
removed. This is each time the session creates or destroys a thread.

This commit also adapts the "cpu_quota" test in base-hw accordingly.

Ref #1464
2015-05-06 10:55:16 +02:00
Martin Stein 955977b516 hw: syscall for changing a threads physical quota
This commit also extends the "cpu_scheduler" test to test the back-end of the
new syscall.

Ref #1464
2015-04-23 16:51:33 +02:00
Martin Stein e4f560f39b hw: change round-robin scheduling slice to 10 ms
Previously, it was set to 100 ms which caused a remarkable disadvantage
in reactivity.

Ref #1464
2015-04-23 16:51:33 +02:00
Martin Stein de9d69a6d7 hw: re-enable kernel tests with the new run env
The new run env doesn't pass the "core_type" parameter at one point
which is why we have to pass it through a global HW-specific variable.

Ref #1464
2015-04-23 16:51:33 +02:00
Alexander Boettcher faa25e1df6 base: make irq_session asynchronous
second step

options: factor out common parts of irq_session_component.cc
options: use on foc arm no proxy threads

Fixes #1456
2015-04-23 16:47:58 +02:00
Alexander Boettcher e2cbc7c5b3 base: unify some irq_session headers
remove repos/base-*/include/irq_session headers and use only a unification
from   repos/base/include/irq_session

first step

Issue #1456
2015-04-23 16:47:57 +02:00
Norman Feske eaab23c012 base: const-correctness of Allocator interface
This patch adds const qualifiers to the functions Allocator::consumed,
Allocator::overhead, Allocator::avail, and Range_allocator::valid_addr.

Fixes #1481
2015-04-17 16:13:22 +02:00
Stefan Kalkowski 0188b08f6a hw: construct kernel irq objects on demand
Ref #1443
2015-04-17 16:13:21 +02:00
Stefan Kalkowski b32af4e0a4 hw: directly reference kernel objects from core
Instead of handing over object ids to the kernel, which has to find them
in object pools then, core can simply use object pointers to reference
kernel objects.

Ref #1443
2015-04-17 16:13:20 +02:00
Stefan Kalkowski c850462f43 hw: replace kernel's object id allocators
Instead of having an ID allocator per object class use one global allocator for
all. Thereby artificial limitations for the different object types are
superfluent. Moreover, replace the base-hw specific id allocator implementation
with the generic Bit_allocator, which is also memory saving.

Ref #1443
2015-04-17 16:13:20 +02:00
Stefan Kalkowski 2df86cd34b hw: rename bin_* syscalls with delete_*
The verb "bin" in the context of destroying kernel objects seems pretty
unusual in contrast to "delete". When reading "bin" in the context of
systems software an association to something like "binary" is more likely.

Ref #1443
2015-04-17 16:13:20 +02:00
Stefan Kalkowski b949489641 base: remove local capability from generic base
* Instead of using local capabilities within core's context area implementation
  for stack allocation/attachment, simply do both operations while stack gets
  attached, thereby getting rid of the local capabilities in generic code
* In base-hw the UTCB of core's main thread gets mapped directly instead of
  constructing a dataspace component out of it and hand over its local
  capability
* Remove local capability implementation from all platforms except Linux

Ref #1443
2015-04-17 16:13:20 +02:00
Stefan Kalkowski a168c9d6ce core: remove global capability id counter
The global capability ID counter is not used by NOVA and Fiasco.OC
and in the future not needed by base-hw too. Thereby, remove the static
counter variable from the generic code base and add it where appropriated.

Ref #1443
2015-04-17 16:13:19 +02:00
Stefan Kalkowski 358380046c base: assign allocator and quota to platform pd
Enable platform specific allocations and ram quota accounting for
protection domains. Needed to allocate object identity references
in the base-hw kernel when delegating capabilities via IPC.
Moreover, it can be used to account translation table entries in the
future.

Ref #1443
2015-04-17 16:13:19 +02:00
Christian Prochaska 0fd53c7fe4 Extract numeric string arguments with the correct signedness
There are lots of places where a numeric argument of an argument string
gets extraced as signed long value and then assigned to an unsigned long
variable. If the value in the string was negative, it would not be
detected as invalid (and replaced by the default value), but become a
positive bogus value.

With this patch, numeric values which are supposed to be unsigned get
extracted with the 'ulong_value()' function, which returns the default
value for negative numbers.

Fixes #1472
2015-04-13 14:18:15 +02:00
Martin Stein 70aa98d837 hw: fix bug in cancellation of 'await_signal'
There were two bugs. First, the caller of Kernel::await_signal wasn't
re-activated for scheduling. Second, the caller did not memorize that he
doesn't wait on a receiver anymore which had bad side effects on further
signal handling.

Fix #1459
2015-04-09 16:04:44 +02:00
Martin Stein 60e392f0c0 hw: support Wandboard Quad (i.MX6)
The port uses the Cortex-A9 private timer for the kernel and an EPIT as
user timer. It was successfully tested on the Wandboard Quad and the CuBox-i
with the signal test. It lacks L2-cache and Trustzone support by now.

Thanks to Praveen Srinivas (IIT Madras, India) and  Nikolay Golikov (Ksys Labs
LLC, Russia). This work is partially based on their contributions.

Fix #1467
2015-04-09 16:04:43 +02:00
Martin Stein 4f887448c3 hw & cortex_a9: clean-up board_support.h
Change class name according to our common naming scheme and remove unnecessary
'using' directive.

Ref #1467
2015-03-27 12:20:07 +01:00
Reto Buerki c82f5e9269 hw_x86_64: Do not mask edge-triggered interrupts
Do not mask edge-triggered interrupts to avoid losing them while masked,
see Intel 82093AA I/O Advanced Programmable Interrupt Controller
(IOAPIC) specification, section 3.4.2, "Interrupt Mask":

"When this bit is 1, the interrupt signal is masked. Edge-sensitive
interrupts signaled on a masked interrupt pin are ignored (i.e., not
delivered or held pending)"

Or to quote Linus Torvalds on the subject:

"Now, edge-triggered interrupts are a _lot_ harder to mask, because the
Intel APIC is an unbelievable piece of sh*t, and has the edge-detect
logic _before_ the mask logic, so if a edge happens _while_ the device
is masked, you'll never ever see the edge ever again (unmasking will not
cause a new edge, so you simply lost the interrupt)."

So when you "mask" an edge-triggered IRQ, you can't really mask it at
all, because if you did that, you'd lose it forever if the IRQ comes in
while you masked it. Instead, we're supposed to leave it active, and set
a flag, and IF the IRQ comes in, we just remember it, and mask it at
that point instead, and then on unmasking, we have to replay it by
sending a self-IPI." [1]

[1] - http://yarchive.net/comp/linux/edge_triggered_interrupts.html

Ref #1448
2015-03-27 11:53:34 +01:00
Martin Stein bfe1fac37c hw_x86_64: style fixes
Ref #1448
2015-03-27 11:53:34 +01:00