-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libsel4vm: guest cpu requests to vcpus from pcpus #85
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,15 +50,24 @@ int handle_psci(vm_vcpu_t *vcpu, seL4_Word fn_number, bool convention) | |
smc_set_return_value(®s, 0x00010000); /* version 1 */ | ||
break; | ||
case PSCI_CPU_ON: { | ||
uintptr_t target_cpu = smc_get_arg(®s, 1); | ||
uintptr_t requested_cpu = smc_get_arg(®s, 1); | ||
uintptr_t entry_point_address = smc_get_arg(®s, 2); | ||
uintptr_t context_id = smc_get_arg(®s, 3); | ||
vm_vcpu_t *target_vcpu = vm_vcpu_for_target_cpu(vcpu->vm, target_cpu); | ||
if (target_vcpu == NULL) { | ||
target_vcpu = vm_find_free_unassigned_vcpu(vcpu->vm); | ||
if (target_vcpu && start_new_vcpu(target_vcpu, entry_point_address, context_id, target_cpu) == 0) { | ||
vm_vcpu_t *target_vcpu = NULL; | ||
if ((requested_cpu >= 0) && (requested_cpu < vcpu->vm->num_vcpus)) { | ||
target_vcpu = vcpu->vm->vcpus[requested_cpu]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work, because |
||
} else { | ||
smc_set_return_value(®s, PSCI_INTERNAL_FAILURE); | ||
break; | ||
} | ||
|
||
/* Automatically assign vcpu to an unassigned physical cpu */ | ||
if (target_vcpu->target_cpu == -1) { | ||
int selected_cpu = vm_find_free_unassigned_cpu(vcpu->vm); | ||
if ((selected_cpu >= 0) && start_new_vcpu(target_vcpu, entry_point_address, context_id, selected_cpu) == 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we have to set the MPIDR of the vCPU here also now, so this is in sync with what the caller requested? Can the caller actually starts arbitrary cored here - shouldn't we have prepared the vCPU list in advance, about what cores the caller can start, ie. what cores the VM has. |
||
smc_set_return_value(®s, PSCI_SUCCESS); | ||
} else { | ||
ZF_LOGE("[vCPU %u] no unused physical core left", vcpu->vcpu_id); | ||
smc_set_return_value(®s, PSCI_INTERNAL_FAILURE); | ||
} | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, my question holds - we get a (v)MPIDR here from the guest and not a linear (seL4 affinity) ID?