mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-21 00:23:16 +00:00
init: Read affinity assignments from config
The assignment of affinities consists of two parts, the definition of the affinity space dimensions as used for the init process, and the association sub systems with affinity locations (relative to the affinity space). The affinity space is configured as a sub node of the config node. For example, the following declaration describes an affinity space of 4x2: <config> ... <affinity_space width="4" height="2" /> ... </config> Subsystems can be constrained to parts of the affinity space using the '<affinity>' sub node of a '<start>' entry: <config> ... <start name="loader"> <affinity xpos="0" ypos="1" width="2" height="1" /> ... </start> ... </config>
This commit is contained in:
@ -24,7 +24,7 @@ namespace Init { bool config_verbose = false; }
|
||||
***************/
|
||||
|
||||
/**
|
||||
* Read priority-levels declaration from config file
|
||||
* Read priority-levels declaration from config
|
||||
*/
|
||||
inline long read_prio_levels_log2()
|
||||
{
|
||||
@ -44,7 +44,26 @@ inline long read_prio_levels_log2()
|
||||
|
||||
|
||||
/**
|
||||
* Read parent-provided services from config file
|
||||
* Read affinity-space parameters from config
|
||||
*
|
||||
* If no affinity space is declared, construct a space with a single element,
|
||||
* width and height being 1. If only one of both dimensions is specified, the
|
||||
* other dimension is set to 1.
|
||||
*/
|
||||
inline Genode::Affinity::Space read_affinity_space()
|
||||
{
|
||||
using namespace Genode;
|
||||
try {
|
||||
Xml_node node = config()->xml_node().sub_node("affinity-space");
|
||||
return Affinity::Space(node.attribute_value<unsigned long>("width", 1),
|
||||
node.attribute_value<unsigned long>("height", 1));
|
||||
} catch (...) {
|
||||
return Affinity::Space(1, 1); }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read parent-provided services from config
|
||||
*/
|
||||
inline void determine_parent_services(Genode::Service_registry *services)
|
||||
{
|
||||
@ -192,6 +211,7 @@ int main(int, char **)
|
||||
children.insert(new (env()->heap())
|
||||
Init::Child(start_node, default_route_node,
|
||||
&children, read_prio_levels_log2(),
|
||||
read_affinity_space(),
|
||||
&parent_services, &child_services, &cap));
|
||||
}
|
||||
catch (Rom_connection::Rom_connection_failed) {
|
||||
|
Reference in New Issue
Block a user