mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-24 01:28:48 +00:00
Integrate CAP session into PD session
This patch integrates the functionality of the former CAP session into the PD session and unifies the approch of supplementing the generic PD session with kernel-specific functionality. The latter is achieved by the new 'Native_pd' interface. The kernel-specific interface can be obtained via the Pd_session::native_pd accessor function. The kernel-specific interfaces are named Nova_native_pd, Foc_native_pd, and Linux_native_pd. The latter change allowed for to deduplication of the pd_session_component code among the various base platforms. To retain API compatibility, we keep the 'Cap_session' and 'Cap_connection' around. But those classes have become mere wrappers around the PD session interface. Issue #1841
This commit is contained in:
committed by
Christian Helmuth
parent
b1910cdd54
commit
62b1c55399
@ -14,6 +14,10 @@
|
||||
#ifndef _INCLUDE__VMM__VCPU_DISPATCHER_H_
|
||||
#define _INCLUDE__VMM__VCPU_DISPATCHER_H_
|
||||
|
||||
/* Genode includes */
|
||||
#include <util/retry.h>
|
||||
#include <nova_native_pd/client.h>
|
||||
|
||||
namespace Vmm {
|
||||
|
||||
using namespace Genode;
|
||||
@ -33,7 +37,8 @@ class Vmm::Vcpu_dispatcher : public T
|
||||
|
||||
enum { WEIGHT = Genode::Cpu_session::DEFAULT_WEIGHT };
|
||||
|
||||
Cap_connection &_cap;
|
||||
Pd_session &_pd;
|
||||
Nova_native_pd_client _native_pd { _pd.native_pd() };
|
||||
|
||||
/**
|
||||
* Portal entry point entered on virtualization events
|
||||
@ -63,12 +68,11 @@ class Vmm::Vcpu_dispatcher : public T
|
||||
|
||||
unsigned int exit_reason = 0;
|
||||
|
||||
Vcpu_dispatcher(size_t stack_size, Cap_connection &cap,
|
||||
Vcpu_dispatcher(size_t stack_size, Pd_session &pd,
|
||||
Cpu_session * cpu_session,
|
||||
Genode::Affinity::Location location)
|
||||
:
|
||||
T(WEIGHT, "vCPU dispatcher", stack_size),
|
||||
_cap(cap)
|
||||
T(WEIGHT, "vCPU dispatcher", stack_size), _pd(pd)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -82,12 +86,12 @@ class Vmm::Vcpu_dispatcher : public T
|
||||
}
|
||||
|
||||
template <typename X>
|
||||
Vcpu_dispatcher(size_t stack_size, Cap_connection &cap,
|
||||
Vcpu_dispatcher(size_t stack_size, Pd_session &pd,
|
||||
Cpu_session * cpu_session,
|
||||
Genode::Affinity::Location location,
|
||||
X attr, void *(*start_routine) (void *), void *arg)
|
||||
: T(attr, start_routine, arg, stack_size, "vCPU dispatcher", nullptr),
|
||||
_cap(cap)
|
||||
_pd(pd)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
@ -111,11 +115,23 @@ class Vmm::Vcpu_dispatcher : public T
|
||||
void (*entry)() = &_portal_entry<EV, DISPATCHER, FUNC>;
|
||||
|
||||
/* Create the portal at the desired selector index */
|
||||
_cap.rcv_window(exc_base + EV);
|
||||
_native_pd.rcv_window(exc_base + EV);
|
||||
|
||||
Native_capability thread_cap(T::tid().ec_sel);
|
||||
Native_capability handler =
|
||||
_cap.alloc(thread_cap, (Nova::mword_t)entry, mtd.value());
|
||||
|
||||
Untyped_capability handler =
|
||||
retry<Genode::Pd_session::Out_of_metadata>(
|
||||
[&] () {
|
||||
return _native_pd.alloc_rpc_cap(thread_cap, (addr_t)entry,
|
||||
mtd.value());
|
||||
},
|
||||
[&] () {
|
||||
Pd_session_client *client =
|
||||
dynamic_cast<Pd_session_client*>(&_pd);
|
||||
|
||||
if (client)
|
||||
env()->parent()->upgrade(*client, "ram_quota=16K");
|
||||
});
|
||||
|
||||
return handler.valid() && (exc_base + EV == handler.local_name());
|
||||
}
|
||||
|
Reference in New Issue
Block a user