sel4: add priority support

Issue #2451
This commit is contained in:
Alexander Boettcher 2017-08-08 14:35:14 +02:00 committed by Christian Helmuth
parent 7a8e0e59af
commit 0ddda79511
5 changed files with 14 additions and 9 deletions

View File

@ -68,6 +68,7 @@ class Genode::Platform_thread : public List<Platform_thread>::Element
enum { INITIAL_IPC_BUFFER_VIRT = 0x1000 }; enum { INITIAL_IPC_BUFFER_VIRT = 0x1000 };
Affinity::Location _location; Affinity::Location _location;
uint16_t _priority;
public: public:

View File

@ -39,7 +39,7 @@ namespace Genode {
Thread_info() { } Thread_info() { }
inline void init(addr_t const utcb_virt_addr); inline void init(addr_t const utcb_virt_addr, unsigned const prio);
inline void destruct(); inline void destruct();
}; };
@ -52,7 +52,7 @@ namespace Genode {
}; };
void Genode::Thread_info::init(addr_t const utcb_virt_addr) void Genode::Thread_info::init(addr_t const utcb_virt_addr, unsigned const prio)
{ {
Platform &platform = *platform_specific(); Platform &platform = *platform_specific();
Range_allocator &phys_alloc = *platform.ram_alloc(); Range_allocator &phys_alloc = *platform.ram_alloc();
@ -99,9 +99,8 @@ void Genode::Thread_info::init(addr_t const utcb_virt_addr)
} }
/* set scheduling priority */ /* set scheduling priority */
enum { PRIORITY_MAX = 0xff }; seL4_TCB_SetMCPriority(tcb_sel.value(), prio);
seL4_TCB_SetMCPriority(tcb_sel.value(), PRIORITY_MAX); seL4_TCB_SetPriority(tcb_sel.value(), prio);
seL4_TCB_SetPriority(tcb_sel.value(), PRIORITY_MAX);
} }

View File

@ -220,10 +220,16 @@ Platform_thread::Platform_thread(size_t, const char *name, unsigned priority,
_name(name), _name(name),
_utcb(utcb), _utcb(utcb),
_pager_obj_sel(platform_specific()->core_sel_alloc().alloc()), _pager_obj_sel(platform_specific()->core_sel_alloc().alloc()),
_location(location) _location(location),
_priority(Cpu_session::scale_priority(CONFIG_NUM_PRIORITIES, priority))
{ {
_info.init(_utcb ? _utcb : INITIAL_IPC_BUFFER_VIRT); static_assert(CONFIG_NUM_PRIORITIES == 256, " unknown priority configuration");
if (_priority > 0)
_priority -= 1;
_info.init(_utcb ? _utcb : INITIAL_IPC_BUFFER_VIRT, _priority);
platform_thread_registry().insert(*this); platform_thread_registry().insert(*this);
} }

View File

@ -38,7 +38,7 @@ void Thread::_init_platform_thread(size_t, Type type)
} }
Thread_info thread_info; Thread_info thread_info;
thread_info.init(utcb_virt_addr); thread_info.init(utcb_virt_addr, CONFIG_NUM_PRIORITIES - 1);
if (!map_local(thread_info.ipc_buffer_phys, utcb_virt_addr, 1)) { if (!map_local(thread_info.ipc_buffer_phys, utcb_virt_addr, 1)) {
error(__func__, ": could not map IPC buffer " error(__func__, ": could not map IPC buffer "

View File

@ -19,7 +19,6 @@ proc pause_resume_supported { } {
# #
proc prio_supported { } { proc prio_supported { } {
if {[have_spec hw]} { return false } if {[have_spec hw]} { return false }
if {[have_spec sel4]} { return false }
if {[have_spec linux]} { return false } if {[have_spec linux]} { return false }
if {[have_spec fiasco]} { return false } if {[have_spec fiasco]} { return false }
return true return true