Skip to content

Commit

Permalink
Added debug statements
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Guikema <[email protected]>
  • Loading branch information
chrisguikema committed Feb 1, 2024
1 parent 2094fef commit 7e89e26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions libsel4vm/src/arch/arm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ int vcpu_start(vm_vcpu_t *vcpu)
return -1;
}
#endif
ZF_LOGE("Calling TBC Resume");
return seL4_TCB_Resume(vm_get_vcpu_tcb(vcpu));
}

Expand Down
11 changes: 11 additions & 0 deletions libsel4vmmplatsupport/src/arch/arm/psci.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,18 @@ static int start_new_vcpu(vm_vcpu_t *vcpu, uintptr_t entry_address, uintptr_t c
int err;
err = vm_assign_vcpu_target(vcpu, target_cpu);
if (err) {
ZF_LOGE("Failed to assign vcpu target");
return -1;
}
err = vcpu_set_bootargs(vcpu, entry_address, 0, context_id);
if (err) {
ZF_LOGE("Failed to set bootargs");
vm_assign_vcpu_target(vcpu, -1);
return -1;
}
err = vcpu_start(vcpu);
if (err) {
ZF_LOGE("Failed to start vcpu. Assigning -1 target");
vm_assign_vcpu_target(vcpu, -1);
return -1;
}
Expand All @@ -47,19 +50,27 @@ int handle_psci(vm_vcpu_t *vcpu, seL4_UserContext *regs, seL4_Word fn_number, bo
uintptr_t target_cpu = smc_get_arg(regs, 1);
uintptr_t entry_point_address = smc_get_arg(regs, 2);
uintptr_t context_id = smc_get_arg(regs, 3);
ZF_LOGE("target_cpu: %d", target_cpu);
vm_vcpu_t *target_vcpu = vm_vcpu_for_target_cpu(vcpu->vm, target_cpu);
if (target_vcpu == NULL) {
ZF_LOGE("Null VCPU");
target_vcpu = vm_find_free_unassigned_vcpu(vcpu->vm);
ZF_LOGE("Found free unassigned VCPU: %p", target_vcpu);
if (target_vcpu && start_new_vcpu(target_vcpu, entry_point_address, context_id, target_cpu) == 0) {
ZF_LOGE("Started found VCPU");
smc_set_return_value(regs, PSCI_SUCCESS);
} else {
ZF_LOGE("Failed to start found VCPU");
smc_set_return_value(regs, PSCI_INTERNAL_FAILURE);
}
} else if ((target_vcpu->target_cpu >= 0) && (target_vcpu->target_cpu < CONFIG_MAX_NUM_NODES)) {
ZF_LOGE("Found existing VCPU");
/* Assign vcpu to physical cpu specified in config */
if (is_vcpu_online(target_vcpu)) {
ZF_LOGE("its already on...");
smc_set_return_value(regs, PSCI_ALREADY_ON);
} else if (start_new_vcpu(target_vcpu, entry_point_address, context_id, target_vcpu->target_cpu) == 0) {
ZF_LOGE("started VCPU that we already found!");
smc_set_return_value(regs, PSCI_SUCCESS);
} else {
ZF_LOGE("[vCPU %u] could not start vCPU", vcpu->vcpu_id);
Expand Down

0 comments on commit 7e89e26

Please sign in to comment.