Browse Source

cpu: Rename parse_cpu_model() to parse_cpu_option()

The "model[,option...]" string parsed by the function is not just
a CPU model.  Rename the function and its argument to indicate it
expects the full "-cpu" option to be provided.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <2019041702.16154-2-ehabkost@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
master
Eduardo Habkost 2 months ago
parent
commit
c1c8cfe5f9
5 changed files with 16 additions and 16 deletions
  1. 1
    1
      bsd-user/main.c
  2. 2
    2
      exec.c
  3. 3
    3
      include/qom/cpu.h
  4. 1
    1
      linux-user/main.c
  5. 9
    9
      vl.c

+ 1
- 1
bsd-user/main.c View File

@@ -905,7 +905,7 @@ int main(int argc, char **argv)
905 905
     /* init tcg before creating CPUs and to get qemu_host_page_size */
906 906
     tcg_exec_init(0);
907 907
 
908
-    cpu_type = parse_cpu_model(cpu_model);
908
+    cpu_type = parse_cpu_option(cpu_model);
909 909
     cpu = cpu_create(cpu_type);
910 910
     env = cpu->env_ptr;
911 911
 #if defined(TARGET_SPARC) || defined(TARGET_PPC)

+ 2
- 2
exec.c View File

@@ -983,14 +983,14 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
983 983
 #endif
984 984
 }
985 985
 
986
-const char *parse_cpu_model(const char *cpu_model)
986
+const char *parse_cpu_option(const char *cpu_option)
987 987
 {
988 988
     ObjectClass *oc;
989 989
     CPUClass *cc;
990 990
     gchar **model_pieces;
991 991
     const char *cpu_type;
992 992
 
993
-    model_pieces = g_strsplit(cpu_model, ",", 2);
993
+    model_pieces = g_strsplit(cpu_option, ",", 2);
994 994
 
995 995
     oc = cpu_class_by_name(CPU_RESOLVING_TYPE, model_pieces[0]);
996 996
     if (oc == NULL) {

+ 3
- 3
include/qom/cpu.h View File

@@ -681,15 +681,15 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model);
681 681
 CPUState *cpu_create(const char *typename);
682 682
 
683 683
 /**
684
- * parse_cpu_model:
685
- * @cpu_model: The model string including optional parameters.
684
+ * parse_cpu_option:
685
+ * @cpu_option: The -cpu option including optional parameters.
686 686
  *
687 687
  * processes optional parameters and registers them as global properties
688 688
  *
689 689
  * Returns: type of CPU to create or prints error and terminates process
690 690
  *          if an error occurred.
691 691
  */
692
-const char *parse_cpu_model(const char *cpu_model);
692
+const char *parse_cpu_option(const char *cpu_option);
693 693
 
694 694
 /**
695 695
  * cpu_has_work:

+ 1
- 1
linux-user/main.c View File

@@ -662,7 +662,7 @@ int main(int argc, char **argv, char **envp)
662 662
     if (cpu_model == NULL) {
663 663
         cpu_model = cpu_get_model(get_elf_eflags(execfd));
664 664
     }
665
-    cpu_type = parse_cpu_model(cpu_model);
665
+    cpu_type = parse_cpu_option(cpu_model);
666 666
 
667 667
     /* init tcg before creating CPUs and to get qemu_host_page_size */
668 668
     tcg_exec_init(0);

+ 9
- 9
vl.c View File

@@ -2989,7 +2989,7 @@ int main(int argc, char **argv, char **envp)
2989 2989
     const char *optarg;
2990 2990
     const char *loadvm = NULL;
2991 2991
     MachineClass *machine_class;
2992
-    const char *cpu_model;
2992
+    const char *cpu_option;
2993 2993
     const char *vga_model = NULL;
2994 2994
     const char *qtest_chrdev = NULL;
2995 2995
     const char *qtest_log = NULL;
@@ -3068,7 +3068,7 @@ int main(int argc, char **argv, char **envp)
3068 3068
     QLIST_INIT (&vm_change_state_head);
3069 3069
     os_setup_early_signal_handling();
3070 3070
 
3071
-    cpu_model = NULL;
3071
+    cpu_option = NULL;
3072 3072
     snapshot = 0;
3073 3073
 
3074 3074
     nb_nics = 0;
@@ -3120,7 +3120,7 @@ int main(int argc, char **argv, char **envp)
3120 3120
             switch(popt->index) {
3121 3121
             case QEMU_OPTION_cpu:
3122 3122
                 /* hw initialization will check this */
3123
-                cpu_model = optarg;
3123
+                cpu_option = optarg;
3124 3124
                 break;
3125 3125
             case QEMU_OPTION_hda:
3126 3126
             case QEMU_OPTION_hdb:
@@ -4037,8 +4037,8 @@ int main(int argc, char **argv, char **envp)
4037 4037
         qemu_set_hw_version(machine_class->hw_version);
4038 4038
     }
4039 4039
 
4040
-    if (cpu_model && is_help_option(cpu_model)) {
4041
-        list_cpus(cpu_model);
4040
+    if (cpu_option && is_help_option(cpu_option)) {
4041
+        list_cpus(cpu_option);
4042 4042
         exit(0);
4043 4043
     }
4044 4044
 
@@ -4286,9 +4286,9 @@ int main(int argc, char **argv, char **envp)
4286 4286
      * Global properties get set up by qdev_prop_register_global(),
4287 4287
      * called from user_register_global_props(), and certain option
4288 4288
      * desugaring.  Also in CPU feature desugaring (buried in
4289
-     * parse_cpu_model()), which happens below this point, but may
4289
+     * parse_cpu_option()), which happens below this point, but may
4290 4290
      * only target the CPU type, which can only be created after
4291
-     * parse_cpu_model() returned the type.
4291
+     * parse_cpu_option() returned the type.
4292 4292
      *
4293 4293
      * Machine compat properties: object_set_machine_compat_props().
4294 4294
      * Accelerator compat props: object_set_accelerator_compat_props(),
@@ -4452,8 +4452,8 @@ int main(int argc, char **argv, char **envp)
4452 4452
 
4453 4453
     /* parse features once if machine provides default cpu_type */
4454 4454
     current_machine->cpu_type = machine_class->default_cpu_type;
4455
-    if (cpu_model) {
4456
-        current_machine->cpu_type = parse_cpu_model(cpu_model);
4455
+    if (cpu_option) {
4456
+        current_machine->cpu_type = parse_cpu_option(cpu_option);
4457 4457
     }
4458 4458
     parse_numa_opts(current_machine);
4459 4459
 

Loading…
Cancel
Save