Skip to content

Commit dd8c84a

Browse files
author
Axel Heider
committed
vm_arm: add priority in vm config struct
- Cleanup the definitions. - Set a default base value for the attribute. - Derive the other priorities in the config params template. - Do sanity check during template processing. Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
1 parent d8fa205 commit dd8c84a

5 files changed

Lines changed: 21 additions & 13 deletions

File tree

components/VM_Arm/configurations/vm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
emits HaveNotification notification_ready_connector; \
6464
maybe uses VMDTBPassthrough dtb_self; \
6565
provides VMDTBPassthrough dtb; \
66-
attribute int base_prio; \
66+
attribute int base_prio = 100; \
6767
attribute int num_vcpus = 1; \
6868
attribute int num_extra_frame_caps; \
6969
attribute int extra_frame_map_address; \

components/VM_Arm/src/main.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ seL4_CPtr camkes_alloc(seL4_ObjectType type, size_t size, unsigned flags);
7676
extern void *fs_buf;
7777
int start_extra_frame_caps;
7878

79-
int VM_PRIO = 100;
8079
int NUM_VCPUS = 1;
8180

82-
#define IRQSERVER_PRIO (VM_PRIO + 1)
8381
#define IRQ_MESSAGE_LABEL 0xCAFE
8482

8583
#define DMA_VSTART 0x40000000
@@ -499,7 +497,7 @@ static int vmm_init(const vm_config_t *vm_config)
499497
assert(!err);
500498

501499
/* Create an IRQ server */
502-
_irq_server = irq_server_new(vspace, vka, IRQSERVER_PRIO,
500+
_irq_server = irq_server_new(vspace, vka, vm_config->priority.irqserver,
503501
simple, simple_get_cnode(simple), fault_ep_obj.cptr,
504502
IRQ_MESSAGE_LABEL, 256, &_io_ops.malloc_ops);
505503
assert(_irq_server);
@@ -1167,7 +1165,7 @@ static int main_continued(void)
11671165
assert(!err);
11681166

11691167
for (int i = 0; i < NUM_VCPUS; i++) {
1170-
vm_vcpu_t *new_vcpu = create_vmm_plat_vcpu(&vm, VM_PRIO - 1);
1168+
vm_vcpu_t *new_vcpu = create_vmm_plat_vcpu(&vm, vm_config.priority.vcpu);
11711169
assert(new_vcpu);
11721170
}
11731171
vm_vcpu_t *vm_vcpu = vm.vcpus[BOOT_VCPU];
@@ -1209,15 +1207,10 @@ static int main_continued(void)
12091207
}
12101208

12111209
/* base_prio and num_vcpus are optional attributes of the VM component. */
1212-
extern const int __attribute__((weak)) base_prio;
12131210
extern const int __attribute__((weak)) num_vcpus;
12141211

12151212
int run(void)
12161213
{
1217-
/* if the base_prio attribute is set, use it */
1218-
if (&base_prio != NULL) {
1219-
VM_PRIO = base_prio;
1220-
}
12211214
/* if the num_vcpus attribute is set, try to use it */
12221215
if (&num_vcpus != NULL) {
12231216
if (num_vcpus > CONFIG_MAX_NUM_NODES) {

components/VM_Arm/vm_common.camkes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ assembly {
3030
vm.cnode_size_bits = 23;
3131
vm.simple_untyped24_pool = 12;
3232

33-
vm.base_prio = 100;
34-
35-
vm._priority = 101;
3633
vm.sem_value = 0;
3734

3835
}

templates/seL4VMParameters.template.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020

2121
const vm_config_t vm_config = {
2222

23+
.priority = {
24+
/*- set base_prio = config.get('base_prio') -*/
25+
/*- set irqserver_prio = config.get('_priority', base_prio + 1) -*/
26+
/*- set vcpu_prio = base_prio - 1 -*/
27+
/*- if ((vcpu_prio < 0) or (irqserver_prio <= base_prio) or (irqserver_prio > 255)) -*/
28+
/*? raise(Exception('Invalid priority configuration')) ?*/
29+
/*- endif -*/
30+
.irqserver = /*? irqserver_prio ?*/,
31+
.vmm = /*? base_prio ?*/,
32+
.vcpu = /*? base_prio - 1 ?*/,
33+
},
34+
2335
/*- if vm_address_config -*/
2436

2537
.ram = {

templates/seL4VMParameters.template.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010
typedef struct {
1111

12+
struct {
13+
uint8_t vmm;
14+
uint8_t irqserver;
15+
uint8_t vcpu;
16+
} priority;
17+
1218
struct {
1319
unsigned long phys_base;
1420
unsigned long base;

0 commit comments

Comments
 (0)