Skip to content

Commit

Permalink
fix(remote_io): translation between virt and abs remote IO ID
Browse files Browse the repository at this point in the history
This patch resolves the translation between the virtual remote IO
ID and the absolute remote IO ID utilized by the Bao Hypervisor.
Specifically, the absolute remote IO ID is obtained by indexing
the list of IO devices within the Backend VM using the virtual
remote IO ID as index.

Signed-off-by: joaopeixoto13 <[email protected]>
  • Loading branch information
joaopeixoto13 committed Apr 15, 2024
1 parent bf2fc92 commit 08070a4
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/core/remote_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,25 +381,11 @@ unsigned long remote_io_hypercall(unsigned long arg0, unsigned long arg1, unsign
unsigned long cpu_id = cpu()->vcpu->regs.x[7];
unsigned long vcpu_id = cpu()->vcpu->regs.x[8];

unsigned long abs_remote_io_id = 0;
bool match = false;

list_foreach (remote_io_list, struct remote_io, io_device) {
if (cpu()->vcpu->vm->id == io_device->instance.backend_vm_id) {
if (abs_remote_io_id == virt_remote_io_id) {
match = true;
break;
} else {
abs_remote_io_id++;
}
}
}

if (!match) {
WARNING("No matching for Remote I/O ID (%d) within VM (%d)", virt_remote_io_id,
cpu()->vcpu->vm->id);
if (virt_remote_io_id > config.vmlist[cpu()->vcpu->vm->id].platform.remote_io_dev_num) {
WARNING("Remote I/O ID (%d) is out of range", virt_remote_io_id);
return -HC_E_FAILURE;
}
unsigned long abs_remote_io_id = config.vmlist[cpu()->vcpu->vm->id].platform.remote_io_devs[virt_remote_io_id].remote_io_id;

switch (op) {
case IO_WRITE_OP:
Expand Down

0 comments on commit 08070a4

Please sign in to comment.