* [Qemu-devel] [PATCH] initialize CPU model list after handling -readconfig options
@ 2012-03-09 19:19 Eduardo Habkost
2012-03-13 2:01 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Habkost @ 2012-03-09 19:19 UTC (permalink / raw)
To: qemu-devel
To properly load cpudefs using -readconfig, we have to call
cpudef_init() after finishing the command-line option handling.
Consequently, the handling of "-cpu ?" has to be done after the
command-line option handling loop, too.
Without this patch, "-readconfig configfile -cpu ?" fails to list the
CPU definitions read from 'configfile'.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
vl.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/vl.c b/vl.c
index 97ab2b9..65f11f2 100644
--- a/vl.c
+++ b/vl.c
@@ -2359,7 +2359,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
}
- cpudef_init();
/* second pass of option parsing */
optind = 1;
@@ -2382,12 +2381,7 @@ int main(int argc, char **argv, char **envp)
break;
case QEMU_OPTION_cpu:
/* hw initialization will check this */
- if (*optarg == '?') {
- list_cpus(stdout, &fprintf, optarg);
- exit(0);
- } else {
- cpu_model = optarg;
- }
+ cpu_model = optarg;
break;
case QEMU_OPTION_hda:
{
@@ -3191,6 +3185,18 @@ int main(int argc, char **argv, char **envp)
}
loc_set_none();
+ /* Init CPU def lists, based on config
+ * - Must be called after all the qemu_read_config_file() calls
+ * - Must be called before list_cpus()
+ * - Must be called before machine->init()
+ */
+ cpudef_init();
+
+ if (cpu_model && *cpu_model == '?') {
+ list_cpus(stdout, &fprintf, optarg);
+ exit(0);
+ }
+
/* Open the logfile at this point, if necessary. We can't open the logfile
* when encountering either of the logging options (-d or -D) because the
* other one may be encountered later on the command line, changing the
--
1.7.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] initialize CPU model list after handling -readconfig options
2012-03-09 19:19 [Qemu-devel] [PATCH] initialize CPU model list after handling -readconfig options Eduardo Habkost
@ 2012-03-13 2:01 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2012-03-13 2:01 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: qemu-devel
On 03/09/2012 01:19 PM, Eduardo Habkost wrote:
> To properly load cpudefs using -readconfig, we have to call
> cpudef_init() after finishing the command-line option handling.
>
> Consequently, the handling of "-cpu ?" has to be done after the
> command-line option handling loop, too.
>
> Without this patch, "-readconfig configfile -cpu ?" fails to list the
> CPU definitions read from 'configfile'.
>
> Signed-off-by: Eduardo Habkost<ehabkost@redhat.com>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> vl.c | 20 +++++++++++++-------
> 1 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index 97ab2b9..65f11f2 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2359,7 +2359,6 @@ int main(int argc, char **argv, char **envp)
> exit(1);
> }
> }
> - cpudef_init();
>
> /* second pass of option parsing */
> optind = 1;
> @@ -2382,12 +2381,7 @@ int main(int argc, char **argv, char **envp)
> break;
> case QEMU_OPTION_cpu:
> /* hw initialization will check this */
> - if (*optarg == '?') {
> - list_cpus(stdout,&fprintf, optarg);
> - exit(0);
> - } else {
> - cpu_model = optarg;
> - }
> + cpu_model = optarg;
> break;
> case QEMU_OPTION_hda:
> {
> @@ -3191,6 +3185,18 @@ int main(int argc, char **argv, char **envp)
> }
> loc_set_none();
>
> + /* Init CPU def lists, based on config
> + * - Must be called after all the qemu_read_config_file() calls
> + * - Must be called before list_cpus()
> + * - Must be called before machine->init()
> + */
> + cpudef_init();
> +
> + if (cpu_model&& *cpu_model == '?') {
> + list_cpus(stdout,&fprintf, optarg);
> + exit(0);
> + }
> +
> /* Open the logfile at this point, if necessary. We can't open the logfile
> * when encountering either of the logging options (-d or -D) because the
> * other one may be encountered later on the command line, changing the
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-13 2:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09 19:19 [Qemu-devel] [PATCH] initialize CPU model list after handling -readconfig options Eduardo Habkost
2012-03-13 2:01 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).