mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
x86 vmm: add general multiprocessor support
* repos/ports/include/vmm - add support to specify cpu location during vCPU construction * seoul - update to latest seoul branch supporting smp - adjust to vmm interface changes - vCPUs will be put in a round robin fashion on the available host CPUs, beginning with the next CPU after the default (boot) CPU - number of vCPUs can be specified in run script * virtualbox - adjust to vmm interface changes - uses still one vCPU, placed on default (boot) CPU Fixes #1212
This commit is contained in:
committed by
Norman Feske
parent
40fc64e24f
commit
5d06078d27
@@ -57,13 +57,18 @@ class Vmm::Vcpu_dispatcher : public T
|
||||
|
||||
public:
|
||||
|
||||
Vcpu_dispatcher(size_t stack_size, Cap_connection &cap)
|
||||
Vcpu_dispatcher(size_t stack_size, Cap_connection &cap,
|
||||
Cpu_session * cpu_session,
|
||||
Genode::Affinity::Location location)
|
||||
:
|
||||
T("vCPU dispatcher", stack_size),
|
||||
_cap(cap)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
/* place the thread on CPU described by location object */
|
||||
cpu_session->affinity(T::cap(), location);
|
||||
|
||||
/* request creation of a 'local' EC */
|
||||
T::_tid.ec_sel = Native_thread::INVALID_INDEX - 1;
|
||||
T::start();
|
||||
@@ -72,12 +77,17 @@ class Vmm::Vcpu_dispatcher : public T
|
||||
|
||||
template <typename X>
|
||||
Vcpu_dispatcher(size_t stack_size, Cap_connection &cap,
|
||||
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)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
/* place the thread on CPU described by location object */
|
||||
cpu_session->affinity(T::cap(), location);
|
||||
|
||||
/* request creation of a 'local' EC */
|
||||
T::_tid.ec_sel = Native_thread::INVALID_INDEX - 1;
|
||||
T::start();
|
||||
|
||||
@@ -43,16 +43,18 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Pd_connection _pd_session;
|
||||
Genode::Cpu_session *_cpu_session;
|
||||
Genode::Pd_connection _pd_session;
|
||||
Genode::Affinity::Location _location;
|
||||
Genode::Cpu_session *_cpu_session;
|
||||
|
||||
Genode::addr_t _exc_pt_sel;
|
||||
|
||||
public:
|
||||
|
||||
Vcpu_other_pd(Cpu_session * cpu_session)
|
||||
Vcpu_other_pd(Cpu_session * cpu_session,
|
||||
Genode::Affinity::Location location)
|
||||
:
|
||||
_pd_session("VM"), _cpu_session(cpu_session),
|
||||
_pd_session("VM"), _location(location), _cpu_session(cpu_session),
|
||||
_exc_pt_sel(Genode::cap_map()->insert(Nova::NUM_INITIAL_VCPU_PT_LOG2))
|
||||
{ }
|
||||
|
||||
@@ -83,6 +85,9 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread
|
||||
*/
|
||||
delegate_vcpu_portals(pager_cap, exc_base());
|
||||
|
||||
/* place the thread on CPU described by location object */
|
||||
_cpu_session->affinity(vcpu_vm, _location);
|
||||
|
||||
/* start vCPU in separate PD */
|
||||
_cpu_session->start(vcpu_vm, 0, 0);
|
||||
|
||||
@@ -101,7 +106,8 @@ class Vmm::Vcpu_same_pd : public Vmm::Vcpu_thread, Genode::Thread_base
|
||||
{
|
||||
public:
|
||||
|
||||
Vcpu_same_pd(size_t stack_size, Cpu_session * cpu_session)
|
||||
Vcpu_same_pd(size_t stack_size, Cpu_session * cpu_session,
|
||||
Genode::Affinity::Location location)
|
||||
:
|
||||
Thread_base("vCPU", stack_size, Type::NORMAL, cpu_session)
|
||||
{
|
||||
@@ -113,6 +119,9 @@ class Vmm::Vcpu_same_pd : public Vmm::Vcpu_thread, Genode::Thread_base
|
||||
|
||||
/* tell generic thread code that this becomes a vCPU */
|
||||
this->tid().is_vcpu = true;
|
||||
|
||||
/* place the thread on CPU described by location object */
|
||||
cpu_session->affinity(Thread_base::cap(), location);
|
||||
}
|
||||
|
||||
~Vcpu_same_pd()
|
||||
|
||||
Reference in New Issue
Block a user