base: extend PD session with managing_system call

Introduce the managing_system privilege for components like the
platform_driver to allow it to call system management functionality
that is reserved by kernel or special firmware, e.g., ARM Trusted Firmware.

The former RAM resource configuration attribute `constrain_phys`,
which enabled to constrain the region of physical RAM to be used,
gets replaced by the new, broader managing_system configuration
attribute of a `start` node. It gets enforced by the sandbox library.

Ref #3816
This commit is contained in:
Stefan Kalkowski 2020-07-10 13:04:12 +02:00 committed by Norman Feske
parent af6d2a8c54
commit 06edc0d52b
58 changed files with 183 additions and 120 deletions

View File

@ -108,3 +108,8 @@ void Pd_session_component::map(addr_t virt, addr_t size)
error(__func__, " failed ", Hex(virt), "+", Hex(size));
}
}
using State = Genode::Pd_session::Managing_system_state;
State Pd_session_component::managing_system(State const &) { return State(); }

View File

@ -93,6 +93,9 @@ struct Genode::Pd_session_client : Rpc_client<Pd_session>
Ram_quota used_ram() const override { return call<Rpc_used_ram>(); }
Capability<Native_pd> native_pd() override { return call<Rpc_native_pd>(); }
Managing_system_state managing_system(Managing_system_state const & state) override {
return call<Rpc_managing_system>(state); }
};
#endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */

View File

@ -16,6 +16,7 @@
#define _INCLUDE__PD_SESSION__PD_SESSION_H_
#include <base/exception.h>
#include <cpu/cpu_state.h>
#include <session/session.h>
#include <region_map/region_map.h>
#include <base/ram_allocator.h>
@ -298,6 +299,18 @@ struct Genode::Pd_session : Session, Ram_allocator
virtual Capability<Native_pd> native_pd() = 0;
/*******************************************
** Access to system management interface **
*******************************************/
using Managing_system_state = Cpu_state;
/**
* Call privileged system management functionality of kernel or firmware
*/
virtual Managing_system_state managing_system(Managing_system_state const &) = 0;
/*********************
** RPC declaration **
*********************/
@ -347,6 +360,9 @@ struct Genode::Pd_session : Session, Ram_allocator
GENODE_RPC(Rpc_native_pd, Capability<Native_pd>, native_pd);
GENODE_RPC(Rpc_managing_system, Managing_system_state, managing_system,
Managing_system_state const &);
GENODE_RPC_INTERFACE(Rpc_assign_parent, Rpc_assign_pci, Rpc_map,
Rpc_alloc_signal_source, Rpc_free_signal_source,
Rpc_alloc_context, Rpc_free_context, Rpc_submit,
@ -355,7 +371,7 @@ struct Genode::Pd_session : Session, Ram_allocator
Rpc_transfer_cap_quota, Rpc_cap_quota, Rpc_used_caps,
Rpc_alloc, Rpc_free,
Rpc_transfer_ram_quota, Rpc_ram_quota, Rpc_used_ram,
Rpc_native_pd);
Rpc_native_pd, Rpc_managing_system);
};
#endif /* _INCLUDE__PD_SESSION__PD_SESSION_H_ */

View File

@ -251,9 +251,9 @@ proc platform_drv_config {} {
if {[have_platform_drv]} {
append drv_config {
<start name="platform_drv" } [platform_drv_priority] { caps="800">
<start name="platform_drv" } [platform_drv_priority] { caps="800" managing_system="yes">
<binary name="} [platform_drv_binary] {"/>
<resource name="RAM" quantum="4M" constrain_phys="yes"/>
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Platform"/>}

View File

@ -72,6 +72,7 @@ class Genode::Core_env : public Env_deprecated, Noncopyable
Ram_dataspace_factory::any_phys_range(),
Ram_dataspace_factory::Virt_range { platform().vm_start(),
platform().vm_size() },
Pd_session_component::Managing_system::PERMITTED,
_region_map,
*((Pager_entrypoint *)nullptr),
"" /* args to native PD */,

View File

@ -57,6 +57,14 @@ class Genode::Pd_root : public Genode::Root_component<Genode::Pd_session_compone
platform().vm_size() };
}
static Pd_session_component::Managing_system _managing_system(char const * args)
{
return (Arg_string::find_arg(args,
"managing_system").bool_value(false))
? Pd_session_component::Managing_system::PERMITTED
: Pd_session_component::Managing_system::DENIED;
}
protected:
Pd_session_component *_create_session(const char *args) override
@ -70,6 +78,7 @@ class Genode::Pd_root : public Genode::Root_component<Genode::Pd_session_compone
_phys_alloc,
_phys_range_from_args(args),
_virt_range_from_args(args),
_managing_system(args),
_local_rm, _pager_ep, args,
_core_mem);
}

View File

@ -43,6 +43,10 @@ namespace Genode { class Pd_session_component; }
class Genode::Pd_session_component : public Session_object<Pd_session>
{
public:
enum class Managing_system { DENIED, PERMITTED };
private:
Rpc_entrypoint &_ep;
@ -64,6 +68,8 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
Region_map_component _stack_area;
Region_map_component _linker_area;
Managing_system _managing_system;
friend class Native_pd_component;
@ -122,6 +128,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
Range_allocator &phys_alloc,
Phys_range phys_range,
Virt_range virt_range,
Managing_system managing_system,
Region_map &local_rm,
Pager_entrypoint &pager_ep,
char const *args,
@ -140,7 +147,8 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
_address_space(ep, _sliced_heap, pager_ep,
virt_range.start, virt_range.size, diag),
_stack_area (ep, _sliced_heap, pager_ep, 0, stack_area_virtual_size(), diag),
_linker_area(ep, _sliced_heap, pager_ep, 0, LINKER_AREA_SIZE, diag)
_linker_area(ep, _sliced_heap, pager_ep, 0, LINKER_AREA_SIZE, diag),
_managing_system(managing_system)
{
if (platform().core_needs_platform_pd() || label != "core") {
_pd.construct(_sliced_heap, _label.string());
@ -319,6 +327,13 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
*******************************************/
Capability<Native_pd> native_pd() override { return _native_pd.cap(); }
/*******************************
** Managing system interface **
*******************************/
Managing_system_state managing_system(Managing_system_state const &) override;
};
#endif /* _CORE__INCLUDE__PD_SESSION_COMPONENT_H_ */

View File

@ -3,7 +3,7 @@
* \author Norman Feske
* \date 2016-01-13
*
* This dummy is used on all kernels with no IOMMU support.
* This dummy is used on all kernels with no IOMMU and managing system support.
*/
/*
@ -22,3 +22,6 @@ bool Pd_session_component::assign_pci(addr_t, uint16_t) { return true; }
void Pd_session_component::map(addr_t, addr_t) { }
using State = Genode::Pd_session::Managing_system_state;
State Pd_session_component::managing_system(State const &) { return State(); }

View File

@ -82,8 +82,8 @@
</route>
</start>
<start name="platform_drv" caps="400">
<resource name="RAM" quantum="4M" constrain_phys="yes"/>
<start name="platform_drv" caps="400" managing_system="yes">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Platform"/>
<service name="Acpi"/>

View File

@ -17,8 +17,8 @@
<service name="Nic">
<default-policy> <child name="nic_drv"/> </default-policy> </service>
<start name="platform_drv" caps="200">
<resource name="RAM" quantum="3M" constrain_phys="yes"/>
<start name="platform_drv" caps="200" managing_system="yes">
<resource name="RAM" quantum="3M"/>
<provides>
<service name="Platform"/>
<service name="Acpi"/>

View File

@ -47,8 +47,8 @@
</route>
</start>
<start name="platform_drv" caps="210">
<resource name="RAM" quantum="3M" constrain_phys="yes"/>
<start name="platform_drv" caps="210" managing_system="yes">
<resource name="RAM" quantum="3M"/>
<provides>
<service name="Platform"/>
<service name="Acpi"/>

View File

@ -32,8 +32,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -34,8 +34,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -36,8 +36,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -45,8 +45,8 @@ install_config {
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -57,8 +57,8 @@ append config {
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -46,8 +46,8 @@ install_config {
</config>
</start>
<start name="drivers" caps="2500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="2500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label_last="managed/event_filter">

View File

@ -31,8 +31,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -65,8 +65,8 @@ install_config {
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -35,8 +35,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -26,8 +26,8 @@ append config {
</default-route>
<default caps="100"/>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -231,8 +231,8 @@ install_config {
</route>
</start>
<start name="drivers" caps="3000" priority="-1">
<resource name="RAM" quantum="96M" constrain_phys="yes"/>
<start name="drivers" caps="3000" priority="-1" managing_system="yes">
<resource name="RAM" quantum="96M"/>
<binary name="init"/>
<route>
<service name="LOG"> <child name="log"/> </service>

View File

@ -43,8 +43,8 @@ install_config {
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -31,8 +31,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -35,8 +35,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -35,8 +35,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -33,8 +33,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -38,8 +38,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -79,8 +79,8 @@ install_config {
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -61,8 +61,8 @@ install_config {
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -48,8 +48,8 @@ set config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -34,8 +34,8 @@ set config {
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -32,8 +32,8 @@ append config {
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -28,8 +28,8 @@ append config {
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -42,8 +42,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -48,8 +48,8 @@ append config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -15,9 +15,12 @@
<default caps="60"/>
<start name="platform_drv" caps="200">
<service name="Input">
<default-policy> <child name="dummy_input_drv"/> </default-policy> </service>
<start name="platform_drv" caps="200" managing_system="yes">
<binary name="imx53_platform_drv"/>
<resource name="RAM" quantum="3M" constrain_phys="yes"/>
<resource name="RAM" quantum="3M"/>
<provides>
<service name="Platform"/>
</provides>

View File

@ -16,8 +16,11 @@
<default caps="60"/>
<start name="platform_drv" caps="200">
<resource name="RAM" quantum="3M" constrain_phys="yes"/>
<service name="Input">
<default-policy> <child name="input_filter"/> </default-policy> </service>
<start name="platform_drv" caps="200" managing_system="yes">
<resource name="RAM" quantum="3M"/>
<provides>
<service name="Platform"/>
<service name="Acpi"/>

View File

@ -46,8 +46,8 @@
</route>
</start>
<start name="platform_drv" caps="200">
<resource name="RAM" quantum="3M" constrain_phys="yes"/>
<start name="platform_drv" caps="200" managing_system="yes">
<resource name="RAM" quantum="3M"/>
<provides>
<service name="Platform"/>
<service name="Acpi"/>

View File

@ -41,8 +41,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -42,8 +42,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="120M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="120M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -27,8 +27,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -31,8 +31,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -48,8 +48,8 @@ append config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -51,8 +51,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -46,8 +46,8 @@ append config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -48,8 +48,8 @@ append config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="drivers" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -22,8 +22,8 @@ A policy may contain several nodes describing several devices. The entries of
a policy may describe PCI devices as non PCI devices. A PCI device is
explicitly configured by the triple 'bus', 'device', 'function':
!<start name="platform_drv">
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
!<start name="platform_drv" managing_system="yes">
! <resource name="RAM" quantum="8M"/>
! ...
! <config>
! <policy label_prefix="usb_drv">
@ -35,8 +35,8 @@ explicitly configured by the triple 'bus', 'device', 'function':
or more fuzzy by a device class alias:
!<start name="platform_drv">
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
!<start name="platform_drv" managing_system="yes">
! <resource name="RAM" quantum="8M"/>
! ...
! <config>
! <policy label_prefix="usb_drv">
@ -48,8 +48,8 @@ or more fuzzy by a device class alias:
Non PCI devices, as the PS2 controller are named by a "device" node in the policy:
!<start name="platform_drv">
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
!<start name="platform_drv" managing_system="yes">
! <resource name="RAM" quantum="8M"/>
! <config>
! <policy label_prefix="ps2_drv">
! <device name="PS2/>
@ -69,8 +69,8 @@ discovery by the client with the fuzzy pci class policy.
By default the driver will try to use MSIs if the device and the used kernel
supports it. This behaviour can be overwritten:
!<start name="platform_drv">
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
!<start name="platform_drv" managing_system="yes">
! <resource name="RAM" quantum="8M"/>
! <config>
! <policy label_prefix="nic_drv" irq_mode="nomsi">
! ...
@ -78,7 +78,7 @@ supports it. This behaviour can be overwritten:
! </config>
! ...
The constrain_phys attribute is evaluated by init. If set to "yes" it
The managing_system attribute is evaluated by init. If set to "yes" it
permits a component, the platform driver, to restrict the allocation of memory to
specific physical RAM ranges. The platform driver uses this feature to ensure that
the allocation of DMA capable memory consider several restrictions. For
@ -86,6 +86,8 @@ example, some drivers, as the UHCI controller, requires a
physical memory address below 4G. Another example is that on 32bit hosts
physical to virtual identical mappings of DMA memory for the device_pd
(required when IOMMU is used) must be below the kernel memory boundary (3G).
On some systems, e.g., base-hw kernel on certain ARM platforms, it allows the
platform driver to call system management firmware via kernel syscalls.
The platform driver waits on startup on the first valid ACPI report, typically
provided dynamically by the acpi driver.
@ -151,8 +153,8 @@ Supported non PCI devices
The driver provides for the PS2 and PIT device the IO_PORT and IRQ resources.
!<start name="platform_drv">
! <resource name="RAM" quantum="8M" constrain_phys="yes"/>
!<start name="platform_drv" managing_system="yes">
! <resource name="RAM" quantum="8M"/>
! <config>
! <policy label_prefix="ps2_drv">
! <dev name="PS2/>

View File

@ -164,7 +164,6 @@
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="quantum" type="Number_of_bytes" />
<xs:attribute name="constrain_phys" type="Boolean" />
</xs:complexType>
</xs:element> <!-- "resource" -->
@ -202,6 +201,7 @@
<xs:attribute name="ld" type="Boolean" />
<xs:attribute name="caps" type="xs:int" />
<xs:attribute name="priority" type="xs:int" />
<xs:attribute name="managing_system" type="Boolean" />
</xs:complexType>
</xs:element> <!-- "start" -->

View File

@ -625,7 +625,7 @@ void Sandbox::Child::filter_session_args(Service::Name const &service,
* allocating DMA memory (as the only use case for the constrain-phys
* mechanism).
*/
if (_constrain_phys) {
if (_managing_system) {
addr_t start = 0;
addr_t size = (sizeof(long) == 4) ? 0xc0000000UL : 0x100000000UL;
@ -634,9 +634,11 @@ void Sandbox::Child::filter_session_args(Service::Name const &service,
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());
Arg_string::set_arg(args, args_len, "managing_system", "yes");
} else {
Arg_string::remove_arg(args, "phys_start");
Arg_string::remove_arg(args, "phys_size");
Arg_string::remove_arg(args, "managing_system");
}
}
}

View File

@ -163,7 +163,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
Ram_quota assigned_ram_quota;
Cap_quota assigned_cap_quota;
size_t cpu_quota_pc;
bool constrain_phys;
Ram_quota effective_ram_quota() const
{
@ -197,7 +196,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
Cap_quota default_cap_quota, Cap_quota)
{
size_t cpu_quota_pc = 0;
bool constrain_phys = false;
Number_of_bytes ram_bytes = 0;
size_t caps = start_node.attribute_value("caps", default_cap_quota.value);
@ -209,7 +207,6 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
if (name == "RAM") {
ram_bytes = rsc.attribute_value("quantum", ram_bytes);
constrain_phys = rsc.attribute_value("constrain_phys", false);
}
if (name == "CPU") {
@ -227,8 +224,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
affinity_location_from_xml(affinity_space, start_node)),
Ram_quota { ram_bytes },
Cap_quota { caps },
cpu_quota_pc,
constrain_phys };
cpu_quota_pc };
}
Resources _resources;
@ -322,10 +318,11 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
long const _priority { _resources.priority };
/**
* If set to true, the child is allowed to constrain physical RAM
* allocations.
* If set to true, the child is allowed to do system management,
* e.g., constrain physical RAM allocations.
*/
bool const _constrain_phys { _resources.constrain_phys };
bool const _managing_system {
_start_node->xml().attribute_value("managing_system", false) };
/**
* Resource request initiated by the child

View File

@ -50,8 +50,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -66,8 +66,8 @@ install_config {
</config>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -45,8 +45,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="nic_drv" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="nic_drv" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -56,8 +56,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="nic_drv" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="nic_drv" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -206,8 +206,8 @@ append config { </wifi_config>
</start> }
} else {
append config {
<start name="nic_drv" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<start name="nic_drv" caps="1000" managing_system="yes">
<resource name="RAM" quantum="32M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -41,8 +41,8 @@ install_config {
<provides><service name="Timer"/></provides>
</start>
<start name="drivers" caps="1500">
<resource name="RAM" quantum="64M" constrain_phys="yes"/>
<start name="drivers" caps="1500" managing_system="yes">
<resource name="RAM" quantum="64M"/>
<binary name="init"/>
<route>
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>

View File

@ -144,6 +144,10 @@ class Gdb_monitor::Pd_session_component : public Rpc_object<Pd_session>
Capability<Native_pd> native_pd() override {
return _pd.native_pd(); }
Managing_system_state
managing_system(Managing_system_state const & state) override {
return _pd.managing_system(state); }
};
#endif /* _PD_SESSION_COMPONENT_H_ */