Commit graph

321 commits

Author SHA1 Message Date
Kent McLeod
ef8b01390d KernelIRQReporting: Change reserved IRQ reporting
Reserved IRQ reporting would print on every received reserved IRQ. This
feature is supposed to report spurious interrupts, yet most cases
reserved IRQs are not spurious. We change the printing to only print if
the reserved IRQ was unhandled. The intention is to allow more app
configurations to leave this feature enabled in development builds.
2019-09-19 11:33:03 +10:00
Anna Lyons
86e50d0703 mcs: Avoid missing a timer tick
Preemption can be via the timer interrupt. In this case we need to
update the timestamp so we can reprogram the timer for the next timeout
and guarantee it is in the future, otherwise we will end up setting a
timeout in the past.
2019-08-22 11:22:41 +10:00
Anna Lyons
acfc3c5257 mcs: tickless driver for x86
Add a tickless timer driver for x86. The driver defaults to using
TSC_DEADLINE mode, but falls back to the apic if that feature is not
available.
2019-08-22 11:22:34 +10:00
Siwei Zhuang
8b4ed9941a RISCV: Add Hifive unleashed platform
This change adds support for Hifive unleashed board. It also removes the
outdated hifive suport from the spike platform.
2019-06-26 15:11:47 +10:00
Siwei Zhuang
375a98c8b3 CMake: Generate device headers from DTS for spike
The DTS compilation was arm platforms only. Moving it to the top level
config file, making it available to RISCV platforms. The generated files
are almost identical with minor differences. A new argument(--arch) is
added to the hardware_gen.py for the differences.
2019-06-26 11:38:08 +10:00
Anna Lyons
8586b7f2b8 boot: refactor allocation of rootserver objects
Prior to this change, the boot process would dynamically allocate
memory for root server objects based on the order of initialisation.
Allocation was a best-fit algorithm.

This change preallocates all memory for root server objects to an
aligned untyped just after the user image. By allocating the objects in
order of size, allocation is greatly simplified and the ability to
reproduce the allocation offline based on the kernel and user image
sizes is increased.
2019-06-20 14:11:50 +10:00
Kent McLeod
4ce8f0a9f5 Add RISC-V IRQ invocations
We add support for seL4_IRQControlGet and seL4_IRQControlGetTrigger. If
a platform doesn't support setting the trigger, then
seL4_IRQControlGetTrigger will return an error. If the platform doesn't
have a PLIC driver, then it won't have any IRQs that can be requested.

Also authored by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2019-06-18 10:22:47 +10:00
Kent McLeod
9a552d84b6 RISC-V: Refactor IRQ handling to use PLIC
Previously we only handled IRQs generated by the BBL running in machine
mode via changes to supervisor interrupt pending (SIP) bits. Now that we
need to support shared global interrupts through the PLIC we need to
modify the way interrupts are processed.

We additionally remove many DONT_TRANSLATE annotations on functions that
the CParser is able to parse.

Also authored by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2019-06-18 10:22:47 +10:00
Kent McLeod
c73d5178d9 RISC-V: Add PLIC interface and HiFive driver
We assume the PLIC is currently the only global interrupt controller
that RISC-V platforms are going to use. Each platform may have a
different programmers model for interracting with the hardware
controller. We provide a common interface for PLIC drivers to implement
that the kernel will use to manage IRQs.

Also authored by: Siwei Zhuang <siwei.zhuang@data61.csiro.au>
2019-06-18 10:22:47 +10:00
Siwei Zhuang
4b24006678 RISC-V: Add kernel device functionalty
- Create device untypeds for platform devices that can be passed to user
space.
- Create kernel device mapping for devices required by the kernel.
Note that the current kernel device mapping is simply a 1GiB of page
physical memory as that contains all devices for all RISC-V platforms
that are currently supported.
2019-06-18 10:22:43 +10:00
Kent McLeod
2865d6b61b spike: Refactor into clearer subplatforms
For now we keep the RISC-V platforms under the spike kernel platform
name. Splitting the different platform definitions into different header
files will help maintainability as we add different device layouts and
kernel device drivers.
2019-06-17 20:31:33 +10:00
Kent McLeod
8dc90b559f RISC-V: Correct PPTR_USER_TOP definition
PPTR_USER_TOP represents the first inaccessible user address which is
usually ((2^(38-12))-1)*0x1000 on SV39. This corresponds to the first
address of the last page in the lower half of the top level page table.
2019-06-17 20:31:33 +10:00
Kent McLeod
4957c5e8a5 RISC-V: Comment 64-bit SV39 kernel address space
Add a comment and diagram explaining the current structure of the SV39
kernel address space. The top half of the virtual address space is
reserved for the kernel and consists of the Kernel window of all
accessible physical memory, the kernel ELF mapping and the Kernel device
mapping region.
2019-06-17 20:31:33 +10:00
Kent McLeod
10655ce634 RISC-V: Add PPTR_KDEV for kernel device mappings
There is a 1GiB region reserved at the top of the Kernel virtual address
space to map devices used by the kernel into. The start of this range is
referred to by PPTR_KDEV. This also represents the end of the Kernel ELF
window mapping.
2019-06-17 20:31:33 +10:00
Siwei Zhuang
6a16d532e6 RISCV: Introduce KERNEL_ELF_BASE for verification
Verification requires the KERNEL_BASE to be 1GB aligned at the start of
the kernel elf window. It was also the location where the kernel elf was
mapped. As we have to include SBI memory in the kernel elf window,
the KERNEL_ELF_BASE is introduced for the real kernel elf mapping.
Keeping KERNEL_BASE unchanged.
2019-06-17 20:31:33 +10:00
Anna Lyons
9dcb470631 arm: remove plat/machine/timer.h
plat/machine/timer.h is unused on arm, so remove it and fix up the
includes.
2019-06-17 10:44:36 +10:00
Anna Lyons
e3a83035f8 boot: consolidate init_freemem
init_freemem sets up available regions of memory for the hardware that
seL4 is booting on. Previously this function was duplicated across
architectures, with minor duplication.

This change provides a top-level init_freemem suitable for all
architectures.

- arm/riscv: change get_avail_p_reg to return whole p_reg array
- update all architectures to use new init_freemem.
- wrap init_freemem calls with arch_init_freemem for each arch, where
arch_init_freemem sets up the available and reserved regions of memory
which are passed to init_freemem.
2019-05-15 14:03:40 +10:00
Anna Lyons
67f2de94a1 trivial: riscv - remove unused function prototype 2019-05-15 14:03:40 +10:00
Anna Lyons
41780b0602 x64: add missing constant PPTR_TOP
PPTR_TOP represents the top that can be made available to the
user as untyped.
2019-05-15 14:03:40 +10:00
Anna Lyons
a6b4cf739d boot: allocate irq cnode statically
The memory used for the irq cnode is never available to the user. As a
result this memory can be allocated statically, simplifying the
bootcode.

- remove allocation of irq cnode
- add static init
- generate irq cnode size from cmake for arm
- add static constants for riscv, x86 as there is no variability at the
moment.
2019-05-03 16:18:39 +10:00
Anna Lyons
cb9499069d zynqmp: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
66df769f8c zynq7000: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
26a3b55521 omap3: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move timer.h to drivers/timer/omap3430.h
- move interrupt.h to drivers/irq/omap3.h
2019-04-12 14:25:58 +10:00
Anna Lyons
df4d19ae5f imx7: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
e4f567e19e imx6: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
7bf513b75e imx31: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move interrupt.h -> drivers/irq/imx31.h
- move hardware.bf -> drivers/timer/imx31-epit.bf
- move timer.h -> drivers/timer/imx31-epit.h
- move definitions from hardware.h to plat/imx31/machine/hardware.c
2019-04-12 14:25:58 +10:00
Anna Lyons
209563d4ca hikey: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
e1a36c2601 exynos: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move timer.h to drivers/timer/exynos5422-mct.h
- move mct.h to drivers/timer/mct.h
2019-04-12 14:25:58 +10:00
Anna Lyons
474a7da5c0 bcm2837: use declare_default_headers
- remove unused header files replaced by declare_default_headers
- move machine.h to drivers/irq/bcm2836-armctrl-ic.h
2019-04-12 14:25:58 +10:00
Anna Lyons
2d77062df4 apq8064: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
a69c3f0f9c am335x: use declare_default_headers
- move timer.h to include/drivers/timer/am335x.h
- move interrupt.h to include/drivers/irq/am335x.h
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Anna Lyons
0a4ffd0a9a allwinnerA20: use declare_default_headers
- move timer.h to include/drivers/timer/allwinner.h
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Kent McLeod
78c8ac9fae tx2: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Kent McLeod
e86190839e tx1: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Kent McLeod
04aabf92ce tk1: use declare_default_headers
- remove unused header files replaced by declare_default_headers
2019-04-12 14:25:58 +10:00
Kent McLeod
d703eab23d cmake: add declare_default_headers
This allows for arm headers to be generated for an arm platform
in include/plat/default that specifies the following:

- maxIRQ
- TIMER_CLOCK_HZ
- the timer header to use
- the interrupt controller header to use
2019-04-12 14:25:53 +10:00
Anna Lyons
0cdd0514cf ia32: adjustments to pass c-parser
This commit updates the ia32 build to pass the c-parser.

- replaces ++i with i++
- use void in functions with no parameters
- add a missing typecast
- remove a void cast of an unused variable

It does not provide any verification guarantees about ia32 code.
2019-04-05 15:39:20 +11:00
Siwei Zhuang
897aaf5b13 RISCV: Change 64 bit kernel window mapping to avoid PMP exception.
The SBI memory was mapped outside the kernel window. This would trigger
an instruction access fault on some hardware, when the bootloader has set
up PMP to protect the SBI memory. Instead of protecting a particular memory
region, the PMP locks the entire page table entry that covers the region.

The PADDR_LOAD and kernel base are adjusted to have the SBI memory
included in the kernel window. So that the SBI memory can be mapped as
part of the kernel image to a separate page table entry. This also
avoids the kernel to allocate untyped memory from the SBI region.
2019-04-03 15:03:25 +11:00
Kent McLeod
f6e5e218dc Remove symlinked libsel4 files from include dir
These files can be included normally using libsel4 include paths. This
removes situations where the same file is available under different
include paths due to symlinking into different directory structures.
2019-03-21 12:44:57 +11:00
Kofi Doku Atuah
2352855213 pc99: Use kernelBase in linker script 2019-03-21 12:31:25 +11:00
Edward Pierzchalski
1ca215cfea RISCV: make sure i has a uniform type.
The C parser produces abbreviations for local variables that depend on
the variable type and the order they appear in the source.

The signature for `get_avail_p_reg` on RISCV has a different type for
`i` than every other function, which causes issues when `hardware.h` is
included early in `kernel_all.c_pp`. Changing the type to `word_t`
avoids these issues.
2019-03-20 17:37:41 +11:00
Anna Lyons
d0930f67de style: consistently attach return type
Add attach-return-type to astyle
2019-03-19 14:05:36 +11:00
Anna Lyons
761006e03b style: consistently align pointer with name
Run astyle with align-pointer=name
2019-03-19 14:04:54 +11:00
Anna Lyons
3d10ef0c4d style: correct parenthesis padding
Use astyle's unpad-paren to unpad all parentheses that are not included
by pad-header, pad-oper, and pad-comma.
2019-03-19 14:02:59 +11:00
Siwei Zhuang
3914931b32 RISCV: Remove hartid and DTB parsing from the boot code. 2019-03-19 13:39:36 +11:00
Sylvain Gauthier
63ed19c9b7 handleReservedIRQ now implemented on arch level except for pc99 2019-03-14 15:23:54 +11:00
Sylvain Gauthier
330cbfbdad Made declaration of handleReservedIRQ optional, refactored consequently 2019-03-14 15:23:21 +11:00
Simon Shields
5cd3b7e317 zynqmp: Remove devices.h
These values are now autogenerated.
2019-02-15 14:05:06 +11:00
Kent McLeod
89dd2603b6 arm: Remove empty level2 cache code 2019-02-15 12:39:09 +11:00
Kent McLeod
7f34e19a43 Remove empty hardware.bf definitions
These have no effect when there aren't any definitions.
2019-02-13 14:21:04 +11:00