diff --git a/repos/ports/include/vmm/vcpu_thread.h b/repos/ports/include/vmm/vcpu_thread.h index 2b0cb3261..8bfa222f9 100644 --- a/repos/ports/include/vmm/vcpu_thread.h +++ b/repos/ports/include/vmm/vcpu_thread.h @@ -44,15 +44,15 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread private: Genode::Pd_connection _pd_session; - Genode::Cpu_connection _cpu_session; + Genode::Cpu_session *_cpu_session; Genode::addr_t _exc_pt_sel; public: - Vcpu_other_pd() + Vcpu_other_pd(Cpu_session * cpu_session) : - _pd_session("VM"), _cpu_session("vCPU"), + _pd_session("VM"), _cpu_session(cpu_session), _exc_pt_sel(Genode::cap_map()->insert(Nova::NUM_INITIAL_VCPU_PT_LOG2)) { } @@ -60,7 +60,7 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread { using namespace Genode; - Thread_capability vcpu_vm = _cpu_session.create_thread("vCPU"); + Thread_capability vcpu_vm = _cpu_session->create_thread("vCPU"); /* assign thread to protection domain */ _pd_session.bind_thread(vcpu_vm); @@ -68,14 +68,14 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread /* create new pager object and assign it to the new thread */ Pager_capability pager_cap = env()->rm_session()->add_client(vcpu_vm); - _cpu_session.set_pager(vcpu_vm, pager_cap); + _cpu_session->set_pager(vcpu_vm, pager_cap); /* tell parent that this will be a vCPU */ Thread_state state; state.sel_exc_base = Native_thread::INVALID_INDEX; state.is_vcpu = true; - _cpu_session.state(vcpu_vm, state); + _cpu_session->state(vcpu_vm, state); /* * Delegate parent the vCPU exception portals required during PD @@ -84,7 +84,7 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread delegate_vcpu_portals(pager_cap, exc_base()); /* start vCPU in separate PD */ - _cpu_session.start(vcpu_vm, 0, 0); + _cpu_session->start(vcpu_vm, 0, 0); /* * Request native EC thread cap and put it next to the @@ -101,9 +101,9 @@ class Vmm::Vcpu_same_pd : public Vmm::Vcpu_thread, Genode::Thread_base { public: - Vcpu_same_pd(size_t stack_size) + Vcpu_same_pd(size_t stack_size, Cpu_session * cpu_session) : - Thread_base("vCPU", stack_size) + Thread_base("vCPU", stack_size, Type::NORMAL, cpu_session) { /* release pre-allocated selectors of Thread */ Genode::cap_map()->remove(tid().exc_pt_sel, Nova::NUM_INITIAL_PT_LOG2); diff --git a/repos/ports/src/app/seoul/main.cc b/repos/ports/src/app/seoul/main.cc index d24c1a1ba..19257da2d 100644 --- a/repos/ports/src/app/seoul/main.cc +++ b/repos/ports/src/app/seoul/main.cc @@ -912,10 +912,12 @@ class Machine : public StaticReceiver Logging::printf("OP_VCPU_CREATE_BACKEND\n"); Vmm::Vcpu_thread * vcpu_thread; + Genode::Cpu_session * cpu = Genode::env()->cpu_session(); + if (_colocate_vm_vmm) - vcpu_thread = new Vmm::Vcpu_same_pd(Vcpu_dispatcher::STACK_SIZE); + vcpu_thread = new Vmm::Vcpu_same_pd(Vcpu_dispatcher::STACK_SIZE, cpu); else - vcpu_thread = new Vmm::Vcpu_other_pd(); + vcpu_thread = new Vmm::Vcpu_other_pd(cpu); Vcpu_dispatcher *vcpu_dispatcher = new Vcpu_dispatcher(_motherboard_lock, diff --git a/repos/ports/src/test/vmm_utils/main.cc b/repos/ports/src/test/vmm_utils/main.cc index 7793320af..f116ab526 100644 --- a/repos/ports/src/test/vmm_utils/main.cc +++ b/repos/ports/src/test/vmm_utils/main.cc @@ -61,7 +61,7 @@ class Vcpu_dispatcher : public Vmm::Vcpu_dispatcher Vcpu_dispatcher(Cap_connection &cap, Type type) : Vmm::Vcpu_dispatcher(STACK_SIZE, cap), - _vcpu_thread(STACK_SIZE) + _vcpu_thread(STACK_SIZE, Genode::env()->cpu_session()) { using namespace Nova;