From 1bea312ba2ed18e4b77a7435f00d105631f67761 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 15 Nov 2016 23:10:30 +0100 Subject: [PATCH] vmm: compatible vcpu same_pd/other_pd constructors Issue #2173 --- repos/ports/include/vmm/vcpu_thread.h | 8 +++++--- repos/ports/run/vmm_utils.run | 6 ++++-- repos/ports/src/app/seoul/main.cc | 2 +- repos/ports/src/test/vmm_utils/main.cc | 13 +++++++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/repos/ports/include/vmm/vcpu_thread.h b/repos/ports/include/vmm/vcpu_thread.h index d776d3d1e..619bc96bc 100644 --- a/repos/ports/include/vmm/vcpu_thread.h +++ b/repos/ports/include/vmm/vcpu_thread.h @@ -57,7 +57,8 @@ class Vmm::Vcpu_other_pd : public Vmm::Vcpu_thread public: Vcpu_other_pd(Cpu_session * cpu_session, - Genode::Affinity::Location location) + Genode::Affinity::Location location, + Genode::size_t = 0 /* stack_size */) : _pd_session("VM"), _location(location), _cpu_session(cpu_session), _exc_pt_sel(Genode::cap_map()->insert(Nova::NUM_INITIAL_VCPU_PT_LOG2)) @@ -112,8 +113,9 @@ class Vmm::Vcpu_same_pd : public Vmm::Vcpu_thread, Genode::Thread public: - Vcpu_same_pd(Genode::size_t stack_size, Cpu_session * cpu_session, - Genode::Affinity::Location location) + Vcpu_same_pd(Cpu_session * cpu_session, + Genode::Affinity::Location location, + Genode::size_t stack_size) : Thread(WEIGHT, "vCPU", stack_size, Type::NORMAL, cpu_session, location) { diff --git a/repos/ports/run/vmm_utils.run b/repos/ports/run/vmm_utils.run index e53c75b53..7550ece41 100644 --- a/repos/ports/run/vmm_utils.run +++ b/repos/ports/run/vmm_utils.run @@ -34,7 +34,9 @@ append qemu_args " -m 512 " append qemu_args " -cpu phenom " append qemu_args " -nographic " -run_genode_until {.*VMM: vcpu1 _svm_startup called.*\n} 30 -run_genode_until {.*VMM: vcpu2 _svm_startup called.*\n} 10 [output_spawn_id] +run_genode_until {.*VMM: vcpu_s_1 _svm_startup called.*\n} 30 +run_genode_until {.*VMM: vcpu_s_2 _svm_startup called.*\n} 10 [output_spawn_id] +run_genode_until {.*VMM: vcpu_o_1 _svm_startup called.*\n} 10 [output_spawn_id] +run_genode_until {.*VMM: vcpu_o_2 _svm_startup called.*\n} 10 [output_spawn_id] puts "Test succeeded" diff --git a/repos/ports/src/app/seoul/main.cc b/repos/ports/src/app/seoul/main.cc index 353b700f6..130f825b4 100644 --- a/repos/ports/src/app/seoul/main.cc +++ b/repos/ports/src/app/seoul/main.cc @@ -949,7 +949,7 @@ class Machine : public StaticReceiver Vmm::Vcpu_thread * vcpu_thread; if (_colocate_vm_vmm) - vcpu_thread = new Vmm::Vcpu_same_pd(Vcpu_dispatcher::STACK_SIZE, cpu_session, location); + vcpu_thread = new Vmm::Vcpu_same_pd(cpu_session, location, Vcpu_dispatcher::STACK_SIZE); else vcpu_thread = new Vmm::Vcpu_other_pd(cpu_session, location); diff --git a/repos/ports/src/test/vmm_utils/main.cc b/repos/ports/src/test/vmm_utils/main.cc index f73f22b10..8253655f6 100644 --- a/repos/ports/src/test/vmm_utils/main.cc +++ b/repos/ports/src/test/vmm_utils/main.cc @@ -60,7 +60,7 @@ class Vcpu_dispatcher : public Vmm::Vcpu_dispatcher Vmm::Vcpu_dispatcher(env, STACK_SIZE, &env.cpu(), Genode::Affinity::Location(), name), - _vcpu_thread(STACK_SIZE, &env.cpu(), Genode::Affinity::Location()) + _vcpu_thread(&env.cpu(), Genode::Affinity::Location(), STACK_SIZE) { using namespace Nova; @@ -85,8 +85,13 @@ class Vcpu_dispatcher : public Vmm::Vcpu_dispatcher void Component::construct(Genode::Env &env) { - typedef Vcpu_dispatcher Vcpu; + typedef Vcpu_dispatcher Vcpu_s; - static Vcpu vcpu(env, Vcpu::SVM, "vcpu1"); - static Vcpu vcpu2(env, Vcpu::SVM, "vcpu2"); + static Vcpu_s vcpu_s_1(env, Vcpu_s::SVM, "vcpu_s_1"); + static Vcpu_s vcpu_s_2(env, Vcpu_s::SVM, "vcpu_s_2"); + + typedef Vcpu_dispatcher Vcpu_o; + + static Vcpu_o vcpu_o_1(env, Vcpu_o::SVM, "vcpu_o_1"); + static Vcpu_o vcpu_o_2(env, Vcpu_o::SVM, "vcpu_o_2"); }