2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Client-side pd session interface
|
|
|
|
* \author Christian Helmuth
|
|
|
|
* \date 2006-07-12
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2006-2017 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__PD_SESSION__CLIENT_H_
|
|
|
|
#define _INCLUDE__PD_SESSION__CLIENT_H_
|
|
|
|
|
|
|
|
#include <pd_session/capability.h>
|
2017-05-11 20:03:28 +02:00
|
|
|
#include <dataspace/client.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-03-04 21:12:14 +01:00
|
|
|
namespace Genode { struct Pd_session_client; }
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
|
2015-03-04 21:12:14 +01:00
|
|
|
struct Genode::Pd_session_client : Rpc_client<Pd_session>
|
|
|
|
{
|
|
|
|
explicit Pd_session_client(Pd_session_capability session)
|
|
|
|
: Rpc_client<Pd_session>(session) { }
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2016-04-14 16:29:07 +02:00
|
|
|
void assign_parent(Capability<Parent> parent) override {
|
|
|
|
call<Rpc_assign_parent>(parent); }
|
2015-03-04 21:12:14 +01:00
|
|
|
|
2016-01-14 13:22:00 +01:00
|
|
|
bool assign_pci(addr_t pci_config_memory_address, uint16_t bdf) override {
|
|
|
|
return call<Rpc_assign_pci>(pci_config_memory_address, bdf); }
|
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Map_result map(Virt_range range) override { return call<Rpc_map>(range); }
|
2017-08-02 17:30:49 +02:00
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Signal_source_result signal_source() override {
|
|
|
|
return call<Rpc_signal_source>(); }
|
2016-01-14 13:22:00 +01:00
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
void free_signal_source(Capability<Signal_source> cap) override {
|
2016-01-14 13:22:00 +01:00
|
|
|
call<Rpc_free_signal_source>(cap); }
|
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Alloc_context_result alloc_context(Capability<Signal_source> source,
|
2024-06-12 18:06:45 +02:00
|
|
|
Imprint imprint) override {
|
2016-01-14 13:22:00 +01:00
|
|
|
return call<Rpc_alloc_context>(source, imprint); }
|
|
|
|
|
|
|
|
void free_context(Signal_context_capability cap) override {
|
|
|
|
call<Rpc_free_context>(cap); }
|
|
|
|
|
|
|
|
void submit(Signal_context_capability receiver, unsigned cnt = 1) override {
|
|
|
|
call<Rpc_submit>(receiver, cnt); }
|
2016-01-19 20:24:22 +01:00
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Alloc_rpc_cap_result alloc_rpc_cap(Native_capability ep) override {
|
2016-01-19 20:24:22 +01:00
|
|
|
return call<Rpc_alloc_rpc_cap>(ep); }
|
|
|
|
|
|
|
|
void free_rpc_cap(Native_capability cap) override {
|
|
|
|
call<Rpc_free_rpc_cap>(cap); }
|
|
|
|
|
2016-04-15 15:19:22 +02:00
|
|
|
Capability<Region_map> address_space() override {
|
|
|
|
return call<Rpc_address_space>(); }
|
|
|
|
|
|
|
|
Capability<Region_map> stack_area() override {
|
|
|
|
return call<Rpc_stack_area>(); }
|
|
|
|
|
|
|
|
Capability<Region_map> linker_area() override {
|
|
|
|
return call<Rpc_linker_area>(); }
|
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Ref_account_result ref_account(Capability<Pd_session> pd) override {
|
|
|
|
return call<Rpc_ref_account>(pd); }
|
Capability quota accounting and trading
This patch mirrors the accounting and trading scheme that Genode employs
for physical memory to the accounting of capability allocations.
Capability quotas must now be explicitly assigned to subsystems by
specifying a 'caps=<amount>' attribute to init's start nodes.
Analogously to RAM quotas, cap quotas can be traded between clients and
servers as part of the session protocol. The capability budget of each
component is maintained by the component's corresponding PD session at
core.
At the current stage, the accounting is applied to RPC capabilities,
signal-context capabilities, and dataspace capabilities. Capabilities
that are dynamically allocated via core's CPU and TRACE service are not
yet covered. Also, the capabilities allocated by resource multiplexers
outside of core (like nitpicker) must be accounted by the respective
servers, which is not covered yet.
If a component runs out of capabilities, core's PD service prints a
warning to the log. To observe the consumption of capabilities per
component in detail, the PD service is equipped with a diagnostic
mode, which can be enabled via the 'diag' attribute in the target
node of init's routing rules. E.g., the following route enables the
diagnostic mode for the PD session of the "timer" component:
<default-route>
<service name="PD" unscoped_label="timer">
<parent diag="yes"/>
</service>
...
</default-route>
For subsystems based on a sub-init instance, init can be configured
to report the capability-quota information of its subsystems by
adding the attribute 'child_caps="yes"' to init's '<report>'
config node. Init's own capability quota can be reported by adding
the attribute 'init_caps="yes"'.
Fixes #2398
2017-05-08 21:35:43 +02:00
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Transfer_cap_quota_result transfer_quota(Capability<Pd_session> pd,
|
|
|
|
Cap_quota amount) override
|
|
|
|
{
|
|
|
|
return call<Rpc_transfer_cap_quota>(pd, amount);
|
|
|
|
}
|
Capability quota accounting and trading
This patch mirrors the accounting and trading scheme that Genode employs
for physical memory to the accounting of capability allocations.
Capability quotas must now be explicitly assigned to subsystems by
specifying a 'caps=<amount>' attribute to init's start nodes.
Analogously to RAM quotas, cap quotas can be traded between clients and
servers as part of the session protocol. The capability budget of each
component is maintained by the component's corresponding PD session at
core.
At the current stage, the accounting is applied to RPC capabilities,
signal-context capabilities, and dataspace capabilities. Capabilities
that are dynamically allocated via core's CPU and TRACE service are not
yet covered. Also, the capabilities allocated by resource multiplexers
outside of core (like nitpicker) must be accounted by the respective
servers, which is not covered yet.
If a component runs out of capabilities, core's PD service prints a
warning to the log. To observe the consumption of capabilities per
component in detail, the PD service is equipped with a diagnostic
mode, which can be enabled via the 'diag' attribute in the target
node of init's routing rules. E.g., the following route enables the
diagnostic mode for the PD session of the "timer" component:
<default-route>
<service name="PD" unscoped_label="timer">
<parent diag="yes"/>
</service>
...
</default-route>
For subsystems based on a sub-init instance, init can be configured
to report the capability-quota information of its subsystems by
adding the attribute 'child_caps="yes"' to init's '<report>'
config node. Init's own capability quota can be reported by adding
the attribute 'init_caps="yes"'.
Fixes #2398
2017-05-08 21:35:43 +02:00
|
|
|
|
2019-02-14 22:39:08 +01:00
|
|
|
Cap_quota cap_quota() const override { return call<Rpc_cap_quota>(); }
|
|
|
|
Cap_quota used_caps() const override { return call<Rpc_used_caps>(); }
|
Capability quota accounting and trading
This patch mirrors the accounting and trading scheme that Genode employs
for physical memory to the accounting of capability allocations.
Capability quotas must now be explicitly assigned to subsystems by
specifying a 'caps=<amount>' attribute to init's start nodes.
Analogously to RAM quotas, cap quotas can be traded between clients and
servers as part of the session protocol. The capability budget of each
component is maintained by the component's corresponding PD session at
core.
At the current stage, the accounting is applied to RPC capabilities,
signal-context capabilities, and dataspace capabilities. Capabilities
that are dynamically allocated via core's CPU and TRACE service are not
yet covered. Also, the capabilities allocated by resource multiplexers
outside of core (like nitpicker) must be accounted by the respective
servers, which is not covered yet.
If a component runs out of capabilities, core's PD service prints a
warning to the log. To observe the consumption of capabilities per
component in detail, the PD service is equipped with a diagnostic
mode, which can be enabled via the 'diag' attribute in the target
node of init's routing rules. E.g., the following route enables the
diagnostic mode for the PD session of the "timer" component:
<default-route>
<service name="PD" unscoped_label="timer">
<parent diag="yes"/>
</service>
...
</default-route>
For subsystems based on a sub-init instance, init can be configured
to report the capability-quota information of its subsystems by
adding the attribute 'child_caps="yes"' to init's '<report>'
config node. Init's own capability quota can be reported by adding
the attribute 'init_caps="yes"'.
Fixes #2398
2017-05-08 21:35:43 +02:00
|
|
|
|
2021-11-08 21:05:11 +01:00
|
|
|
Alloc_result try_alloc(size_t size, Cache cache = CACHED) override
|
2017-05-11 20:03:28 +02:00
|
|
|
{
|
2021-11-08 21:05:11 +01:00
|
|
|
return call<Rpc_try_alloc>(size, cache);
|
2017-05-11 20:03:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void free(Ram_dataspace_capability ds) override { call<Rpc_free>(ds); }
|
|
|
|
|
|
|
|
size_t dataspace_size(Ram_dataspace_capability ds) const override
|
|
|
|
{
|
|
|
|
return ds.valid() ? Dataspace_client(ds).size() : 0;
|
|
|
|
}
|
|
|
|
|
2024-06-13 16:35:00 +02:00
|
|
|
Transfer_ram_quota_result transfer_quota(Pd_session_capability pd_session,
|
|
|
|
Ram_quota amount) override
|
|
|
|
{
|
|
|
|
return call<Rpc_transfer_ram_quota>(pd_session, amount);
|
|
|
|
}
|
2017-05-11 20:03:28 +02:00
|
|
|
|
|
|
|
Ram_quota ram_quota() const override { return call<Rpc_ram_quota>(); }
|
|
|
|
Ram_quota used_ram() const override { return call<Rpc_used_ram>(); }
|
|
|
|
|
2016-01-19 20:24:22 +01:00
|
|
|
Capability<Native_pd> native_pd() override { return call<Rpc_native_pd>(); }
|
2020-07-10 13:04:12 +02:00
|
|
|
|
2023-09-26 10:55:06 +02:00
|
|
|
Capability<System_control> system_control_cap(Affinity::Location const location) override {
|
|
|
|
return call<Rpc_system_control_cap>(location); }
|
2022-02-01 15:17:29 +01:00
|
|
|
|
|
|
|
addr_t dma_addr(Ram_dataspace_capability ds) override { return call<Rpc_dma_addr>(ds); }
|
|
|
|
|
|
|
|
Attach_dma_result attach_dma(Dataspace_capability ds, addr_t at) override {
|
|
|
|
return call<Rpc_attach_dma>(ds, at); }
|
2015-03-04 21:12:14 +01:00
|
|
|
};
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
#endif /* _INCLUDE__PD_SESSION__CLIENT_H_ */
|