Skip to content

Commit 4e6a971

Browse files
committed
ref(inc/vm): removed remio_devs from vm structure
Signed-off-by: João Peixoto <[email protected]>
1 parent db69f1f commit 4e6a971

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/core/inc/vm.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ struct vm {
8888

8989
size_t ipc_num;
9090
struct ipc* ipcs;
91-
92-
size_t remio_dev_num;
93-
struct remio_dev* remio_devs;
9491
};
9592

9693
struct vcpu {

src/core/remio.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,9 @@ static struct remio_device* remio_find_vm_dev_by_id(struct vm* vm, unsigned long
307307
struct remio_device* device = NULL;
308308

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

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

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

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

618620
/** Find the Remote I/O device associated with the current backend VM */
619621
device = remio_find_vm_dev_by_id(vm, remio_dev_id);

src/core/vm.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,6 @@ static void vm_init_remio(struct vm* vm, const struct vm_config* vm_config)
272272
return;
273273
}
274274

275-
vm->remio_dev_num = vm_config->platform.remio_dev_num;
276-
vm->remio_devs = vm_config->platform.remio_devs;
277-
278275
for (size_t i = 0; i < vm_config->platform.remio_dev_num; i++) {
279276
struct remio_dev* remio_dev = &vm_config->platform.remio_devs[i];
280277
vm_init_remio_dev(vm, remio_dev);

0 commit comments

Comments
 (0)