Skip to content

libsel4vm: guest cpu requests to vcpus from pcpus#85

Open
alexpavey wants to merge 1 commit intoseL4:masterfrom
dornerworks:arm-vm-vcpu
Open

libsel4vm: guest cpu requests to vcpus from pcpus#85
alexpavey wants to merge 1 commit intoseL4:masterfrom
dornerworks:arm-vm-vcpu

Conversation

@alexpavey
Copy link

Originally the guests were able to make requests for a specific physical core based on its id. These changes associate that requested id with a vcpu instead of a pcpu.

Signed-off-by: Alex Pavey Alex.Pavey@dornerworks.com

Originally the guests were able to make requests for a specific physical
core based on its id. These changes associate that requested id with a
vcpu instead of a pcpu.

Signed-off-by: Alex Pavey <Alex.Pavey@dornerworks.com>
break;
case PSCI_CPU_ON: {
uintptr_t target_cpu = smc_get_arg(&regs, 1);
uintptr_t requested_cpu = smc_get_arg(&regs, 1);
Copy link
Member

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?

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];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work, because requested_cpu is a MPID value now - because that is what a caller passed into the SMC according to the spec. So we need to do a lookup over all our vCPUs.

/* 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) {
Copy link
Member

Choose a reason for hiding this comment

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments