parent
dca144f2ee
commit
05fa063068
|
@ -25,6 +25,8 @@
|
||||||
#include <dataspace_component.h>
|
#include <dataspace_component.h>
|
||||||
#include <region_map_component.h>
|
#include <region_map_component.h>
|
||||||
|
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
namespace Genode { class Vm_session_component; struct Vcpu; }
|
namespace Genode { class Vm_session_component; struct Vcpu; }
|
||||||
|
|
||||||
struct Genode::Vcpu : Genode::List<Vcpu>::Element
|
struct Genode::Vcpu : Genode::List<Vcpu>::Element
|
||||||
|
@ -83,7 +85,8 @@ class Genode::Vm_session_component
|
||||||
using Cap_quota_guard::upgrade;
|
using Cap_quota_guard::upgrade;
|
||||||
|
|
||||||
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
||||||
Diag, Ram_allocator &ram, Region_map &, unsigned);
|
Diag, Ram_allocator &ram, Region_map &, unsigned,
|
||||||
|
Trace::Source_registry &);
|
||||||
~Vm_session_component();
|
~Vm_session_component();
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
|
|
|
@ -20,12 +20,13 @@
|
||||||
/*
|
/*
|
||||||
* Add x86 specific services
|
* Add x86 specific services
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &heap,
|
Sliced_heap &heap,
|
||||||
Registry<Service> &services)
|
Registry<Service> &services,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
{
|
{
|
||||||
static Vm_root vm_root(ep, heap, core_env().ram_allocator(),
|
static Vm_root vm_root(ep, heap, core_env().ram_allocator(),
|
||||||
core_env().local_rm());
|
core_env().local_rm(), trace_sources);
|
||||||
static Core_service<Vm_session_component> vm(services, vm_root);
|
static Core_service<Vm_session_component> vm(services, vm_root);
|
||||||
|
|
||||||
static Io_port_root io_root(*core_env().pd_session(),
|
static Io_port_root io_root(*core_env().pd_session(),
|
||||||
|
|
|
@ -34,7 +34,8 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||||
Diag,
|
Diag,
|
||||||
Ram_allocator &ram,
|
Ram_allocator &ram,
|
||||||
Region_map &local_rm,
|
Region_map &local_rm,
|
||||||
unsigned)
|
unsigned,
|
||||||
|
Trace::Source_registry &)
|
||||||
:
|
:
|
||||||
Ram_quota_guard(resources.ram_quota),
|
Ram_quota_guard(resources.ram_quota),
|
||||||
Cap_quota_guard(resources.cap_quota),
|
Cap_quota_guard(resources.cap_quota),
|
||||||
|
|
|
@ -34,7 +34,7 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint &ds_ep,
|
||||||
Diag,
|
Diag,
|
||||||
Ram_allocator &ram_alloc,
|
Ram_allocator &ram_alloc,
|
||||||
Region_map ®ion_map,
|
Region_map ®ion_map,
|
||||||
unsigned)
|
unsigned, Trace::Source_registry &)
|
||||||
:
|
:
|
||||||
Ram_quota_guard(resources.ram_quota),
|
Ram_quota_guard(resources.ram_quota),
|
||||||
Cap_quota_guard(resources.cap_quota),
|
Cap_quota_guard(resources.cap_quota),
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <base/session_object.h>
|
#include <base/session_object.h>
|
||||||
#include <vm_session/vm_session.h>
|
#include <vm_session/vm_session.h>
|
||||||
#include <dataspace/capability.h>
|
#include <dataspace/capability.h>
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
/* Core includes */
|
/* Core includes */
|
||||||
#include <object.h>
|
#include <object.h>
|
||||||
|
@ -68,7 +69,7 @@ class Genode::Vm_session_component
|
||||||
|
|
||||||
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
||||||
Diag, Ram_allocator &ram, Region_map &,
|
Diag, Ram_allocator &ram, Region_map &,
|
||||||
unsigned priority);
|
unsigned priority, Trace::Source_registry &);
|
||||||
~Vm_session_component();
|
~Vm_session_component();
|
||||||
|
|
||||||
/**************************
|
/**************************
|
||||||
|
|
|
@ -93,7 +93,8 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint &ds_ep,
|
||||||
Diag,
|
Diag,
|
||||||
Ram_allocator &ram_alloc,
|
Ram_allocator &ram_alloc,
|
||||||
Region_map ®ion_map,
|
Region_map ®ion_map,
|
||||||
unsigned)
|
unsigned,
|
||||||
|
Trace::Source_registry &)
|
||||||
:
|
:
|
||||||
Ram_quota_guard(resources.ram_quota),
|
Ram_quota_guard(resources.ram_quota),
|
||||||
Cap_quota_guard(resources.cap_quota),
|
Cap_quota_guard(resources.cap_quota),
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include <translation_table.h>
|
#include <translation_table.h>
|
||||||
#include <kernel/vm.h>
|
#include <kernel/vm.h>
|
||||||
|
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
class Vm_session_component;
|
class Vm_session_component;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +88,8 @@ class Genode::Vm_session_component
|
||||||
using Rpc_object<Vm_session, Vm_session_component>::cap;
|
using Rpc_object<Vm_session, Vm_session_component>::cap;
|
||||||
|
|
||||||
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
||||||
Diag, Ram_allocator &ram, Region_map &, unsigned);
|
Diag, Ram_allocator &ram, Region_map &, unsigned,
|
||||||
|
Trace::Source_registry &);
|
||||||
~Vm_session_component();
|
~Vm_session_component();
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
|
|
|
@ -29,9 +29,10 @@ extern Genode::addr_t hypervisor_exception_vector;
|
||||||
/*
|
/*
|
||||||
* Add ARM virtualization specific vm service
|
* Add ARM virtualization specific vm service
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &sh,
|
Sliced_heap &sh,
|
||||||
Registry<Service> &services)
|
Registry<Service> &services,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
{
|
{
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
@ -40,6 +41,6 @@ void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Hw::PAGE_FLAGS_KERN_TEXT);
|
Hw::PAGE_FLAGS_KERN_TEXT);
|
||||||
|
|
||||||
static Vm_root vm_root(ep, sh, core_env().ram_allocator(),
|
static Vm_root vm_root(ep, sh, core_env().ram_allocator(),
|
||||||
core_env().local_rm());
|
core_env().local_rm(), trace_sources);
|
||||||
static Core_service<Vm_session_component> vm_service(services, vm_root);
|
static Core_service<Vm_session_component> vm_service(services, vm_root);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,15 +28,16 @@ extern int monitor_mode_exception_vector;
|
||||||
/*
|
/*
|
||||||
* Add TrustZone specific vm service
|
* Add TrustZone specific vm service
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &sliced_heap,
|
Sliced_heap &sliced_heap,
|
||||||
Registry<Service> &local_services)
|
Registry<Service> &local_services,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
{
|
{
|
||||||
static addr_t const phys_base =
|
static addr_t const phys_base =
|
||||||
Platform::core_phys_addr((addr_t)&monitor_mode_exception_vector);
|
Platform::core_phys_addr((addr_t)&monitor_mode_exception_vector);
|
||||||
map_local(phys_base, Hw::Mm::system_exception_vector().base, 1,
|
map_local(phys_base, Hw::Mm::system_exception_vector().base, 1,
|
||||||
Hw::PAGE_FLAGS_KERN_TEXT);
|
Hw::PAGE_FLAGS_KERN_TEXT);
|
||||||
static Vm_root vm_root(ep, sliced_heap, core_env().ram_allocator(),
|
static Vm_root vm_root(ep, sliced_heap, core_env().ram_allocator(),
|
||||||
core_env().local_rm());
|
core_env().local_rm(), trace_sources);
|
||||||
static Core_service<Vm_session_component> vm_service(local_services, vm_root);
|
static Core_service<Vm_session_component> vm_service(local_services, vm_root);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,12 +24,13 @@
|
||||||
/*
|
/*
|
||||||
* Add I/O port service and virtualization specific vm service
|
* Add I/O port service and virtualization specific vm service
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &sliced_heap,
|
Sliced_heap &sliced_heap,
|
||||||
Registry<Service> &services)
|
Registry<Service> &services,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
{
|
{
|
||||||
static Vm_root vm_root(ep, sliced_heap, core_env().ram_allocator(),
|
static Vm_root vm_root(ep, sliced_heap, core_env().ram_allocator(),
|
||||||
core_env().local_rm());
|
core_env().local_rm(), trace_sources);
|
||||||
static Core_service<Vm_session_component> vm_ls(services, vm_root);
|
static Core_service<Vm_session_component> vm_ls(services, vm_root);
|
||||||
|
|
||||||
static Io_port_root io_port_root(*core_env().pd_session(),
|
static Io_port_root io_port_root(*core_env().pd_session(),
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <base/rpc_server.h>
|
#include <base/rpc_server.h>
|
||||||
#include <vm_session/vm_session.h>
|
#include <vm_session/vm_session.h>
|
||||||
#include <dataspace/capability.h>
|
#include <dataspace/capability.h>
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
/* Core includes */
|
/* Core includes */
|
||||||
#include <dataspace_component.h>
|
#include <dataspace_component.h>
|
||||||
|
@ -45,7 +46,8 @@ class Genode::Vm_session_component
|
||||||
|
|
||||||
Vm_session_component(Rpc_entrypoint &, Resources resources,
|
Vm_session_component(Rpc_entrypoint &, Resources resources,
|
||||||
Label const &, Diag, Ram_allocator &,
|
Label const &, Diag, Ram_allocator &,
|
||||||
Region_map &, unsigned)
|
Region_map &, unsigned,
|
||||||
|
Trace::Source_registry &)
|
||||||
:
|
:
|
||||||
Ram_quota_guard(resources.ram_quota),
|
Ram_quota_guard(resources.ram_quota),
|
||||||
Cap_quota_guard(resources.cap_quota),
|
Cap_quota_guard(resources.cap_quota),
|
||||||
|
|
|
@ -17,8 +17,12 @@
|
||||||
/* Genode includes */
|
/* Genode includes */
|
||||||
#include <base/allocator_guard.h>
|
#include <base/allocator_guard.h>
|
||||||
#include <base/rpc_server.h>
|
#include <base/rpc_server.h>
|
||||||
|
|
||||||
#include <vm_session/vm_session.h>
|
#include <vm_session/vm_session.h>
|
||||||
|
|
||||||
|
#include <trace/control_area.h>
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
namespace Genode { class Vm_session_component; }
|
namespace Genode { class Vm_session_component; }
|
||||||
|
|
||||||
class Genode::Vm_session_component
|
class Genode::Vm_session_component
|
||||||
|
@ -33,7 +37,12 @@ class Genode::Vm_session_component
|
||||||
typedef Constrained_ram_allocator Con_ram_allocator;
|
typedef Constrained_ram_allocator Con_ram_allocator;
|
||||||
typedef Allocator_avl_tpl<Rm_region> Avl_region;
|
typedef Allocator_avl_tpl<Rm_region> Avl_region;
|
||||||
|
|
||||||
class Vcpu : public List<Vcpu>::Element {
|
class Vcpu : private List<Vcpu>::Element,
|
||||||
|
public Trace::Source::Info_accessor
|
||||||
|
{
|
||||||
|
|
||||||
|
friend class List<Vcpu>;
|
||||||
|
friend class Vm_session_component;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -43,17 +52,23 @@ class Genode::Vm_session_component
|
||||||
|
|
||||||
Constrained_ram_allocator &_ram_alloc;
|
Constrained_ram_allocator &_ram_alloc;
|
||||||
Cap_quota_guard &_cap_alloc;
|
Cap_quota_guard &_cap_alloc;
|
||||||
|
Trace::Source_registry &_trace_sources;
|
||||||
Ram_dataspace_capability _ds_cap { };
|
Ram_dataspace_capability _ds_cap { };
|
||||||
addr_t _sel_sm_ec_sc;
|
addr_t _sel_sm_ec_sc;
|
||||||
addr_t _vm_pt_cnt { 0 };
|
addr_t _vm_pt_cnt { 0 };
|
||||||
Vcpu_id const _id;
|
Vcpu_id const _id;
|
||||||
State _state { INIT };
|
State _state { INIT };
|
||||||
|
Affinity::Location const _location;
|
||||||
|
Session_label const &_label;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Vcpu(Constrained_ram_allocator &ram_alloc,
|
Vcpu(Constrained_ram_allocator &ram_alloc,
|
||||||
Cap_quota_guard &cap_alloc,
|
Cap_quota_guard &cap_alloc,
|
||||||
Vcpu_id const id);
|
Vcpu_id const id, Affinity::Location const,
|
||||||
|
Session_label const &,
|
||||||
|
Trace::Control_area &,
|
||||||
|
Trace::Source_registry &);
|
||||||
|
|
||||||
~Vcpu();
|
~Vcpu();
|
||||||
|
|
||||||
|
@ -70,17 +85,55 @@ class Genode::Vm_session_component
|
||||||
void alive() { _state = ALIVE; };
|
void alive() { _state = ALIVE; };
|
||||||
|
|
||||||
static addr_t invalid() { return ~0UL; }
|
static addr_t invalid() { return ~0UL; }
|
||||||
|
|
||||||
|
/********************************************
|
||||||
|
** Trace::Source::Info_accessor interface **
|
||||||
|
********************************************/
|
||||||
|
|
||||||
|
Trace::Source::Info trace_source_info() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
struct Trace_control_slot
|
||||||
|
{
|
||||||
|
unsigned index = 0;
|
||||||
|
Trace::Control_area &_trace_control_area;
|
||||||
|
|
||||||
|
Trace_control_slot(Trace::Control_area &trace_control_area)
|
||||||
|
: _trace_control_area(trace_control_area)
|
||||||
|
{
|
||||||
|
if (!_trace_control_area.alloc(index))
|
||||||
|
throw Out_of_ram();
|
||||||
|
}
|
||||||
|
|
||||||
|
~Trace_control_slot()
|
||||||
|
{
|
||||||
|
_trace_control_area.free(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
Trace::Control &control()
|
||||||
|
{
|
||||||
|
return *_trace_control_area.at(index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Trace_control_slot _trace_control_slot;
|
||||||
|
|
||||||
|
Trace::Source _trace_source { *this, _trace_control_slot.control() };
|
||||||
};
|
};
|
||||||
|
|
||||||
Rpc_entrypoint &_ep;
|
Rpc_entrypoint &_ep;
|
||||||
Con_ram_allocator _constrained_md_ram_alloc;
|
Trace::Control_area _trace_control_area;
|
||||||
Sliced_heap _heap;
|
Trace::Source_registry &_trace_sources;
|
||||||
Avl_region _map { &_heap };
|
Con_ram_allocator _constrained_md_ram_alloc;
|
||||||
addr_t _pd_sel { 0 };
|
Sliced_heap _heap;
|
||||||
unsigned _id_alloc { 0 };
|
Avl_region _map { &_heap };
|
||||||
unsigned _priority;
|
addr_t _pd_sel { 0 };
|
||||||
|
unsigned _id_alloc { 0 };
|
||||||
|
unsigned _priority;
|
||||||
|
Session_label const _session_label;
|
||||||
|
|
||||||
List<Vcpu> _vcpus { };
|
List<Vcpu> _vcpus { };
|
||||||
|
|
||||||
Vcpu * _lookup(Vcpu_id const vcpu_id)
|
Vcpu * _lookup(Vcpu_id const vcpu_id)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +157,8 @@ class Genode::Vm_session_component
|
||||||
using Cap_quota_guard::upgrade;
|
using Cap_quota_guard::upgrade;
|
||||||
|
|
||||||
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
||||||
Diag, Ram_allocator &ram, Region_map &, unsigned);
|
Diag, Ram_allocator &ram, Region_map &, unsigned,
|
||||||
|
Trace::Source_registry &);
|
||||||
~Vm_session_component();
|
~Vm_session_component();
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
|
|
|
@ -20,12 +20,13 @@
|
||||||
/*
|
/*
|
||||||
* Add x86 specific services
|
* Add x86 specific services
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &heap,
|
Sliced_heap &heap,
|
||||||
Registry<Service> &services)
|
Registry<Service> &services,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
{
|
{
|
||||||
static Vm_root vm_root(ep, heap, core_env().ram_allocator(),
|
static Vm_root vm_root(ep, heap, core_env().ram_allocator(),
|
||||||
core_env().local_rm());
|
core_env().local_rm(), trace_sources);
|
||||||
static Core_service<Vm_session_component> vm(services, vm_root);
|
static Core_service<Vm_session_component> vm(services, vm_root);
|
||||||
|
|
||||||
static Io_port_root io_root(*core_env().pd_session(),
|
static Io_port_root io_root(*core_env().pd_session(),
|
||||||
|
|
|
@ -37,12 +37,20 @@ enum { CAP_RANGE_LOG2 = 2, CAP_RANGE = 1 << CAP_RANGE_LOG2 };
|
||||||
|
|
||||||
Vm_session_component::Vcpu::Vcpu(Constrained_ram_allocator &ram_alloc,
|
Vm_session_component::Vcpu::Vcpu(Constrained_ram_allocator &ram_alloc,
|
||||||
Cap_quota_guard &cap_alloc,
|
Cap_quota_guard &cap_alloc,
|
||||||
Vcpu_id const id)
|
Vcpu_id const id,
|
||||||
|
Affinity::Location const location,
|
||||||
|
Session_label const &label,
|
||||||
|
Trace::Control_area &trace_control_area,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
:
|
:
|
||||||
_ram_alloc(ram_alloc),
|
_ram_alloc(ram_alloc),
|
||||||
_cap_alloc(cap_alloc),
|
_cap_alloc(cap_alloc),
|
||||||
|
_trace_sources(trace_sources),
|
||||||
_sel_sm_ec_sc(invalid()),
|
_sel_sm_ec_sc(invalid()),
|
||||||
_id(id)
|
_id(id),
|
||||||
|
_location(location),
|
||||||
|
_label(label),
|
||||||
|
_trace_control_slot(trace_control_area)
|
||||||
{
|
{
|
||||||
/* account caps required to setup vCPU */
|
/* account caps required to setup vCPU */
|
||||||
_cap_alloc.withdraw(Cap_quota{CAP_RANGE});
|
_cap_alloc.withdraw(Cap_quota{CAP_RANGE});
|
||||||
|
@ -63,10 +71,14 @@ Vm_session_component::Vcpu::Vcpu(Constrained_ram_allocator &ram_alloc,
|
||||||
cap_map().remove(_sel_sm_ec_sc, CAP_RANGE_LOG2);
|
cap_map().remove(_sel_sm_ec_sc, CAP_RANGE_LOG2);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_trace_sources.insert(&_trace_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vm_session_component::Vcpu::~Vcpu()
|
Vm_session_component::Vcpu::~Vcpu()
|
||||||
{
|
{
|
||||||
|
_trace_sources.remove(&_trace_source);
|
||||||
|
|
||||||
if (_ds_cap.valid())
|
if (_ds_cap.valid())
|
||||||
_ram_alloc.free(_ds_cap);
|
_ram_alloc.free(_ds_cap);
|
||||||
|
|
||||||
|
@ -85,6 +97,19 @@ addr_t Vm_session_component::Vcpu::new_pt_id()
|
||||||
return MAX_VM_EXITS * _id.id + _vm_pt_cnt ++;
|
return MAX_VM_EXITS * _id.id + _vm_pt_cnt ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Genode::Trace::Source::Info Vm_session_component::Vcpu::trace_source_info() const
|
||||||
|
{
|
||||||
|
Genode::uint64_t sc_time = 0;
|
||||||
|
|
||||||
|
uint8_t res = Nova::sc_ctrl(sc_sel(), sc_time);
|
||||||
|
if (res != Nova::NOVA_OK)
|
||||||
|
warning("sc_ctrl failed res=", res);
|
||||||
|
|
||||||
|
return { _label, String<5>("vCPU"),
|
||||||
|
Trace::Execution_time(sc_time, sc_time),
|
||||||
|
_location };
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static Nova::uint8_t map_async_caps(Nova::Obj_crd const src,
|
static Nova::uint8_t map_async_caps(Nova::Obj_crd const src,
|
||||||
Nova::Obj_crd const dst,
|
Nova::Obj_crd const dst,
|
||||||
|
@ -132,13 +157,16 @@ void Vm_session_component::_create_vcpu(Thread_capability cap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* lookup vmm pd and cpu location of handler thread in VMM */
|
/* lookup vmm pd and cpu location of handler thread in VMM */
|
||||||
addr_t kernel_cpu_id = 0;
|
addr_t kernel_cpu_id = 0;
|
||||||
|
Affinity::Location vcpu_location;
|
||||||
|
|
||||||
auto lambda = [&] (Cpu_thread_component *ptr) {
|
auto lambda = [&] (Cpu_thread_component *ptr) {
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return Vcpu::invalid();
|
return Vcpu::invalid();
|
||||||
|
|
||||||
Cpu_thread_component &thread = *ptr;
|
Cpu_thread_component &thread = *ptr;
|
||||||
|
|
||||||
|
vcpu_location = thread.platform_thread().affinity();
|
||||||
addr_t genode_cpu_id = thread.platform_thread().affinity().xpos();
|
addr_t genode_cpu_id = thread.platform_thread().affinity().xpos();
|
||||||
kernel_cpu_id = platform_specific().kernel_cpu_id(genode_cpu_id);
|
kernel_cpu_id = platform_specific().kernel_cpu_id(genode_cpu_id);
|
||||||
|
|
||||||
|
@ -153,7 +181,11 @@ void Vm_session_component::_create_vcpu(Thread_capability cap)
|
||||||
/* allocate vCPU object */
|
/* allocate vCPU object */
|
||||||
Vcpu &vcpu = *new (_heap) Vcpu(_constrained_md_ram_alloc,
|
Vcpu &vcpu = *new (_heap) Vcpu(_constrained_md_ram_alloc,
|
||||||
_cap_quota_guard(),
|
_cap_quota_guard(),
|
||||||
Vcpu_id {_id_alloc});
|
Vcpu_id {_id_alloc},
|
||||||
|
vcpu_location,
|
||||||
|
_session_label,
|
||||||
|
_trace_control_area,
|
||||||
|
_trace_sources);
|
||||||
|
|
||||||
/* we ran out of caps in core */
|
/* we ran out of caps in core */
|
||||||
if (!vcpu.ds_cap().valid())
|
if (!vcpu.ds_cap().valid())
|
||||||
|
@ -273,18 +305,21 @@ Genode::Dataspace_capability Vm_session_component::_cpu_state(Vcpu_id const vcpu
|
||||||
|
|
||||||
Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||||
Resources resources,
|
Resources resources,
|
||||||
Label const &,
|
Label const &label,
|
||||||
Diag,
|
Diag,
|
||||||
Ram_allocator &ram,
|
Ram_allocator &ram,
|
||||||
Region_map &local_rm,
|
Region_map &local_rm,
|
||||||
unsigned const priority)
|
unsigned const priority,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
:
|
:
|
||||||
Ram_quota_guard(resources.ram_quota),
|
Ram_quota_guard(resources.ram_quota),
|
||||||
Cap_quota_guard(resources.cap_quota),
|
Cap_quota_guard(resources.cap_quota),
|
||||||
_ep(ep),
|
_ep(ep),
|
||||||
|
_trace_control_area(ram, local_rm), _trace_sources(trace_sources),
|
||||||
_constrained_md_ram_alloc(ram, _ram_quota_guard(), _cap_quota_guard()),
|
_constrained_md_ram_alloc(ram, _ram_quota_guard(), _cap_quota_guard()),
|
||||||
_heap(_constrained_md_ram_alloc, local_rm),
|
_heap(_constrained_md_ram_alloc, local_rm),
|
||||||
_priority(scale_priority(priority, "VM session"))
|
_priority(scale_priority(priority, "VM session")),
|
||||||
|
_session_label(label)
|
||||||
{
|
{
|
||||||
_cap_quota_guard().withdraw(Cap_quota{1});
|
_cap_quota_guard().withdraw(Cap_quota{1});
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include <base/rpc_server.h>
|
#include <base/rpc_server.h>
|
||||||
#include <vm_session/vm_session.h>
|
#include <vm_session/vm_session.h>
|
||||||
|
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
namespace Genode { class Vm_session_component; }
|
namespace Genode { class Vm_session_component; }
|
||||||
|
|
||||||
class Genode::Vm_session_component
|
class Genode::Vm_session_component
|
||||||
|
@ -96,7 +98,8 @@ class Genode::Vm_session_component
|
||||||
using Cap_quota_guard::upgrade;
|
using Cap_quota_guard::upgrade;
|
||||||
|
|
||||||
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
Vm_session_component(Rpc_entrypoint &, Resources, Label const &,
|
||||||
Diag, Ram_allocator &ram, Region_map &, unsigned);
|
Diag, Ram_allocator &ram, Region_map &, unsigned,
|
||||||
|
Trace::Source_registry &);
|
||||||
~Vm_session_component();
|
~Vm_session_component();
|
||||||
|
|
||||||
/*********************************
|
/*********************************
|
||||||
|
|
|
@ -20,12 +20,13 @@
|
||||||
/*
|
/*
|
||||||
* Add x86 specific services
|
* Add x86 specific services
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &heap,
|
Sliced_heap &heap,
|
||||||
Registry<Service> &services)
|
Registry<Service> &services,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
{
|
{
|
||||||
static Vm_root vm_root(ep, heap, core_env().ram_allocator(),
|
static Vm_root vm_root(ep, heap, core_env().ram_allocator(),
|
||||||
core_env().local_rm());
|
core_env().local_rm(), trace_sources);
|
||||||
static Core_service<Vm_session_component> vm(services, vm_root);
|
static Core_service<Vm_session_component> vm(services, vm_root);
|
||||||
|
|
||||||
static Io_port_root io_root(*core_env().pd_session(),
|
static Io_port_root io_root(*core_env().pd_session(),
|
||||||
|
|
|
@ -70,7 +70,8 @@ Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||||
Diag,
|
Diag,
|
||||||
Ram_allocator &ram,
|
Ram_allocator &ram,
|
||||||
Region_map &local_rm,
|
Region_map &local_rm,
|
||||||
unsigned)
|
unsigned,
|
||||||
|
Trace::Source_registry &)
|
||||||
try
|
try
|
||||||
:
|
:
|
||||||
Ram_quota_guard(resources.ram_quota),
|
Ram_quota_guard(resources.ram_quota),
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#define _CORE__INCLUDE__PLATFORM_SERVICES_H_
|
#define _CORE__INCLUDE__PLATFORM_SERVICES_H_
|
||||||
|
|
||||||
#include <core_service.h>
|
#include <core_service.h>
|
||||||
|
#include <trace/source_registry.h>
|
||||||
|
|
||||||
namespace Genode {
|
namespace Genode {
|
||||||
|
|
||||||
|
@ -26,13 +27,15 @@ namespace Genode {
|
||||||
* Register platform-specific services at entrypoint, and service
|
* Register platform-specific services at entrypoint, and service
|
||||||
* registry
|
* registry
|
||||||
*
|
*
|
||||||
* \param ep entrypoint used for session components of platform-services
|
* \param ep entrypoint used for session components of platform-services
|
||||||
* \param md metadata allocator for session components
|
* \param md metadata allocator for session components
|
||||||
* \param reg registry where to add platform-specific services
|
* \param reg registry where to add platform-specific services
|
||||||
|
* \param trace registry where to add trace subjects
|
||||||
*/
|
*/
|
||||||
void platform_add_local_services(Rpc_entrypoint &ep,
|
void platform_add_local_services(Rpc_entrypoint &ep,
|
||||||
Sliced_heap &md,
|
Sliced_heap &md,
|
||||||
Registry<Service> ®);
|
Registry<Service> ®,
|
||||||
|
Trace::Source_registry &trace);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _CORE__INCLUDE__PLATFORM_SERVICES_H_ */
|
#endif /* _CORE__INCLUDE__PLATFORM_SERVICES_H_ */
|
||||||
|
|
|
@ -27,8 +27,9 @@ class Genode::Vm_root : public Root_component<Vm_session_component>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ram_allocator &_ram_allocator;
|
Ram_allocator &_ram_allocator;
|
||||||
Region_map &_local_rm;
|
Region_map &_local_rm;
|
||||||
|
Trace::Source_registry &_trace_sources;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -48,7 +49,8 @@ class Genode::Vm_root : public Root_component<Vm_session_component>
|
||||||
session_resources_from_args(args),
|
session_resources_from_args(args),
|
||||||
session_label_from_args(args),
|
session_label_from_args(args),
|
||||||
session_diag_from_args(args),
|
session_diag_from_args(args),
|
||||||
_ram_allocator, _local_rm, priority);
|
_ram_allocator, _local_rm, priority,
|
||||||
|
_trace_sources);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _upgrade_session(Vm_session_component *vm, const char *args) override
|
void _upgrade_session(Vm_session_component *vm, const char *args) override
|
||||||
|
@ -65,13 +67,15 @@ class Genode::Vm_root : public Root_component<Vm_session_component>
|
||||||
* \param session_ep entrypoint managing vm_session components
|
* \param session_ep entrypoint managing vm_session components
|
||||||
* \param md_alloc meta-data allocator to be used by root component
|
* \param md_alloc meta-data allocator to be used by root component
|
||||||
*/
|
*/
|
||||||
Vm_root(Rpc_entrypoint &session_ep,
|
Vm_root(Rpc_entrypoint &session_ep,
|
||||||
Allocator &md_alloc,
|
Allocator &md_alloc,
|
||||||
Ram_allocator &ram_alloc,
|
Ram_allocator &ram_alloc,
|
||||||
Region_map &local_rm)
|
Region_map &local_rm,
|
||||||
|
Trace::Source_registry &trace_sources)
|
||||||
: Root_component<Vm_session_component>(&session_ep, &md_alloc),
|
: Root_component<Vm_session_component>(&session_ep, &md_alloc),
|
||||||
_ram_allocator(ram_alloc),
|
_ram_allocator(ram_alloc),
|
||||||
_local_rm(local_rm)
|
_local_rm(local_rm),
|
||||||
|
_trace_sources(trace_sources)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ int main()
|
||||||
static Core_service<Trace::Session_component> trace_service (services, trace_root);
|
static Core_service<Trace::Session_component> trace_service (services, trace_root);
|
||||||
|
|
||||||
/* make platform-specific services known to service pool */
|
/* make platform-specific services known to service pool */
|
||||||
platform_add_local_services(ep, sliced_heap, services);
|
platform_add_local_services(ep, sliced_heap, services, Trace::sources());
|
||||||
|
|
||||||
size_t const avail_ram_quota = core_pd.avail_ram().value;
|
size_t const avail_ram_quota = core_pd.avail_ram().value;
|
||||||
size_t const avail_cap_quota = core_pd.avail_caps().value;
|
size_t const avail_cap_quota = core_pd.avail_caps().value;
|
||||||
|
|
|
@ -16,4 +16,5 @@
|
||||||
|
|
||||||
|
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &, Sliced_heap &,
|
void Genode::platform_add_local_services(Rpc_entrypoint &, Sliced_heap &,
|
||||||
Registry<Service> &) { }
|
Registry<Service> &,
|
||||||
|
Trace::Source_registry &) { }
|
||||||
|
|
|
@ -24,9 +24,10 @@
|
||||||
/*
|
/*
|
||||||
* Add x86 specific ioport service
|
* Add x86 specific ioport service
|
||||||
*/
|
*/
|
||||||
void Genode::platform_add_local_services(Rpc_entrypoint &,
|
void Genode::platform_add_local_services(Rpc_entrypoint &,
|
||||||
Sliced_heap &sliced_heap,
|
Sliced_heap &sliced_heap,
|
||||||
Registry<Service> &local_services)
|
Registry<Service> &local_services,
|
||||||
|
Trace::Source_registry &)
|
||||||
{
|
{
|
||||||
static Io_port_root io_port_root(*core_env().pd_session(),
|
static Io_port_root io_port_root(*core_env().pd_session(),
|
||||||
platform().io_port_alloc(), sliced_heap);
|
platform().io_port_alloc(), sliced_heap);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user