Received: from eggs.gnu.org ([208.118.235.92]:50504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S65LW-0006GO-WC for qemu-devel@nongnu.org; Fri, 09 Mar 2012 14:19:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S65LD-0002fm-3F for qemu-devel@nongnu.org; Fri, 09 Mar 2012 14:19:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S65LC-0002fO-Ot for qemu-devel@nongnu.org; Fri, 09 Mar 2012 14:19:03 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q29JJ1bN017050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 9 Mar 2012 14:19:01 -0500 Received: from blackpad.lan.raisama.net (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q29JIx45004264 for ; Fri, 9 Mar 2012 14:19:00 -0500 From: Eduardo Habkost Date: Fri, 9 Mar 2012 16:19:07 -0300 Message-Id: <1331320747-2209-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH] initialize CPU model list after handling -readconfig options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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