diff --git a/repos/dde_uos-intel-gpgpu/src/virt/strategies/config.h b/repos/dde_uos-intel-gpgpu/src/config.h
similarity index 51%
rename from repos/dde_uos-intel-gpgpu/src/virt/strategies/config.h
rename to repos/dde_uos-intel-gpgpu/src/config.h
index 2cbed7619a..10691f9384 100644
--- a/repos/dde_uos-intel-gpgpu/src/virt/strategies/config.h
+++ b/repos/dde_uos-intel-gpgpu/src/config.h
@@ -1,6 +1,11 @@
#ifndef CONFIG_H
#define CONFIG_H
+#define QEMU_TEST
+
+//#define VERBOSE
+
#define SCHED_CFS
+//#define SCHED_RR // default
#endif // CONFIG_H
\ No newline at end of file
diff --git a/repos/dde_uos-intel-gpgpu/src/gpgpu/main.cc b/repos/dde_uos-intel-gpgpu/src/gpgpu/main.cc
index 9c19db2ae0..d0abb84233 100644
--- a/repos/dde_uos-intel-gpgpu/src/gpgpu/main.cc
+++ b/repos/dde_uos-intel-gpgpu/src/gpgpu/main.cc
@@ -1,5 +1,6 @@
#include
+#include "../config.h"
#include "../virt/rpc.h"
#include "../virt/scheduler.h"
@@ -7,12 +8,11 @@
#include
#include "gpgpu_genode.h"
-//#define TEST // test stubs only (works with qemu)
-#ifdef TEST
+#ifdef QEMU_TEST
#include
-#else
+#else // QEMU_TEST
#include "test.h"
-#endif // TEST
+#endif // QEMU_TEST
gpgpu::gpgpu_genode* _global_gpgpu_genode;
gpgpu_virt::GPGPUScheduler* _global_sched;
@@ -28,7 +28,7 @@ void Component::construct(Genode::Env& e)
static gpgpu_virt::GPGPUScheduler sched;
_global_sched = &sched;
-#ifdef TEST
+#ifdef QEMU_TEST
// test prink
printk("Hello printk: %d", 42);
@@ -80,7 +80,7 @@ void Component::construct(Genode::Env& e)
// test interrupts
_global_gpgpu_genode->registerInterruptHandler();
Genode::log("Interrupt test finished!");
-#else
+#else // QEMU_TEST
// init driver
Genode::log("Init GPGPU driver...");
GPGPU_Driver& gpgpudriver = GPGPU_Driver::getInstance();
@@ -91,7 +91,7 @@ void Component::construct(Genode::Env& e)
// run the test and hope the best
Genode::log("Run self test...");
gpgpu::run_gpgpu_test();
-#endif // TEST
+#endif // QEMU_TEST
Genode::log("Register RPCs...");
static gpgpu_virt::Main main(e);
diff --git a/repos/dde_uos-intel-gpgpu/src/gpgpu/target.mk b/repos/dde_uos-intel-gpgpu/src/gpgpu/target.mk
index 4796dd590d..82fb90e91d 100644
--- a/repos/dde_uos-intel-gpgpu/src/gpgpu/target.mk
+++ b/repos/dde_uos-intel-gpgpu/src/gpgpu/target.mk
@@ -9,7 +9,7 @@ SRC_CC = main.cc gpgpu_genode.cc stubs.cc test.cc ../virt/rpc.cc ../virt/strateg
LIBS = base
INC_DIR += $(GPGPU_DRIVER_PATH)
-$(TARGET): $(UOS_INTEL_GPGPU) $(SRC_CC) ../virt/strategies/config.h
+$(TARGET): $(UOS_INTEL_GPGPU) $(SRC_CC) ../config.h
$(UOS_INTEL_GPGPU):
$(MSG_BUILD) "Building uos-intel-gpgpu..."
diff --git a/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc b/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc
index 4351baf59b..22a1029b5b 100644
--- a/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc
+++ b/repos/dde_uos-intel-gpgpu/src/virt/rpc.cc
@@ -30,7 +30,9 @@ void Session_component::register_vm(Genode::size_t size, Genode::Ram_dataspace_c
ram_cap_vm = ram_cap;
// create vgpu context and add it to scheduler
+#ifndef QEMU_TEST
vgpu.allocContext();
+#endif // QEMU_TEST
_global_sched->add_vgpu(&vgpu);
}
@@ -67,7 +69,8 @@ void Session_component::start_task(unsigned long kconf)
// trigger sched
_global_sched->trigger();
- /*static int id = 0;
+#ifdef VERBOSE
+ static int id = 0;
Genode::log("Kernel ", id);
for(int i = 0; i < 3; i++)
{
@@ -81,19 +84,20 @@ void Session_component::start_task(unsigned long kconf)
{
Genode::log("\t\tvaddr: ", (void*)kc->buffConfigs[i].buffer);
Genode::log("\t\tval: ", *((uint32_t*)(kc->buffConfigs[i].buffer)));
- Genode::log("\t\tgpuaddr: ", (void*)((addr_t)kc->buffConfigs[i].ga)); // to print this, temporary make the var public
- Genode::log("\t\tpos: ", (uint32_t)kc->buffConfigs[i].pos); // to print this, temporary make the var public
+ //Genode::log("\t\tgpuaddr: ", (void*)((addr_t)kc->buffConfigs[i].ga)); // to print this, temporary make the var public
+ //Genode::log("\t\tpos: ", (uint32_t)kc->buffConfigs[i].pos); // to print this, temporary make the var public
}
else
{
Genode::log("\t\tvaddr: ", (void*)((Genode::addr_t)kc->buffConfigs[i].buffer - base + mapped_base));
Genode::log("\t\tpaddr: ", (void*)kc->buffConfigs[i].buffer);
- Genode::log("\t\tgpuaddr: ", (void*)((addr_t)kc->buffConfigs[i].ga)); // to print this, temporary make the var public
- Genode::log("\t\tpos: ", (uint32_t)kc->buffConfigs[i].pos); // to print this, temporary make the var public
+ //Genode::log("\t\tgpuaddr: ", (void*)((addr_t)kc->buffConfigs[i].ga)); // to print this, temporary make the var public
+ //Genode::log("\t\tpos: ", (uint32_t)kc->buffConfigs[i].pos); // to print this, temporary make the var public
}
Genode::log("\t\tsize: ", (int)kc->buffConfigs[i].buffer_size);
}
- id++;*/
+ id++;
+#endif // VERBOSE
}
Session_component::~Session_component()
diff --git a/repos/dde_uos-intel-gpgpu/src/virt/scheduler.h b/repos/dde_uos-intel-gpgpu/src/virt/scheduler.h
index 195651c506..b1ca3c8d23 100644
--- a/repos/dde_uos-intel-gpgpu/src/virt/scheduler.h
+++ b/repos/dde_uos-intel-gpgpu/src/virt/scheduler.h
@@ -1,7 +1,7 @@
#ifndef SCHEDULER_H
#define SCHEDULER_H
-#include "strategies/config.h"
+#include "../config.h"
#include "vgpu.h"
#include "kernel.h"
@@ -57,9 +57,11 @@ namespace gpgpu_virt {
*/
void handle_gpu_event()
{
+#ifndef QEMU_TEST
// reduce frequency
GPGPU_Driver& gpgpudriver = GPGPU_Driver::getInstance();
gpgpudriver.setMinFreq();
+#endif // QEMU_TEST
/* Switch to next vGPU in the run list */
_curr_vgpu = strat.nextVGPU();
@@ -78,11 +80,23 @@ namespace gpgpu_virt {
// switch context
dispatch(*_curr_vgpu);
+#ifdef QEMU_TEST
+ // sim interupt
+ handle_gpu_event();
+
+ // set finished and call callback
+ next->get_config()->finished = true;
+ if(next->get_config()->finish_callback)
+ {
+ next->get_config()->finish_callback();
+ }
+#else
// set frequency
gpgpudriver.setMaxFreq();
// run gpgpu task
gpgpudriver.enqueueRun(*next->get_config());
+#endif // QEMU_TEST
// free kernel object
// kernel_config will not be freed, just the Queue object!
diff --git a/repos/dde_uos-intel-gpgpu/src/virt/vgpu.h b/repos/dde_uos-intel-gpgpu/src/virt/vgpu.h
index 8cbe8b3b30..96af9a78ed 100644
--- a/repos/dde_uos-intel-gpgpu/src/virt/vgpu.h
+++ b/repos/dde_uos-intel-gpgpu/src/virt/vgpu.h
@@ -2,7 +2,7 @@
#define VGPU_H
#include
-#include "strategies/config.h"
+#include "../config.h"
#include "kernel.h"
#ifdef SCHED_CFS