mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
init: heuristics for DMA buffer allocations
If a child is allowed to constrain physical memory allocations but left the 'phys_start' and 'phys_size' session arguments blank, init applies builtin constraints for allocating DMA buffers. The only component that makes use of the physical-memory constraint feature is the platform driver. Since the built-in heuristics are applied to the platform driver's environment RAM session, all allocations performed by the platform driver satisfy the DMA constraints. To justify building-in these heuristics into init as opposed to supplying the values as configuration arguments, the values differ between 32 and 64 bit. The configuration approach would raise the need to differentiate init configurations for both cases, which are completely identical otherwise. Issue #2407
This commit is contained in:
parent
420b66a1f0
commit
3fc2a798b2
@ -572,9 +572,28 @@ void Init::Child::filter_session_args(Service::Name const &service,
|
||||
* Remove phys_start and phys_size RAM-session arguments unless
|
||||
* explicitly permitted by the child configuration.
|
||||
*/
|
||||
if (service == "RAM" && !_constrain_phys) {
|
||||
Arg_string::remove_arg(args, "phys_start");
|
||||
Arg_string::remove_arg(args, "phys_size");
|
||||
if (service == "RAM") {
|
||||
|
||||
/*
|
||||
* If the child is allowed to constrain physical memory allocations,
|
||||
* pass the child-provided constraints as session arguments to core.
|
||||
* If no constraints are specified, we apply the constraints for
|
||||
* allocating DMA memory (as the only use case for the constrain-phys
|
||||
* mechanism).
|
||||
*/
|
||||
if (_constrain_phys) {
|
||||
addr_t start = 0;
|
||||
addr_t size = (sizeof(long) == 4) ? 0xc0000000UL : 0x100000000UL;
|
||||
|
||||
Arg_string::find_arg(args, "phys_start").ulong_value(start);
|
||||
Arg_string::find_arg(args, "phys_size") .ulong_value(size);
|
||||
|
||||
Arg_string::set_arg(args, args_len, "phys_start", String<32>(Hex(start)).string());
|
||||
Arg_string::set_arg(args, args_len, "phys_size", String<32>(Hex(size)) .string());
|
||||
} else {
|
||||
Arg_string::remove_arg(args, "phys_start");
|
||||
Arg_string::remove_arg(args, "phys_size");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user