Skip to content

Commit

Permalink
ref(inc/vm): removed remio_devs from vm structure
Browse files Browse the repository at this point in the history
Signed-off-by: João Peixoto <joaopeixotooficial@gmail.com>
  • Loading branch information
joaopeixoto13 committed Oct 22, 2024
1 parent db69f1f commit 4e6a971
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/core/inc/vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ struct vm {

size_t ipc_num;
struct ipc* ipcs;

size_t remio_dev_num;
struct remio_dev* remio_devs;
};

struct vcpu {
Expand Down
14 changes: 8 additions & 6 deletions src/core/remio.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,9 @@ static struct remio_device* remio_find_vm_dev_by_id(struct vm* vm, unsigned long
struct remio_device* device = NULL;

/** Find the Remote I/O device VM configuration based on the Remote I/O device ID */
for (size_t i = 0; i < vm->remio_dev_num; i++) {
dev = &vm->remio_devs[i];
struct vm_config* vm_config = &config.vmlist[vm->id];
for (size_t i = 0; i < vm_config->platform.remio_dev_num; i++) {
dev = &vm_config->platform.remio_devs[i];
if (dev->id == id) {
break;
}
Expand Down Expand Up @@ -346,8 +347,9 @@ static struct remio_device* remio_find_vm_dev_by_addr(struct vm* vm, unsigned lo
{
struct remio_dev* dev = NULL;

for (size_t i = 0; i < vm->remio_dev_num; i++) {
dev = &vm->remio_devs[i];
struct vm_config* vm_config = &config.vmlist[vm->id];
for (size_t i = 0; i < vm_config->platform.remio_dev_num; i++) {
dev = &vm_config->platform.remio_devs[i];
if (in_range(addr, dev->va, dev->size)) {
break;
}
Expand Down Expand Up @@ -606,14 +608,14 @@ long int remio_hypercall(unsigned long arg0, unsigned long arg1, unsigned long a
struct vm* vm = cpu()->vcpu->vm;

/** Check if the virtual Remote I/O device ID is within the valid range */
if (virt_remio_dev_id >= vm->remio_dev_num) {
if (virt_remio_dev_id >= config.vmlist[vm->id].platform.remio_dev_num) {
ERROR("Remote I/O ID (%d) exceeds the valid range for backend VM (%d)", virt_remio_dev_id,
vm->id);
return -HC_E_FAILURE;
}

/** Get the Remote I/O device ID based on the virtual Remote I/O device ID */
unsigned long remio_dev_id = vm->remio_devs[virt_remio_dev_id].id;
unsigned long remio_dev_id = config.vmlist[vm->id].platform.remio_devs[virt_remio_dev_id].id;

/** Find the Remote I/O device associated with the current backend VM */
device = remio_find_vm_dev_by_id(vm, remio_dev_id);
Expand Down
3 changes: 0 additions & 3 deletions src/core/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,6 @@ static void vm_init_remio(struct vm* vm, const struct vm_config* vm_config)
return;
}

vm->remio_dev_num = vm_config->platform.remio_dev_num;
vm->remio_devs = vm_config->platform.remio_devs;

for (size_t i = 0; i < vm_config->platform.remio_dev_num; i++) {
struct remio_dev* remio_dev = &vm_config->platform.remio_devs[i];
vm_init_remio_dev(vm, remio_dev);
Expand Down

0 comments on commit 4e6a971

Please sign in to comment.