diff --git a/repos/base-nova/include/nova/native_thread.h b/repos/base-nova/include/nova/native_thread.h index 2e629ce416..6f751a6f11 100644 --- a/repos/base-nova/include/nova/native_thread.h +++ b/repos/base-nova/include/nova/native_thread.h @@ -30,7 +30,6 @@ struct Genode::Native_thread addr_t ec_sel { 0 }; /* selector for execution context */ addr_t exc_pt_sel { 0 }; /* base of event portal window */ - bool vcpu { false }; /* true if thread is a virtual CPU */ addr_t initial_ip { 0 }; /* initial IP of local thread */ /* receive window for capability selectors received at the server side */ @@ -56,7 +55,6 @@ struct Genode::Native_thread Native_thread() : ec_sel(INVALID_INDEX), exc_pt_sel(INVALID_INDEX), - vcpu(false), initial_ip(0) { } }; diff --git a/repos/base-nova/src/core/platform_thread.cc b/repos/base-nova/src/core/platform_thread.cc index fb0061afa2..989622f303 100644 --- a/repos/base-nova/src/core/platform_thread.cc +++ b/repos/base-nova/src/core/platform_thread.cc @@ -121,11 +121,7 @@ int Platform_thread::start(void *ip, void *sp) return -4; } - if (vcpu()) { - if (!remote_pd()) - res = map_pagefault_portal(*_pager, _pager->exc_pt_sel_client(), - _sel_exc_base, _pd->pd_sel(), utcb); - } else + if (!vcpu()) res = map_thread_portals(*_pager, _sel_exc_base, utcb); if (res != NOVA_OK) { diff --git a/repos/base-nova/src/lib/base/thread_start.cc b/repos/base-nova/src/lib/base/thread_start.cc index 2a3acdbf13..c4f82fa355 100644 --- a/repos/base-nova/src/lib/base/thread_start.cc +++ b/repos/base-nova/src/lib/base/thread_start.cc @@ -154,9 +154,7 @@ void Thread::start() try { Nova_native_cpu::Thread_type thread_type; - if (native_thread().vcpu) - thread_type = Nova_native_cpu::Thread_type::VCPU; - else if (global) + if (global) thread_type = Nova_native_cpu::Thread_type::GLOBAL; else thread_type = Nova_native_cpu::Thread_type::LOCAL; @@ -187,12 +185,10 @@ void Thread::start() using namespace Nova; - if (!native_thread().vcpu) { - /* default: we don't accept any mappings or translations */ - Utcb * utcb_obj = reinterpret_cast(utcb()); - utcb_obj->crd_rcv = Obj_crd(); - utcb_obj->crd_xlt = Obj_crd(); - } + /* default: we don't accept any mappings or translations */ + Utcb * utcb_obj = reinterpret_cast(utcb()); + utcb_obj->crd_rcv = Obj_crd(); + utcb_obj->crd_xlt = Obj_crd(); if (global) /* request creation of SC to let thread run*/ diff --git a/repos/ports/include/vmm/vcpu_dispatcher.h b/repos/ports/include/vmm/vcpu_dispatcher.h index 556a0d71e2..73d6103c58 100644 --- a/repos/ports/include/vmm/vcpu_dispatcher.h +++ b/repos/ports/include/vmm/vcpu_dispatcher.h @@ -128,20 +128,6 @@ class Vmm::Vcpu_dispatcher : public T * virtualization event. */ void entry() override { } - - /** - * Return capability selector of the VCPU's SM and EC - * - * The returned number corresponds to the VCPU's semaphore selector. - * The consecutive number corresponds to the EC. The number returned by - * this function is used by the VMM code as a unique identifier of the - * VCPU. I.e., it gets passed as arguments for 'MessageHostOp' - * operations. - */ - Nova::mword_t sel_sm_ec() - { - return T::native_thread().exc_pt_sel + Nova::SM_SEL_EC; - } }; #endif /* _INCLUDE__VMM__VCPU_DISPATCHER_H_ */ diff --git a/repos/ports/include/vmm/vcpu_thread.h b/repos/ports/include/vmm/vcpu_thread.h index 34052b042e..5f96c42ca1 100644 --- a/repos/ports/include/vmm/vcpu_thread.h +++ b/repos/ports/include/vmm/vcpu_thread.h @@ -104,8 +104,7 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread cpu_thread.start(0, 0); /* - * Request native EC thread cap and put it next to the - * SM cap - see Vcpu_dispatcher->sel_sm_ec description + * Request native EC thread cap used for recalling vCPU */ addr_t const pager_pt = _exc_pt_sel + Nova::PT_SEL_PAGE_FAULT; request_native_ec_cap(pager_pt, sel_ec); @@ -120,59 +119,4 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread Genode::addr_t exc_base() override { return _exc_pt_sel; } }; - -class Vmm::Vcpu_same_pd : public Vmm::Vcpu_thread, Genode::Thread -{ - enum { WEIGHT = Genode::Cpu_session::Weight::DEFAULT_WEIGHT }; - - public: - - Vcpu_same_pd(Cpu_connection * cpu_connection, - Genode::Affinity::Location location, - Genode::Capability, - Genode::size_t stack_size) - : - Thread(WEIGHT, "vCPU", stack_size, Type::NORMAL, cpu_connection, location) - { - /* release pre-allocated selectors of Thread */ - Genode::cap_map().remove(native_thread().exc_pt_sel, Nova::NUM_INITIAL_PT_LOG2); - - /* allocate correct number of selectors */ - this->native_thread().exc_pt_sel = cap_map().insert(Nova::NUM_INITIAL_VCPU_PT_LOG2); - - /* tell generic thread code that this becomes a vCPU */ - this->native_thread().vcpu = true; - } - - ~Vcpu_same_pd() - { - using namespace Nova; - - revoke(Nova::Obj_crd(this->native_thread().exc_pt_sel, NUM_INITIAL_VCPU_PT_LOG2)); - cap_map().remove(this->native_thread().exc_pt_sel, NUM_INITIAL_VCPU_PT_LOG2, false); - - /* allocate selectors for ~Thread */ - this->native_thread().exc_pt_sel = cap_map().insert(Nova::NUM_INITIAL_PT_LOG2); - } - - addr_t exc_base() override { return this->native_thread().exc_pt_sel; } - - void start(Genode::addr_t sel_ec) override - { - this->Thread::start(); - - /* - * Request native EC thread cap and put it next to the - * SM cap - see Vcpu_dispatcher->sel_sm_ec description - */ - addr_t const pager_pt = exc_base() + Nova::PT_SEL_PAGE_FAULT; - request_native_ec_cap(pager_pt, sel_ec); - - /* solely needed for vcpu to request native ec cap - drop it */ - Nova::revoke(Nova::Obj_crd(pager_pt, 0)); - } - - void entry() override { } -}; - #endif /* _INCLUDE__VMM__VCPU_THREAD_H_ */