All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09
@ 2017-10-10  2:39 Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 1/8] qom/cpu: move cpu_model null check to cpu_class_by_name() Eduardo Habkost
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

Changes on v2:
* Removed NUMA/ACPI patches until we figure out what's breaking
  the tests.
  (See: https://www.mail-archive.com/qemu-devel@nongnu.org/msg486368.html)
  Note that I didn't reproduce the failure yet.  I am just
  removing those patches because they are the only ones touching
  ACPI code.

The following changes since commit 530049bc1dcc24c1178a29d99ca08b6dd08413e0:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2017-10-06 17:43:02 +0100)

are available in the git repository at:

  git://github.com/ehabkost/qemu.git tags/x86-and-machine-pull-request

for you to fetch changes up to e0dd5fd41a1a38766009f442967fab700d2d0550:

  x86: Correct translation of some rdgsbase and wrgsbase encodings (2017-10-09 23:29:20 -0300)

----------------------------------------------------------------
x86 and machine queue, 2017-10-09

Includes x86, QOM, CPU, and option/config parsing patches.

Highlights:
* Deprecation of -nodefconfig option;
* MachineClass::valid_cpu_types field.

----------------------------------------------------------------

Alistair Francis (1):
  machine: Add a valid_cpu_types property

Eduardo Habkost (3):
  vl: Eliminate defconfig variable
  qemu-options: Deprecate -nodefconfig
  config: qemu_config_parse() return number of config groups

Igor Mammedov (1):
  qom: update doc comment for type_register[_static]()

Philippe Mathieu-Daudé (1):
  qom/cpu: move cpu_model null check to cpu_class_by_name()

Seeteena Thoufeek (1):
  vl: exit if maxcpus is negative

Todd Eisenberger (1):
  x86: Correct translation of some rdgsbase and wrgsbase encodings

 include/hw/boards.h     |  1 +
 include/qom/object.h    |  4 ++--
 include/sysemu/sysemu.h |  2 +-
 block/blkdebug.c        |  1 -
 hw/core/machine.c       | 32 ++++++++++++++++++++++++++++++++
 qom/cpu.c               |  7 ++++++-
 target/alpha/cpu.c      |  6 +-----
 target/arm/cpu.c        |  4 ----
 target/cris/cpu.c       |  4 ----
 target/i386/translate.c |  4 ++--
 target/lm32/cpu.c       |  4 ----
 target/m68k/cpu.c       |  4 ----
 target/mips/cpu.c       |  4 ----
 target/moxie/cpu.c      |  8 +-------
 target/openrisc/cpu.c   |  4 ----
 target/sh4/cpu.c        |  3 ---
 target/sparc/cpu.c      |  4 ----
 target/tricore/cpu.c    |  4 ----
 target/unicore32/cpu.c  |  4 ----
 target/xtensa/cpu.c     |  4 ----
 util/qemu-config.c      | 15 +++++++--------
 vl.c                    | 11 ++++-------
 qemu-doc.texi           |  4 ++++
 qemu-options.hx         | 17 ++++-------------
 24 files changed, 65 insertions(+), 90 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 1/8] qom/cpu: move cpu_model null check to cpu_class_by_name()
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
@ 2017-10-10  2:39 ` Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 2/8] machine: Add a valid_cpu_types property Eduardo Habkost
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

and clean every implementation.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170917232842.14544-1-f4bug@amsat.org>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qom/cpu.c              | 7 ++++++-
 target/alpha/cpu.c     | 6 +-----
 target/arm/cpu.c       | 4 ----
 target/cris/cpu.c      | 4 ----
 target/lm32/cpu.c      | 4 ----
 target/m68k/cpu.c      | 4 ----
 target/mips/cpu.c      | 4 ----
 target/moxie/cpu.c     | 8 +-------
 target/openrisc/cpu.c  | 4 ----
 target/sh4/cpu.c       | 3 ---
 target/sparc/cpu.c     | 4 ----
 target/tricore/cpu.c   | 4 ----
 target/unicore32/cpu.c | 4 ----
 target/xtensa/cpu.c    | 4 ----
 14 files changed, 8 insertions(+), 56 deletions(-)

diff --git a/qom/cpu.c b/qom/cpu.c
index 94fa8fe005..54c9452b1c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -316,7 +316,12 @@ static bool cpu_common_has_work(CPUState *cs)
 
 ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model)
 {
-    CPUClass *cc = CPU_CLASS(object_class_by_name(typename));
+    CPUClass *cc;
+
+    if (!cpu_model) {
+        return NULL;
+    }
+    cc = CPU_CLASS(object_class_by_name(typename));
 
     return cc->class_by_name(cpu_model);
 }
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index e6c6aabdf0..b8a21f4e01 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -127,14 +127,10 @@ static const AlphaCPUAlias alpha_cpu_aliases[] = {
 
 static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
 {
-    ObjectClass *oc = NULL;
+    ObjectClass *oc;
     char *typename;
     int i;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     oc = object_class_by_name(cpu_model);
     if (oc != NULL && object_class_dynamic_cast(oc, TYPE_ALPHA_CPU) != NULL &&
         !object_class_is_abstract(oc)) {
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index f4f601f079..88578f360e 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -939,10 +939,6 @@ static ObjectClass *arm_cpu_class_by_name(const char *cpu_model)
     char *typename;
     char **cpuname;
 
-    if (!cpu_model) {
-        return NULL;
-    }
-
     cpuname = g_strsplit(cpu_model, ",", 1);
     typename = g_strdup_printf(ARM_CPU_TYPE_NAME("%s"), cpuname[0]);
     oc = object_class_by_name(typename);
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
index ceebfed79b..88d93f2d11 100644
--- a/target/cris/cpu.c
+++ b/target/cris/cpu.c
@@ -69,10 +69,6 @@ static ObjectClass *cris_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
 #if defined(CONFIG_USER_ONLY)
     if (strcasecmp(cpu_model, "any") == 0) {
         return object_class_by_name("crisv32-" TYPE_CRIS_CPU);
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
index 2b8c36b6d0..bf081f56d2 100644
--- a/target/lm32/cpu.c
+++ b/target/lm32/cpu.c
@@ -246,10 +246,6 @@ static ObjectClass *lm32_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = g_strdup_printf("%s-" TYPE_LM32_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
index 55bf24bae6..8c70e0805c 100644
--- a/target/m68k/cpu.c
+++ b/target/m68k/cpu.c
@@ -87,10 +87,6 @@ static ObjectClass *m68k_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = g_strdup_printf("%s-" TYPE_M68K_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 1a9a3ed94d..c15b894362 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -166,10 +166,6 @@ static ObjectClass *mips_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = mips_cpu_type_name(cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c
index 748d02f29e..30bd44fcad 100644
--- a/target/moxie/cpu.c
+++ b/target/moxie/cpu.c
@@ -89,13 +89,7 @@ static void moxie_cpu_initfn(Object *obj)
 
 static ObjectClass *moxie_cpu_class_by_name(const char *cpu_model)
 {
-    ObjectClass *oc;
-
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
-    oc = object_class_by_name(cpu_model);
+    ObjectClass *oc = object_class_by_name(cpu_model);
     if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_MOXIE_CPU) ||
                        object_class_is_abstract(oc))) {
         return NULL;
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
index a979f0bf8b..af9cdcc102 100644
--- a/target/openrisc/cpu.c
+++ b/target/openrisc/cpu.c
@@ -108,10 +108,6 @@ static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index 6ce7cba5a9..252440e019 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -133,9 +133,6 @@ static ObjectClass *superh_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     GSList *list, *item;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
     if (strcasecmp(cpu_model, "any") == 0) {
         return object_class_by_name(TYPE_SH7750R_CPU);
     }
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 0806d699e6..beab90f3e6 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -730,10 +730,6 @@ static ObjectClass *sparc_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = sparc_cpu_type_name(cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index 5ab5b56454..871eb35453 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -120,10 +120,6 @@ static ObjectClass *tricore_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (!cpu_model) {
-        return NULL;
-    }
-
     typename = g_strdup_printf("%s-" TYPE_TRICORE_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
index c9b78ce68e..138acc9dd8 100644
--- a/target/unicore32/cpu.c
+++ b/target/unicore32/cpu.c
@@ -44,10 +44,6 @@ static ObjectClass *uc32_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = g_strdup_printf("%s-" TYPE_UNICORE32_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
index 85897df0a8..dcdc765a86 100644
--- a/target/xtensa/cpu.c
+++ b/target/xtensa/cpu.c
@@ -83,10 +83,6 @@ static ObjectClass *xtensa_cpu_class_by_name(const char *cpu_model)
     ObjectClass *oc;
     char *typename;
 
-    if (cpu_model == NULL) {
-        return NULL;
-    }
-
     typename = g_strdup_printf("%s-" TYPE_XTENSA_CPU, cpu_model);
     oc = object_class_by_name(typename);
     g_free(typename);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 2/8] machine: Add a valid_cpu_types property
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 1/8] qom/cpu: move cpu_model null check to cpu_class_by_name() Eduardo Habkost
@ 2017-10-10  2:39 ` Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 3/8] vl: Eliminate defconfig variable Eduardo Habkost
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Alistair Francis

From: Alistair Francis <alistair.francis@xilinx.com>

This patch add a MachineClass element that can be set in the machine C
code to specify a list of supported CPU types. If the supported CPU
types are specified the user enter CPU (by -cpu at runtime) is checked
against the supported types and QEMU exits if they aren't supported.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Message-Id: <b8474e9d2e0a219d9bac901342f983b13d009301.1507059418.git.alistair.francis@xilinx.com>
[ehabkost: removed assert(), rewrote comment]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/hw/boards.h |  1 +
 hw/core/machine.c   | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 156e0a5701..191a5b3cd8 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -191,6 +191,7 @@ struct MachineClass {
     bool has_hotpluggable_cpus;
     bool ignore_memory_transaction_failures;
     int numa_mem_align_shift;
+    const char **valid_cpu_types;
     void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
                                  int nb_nodes, ram_addr_t size);
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 80647edc2a..36c2fb069c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -758,6 +758,38 @@ void machine_run_board_init(MachineState *machine)
     if (nb_numa_nodes) {
         machine_numa_finish_init(machine);
     }
+
+    /* If the machine supports the valid_cpu_types check and the user
+     * specified a CPU with -cpu check here that the user CPU is supported.
+     */
+    if (machine_class->valid_cpu_types && machine->cpu_type) {
+        ObjectClass *class = object_class_by_name(machine->cpu_type);
+        int i;
+
+        for (i = 0; machine_class->valid_cpu_types[i]; i++) {
+            if (object_class_dynamic_cast(class,
+                                          machine_class->valid_cpu_types[i])) {
+                /* The user specificed CPU is in the valid field, we are
+                 * good to go.
+                 */
+                break;
+            }
+        }
+
+        if (!machine_class->valid_cpu_types[i]) {
+            /* The user specified CPU is not valid */
+            error_report("Invalid CPU type: %s", machine->cpu_type);
+            error_printf("The valid types are: %s",
+                         machine_class->valid_cpu_types[0]);
+            for (i = 1; machine_class->valid_cpu_types[i]; i++) {
+                error_printf(", %s", machine_class->valid_cpu_types[i]);
+            }
+            error_printf("\n");
+
+            exit(1);
+        }
+    }
+
     machine_class->init(machine);
 }
 
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 3/8] vl: Eliminate defconfig variable
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 1/8] qom/cpu: move cpu_model null check to cpu_class_by_name() Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 2/8] machine: Add a valid_cpu_types property Eduardo Habkost
@ 2017-10-10  2:39 ` Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 4/8] qemu-options: Deprecate -nodefconfig Eduardo Habkost
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

Both -nodefconfig and -no-user-config options do the same thing
today, we only need one variable to keep track of them.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20171004030025.7866-2-ehabkost@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 vl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/vl.c b/vl.c
index 3fed457921..ebea42e0ea 100644
--- a/vl.c
+++ b/vl.c
@@ -3111,7 +3111,6 @@ int main(int argc, char **argv, char **envp)
     const char *qtest_log = NULL;
     const char *pid_file = NULL;
     const char *incoming = NULL;
-    bool defconfig = true;
     bool userconfig = true;
     bool nographic = false;
     DisplayType display_type = DT_DEFAULT;
@@ -3213,8 +3212,6 @@ int main(int argc, char **argv, char **envp)
             popt = lookup_opt(argc, argv, &optarg, &optind);
             switch (popt->index) {
             case QEMU_OPTION_nodefconfig:
-                defconfig = false;
-                break;
             case QEMU_OPTION_nouserconfig:
                 userconfig = false;
                 break;
@@ -3222,7 +3219,7 @@ int main(int argc, char **argv, char **envp)
         }
     }
 
-    if (defconfig && userconfig) {
+    if (userconfig) {
         if (qemu_read_default_config_file() < 0) {
             exit(1);
         }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 4/8] qemu-options: Deprecate -nodefconfig
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
                   ` (2 preceding siblings ...)
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 3/8] vl: Eliminate defconfig variable Eduardo Habkost
@ 2017-10-10  2:39 ` Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 5/8] config: qemu_config_parse() return number of config groups Eduardo Habkost
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Markus Armbruster

Since 2012 (commit ba6212d8 "Eliminate cpus-x86_64.conf file") we
have no default config files that would be disabled using
-nodefconfig.  Update documentation and document -nodefconfig as
deprecated.

Cc: Markus Armbruster <armbru@redhat.com>
Acked-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20171004030025.7866-3-ehabkost@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu-doc.texi   |  4 ++++
 qemu-options.hx | 17 ++++-------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/qemu-doc.texi b/qemu-doc.texi
index ecd186a159..d8bb2c664f 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -2496,6 +2496,10 @@ would automatically enable USB support on the machine type.
 If using the new syntax, USB support must be explicitly
 enabled via the ``-machine usb=on'' argument.
 
+@subsection -nodefconfig (since 2.11.0)
+
+The ``-nodefconfig`` argument is a synonym for ``-no-user-config``.
+
 @section qemu-img command line arguments
 
 @subsection convert -s (since 2.0.0)
diff --git a/qemu-options.hx b/qemu-options.hx
index 39225ae6c3..981742d191 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4067,26 +4067,17 @@ Write device configuration to @var{file}. The @var{file} can be either filename
 command line and device configuration into file or dash @code{-}) character to print the
 output to stdout. This can be later used as input file for @code{-readconfig} option.
 ETEXI
-DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig,
-    "-nodefconfig\n"
-    "                do not load default config files at startup\n",
-    QEMU_ARCH_ALL)
-STEXI
-@item -nodefconfig
-@findex -nodefconfig
-Normally QEMU loads configuration files from @var{sysconfdir} and @var{datadir} at startup.
-The @code{-nodefconfig} option will prevent QEMU from loading any of those config files.
-ETEXI
+HXCOMM Deprecated, same as -no-user-config
+DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig, "", QEMU_ARCH_ALL)
 DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
     "-no-user-config\n"
-    "                do not load user-provided config files at startup\n",
+    "                do not load default user-provided config files at startup\n",
     QEMU_ARCH_ALL)
 STEXI
 @item -no-user-config
 @findex -no-user-config
 The @code{-no-user-config} option makes QEMU not load any of the user-provided
-config files on @var{sysconfdir}, but won't make it skip the QEMU-provided config
-files from @var{datadir}.
+config files on @var{sysconfdir}.
 ETEXI
 DEF("trace", HAS_ARG, QEMU_OPTION_trace,
     "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 5/8] config: qemu_config_parse() return number of config groups
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
                   ` (3 preceding siblings ...)
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 4/8] qemu-options: Deprecate -nodefconfig Eduardo Habkost
@ 2017-10-10  2:39 ` Eduardo Habkost
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 6/8] qom: update doc comment for type_register[_static]() Eduardo Habkost
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

Change qemu_config_parse() to return the number of config groups
in success and -EINVAL on error. This will allow callers of
qemu_config_parse() to check if something was really loaded from
the config file.

All existing callers of qemu_config_parse() and
qemu_read_config_file() only check if the return value was
negative, so the change shouldn't affect them.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20171004025043.3788-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 block/blkdebug.c   |  1 -
 util/qemu-config.c | 15 +++++++--------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index 46e53f2f09..dfdf9b91aa 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -244,7 +244,6 @@ static int read_config(BDRVBlkdebugState *s, const char *filename,
         ret = qemu_config_parse(f, config_groups, filename);
         if (ret < 0) {
             error_setg(errp, "Could not parse blkdebug config file");
-            ret = -EINVAL;
             goto fail;
         }
     }
diff --git a/util/qemu-config.c b/util/qemu-config.c
index 405dd1a1d7..99b0e46fa3 100644
--- a/util/qemu-config.c
+++ b/util/qemu-config.c
@@ -385,6 +385,7 @@ void qemu_config_write(FILE *fp)
     }
 }
 
+/* Returns number of config groups on success, -errno on error */
 int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
 {
     char line[1024], group[64], id[64], arg[64], value[1024];
@@ -392,7 +393,8 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
     QemuOptsList *list = NULL;
     Error *local_err = NULL;
     QemuOpts *opts = NULL;
-    int res = -1, lno = 0;
+    int res = -EINVAL, lno = 0;
+    int count = 0;
 
     loc_push_none(&loc);
     while (fgets(line, sizeof(line), fp) != NULL) {
@@ -413,6 +415,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
                 goto out;
             }
             opts = qemu_opts_create(list, id, 1, NULL);
+            count++;
             continue;
         }
         if (sscanf(line, "[%63[^]]]", group) == 1) {
@@ -423,6 +426,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
                 goto out;
             }
             opts = qemu_opts_create(list, NULL, 0, &error_abort);
+            count++;
             continue;
         }
         value[0] = '\0';
@@ -447,7 +451,7 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname)
         error_report("error reading file");
         goto out;
     }
-    res = 0;
+    res = count;
 out:
     loc_pop(&loc);
     return res;
@@ -464,12 +468,7 @@ int qemu_read_config_file(const char *filename)
 
     ret = qemu_config_parse(f, vm_config_groups, filename);
     fclose(f);
-
-    if (ret == 0) {
-        return 0;
-    } else {
-        return -EINVAL;
-    }
+    return ret;
 }
 
 static void config_parse_qdict_section(QDict *options, QemuOptsList *opts,
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 6/8] qom: update doc comment for type_register[_static]()
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
                   ` (4 preceding siblings ...)
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 5/8] config: qemu_config_parse() return number of config groups Eduardo Habkost
@ 2017-10-10  2:39 ` Eduardo Habkost
  2017-10-10  2:40 ` [Qemu-devel] [PULL v2 7/8] vl: exit if maxcpus is negative Eduardo Habkost
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:39 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

type_register()/type_register_static() functions in current impl.
can't fail returning 0, also none of the users check for error
so update doc comment to reflect current behaviour.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1507111682-66171-2-git-send-email-imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/qom/object.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index e0d9824415..a707b67781 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -773,7 +773,7 @@ const char *object_get_typename(const Object *obj);
  * @info and all of the strings it points to should exist for the life time
  * that the type is registered.
  *
- * Returns: 0 on failure, the new #Type on success.
+ * Returns: the new #Type.
  */
 Type type_register_static(const TypeInfo *info);
 
@@ -784,7 +784,7 @@ Type type_register_static(const TypeInfo *info);
  * Unlike type_register_static(), this call does not require @info or its
  * string members to continue to exist after the call returns.
  *
- * Returns: 0 on failure, the new #Type on success.
+ * Returns: the new #Type.
  */
 Type type_register(const TypeInfo *info);
 
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 7/8] vl: exit if maxcpus is negative
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
                   ` (5 preceding siblings ...)
  2017-10-10  2:39 ` [Qemu-devel] [PULL v2 6/8] qom: update doc comment for type_register[_static]() Eduardo Habkost
@ 2017-10-10  2:40 ` Eduardo Habkost
  2017-10-10  2:40 ` [Qemu-devel] [PULL v2 8/8] x86: Correct translation of some rdgsbase and wrgsbase encodings Eduardo Habkost
  2017-10-10 13:42 ` [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Peter Maydell
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:40 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Seeteena Thoufeek

From: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

---Steps to Reproduce---

When passed a negative number to 'maxcpus' parameter, Qemu aborts
with a core dump.

Run the following command with maxcpus argument as negative number

ppc64-softmmu/qemu-system-ppc64 --nographic -vga none -machine
pseries,accel=kvm,kvm-type=HV -m size=200g -device virtio-blk-pci,
drive=rootdisk -drive file=/home/images/pegas-1.0-ppc64le.qcow2,
if=none,cache=none,id=rootdisk,format=qcow2 -monitor telnet
:127.0.0.1:1234,server,nowait -net nic,model=virtio -net
user -redir tcp:2000::22 -device nec-usb-xhci -smp 8,cores=1,
threads=1,maxcpus=-12

(process:12149): GLib-ERROR **: gmem.c:130: failed to allocate
 18446744073709550568 bytes

Trace/breakpoint trap

Reported-by: R.Nageswara Sastry <rnsastry@linux.vnet.ibm.com>
Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
Message-Id: <1504511031-26834-1-git-send-email-s1seetee@linux.vnet.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 include/sysemu/sysemu.h | 2 +-
 vl.c                    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index b21369672a..c083869fcf 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -113,7 +113,7 @@ extern int win2k_install_hack;
 extern int alt_grab;
 extern int ctrl_grab;
 extern int smp_cpus;
-extern int max_cpus;
+extern unsigned int max_cpus;
 extern int cursor_hide;
 extern int graphic_rotate;
 extern int no_quit;
diff --git a/vl.c b/vl.c
index ebea42e0ea..d7c349233f 100644
--- a/vl.c
+++ b/vl.c
@@ -161,7 +161,7 @@ Chardev *sclp_hds[MAX_SCLP_CONSOLES];
 int win2k_install_hack = 0;
 int singlestep = 0;
 int smp_cpus = 1;
-int max_cpus = 1;
+unsigned int max_cpus = 1;
 int smp_cores = 1;
 int smp_threads = 1;
 int acpi_enabled = 1;
@@ -4331,8 +4331,8 @@ int main(int argc, char **argv, char **envp)
 
     machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */
     if (max_cpus > machine_class->max_cpus) {
-        error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
-                     "supported by machine '%s' (%d)", max_cpus,
+        error_report("Invalid SMP CPUs %d. The max CPUs "
+                     "supported by machine '%s' is %d", max_cpus,
                      machine_class->name, machine_class->max_cpus);
         exit(1);
     }
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PULL v2 8/8] x86: Correct translation of some rdgsbase and wrgsbase encodings
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
                   ` (6 preceding siblings ...)
  2017-10-10  2:40 ` [Qemu-devel] [PULL v2 7/8] vl: exit if maxcpus is negative Eduardo Habkost
@ 2017-10-10  2:40 ` Eduardo Habkost
  2017-10-10 13:42 ` [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Peter Maydell
  8 siblings, 0 replies; 10+ messages in thread
From: Eduardo Habkost @ 2017-10-10  2:40 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Todd Eisenberger

From: Todd Eisenberger <teisenbe@google.com>

It looks like there was a transcription error when writing this code
initially.  The code previously only decoded src or dst of rax.  This
resolves
https://bugs.launchpad.net/qemu/+bug/1719984.

Signed-off-by: Todd Eisenberger <teisenbe@google.com>
Message-Id: <CAP26EVRNVb=Mq=O3s51w7fDhGVmf-e3XFFA73MRzc5b4qKBA4g@mail.gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/i386/translate.c b/target/i386/translate.c
index a8986f4c1a..7b920115f9 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -8155,9 +8155,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
             break;
 
         case 0xc0 ... 0xc7: /* rdfsbase (f3 0f ae /0) */
-        case 0xc8 ... 0xc8: /* rdgsbase (f3 0f ae /1) */
+        case 0xc8 ... 0xcf: /* rdgsbase (f3 0f ae /1) */
         case 0xd0 ... 0xd7: /* wrfsbase (f3 0f ae /2) */
-        case 0xd8 ... 0xd8: /* wrgsbase (f3 0f ae /3) */
+        case 0xd8 ... 0xdf: /* wrgsbase (f3 0f ae /3) */
             if (CODE64(s)
                 && (prefixes & PREFIX_REPZ)
                 && !(prefixes & PREFIX_LOCK)
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09
  2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
                   ` (7 preceding siblings ...)
  2017-10-10  2:40 ` [Qemu-devel] [PULL v2 8/8] x86: Correct translation of some rdgsbase and wrgsbase encodings Eduardo Habkost
@ 2017-10-10 13:42 ` Peter Maydell
  8 siblings, 0 replies; 10+ messages in thread
From: Peter Maydell @ 2017-10-10 13:42 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: QEMU Developers

On 10 October 2017 at 03:39, Eduardo Habkost <ehabkost@redhat.com> wrote:
> Changes on v2:
> * Removed NUMA/ACPI patches until we figure out what's breaking
>   the tests.
>   (See: https://www.mail-archive.com/qemu-devel@nongnu.org/msg486368.html)
>   Note that I didn't reproduce the failure yet.  I am just
>   removing those patches because they are the only ones touching
>   ACPI code.
>
> The following changes since commit 530049bc1dcc24c1178a29d99ca08b6dd08413e0:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2017-10-06 17:43:02 +0100)
>
> are available in the git repository at:
>
>   git://github.com/ehabkost/qemu.git tags/x86-and-machine-pull-request
>
> for you to fetch changes up to e0dd5fd41a1a38766009f442967fab700d2d0550:
>
>   x86: Correct translation of some rdgsbase and wrgsbase encodings (2017-10-09 23:29:20 -0300)
>
> ----------------------------------------------------------------
> x86 and machine queue, 2017-10-09
>
> Includes x86, QOM, CPU, and option/config parsing patches.
>
> Highlights:
> * Deprecation of -nodefconfig option;
> * MachineClass::valid_cpu_types field.
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-10-10 13:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10  2:39 [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Eduardo Habkost
2017-10-10  2:39 ` [Qemu-devel] [PULL v2 1/8] qom/cpu: move cpu_model null check to cpu_class_by_name() Eduardo Habkost
2017-10-10  2:39 ` [Qemu-devel] [PULL v2 2/8] machine: Add a valid_cpu_types property Eduardo Habkost
2017-10-10  2:39 ` [Qemu-devel] [PULL v2 3/8] vl: Eliminate defconfig variable Eduardo Habkost
2017-10-10  2:39 ` [Qemu-devel] [PULL v2 4/8] qemu-options: Deprecate -nodefconfig Eduardo Habkost
2017-10-10  2:39 ` [Qemu-devel] [PULL v2 5/8] config: qemu_config_parse() return number of config groups Eduardo Habkost
2017-10-10  2:39 ` [Qemu-devel] [PULL v2 6/8] qom: update doc comment for type_register[_static]() Eduardo Habkost
2017-10-10  2:40 ` [Qemu-devel] [PULL v2 7/8] vl: exit if maxcpus is negative Eduardo Habkost
2017-10-10  2:40 ` [Qemu-devel] [PULL v2 8/8] x86: Correct translation of some rdgsbase and wrgsbase encodings Eduardo Habkost
2017-10-10 13:42 ` [Qemu-devel] [PULL v2 0/8] x86 and machine queue, 2017-10-09 Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.