[PATCH 76/86] post conversion default_ram_id cleanup

Igor Mammedov posted 86 patches 5 years, 11 months ago
Maintainers: Andrew Baumann <Andrew.Baumann@microsoft.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Andrew Jeffery <andrew@aj.id.au>, Sergio Lopez <slp@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Aurelien Jarno <aurelien@aurel32.net>, Christian Borntraeger <borntraeger@de.ibm.com>, Paul Burton <pburton@wavecomp.com>, Artyom Tarasenko <atar4qemu@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Igor Mammedov <imammedo@redhat.com>, Andrzej Zaborowski <balrogg@gmail.com>, Thomas Huth <thuth@redhat.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, KONRAD Frederic <frederic.konrad@adacore.com>, David Hildenbrand <david@redhat.com>, Michael Walle <michael@walle.cc>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, David Gibson <david@gibson.dropbear.id.au>, Eduardo Habkost <ehabkost@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Rob Herring <robh@kernel.org>, Jan Kiszka <jan.kiszka@web.de>, Beniamino Galvani <b.galvani@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, Fabien Chouteau <chouteau@adacore.com>, Leif Lindholm <leif.lindholm@linaro.org>, Thomas Huth <huth@tuxfamily.org>, Peter Chubb <peter.chubb@nicta.com.au>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>, Cornelia Huck <cohuck@redhat.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Antony Pavlov <antonynpavlov@gmail.com>, Jean-Christophe Dubois <jcd@tribudubois.net>, Helge Deller <deller@gmx.de>, Alistair Francis <alistair@alistair23.me>, Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, Joel Stanley <joel@jms.id.au>, BALATON Zoltan <balaton@eik.bme.hu>, Richard Henderson <rth@twiddle.net>
There is a newer version of this series
[PATCH 76/86] post conversion default_ram_id cleanup
Posted by Igor Mammedov 5 years, 11 months ago
With default_ram_id is always defined, simplify
'if' conditions in vl.c and numa.c

while at it set
  MachineClass::default_ram_id = "ram"
and clean up several boards that use "ram" id

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
 hw/alpha/dp264.c       | 1 -
 hw/arm/aspeed.c        | 1 -
 hw/arm/digic_boards.c  | 1 -
 hw/arm/raspi.c         | 2 --
 hw/core/machine.c      | 1 +
 hw/core/null-machine.c | 1 -
 hw/core/numa.c         | 2 +-
 hw/hppa/machine.c      | 1 -
 hw/ppc/virtex_ml507.c  | 1 -
 vl.c                   | 1 -
 10 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 29439c7..f6b9e50 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -183,7 +183,6 @@ static void clipper_machine_init(MachineClass *mc)
     mc->max_cpus = 4;
     mc->is_default = 1;
     mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
-    mc->default_ram_id = "ram";
 }
 
 DEFINE_MACHINE("clipper", clipper_machine_init)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 330254b..188d42f 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -391,7 +391,6 @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
-    mc->default_ram_id = "ram";
 }
 
 static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data)
diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
index c3bc5cb..c3cffb3 100644
--- a/hw/arm/digic_boards.c
+++ b/hw/arm/digic_boards.c
@@ -149,7 +149,6 @@ static void canon_a1100_machine_init(MachineClass *mc)
     mc->init = &canon_a1100_init;
     mc->ignore_memory_transaction_failures = true;
     mc->default_ram_size = 64 * MiB;
-    mc->default_ram_id = "ram";
 }
 
 DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init)
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
index 33ace66..3d49dcc 100644
--- a/hw/arm/raspi.c
+++ b/hw/arm/raspi.c
@@ -223,7 +223,6 @@ static void raspi2_machine_init(MachineClass *mc)
     mc->min_cpus = BCM283X_NCPUS;
     mc->default_cpus = BCM283X_NCPUS;
     mc->default_ram_size = 1 * GiB;
-    mc->default_ram_id = "ram";
     mc->ignore_memory_transaction_failures = true;
 };
 DEFINE_MACHINE("raspi2", raspi2_machine_init)
@@ -246,7 +245,6 @@ static void raspi3_machine_init(MachineClass *mc)
     mc->min_cpus = BCM283X_NCPUS;
     mc->default_cpus = BCM283X_NCPUS;
     mc->default_ram_size = 1 * GiB;
-    mc->default_ram_id = "ram";
 }
 DEFINE_MACHINE("raspi3", raspi3_machine_init)
 #endif
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 080ce57..a938052 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -711,6 +711,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
 
     /* Default 128 MB as guest ram size */
     mc->default_ram_size = 128 * MiB;
+    mc->default_ram_id = "ram";
     mc->rom_file_has_mr = true;
     mc->smp_parse = smp_parse;
 
diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
index cb47d9d..08c6109 100644
--- a/hw/core/null-machine.c
+++ b/hw/core/null-machine.c
@@ -49,7 +49,6 @@ static void machine_none_machine_init(MachineClass *mc)
     mc->init = machine_none_init;
     mc->max_cpus = 1;
     mc->default_ram_size = 0;
-    mc->default_ram_id = "ram";
 }
 
 DEFINE_MACHINE("none", machine_none_machine_init)
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 623b307..6a1711d 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -459,7 +459,7 @@ void numa_complete_configuration(MachineState *ms)
             exit(1);
         }
 
-        if (!numa_uses_legacy_mem() && mc->default_ram_id) {
+        if (!numa_uses_legacy_mem()) {
             ms->ram = g_new(MemoryRegion, 1);
             memory_region_init(ms->ram, OBJECT(ms), mc->default_ram_id,
                                ram_size);
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index b2f7bc5..ebbf44f 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -279,7 +279,6 @@ static void machine_hppa_machine_init(MachineClass *mc)
     mc->is_default = 1;
     mc->default_ram_size = 512 * MiB;
     mc->default_boot_order = "cd";
-    mc->default_ram_id = "ram";
 }
 
 DEFINE_MACHINE("hppa", machine_hppa_machine_init)
diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
index b74a269..b31f1cf 100644
--- a/hw/ppc/virtex_ml507.c
+++ b/hw/ppc/virtex_ml507.c
@@ -299,7 +299,6 @@ static void virtex_machine_init(MachineClass *mc)
     mc->desc = "Xilinx Virtex ML507 reference design";
     mc->init = virtex_init;
     mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440-xilinx");
-    mc->default_ram_id = "ram";
 }
 
 DEFINE_MACHINE("virtex-ml507", virtex_machine_init)
diff --git a/vl.c b/vl.c
index b89e76c..60dffb4 100644
--- a/vl.c
+++ b/vl.c
@@ -4296,7 +4296,6 @@ int main(int argc, char **argv, char **envp)
 
     if (numa_uses_legacy_mem() &&
         machine_class->default_ram_size &&
-        machine_class->default_ram_id &&
         !current_machine->ram_memdev) {
         create_default_memdev(current_machine, mem_path, mem_prealloc);
     }
-- 
2.7.4


Re: [PATCH 76/86] post conversion default_ram_id cleanup
Posted by Philippe Mathieu-Daudé 5 years, 11 months ago
On 12/31/19 2:04 PM, Igor Mammedov wrote:
> With default_ram_id is always defined, simplify
> 'if' conditions in vl.c and numa.c
> 
> while at it set
>    MachineClass::default_ram_id = "ram"
> and clean up several boards that use "ram" id
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>   hw/alpha/dp264.c       | 1 -
>   hw/arm/aspeed.c        | 1 -
>   hw/arm/digic_boards.c  | 1 -
>   hw/arm/raspi.c         | 2 --
>   hw/core/machine.c      | 1 +
>   hw/core/null-machine.c | 1 -
>   hw/core/numa.c         | 2 +-
>   hw/hppa/machine.c      | 1 -
>   hw/ppc/virtex_ml507.c  | 1 -
>   vl.c                   | 1 -
>   10 files changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index 29439c7..f6b9e50 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -183,7 +183,6 @@ static void clipper_machine_init(MachineClass *mc)
>       mc->max_cpus = 4;
>       mc->is_default = 1;
>       mc->default_cpu_type = ALPHA_CPU_TYPE_NAME("ev67");
> -    mc->default_ram_id = "ram";
>   }
>   
>   DEFINE_MACHINE("clipper", clipper_machine_init)
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 330254b..188d42f 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -391,7 +391,6 @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
>       mc->no_floppy = 1;
>       mc->no_cdrom = 1;
>       mc->no_parallel = 1;
> -    mc->default_ram_id = "ram";
>   }
>   
>   static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data)
> diff --git a/hw/arm/digic_boards.c b/hw/arm/digic_boards.c
> index c3bc5cb..c3cffb3 100644
> --- a/hw/arm/digic_boards.c
> +++ b/hw/arm/digic_boards.c
> @@ -149,7 +149,6 @@ static void canon_a1100_machine_init(MachineClass *mc)
>       mc->init = &canon_a1100_init;
>       mc->ignore_memory_transaction_failures = true;
>       mc->default_ram_size = 64 * MiB;
> -    mc->default_ram_id = "ram";
>   }
>   
>   DEFINE_MACHINE("canon-a1100", canon_a1100_machine_init)
> diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> index 33ace66..3d49dcc 100644
> --- a/hw/arm/raspi.c
> +++ b/hw/arm/raspi.c
> @@ -223,7 +223,6 @@ static void raspi2_machine_init(MachineClass *mc)
>       mc->min_cpus = BCM283X_NCPUS;
>       mc->default_cpus = BCM283X_NCPUS;
>       mc->default_ram_size = 1 * GiB;
> -    mc->default_ram_id = "ram";
>       mc->ignore_memory_transaction_failures = true;
>   };
>   DEFINE_MACHINE("raspi2", raspi2_machine_init)
> @@ -246,7 +245,6 @@ static void raspi3_machine_init(MachineClass *mc)
>       mc->min_cpus = BCM283X_NCPUS;
>       mc->default_cpus = BCM283X_NCPUS;
>       mc->default_ram_size = 1 * GiB;
> -    mc->default_ram_id = "ram";
>   }
>   DEFINE_MACHINE("raspi3", raspi3_machine_init)
>   #endif
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 080ce57..a938052 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -711,6 +711,7 @@ static void machine_class_init(ObjectClass *oc, void *data)
>   
>       /* Default 128 MB as guest ram size */
>       mc->default_ram_size = 128 * MiB;
> +    mc->default_ram_id = "ram";
>       mc->rom_file_has_mr = true;
>       mc->smp_parse = smp_parse;
>   
> diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
> index cb47d9d..08c6109 100644
> --- a/hw/core/null-machine.c
> +++ b/hw/core/null-machine.c
> @@ -49,7 +49,6 @@ static void machine_none_machine_init(MachineClass *mc)
>       mc->init = machine_none_init;
>       mc->max_cpus = 1;
>       mc->default_ram_size = 0;
> -    mc->default_ram_id = "ram";
>   }
>   
>   DEFINE_MACHINE("none", machine_none_machine_init)
> diff --git a/hw/core/numa.c b/hw/core/numa.c
> index 623b307..6a1711d 100644
> --- a/hw/core/numa.c
> +++ b/hw/core/numa.c
> @@ -459,7 +459,7 @@ void numa_complete_configuration(MachineState *ms)
>               exit(1);
>           }
>   
> -        if (!numa_uses_legacy_mem() && mc->default_ram_id) {
> +        if (!numa_uses_legacy_mem()) {
>               ms->ram = g_new(MemoryRegion, 1);
>               memory_region_init(ms->ram, OBJECT(ms), mc->default_ram_id,
>                                  ram_size);
> diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
> index b2f7bc5..ebbf44f 100644
> --- a/hw/hppa/machine.c
> +++ b/hw/hppa/machine.c
> @@ -279,7 +279,6 @@ static void machine_hppa_machine_init(MachineClass *mc)
>       mc->is_default = 1;
>       mc->default_ram_size = 512 * MiB;
>       mc->default_boot_order = "cd";
> -    mc->default_ram_id = "ram";
>   }
>   
>   DEFINE_MACHINE("hppa", machine_hppa_machine_init)
> diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c
> index b74a269..b31f1cf 100644
> --- a/hw/ppc/virtex_ml507.c
> +++ b/hw/ppc/virtex_ml507.c
> @@ -299,7 +299,6 @@ static void virtex_machine_init(MachineClass *mc)
>       mc->desc = "Xilinx Virtex ML507 reference design";
>       mc->init = virtex_init;
>       mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("440-xilinx");
> -    mc->default_ram_id = "ram";
>   }
>   
>   DEFINE_MACHINE("virtex-ml507", virtex_machine_init)
> diff --git a/vl.c b/vl.c
> index b89e76c..60dffb4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4296,7 +4296,6 @@ int main(int argc, char **argv, char **envp)
>   
>       if (numa_uses_legacy_mem() &&
>           machine_class->default_ram_size &&
> -        machine_class->default_ram_id &&
>           !current_machine->ram_memdev) {
>           create_default_memdev(current_machine, mem_path, mem_prealloc);
>       }
>