core: add map method to pd_session interface

The method can be used to trigger the eager insertion of page frames into
page tables. Intention: to be used for memory used for DMA.

Issue #2209
This commit is contained in:
Alexander Boettcher 2017-08-02 17:30:49 +02:00 committed by Christian Helmuth
parent 5f35175644
commit 58e4f6cf9d
15 changed files with 47 additions and 16 deletions

View File

@ -23,7 +23,7 @@ SRC_CC += stack_area.cc \
pager_object.cc \
rpc_cap_factory_l4.cc \
ram_dataspace_factory.cc \
pd_assign_pci.cc \
pd_session_support.cc \
platform.cc \
platform_pd.cc \
platform_services.cc \
@ -60,7 +60,7 @@ vpath rpc_cap_factory_l4.cc $(GEN_CORE_DIR)
vpath ram_dataspace_factory.cc $(GEN_CORE_DIR)
vpath core_rpc_cap_alloc.cc $(GEN_CORE_DIR)
vpath core_region_map.cc $(GEN_CORE_DIR)
vpath pd_assign_pci.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath region_map_component.cc $(GEN_CORE_DIR)
vpath io_mem_session_component.cc $(GEN_CORE_DIR)

View File

@ -19,7 +19,7 @@ SRC_CC += stack_area.cc \
main.cc \
pager.cc \
pager_object.cc \
pd_assign_pci.cc \
pd_session_support.cc \
native_cpu_component.cc \
rpc_cap_factory.cc \
platform.cc \
@ -55,7 +55,7 @@ vpath default_log.cc $(GEN_CORE_DIR)
vpath io_mem_session_component.cc $(GEN_CORE_DIR)
vpath io_mem_session_support.cc $(GEN_CORE_DIR)
vpath main.cc $(GEN_CORE_DIR)
vpath pd_assign_pci.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath pd_session_component.cc $(GEN_CORE_DIR)
vpath region_map_component.cc $(GEN_CORE_DIR)

View File

@ -30,7 +30,7 @@ SRC_CC += io_mem_session_support.cc
SRC_CC += irq_session_component.cc
SRC_CC += main.cc
SRC_CC += native_pd_component.cc
SRC_CC += pd_assign_pci.cc
SRC_CC += pd_session_support.cc
SRC_CC += platform.cc
SRC_CC += platform_pd.cc
SRC_CC += platform_thread.cc

View File

@ -14,7 +14,7 @@ SRC_CC = main.cc \
cpu_session_component.cc \
cpu_session_support.cc \
cpu_thread_component.cc \
pd_assign_pci.cc \
pd_session_support.cc \
dataspace_component.cc \
native_pd_component.cc \
native_cpu_component.cc \
@ -52,7 +52,7 @@ vpath cpu_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_support.cc $(GEN_CORE_DIR)
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath pd_assign_pci.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath capability_space.cc $(GEN_CORE_DIR)
vpath rpc_cap_factory_l4.cc $(GEN_CORE_DIR)
vpath ram_dataspace_factory.cc $(GEN_CORE_DIR)

View File

@ -24,7 +24,7 @@ SRC_CC += stack_area.cc \
pager.cc \
native_cpu_component.cc \
native_pd_component.cc \
pd_assign_pci.cc \
pd_session_support.cc \
rpc_cap_factory.cc \
ram_dataspace_factory.cc \
platform.cc \

View File

@ -30,3 +30,6 @@ bool Pd_session_component::assign_pci(addr_t pci_config_memory, uint16_t bdf)
return res == Nova::NOVA_OK;
}
void Pd_session_component::map(addr_t, addr_t) { }

View File

@ -24,7 +24,7 @@ SRC_CC += stack_area.cc \
pager.cc \
pager_ep.cc \
pager_object.cc \
pd_assign_pci.cc \
pd_session_support.cc \
rpc_cap_factory_l4.cc \
ram_dataspace_factory.cc \
platform.cc \
@ -57,7 +57,7 @@ vpath capability_space.cc $(GEN_CORE_DIR)
vpath rpc_cap_factory_l4.cc $(GEN_CORE_DIR)
vpath ram_dataspace_factory.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath pd_assign_pci.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath region_map_component.cc $(GEN_CORE_DIR)
vpath io_mem_session_component.cc $(GEN_CORE_DIR)
vpath io_mem_session_support.cc $(GEN_CORE_DIR)

View File

@ -21,7 +21,7 @@ SRC_CC = stack_area.cc \
main.cc \
rpc_cap_factory_l4.cc \
ram_dataspace_factory.cc \
pd_assign_pci.cc \
pd_session_support.cc \
pager.cc \
pager_ep.cc \
pager_object.cc \
@ -51,7 +51,7 @@ vpath rom_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_support.cc $(GEN_CORE_DIR)
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
vpath pd_assign_pci.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath region_map_component.cc $(GEN_CORE_DIR)
vpath rpc_cap_factory_l4.cc $(GEN_CORE_DIR)

View File

@ -10,7 +10,7 @@ SRC_CC += \
cpu_thread_component.cc \
rpc_cap_factory.cc \
ram_dataspace_factory.cc \
pd_assign_pci.cc \
pd_session_support.cc \
io_mem_session_component.cc \
io_mem_session_support.cc \
thread_start.cc \
@ -48,7 +48,7 @@ vpath rom_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_component.cc $(GEN_CORE_DIR)
vpath cpu_session_support.cc $(GEN_CORE_DIR)
vpath cpu_thread_component.cc $(GEN_CORE_DIR)
vpath pd_assign_pci.cc $(GEN_CORE_DIR)
vpath pd_session_support.cc $(GEN_CORE_DIR)
vpath pd_upgrade_ram_quota.cc $(GEN_CORE_DIR)
vpath region_map_component.cc $(GEN_CORE_DIR)
vpath io_mem_session_component.cc $(GEN_CORE_DIR)

View File

@ -31,6 +31,8 @@ struct Genode::Pd_session_client : Rpc_client<Pd_session>
bool assign_pci(addr_t pci_config_memory_address, uint16_t bdf) override {
return call<Rpc_assign_pci>(pci_config_memory_address, bdf); }
void map(addr_t virt, addr_t size) override { call<Rpc_map>(virt, size); }
Signal_source_capability alloc_signal_source() override {
return call<Rpc_alloc_signal_source>(); }

View File

@ -68,6 +68,20 @@ struct Genode::Pd_session : Session, Ram_allocator
*/
virtual bool assign_pci(addr_t pci_config_memory_address, uint16_t bdf) = 0;
/**
* Trigger eager insertion of page frames to page table within
* specified virtual range.
*
* If the used kernel don't support this feature, the operation will
* silently ignore the request.
*
* \param virt virtual address within the address space to start
* \param size the virtual size of the region
*
* \throw Out_of_ram
* \throw Out_of_caps
*/
virtual void map(addr_t virt, addr_t size) = 0;
/********************************
** Support for the signal API **
@ -291,6 +305,9 @@ struct Genode::Pd_session : Session, Ram_allocator
GENODE_RPC(Rpc_assign_parent, void, assign_parent, Capability<Parent>);
GENODE_RPC(Rpc_assign_pci, bool, assign_pci, addr_t, uint16_t);
GENODE_RPC_THROW(Rpc_map, void, map,
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps),
addr_t, addr_t);
GENODE_RPC_THROW(Rpc_alloc_signal_source, Signal_source_capability,
alloc_signal_source,
@ -331,7 +348,7 @@ struct Genode::Pd_session : Session, Ram_allocator
GENODE_RPC(Rpc_native_pd, Capability<Native_pd>, native_pd);
GENODE_RPC_INTERFACE(Rpc_assign_parent, Rpc_assign_pci,
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,
Rpc_alloc_rpc_cap, Rpc_free_rpc_cap, Rpc_address_space,

View File

@ -178,6 +178,7 @@ class Genode::Pd_session_component : public Session_object<Pd_session>
bool assign_pci(addr_t, uint16_t) override;
void map(addr_t, addr_t) override;
/****************
** Signalling **

View File

@ -18,5 +18,7 @@
using namespace Genode;
bool Pd_session_component::assign_pci(addr_t, uint16_t) { return false; }
bool Pd_session_component::assign_pci(addr_t, uint16_t) { return true; }
void Pd_session_component::map(addr_t, addr_t) { }

View File

@ -85,6 +85,9 @@ class Gdb_monitor::Pd_session_component : public Rpc_object<Pd_session>
bool assign_pci(addr_t addr, uint16_t bdf) override {
return _pd.assign_pci(addr, bdf); }
void map(addr_t virt, addr_t size) override {
return _pd.map(virt, size); }
Signal_source_capability alloc_signal_source() override {
return _pd.alloc_signal_source(); }

View File

@ -216,6 +216,9 @@ class Noux::Pd_session_component : public Rpc_object<Pd_session>
bool assign_pci(addr_t addr, uint16_t bdf) override {
return _pd.assign_pci(addr, bdf); }
void map(addr_t virt, addr_t size) override {
return _pd.map(virt, size); }
Signal_source_capability alloc_signal_source() override
{
return _with_automatic_cap_upgrade([&] () {