Skip to contentSkip to conversation

arm:virt: fix broken IPA range with KVM enabled

PATCH In review Igor Mammedov 2 participants 2 messages Mar 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm:virt: fix broken IPA range with KVM enabled

Commit a1b18df9a4848, broke virt_kvm_type() logic, which depends on maxram_size, ram_size, ram_slots being parsed/set on machine instance at the time accelerator (KVM) is initialized.

set_memory_options() part was already reverted by commit 2a7b18a3205b, so revert remaining initialization of above machine fields to make virt_kvm_type() work as it used to.

---
 softmmu/vl.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
softmmu/vl.c +3 -4
index 814537bb42..132c6e73dc 100644
@@ -4137,6 +4137,9 @@ void qemu_init(int argc, char **argv, char **envp)
     machine_opts = qemu_get_machine_opts();
     qemu_opt_foreach(machine_opts, machine_set_property, current_machine,
                      &error_fatal);
+    current_machine->ram_size = ram_size;
+    current_machine->maxram_size = maxram_size;
+    current_machine->ram_slots = ram_slots;
 
     /*
      * Note: uses machine properties such as kernel-irqchip, must run
@@ -4315,10 +4318,6 @@ void qemu_init(int argc, char **argv, char **envp)
         }
     }
 
-    current_machine->ram_size = ram_size;
-    current_machine->maxram_size = maxram_size;
-    current_machine->ram_slots = ram_slots;
-
     parse_numa_opts(current_machine);
 
     if (machine_class->default_ram_id && current_machine->ram_size &&
Signature · 1 line
2.18.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi Igor,

Quoted 7 lines · Igor Mammedov

Commit a1b18df9a4848, broke virt_kvm_type() logic, which depends on maxram_size, ram_size, ram_slots being parsed/set on machine instance at the time accelerator (KVM) is initialized.

set_memory_options() part was already reverted by commit 2a7b18a3205b, so revert remaining initialization of above machine fields to make virt_kvm_type() work as it used to.

Oh I did not notice set_memory_options() change was already reverted.

Quoted 3 lines
Quoted 9 lines
---
 softmmu/vl.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
softmmu/vl.c +0 -0
index 814537bb42..132c6e73dc 100644

softmmu/vl.c void qemu_init(int argc, char **argv, char **envp) · line 4142

Quoted 6 lines
softmmu/vl.c +3 -0
@@ -4137,6 +4137,9 @@ void qemu_init(int argc, char **argv, char **envp)
     machine_opts = qemu_get_machine_opts();
     qemu_opt_foreach(machine_opts, machine_set_property, current_machine,
                      &error_fatal);
+    current_machine->ram_size = ram_size;
+    current_machine->maxram_size = maxram_size;
+    current_machine->ram_slots = ram_slots;

Nit: Before configure_accelerators() call there is a comment stating that configure_accelerators uses machine properties and must be called after machine_set_property. Maybe we should add it also uses memory properties and should be called after set_memory_options. This may avoid other changes of the same style.

Thanks

Eric

Quoted 15 lines
softmmu/vl.c +0 -4
     /*
      * Note: uses machine properties such as kernel-irqchip, must run
@@ -4315,10 +4318,6 @@ void qemu_init(int argc, char **argv, char **envp)
         }
     }
 
-    current_machine->ram_size = ram_size;
-    current_machine->maxram_size = maxram_size;
-    current_machine->ram_slots = ram_slots;
-
     parse_numa_opts(current_machine);
 
     if (machine_class->default_ram_id && current_machine->ram_size &&