History log of /seL4-camkes-master/projects/camkes-tool/camkes/templates/component.common.c
Revision Date Author Comments
# b7257d7f 11-May-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

libsel4camkes,dma: Support different cache attribs

Support registering DMA memory that is both cached and uncached and then
return memory with correct cache attributes when alloc is called.


# b2a39af0 09-Jul-2020 Oliver Scott <Oliver.Scott@data61.csiro.au>

trivial: fix style


# 9e7a741d 13-May-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

component.common.c: Use correct label for dma pool

The default label is calculated assuming that the context is a
connection end. When calling register_shared_variable from a component
context then the label needs to be provided.


# 902c76ad 05-May-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

trivial: Fix incorrect name lookup

The effect of this were some objects being named None in the capdl spec.


# 781dfdc3 04-May-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

trivial: Fix aarch64 compile warnings

These variables should already be intialized to zero.


# a7da2c08 04-May-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

component.common.c: Support additional DMA setting

Allow setting the cache and base paddr value of the DMA pool.

The base paddr value is necessary as some devices can't access memory
located at certain addresses.


# d87d6b96 28-Apr-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

component.common.c: Move init() to C constructor

Connectors that don't use threads use runtime constructors for their
initialization. This function previously was called immediately after
the runtime constructors were. Now it is called earlier with a higher
runtime constructor priority than other connectors.


# 4b6bf247 20-Apr-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

templates: recognize tcb_pool_domains option

Assign domain IDs for TCBs in the thread pool based on values provided
by the config option array values.

eg:
receiver.tcb_pool = 2;
receiver.tcb_pool_domains = [1, 1];


# 0b93736f 20-Apr-2020 Kent McLeod <Kent.Mcleod@data61.csiro.au>

templates: Correctly support TCB pool allocations

Set `resume` attribute on TCB object to false so that the loader leaves
the TCB object suspended. Also correct arguments to camkes_provide so
that the TCB object can be correctly registered with the allocator.


# e60c9511 07-Jan-2020 Jingyao Zhou <Jingyao.Zhou@data61.csiro.au>

templates: Fixes related to passive threads

Line 428: Missing a ``not''
Line 536: Changed to a more meaningful variable name
Line 818: Fixed the inconsistent format of thread names


# f7a5edc5 21-Aug-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

component.common.c: Add missing sc_control def

This definition was removed in an earlier commit during code refactor.


# 08ab632a 23-Nov-2019 Axel Heider <axelheider@gmx.de>

templates: add missing return statement


# 48957736 21-Nov-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

component.common.c: Don't call exit() from threads

When any camkes threads finish executing they call exit(). This is not
the right approach as even if the threads themselves are finished the
intention isn't to exit the process. Instead get the threads to block on
their initialisation semaphores so they become inactive.


# 5055bbb0 09-Oct-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Update FrameFill declarations to match new api

FrameFills in the capDL spec have been updated to always require
destination_offset and size parameters before the FrameFill subtype
specific parameters.


# f6d1ba48 21-Aug-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

mcs: Rename CONFIG_KERNEL_RT to CONFIG_KERNEL_MCS

This is to be consistent with the name defined in the kernel.


# 8d0ac5ca 19-Jul-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Fix DTB passthrough template code

Previously, this functionality was only tested on the CAmkES VM projects
and while it worked there, it did not work on the normal CAmkES
applications. This commit fixes the functionality to make it work with
the normal CAmkES applications.


# c12bb3fb 22-May-2019 Yu Hou <Yu.Hou@data61.csiro.au>

camkes-tool: explicitly include gen_config.h

explicitly include gen_config.h since there is going to be
no more global configuration lib


# 59f13ab2 11-Jul-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Use ROUND_UP for calculating DTB size

Previously, we used next_page_multiple, but this had a tendency to
allocate more pages than needed. We change this instead of that macro
because it's still needed to keep register mappings aligned.


# 8b7bb05c 11-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

camkes/templates: remove unused TLS region

This region was used for TLS before actual TLS became available. It is
no longer required.


# f2d1acfc 11-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

camkes/templates: provide initial static tls regions

This allows components to have multiple threads without needing a heap.


# 3c0d8132 10-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

Exit, don't exit the runtime

Camkes threads should use their own exit, rather than the runtimes, as
camkes threads don't expect the whole process to be killed on exit.


# b4130951 06-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

Use new TLS and sel4runtime support

- minimal crt0.S: construct environment in start.c and via the runtime
- update tls init to be compatible with runtime and move initialisation
to after the runtime is initialised
- wait runtime to be initialised in fault handlers


# 26ca2eda 04-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

component.common.c: move tcb_control definition

This needs to be used earlier in the file on a future commit.


# 34c1dd1c 04-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

component.common.c: more thread naming

This prepares for a change where thread naming must be done after
TLS is set up, as prior to TLS initialisation the thread does have
access to its IPC buffer and therefore cannot set its name.


# f27d7775 03-Mar-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

templates: move function definition

This needs to be used earlier in the file


# 6a1c2cb6 16-Jun-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Copy the DTB to a CAmkES managed buffer

Using the new register_fill_frames function, we ask the loader to copy
the DTB that's exposed by the kernel into a buffer. This buffer is
intended to be exposed to userland via libsel4camkes.


# 52d6f64d 15-Apr-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Remove camkes_io_port functions

libsel4camkes no longer call the IO port functions in the CAmkES common
component.


# ff076668 09-Apr-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Update DMA init call in common template

This commit updates the common component template to call the DMA init
function properly.


# b85e283d 22-Apr-2019 Damon Lee <Damon.Lee@data61.csiro.au>

libsel4camkes: Move DMA paddr and cptr functions

This commit moves the dma_get_paddr() and get_cptr() functions from the
CAmkES common template over to libsel4camkes. The new functions in
libsel4camkes iterate over the exposed DMA frames. A new helper function
has also been added. This function just returns the size of the pages
that are backing the DMA pool.


# 6454827f 09-Apr-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Expose the frames backing the DMA pool

This commit exposes the DMA frames that are backing the DMA pool into a
section in an ELF file.


# 710bf27b 09-Apr-2019 Damon Lee <Damon.Lee@data61.csiro.au>

libsel4camkes: Move io map func into libsel4camkes

Instead of relying on the dataport paddr translation functions in the
dataport related connector templates, we use the exposed dataport frame
structures instead. Thus, this allows us to move this functionality away
from the CAmkES templates and into a shared library.


# 16344d7e 13-Mar-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Call capdl_linker for final capdl spec generation

The Camkes tool is invoked in 3 or 4 phases (the extra last phase is for
integity refinement and is currently optional). The first 2 phases,
parsing the AST and then generating all of the templates are both very
camkes specific. The 3rd phase takes the ELF files for all components
and a record of all objects and caps currently allocated
(AllocatorState) and generates a capdl spec after constructing paging
objects described by the ELF files. This is pretty generic and is also
performed by non-camkes capDL projects, such as the tutorials. Using
capdl_linker.py allows more capdl internals to be transparent to the
camkes runner and reduces its complexity while also allowing the
functionality to be used in other non-camkes applications.


# 3d603600 03-Apr-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Fix camkes_io_map logic

The last comparator should be '>' and not '>=', we want to find a region
with a paddr greater than the desired one and not one whose paddr and
size equals the desired paddr.


# 487f41a3 12-Mar-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

cmake: Move config definitions to correct location

Define ones that are passed to the camkes tool in camkes.cmake and
define the ones that are used in autoconf.h in libsel4camkes. This is to
reduce the chances of the camkes tool handling a config option
differently from the code if it is present as both a cmdline option and
as an autoconfig.h variable.


# 0d3be0c7 19-Mar-2019 Damon Lee <Damon.Lee@data61.csiro.au>

templates: Allow camkes_io_map to find resources from seL4DTBHardware


# a572e4a3 02-Mar-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Filters: Set scheduling properties in templates

These properties can be set when the objects are created.


# 233e1b86 02-Mar-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Filters: Remove two more filters

- set_tcb_caps: This filter sets a thread's VSpace and CSpace caps and
sets a threads CNode size based on a config value or how many slots have
been allocated.
- guard_cnode_caps: Sets the correct guard value on any Caps to CNodes.

As the CNode object supports updating Caps that have been registered to
it whenever finalise_size() is called on it, we can call this when
finalising the total spec, and the TCB caps can be set in the template
when the TCB is created.


# 96f34db4 05-Mar-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Filters: Remove set_tcb_info filter

This filter set the following properties on a TCB:
- elf: the name of the ELF file describing the threads address space
- ip: The program counter of the thread when it is started
- sp: The stack pointer of the thread when it is started
- addr: The address of the IPC buffer for the thread
- init: An array of arguments that are given to the thread.
- sc_slot: A cap to the scheduling context of the thread if it is not
'passive'

These properties are all mostly known when the TCB objects are created
in the templates and we don't need to set them in a filter. The only
special cases are the ip, sp, and addr values that need to be set based
on the virtual address of the symbol in the ELF file. We use simpleeval
to allow the template to save a query that calculates an offset of a
virtual address corresponding to a symbol name so that the values can be
easily calculated once the ELF files are built, but the policy for what
offset into the symbol (e.g. to allow for page guards) can still be
controlled by the template. This mechanism is not Camkes specific and
could be moved into the python-capdl-tool library at a future date.


# 7669b3b0 05-Mar-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

templates: Refactor TCB creation for components

Create thread stacks, ipc buffers, scheduling contexts, and properties
in one place. Previously having this allocation occuring within a switch
statement made it very hard to understand and maintain.

Now macros.threads() returns an array of all the threads for a component
containing properties for each thread:
- name: The name used for creating objects
- interface: If the thread is an interface thread, what interface it is
for
- intra_index: Index of the thread within an interface that has more
than one thread. 0 if not an interface thread.
- stack_symbol: Name of the stack for this thread
- stack_size: Size of the stack
- ipc_symbol: Name of the ipc buffer symbol for this thread.

The template can then create resources for each thread based on the
contents of this array.


# 14686f4d 14-Feb-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

camkes_version: Remove camkes_release symbol

This symbol is statically initialised to a hash of all camkes sources.
It is being removed as it no longer refers to the actual camkes version,
and there isn't a strong need to read the version from every component.


# d12e24cf 13-Feb-2019 Japheth Lim <Japheth.Lim@data61.csiro.au>

templates: don't request cap rights for object types that don't have them


# fae5f46f 13-Feb-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

ps_io_map: Require mappings to be 4KiB aligned.

This should make it easier to catch mistakes.


# 2aa7a854 15-Jan-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

templates: Don't use c_symbol for private symbols

Many uses of c_symbol are no longer needed due to historical
refactorings. Removing them should improve readability and rendering
performance.


# 0bbd796c 15-Jan-2019 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Remove --fsupport-init flag support

This flag was mostly redundant as it is used by default and there are
no longer any motivating uses for not providing init support.


# c2f485d8 05-Dec-2018 Anna Lyons <Anna.Lyons@data61.csiro.au>

templates: update grant to grantreply on endpoints

Endpoints no longer require grant to generate reply caps on call. Add
the new reduced right 'grantreply'.


# 44177b7b 05-Dec-2018 Anna Lyons <Anna.Lyons@data61.csiro.au>

templates: remove redundant grant=False

Cap rights default to False


# 66d82e92 10-Oct-2018 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Change Camkes alignment and section linking policy

There are now special sections created by the Camkes linker script that
are aligned to each of the architecture page sizes. Symbols that require
a certain alignment in order to be backed by an underlying seL4 frame of
a certain size should declare to be in the section of that size. The
purpose of this is to drastically simplify the linking policy shared
between Camkes and the capdl python scripts that would create the
address space objects.

The linker script requirement is because a compiler/assembler is not required to
respect the `align` attribute above a certain small size and any
alignment requirements on the order of page sizes needs to be specified
by a linker script.

These changes make it possible to remove some architecture special cases
that exist in Camkes templates, which is why they are removed.

It is assumed that any of the special policy associated with the special
section names: guarded, shared_*, ignore_* and persistent can still be
implemented by using the new section name with the same alignment, eg
align_12bit for all symbols that require 4k guard pages.


# 6e709e4b 09-Oct-2018 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Use AddressSpaceAllocator for dma_pools

This removes the need for the replace_dma_frames filter. We also remove
the symbol rename in the objcopy phase as the symbol is private and
won't collide with anything else. This also means
we can remove the dma_pool_symbol entry from the filter NameMangling
list.


# 123f9b91 09-Oct-2018 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Use AddressSpaceAllocator for creating guard pages

Stacks and ipc buffers have guard pages that were implemented by running
a filter over the address space objects and deleting the frame before
and after the address regions. This way uses the AddressSpaceAllocator
to explicitly create the guarded sections when the C symbols are
defined. This remove the need for the more complex filter.


# 2827783a 09-Oct-2018 Kent McLeod <Kent.Mcleod@data61.csiro.au>

camkes: Pass default-stack-size through camkes

This makes it possible for camkes to know the default stack size without
having to build the component into an ELF file.


# 6ce14996 17-Jul-2018 Kent McLeod <Kent.Mcleod@data61.csiro.au>

Fix type error for notification_pools


# 597dfaed 04-Jul-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

Move component init interfaces to libsel4camkes

These functions are constant and will always be defined by all components and so there is need
for them to be templated. Removing them specifically from the component header also removes the
implication that they should be called by component code when they are intended for internal use
by CAmkES only.

Finally putting these definitions in a library allows them to be used by other library code in
the future, as libraries cannot include per component templates.


# ea67b771 04-Jul-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

Add missing returns values

These functions should return 0 on success, and if they reach the end without returning
early then they have succeeded.


# 61f44e90 28-Jun-2018 Adrian Danis <Adrian.Danis@data61.csiro.au>

Refactor component.template.c into multiple files

Prepares the way for supporting different environments by moving the C specific environment
code into a separate file.