diff --git a/repos/base-nova/src/core/pd_session_support.cc b/repos/base-nova/src/core/pd_session_support.cc index 99a25a0a30..97f89d7872 100644 --- a/repos/base-nova/src/core/pd_session_support.cc +++ b/repos/base-nova/src/core/pd_session_support.cc @@ -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(); } diff --git a/repos/base/include/pd_session/client.h b/repos/base/include/pd_session/client.h index 11908c3f0c..da2bf03f35 100644 --- a/repos/base/include/pd_session/client.h +++ b/repos/base/include/pd_session/client.h @@ -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_ */ diff --git a/repos/base/include/pd_session/pd_session.h b/repos/base/include/pd_session/pd_session.h index 27b599320d..f926ea5028 100644 --- a/repos/base/include/pd_session/pd_session.h +++ b/repos/base/include/pd_session/pd_session.h @@ -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_ */ diff --git a/repos/base/run/platform_drv.inc b/repos/base/run/platform_drv.inc index e5396f16e3..d7de2f343a 100644 --- a/repos/base/run/platform_drv.inc +++ b/repos/base/run/platform_drv.inc @@ -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"/>} diff --git a/repos/base/src/core/include/core_env.h b/repos/base/src/core/include/core_env.h index 2b145f61d0..059a7cb306 100644 --- a/repos/base/src/core/include/core_env.h +++ b/repos/base/src/core/include/core_env.h @@ -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 */, diff --git a/repos/base/src/core/include/pd_root.h b/repos/base/src/core/include/pd_root.h index 3b78c551b0..e5655f11c8 100644 --- a/repos/base/src/core/include/pd_root.h +++ b/repos/base/src/core/include/pd_root.h @@ -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); } diff --git a/repos/base/src/core/include/pd_session_component.h b/repos/base/src/core/include/pd_session_component.h index 3ae88a0fcb..14f6230eee 100644 --- a/repos/base/src/core/include/pd_session_component.h +++ b/repos/base/src/core/include/pd_session_component.h @@ -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_ */ diff --git a/repos/base/src/core/pd_session_support.cc b/repos/base/src/core/pd_session_support.cc index 16966a8e54..e314181595 100644 --- a/repos/base/src/core/pd_session_support.cc +++ b/repos/base/src/core/pd_session_support.cc @@ -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(); } diff --git a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config b/repos/gems/recipes/raw/drivers_managed-pc/drivers.config index d6fb1116b6..2dfd804845 100644 --- a/repos/gems/recipes/raw/drivers_managed-pc/drivers.config +++ b/repos/gems/recipes/raw/drivers_managed-pc/drivers.config @@ -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"/> diff --git a/repos/gems/recipes/raw/drivers_nic-muen/drivers.config b/repos/gems/recipes/raw/drivers_nic-muen/drivers.config index 1e46b8073c..bf4d923fae 100644 --- a/repos/gems/recipes/raw/drivers_nic-muen/drivers.config +++ b/repos/gems/recipes/raw/drivers_nic-muen/drivers.config @@ -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"/> diff --git a/repos/gems/recipes/raw/drivers_nic-pc/drivers.config b/repos/gems/recipes/raw/drivers_nic-pc/drivers.config index 4148c8b8c4..95e407c6b8 100644 --- a/repos/gems/recipes/raw/drivers_nic-pc/drivers.config +++ b/repos/gems/recipes/raw/drivers_nic-pc/drivers.config @@ -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"/> diff --git a/repos/gems/run/cpu_load_display.run b/repos/gems/run/cpu_load_display.run index 085ebcfc76..cc3d640df4 100644 --- a/repos/gems/run/cpu_load_display.run +++ b/repos/gems/run/cpu_load_display.run @@ -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> diff --git a/repos/gems/run/decorator.run b/repos/gems/run/decorator.run index 0bbf7bbdf7..868bc8ccc9 100644 --- a/repos/gems/run/decorator.run +++ b/repos/gems/run/decorator.run @@ -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> diff --git a/repos/gems/run/decorator_stress.run b/repos/gems/run/decorator_stress.run index af5b41f715..5e0a9451e2 100644 --- a/repos/gems/run/decorator_stress.run +++ b/repos/gems/run/decorator_stress.run @@ -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> diff --git a/repos/gems/run/depot_deploy.run b/repos/gems/run/depot_deploy.run index b845164ae8..f9a8842b07 100644 --- a/repos/gems/run/depot_deploy.run +++ b/repos/gems/run/depot_deploy.run @@ -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> diff --git a/repos/gems/run/depot_download.run b/repos/gems/run/depot_download.run index 038313bec2..03eb5ff551 100644 --- a/repos/gems/run/depot_download.run +++ b/repos/gems/run/depot_download.run @@ -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> diff --git a/repos/gems/run/driver_manager.run b/repos/gems/run/driver_manager.run index 64e05628b8..f26810fb03 100644 --- a/repos/gems/run/driver_manager.run +++ b/repos/gems/run/driver_manager.run @@ -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"> diff --git a/repos/gems/run/gui_fader.run b/repos/gems/run/gui_fader.run index c05c9a437e..027b2e1f5c 100644 --- a/repos/gems/run/gui_fader.run +++ b/repos/gems/run/gui_fader.run @@ -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> diff --git a/repos/gems/run/leitzentrale.run b/repos/gems/run/leitzentrale.run index ea8e58ae70..57db385864 100644 --- a/repos/gems/run/leitzentrale.run +++ b/repos/gems/run/leitzentrale.run @@ -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> diff --git a/repos/gems/run/menu_view.run b/repos/gems/run/menu_view.run index 5c24831418..eaeb826ecd 100644 --- a/repos/gems/run/menu_view.run +++ b/repos/gems/run/menu_view.run @@ -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> diff --git a/repos/gems/run/nano3d.run b/repos/gems/run/nano3d.run index 4e71863780..a839ba50c3 100644 --- a/repos/gems/run/nano3d.run +++ b/repos/gems/run/nano3d.run @@ -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> diff --git a/repos/gems/run/sculpt.run b/repos/gems/run/sculpt.run index 7e03a01d42..eadf8853a5 100644 --- a/repos/gems/run/sculpt.run +++ b/repos/gems/run/sculpt.run @@ -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> diff --git a/repos/gems/run/tcp_terminal.run b/repos/gems/run/tcp_terminal.run index 35d3f5e0ff..825d915457 100644 --- a/repos/gems/run/tcp_terminal.run +++ b/repos/gems/run/tcp_terminal.run @@ -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> diff --git a/repos/gems/run/terminal_echo.run b/repos/gems/run/terminal_echo.run index 21cc8d6a71..adeb8c5c91 100644 --- a/repos/gems/run/terminal_echo.run +++ b/repos/gems/run/terminal_echo.run @@ -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> diff --git a/repos/gems/run/terminal_log.run b/repos/gems/run/terminal_log.run index ca0436911e..637b6eaec7 100644 --- a/repos/gems/run/terminal_log.run +++ b/repos/gems/run/terminal_log.run @@ -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> diff --git a/repos/gems/run/text_area.run b/repos/gems/run/text_area.run index e49771be53..049ff118a6 100644 --- a/repos/gems/run/text_area.run +++ b/repos/gems/run/text_area.run @@ -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> diff --git a/repos/gems/run/text_painter.run b/repos/gems/run/text_painter.run index 4ce0136793..0b29af7992 100644 --- a/repos/gems/run/text_painter.run +++ b/repos/gems/run/text_painter.run @@ -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> diff --git a/repos/gems/run/wm.run b/repos/gems/run/wm.run index 9701e23d22..f14afdd8a8 100644 --- a/repos/gems/run/wm.run +++ b/repos/gems/run/wm.run @@ -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> diff --git a/repos/libports/run/fetchurl.inc b/repos/libports/run/fetchurl.inc index f739d63149..a6d35ae67a 100644 --- a/repos/libports/run/fetchurl.inc +++ b/repos/libports/run/fetchurl.inc @@ -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> diff --git a/repos/libports/run/lwip.run b/repos/libports/run/lwip.run index 679c074814..eb8559f251 100644 --- a/repos/libports/run/lwip.run +++ b/repos/libports/run/lwip.run @@ -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> diff --git a/repos/libports/run/mesa.inc b/repos/libports/run/mesa.inc index 4358bb1517..9221b27ebc 100644 --- a/repos/libports/run/mesa.inc +++ b/repos/libports/run/mesa.inc @@ -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> diff --git a/repos/libports/run/mupdf.run b/repos/libports/run/mupdf.run index c663a6c469..7a385922e4 100644 --- a/repos/libports/run/mupdf.run +++ b/repos/libports/run/mupdf.run @@ -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> diff --git a/repos/libports/run/netty.inc b/repos/libports/run/netty.inc index 06e4c21d42..fc94608f40 100644 --- a/repos/libports/run/netty.inc +++ b/repos/libports/run/netty.inc @@ -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> diff --git a/repos/libports/run/netty_lwip.inc b/repos/libports/run/netty_lwip.inc index 8692cd7d70..f31a371a8f 100644 --- a/repos/libports/run/netty_lwip.inc +++ b/repos/libports/run/netty_lwip.inc @@ -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> diff --git a/repos/libports/run/nic_bridge.run b/repos/libports/run/nic_bridge.run index cef6e64ae8..7bda629683 100644 --- a/repos/libports/run/nic_bridge.run +++ b/repos/libports/run/nic_bridge.run @@ -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> diff --git a/repos/libports/run/sntp_client.run b/repos/libports/run/sntp_client.run index e8dd557e38..d381ba06a4 100644 --- a/repos/libports/run/sntp_client.run +++ b/repos/libports/run/sntp_client.run @@ -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> diff --git a/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config b/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config index c6a3c7d43f..e888030a52 100644 --- a/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-imx53_qsb/drivers.config @@ -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> diff --git a/repos/os/recipes/raw/drivers_interactive-muen/drivers.config b/repos/os/recipes/raw/drivers_interactive-muen/drivers.config index 41e7ef2a0a..9b17944d7e 100644 --- a/repos/os/recipes/raw/drivers_interactive-muen/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-muen/drivers.config @@ -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"/> diff --git a/repos/os/recipes/raw/drivers_interactive-pc/drivers.config b/repos/os/recipes/raw/drivers_interactive-pc/drivers.config index ce4f89b8a5..e051b2ad13 100644 --- a/repos/os/recipes/raw/drivers_interactive-pc/drivers.config +++ b/repos/os/recipes/raw/drivers_interactive-pc/drivers.config @@ -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"/> diff --git a/repos/os/run/demo.run b/repos/os/run/demo.run index b58ebb0073..9bf4eef4e7 100644 --- a/repos/os/run/demo.run +++ b/repos/os/run/demo.run @@ -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> diff --git a/repos/os/run/fb_bench.run b/repos/os/run/fb_bench.run index 90ab61571d..9190f03a2f 100644 --- a/repos/os/run/fb_bench.run +++ b/repos/os/run/fb_bench.run @@ -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> diff --git a/repos/os/run/framebuffer.run b/repos/os/run/framebuffer.run index 31a03b4e6b..26433ab207 100644 --- a/repos/os/run/framebuffer.run +++ b/repos/os/run/framebuffer.run @@ -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> diff --git a/repos/os/run/loader.run b/repos/os/run/loader.run index c4d057db00..4209778aca 100644 --- a/repos/os/run/loader.run +++ b/repos/os/run/loader.run @@ -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> diff --git a/repos/os/run/nic_dump.run b/repos/os/run/nic_dump.run index e938fc6900..954178862d 100644 --- a/repos/os/run/nic_dump.run +++ b/repos/os/run/nic_dump.run @@ -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> diff --git a/repos/os/run/nic_router_flood.run b/repos/os/run/nic_router_flood.run index 2acb1c8ba1..9494778e3d 100644 --- a/repos/os/run/nic_router_flood.run +++ b/repos/os/run/nic_router_flood.run @@ -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> diff --git a/repos/os/run/ping.run b/repos/os/run/ping.run index bd138ff9b5..7ee4ab1e7a 100644 --- a/repos/os/run/ping.run +++ b/repos/os/run/ping.run @@ -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> diff --git a/repos/os/run/ping_nic_router.run b/repos/os/run/ping_nic_router.run index 3f1b1c0dc9..bc428aff3c 100644 --- a/repos/os/run/ping_nic_router.run +++ b/repos/os/run/ping_nic_router.run @@ -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> diff --git a/repos/os/src/drivers/platform/spec/x86/README b/repos/os/src/drivers/platform/spec/x86/README index 762ebc44d7..83649f3b33 100644 --- a/repos/os/src/drivers/platform/spec/x86/README +++ b/repos/os/src/drivers/platform/spec/x86/README @@ -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/> diff --git a/repos/os/src/init/config.xsd b/repos/os/src/init/config.xsd index 3246d4d6bc..727b5b91e6 100644 --- a/repos/os/src/init/config.xsd +++ b/repos/os/src/init/config.xsd @@ -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" --> @@ -198,10 +197,11 @@ </xs:element> <!-- "config" --> </xs:choice> - <xs:attribute name="name" type="xs:string" /> - <xs:attribute name="ld" type="Boolean" /> - <xs:attribute name="caps" type="xs:int" /> - <xs:attribute name="priority" type="xs:int" /> + <xs:attribute name="name" type="xs:string" /> + <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" --> diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc index f13c92454c..e321df61fd 100644 --- a/repos/os/src/lib/sandbox/child.cc +++ b/repos/os/src/lib/sandbox/child.cc @@ -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"); } } } diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h index 030ccbd66d..2c213e662c 100644 --- a/repos/os/src/lib/sandbox/child.h +++ b/repos/os/src/lib/sandbox/child.h @@ -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 diff --git a/repos/ports/run/bash.run b/repos/ports/run/bash.run index abd9531006..5457a74c86 100644 --- a/repos/ports/run/bash.run +++ b/repos/ports/run/bash.run @@ -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> diff --git a/repos/ports/run/debug_nitpicker.run b/repos/ports/run/debug_nitpicker.run index 16e89bebb8..4bc00a0c30 100644 --- a/repos/ports/run/debug_nitpicker.run +++ b/repos/ports/run/debug_nitpicker.run @@ -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> diff --git a/repos/ports/run/genode_org.run b/repos/ports/run/genode_org.run index 280d2fbbaa..c36a3b7d07 100644 --- a/repos/ports/run/genode_org.run +++ b/repos/ports/run/genode_org.run @@ -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> diff --git a/repos/ports/run/lighttpd.run b/repos/ports/run/lighttpd.run index c1d78dea4d..7762237f98 100644 --- a/repos/ports/run/lighttpd.run +++ b/repos/ports/run/lighttpd.run @@ -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> diff --git a/repos/ports/run/netperf.inc b/repos/ports/run/netperf.inc index 04bd423783..4c72541031 100644 --- a/repos/ports/run/netperf.inc +++ b/repos/ports/run/netperf.inc @@ -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> diff --git a/repos/ports/run/vim.run b/repos/ports/run/vim.run index 23235ef56e..48533ca408 100644 --- a/repos/ports/run/vim.run +++ b/repos/ports/run/vim.run @@ -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> diff --git a/repos/ports/src/app/gdb_monitor/pd_session_component.h b/repos/ports/src/app/gdb_monitor/pd_session_component.h index 97fbf83d7a..e560277cdf 100644 --- a/repos/ports/src/app/gdb_monitor/pd_session_component.h +++ b/repos/ports/src/app/gdb_monitor/pd_session_component.h @@ -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_ */