hw_x86_64_muen: Use scheduling info region

Return scheduling start and end values from scheduling info page.
This commit is contained in:
Adrian-Ken Rueegsegger 2016-12-06 11:50:46 +01:00 committed by Christian Helmuth
parent 86a3e0b8b3
commit c7454dfb08
4 changed files with 38 additions and 5 deletions

View File

@ -20,6 +20,7 @@
#include <base/stdint.h> #include <base/stdint.h>
struct subject_info_type; struct subject_info_type;
struct scheduling_info_type;
namespace Genode namespace Genode
{ {
@ -180,6 +181,7 @@ class Genode::Sinfo
private: private:
subject_info_type * sinfo; subject_info_type * sinfo;
scheduling_info_type * sched_info;
char subject_name[MAX_NAME_LENGTH + 1]; char subject_name[MAX_NAME_LENGTH + 1];
bool subject_name_set = false; bool subject_name_set = false;

View File

@ -0,0 +1,24 @@
/*
* \brief Muen scheduling group info
* \author Adrian-Ken Rueegsegger
* \date 2016-12-06
*/
/*
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _BASE__MUEN__MUSCHEDINFO_H_
#define _BASE__MUEN__MUSCHEDINFO_H_
#include <base/stdint.h>
struct scheduling_info_type {
uint64_t tsc_schedule_start;
uint64_t tsc_schedule_end;
} __attribute__((packed, aligned (8)));
#endif /* _BASE__MUEN_MUSCHEDINFO_H_ */

View File

@ -79,8 +79,6 @@ struct subject_info_type {
uint8_t dev_info_count; uint8_t dev_info_count;
char padding[4]; char padding[4];
uint64_t tsc_khz; uint64_t tsc_khz;
uint64_t tsc_schedule_start;
uint64_t tsc_schedule_end;
struct resource_type resources[MAX_RESOURCE_COUNT]; struct resource_type resources[MAX_RESOURCE_COUNT];
struct memregion_type memregions[MAX_RESOURCE_COUNT]; struct memregion_type memregions[MAX_RESOURCE_COUNT];
struct channel_info_type channels_info[MAX_RESOURCE_COUNT]; struct channel_info_type channels_info[MAX_RESOURCE_COUNT];

View File

@ -18,6 +18,13 @@
#include <muen/sinfo.h> #include <muen/sinfo.h>
#include "musinfo.h" #include "musinfo.h"
#include "muschedinfo.h"
#define roundup(x, y) ( \
{ \
const typeof(y) __y = y; \
(((x) + (__y - 1)) / __y) * __y; \
})
static_assert(sizeof(subject_info_type) <= Sinfo::SIZE, static_assert(sizeof(subject_info_type) <= Sinfo::SIZE,
"Size of subject info type larger than Sinfo::SIZE."); "Size of subject info type larger than Sinfo::SIZE.");
@ -106,7 +113,9 @@ static bool is_channel(const struct resource_type * const resource)
Sinfo::Sinfo(const addr_t base_addr) Sinfo::Sinfo(const addr_t base_addr)
{ {
sinfo = ((subject_info_type *)base_addr); const uint64_t sinfo_page_size = roundup(sizeof(subject_info_type), 0x1000);
sinfo = ((subject_info_type *)base_addr);
sched_info = ((scheduling_info_type *)(base_addr + sinfo_page_size));
if (!check_magic()) { if (!check_magic()) {
Genode::error("muen-sinfo: Subject information MAGIC mismatch"); Genode::error("muen-sinfo: Subject information MAGIC mismatch");
@ -244,7 +253,7 @@ uint64_t Sinfo::get_sched_start(void)
if (!check_magic()) if (!check_magic())
return 0; return 0;
return sinfo->tsc_schedule_start; return sched_info->tsc_schedule_start;
} }
@ -253,7 +262,7 @@ uint64_t Sinfo::get_sched_end(void)
if (!check_magic()) if (!check_magic())
return 0; return 0;
return sinfo->tsc_schedule_end; return sched_info->tsc_schedule_end;
} }