* [Qemu-devel] [PATCH 1/7] qmp: introduce device-list-properties command
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 2/7] qapi: mark QOM commands stable Anthony Liguori
` (6 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
This can be used in conjunction with qom-list-types to determine the supported
set of devices and their parameters.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
qapi-schema.json | 28 ++++++++++++++++++++++++++++
qmp-commands.hx | 7 +++++++
qmp.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+), 0 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index bd9c450..191a889 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1729,6 +1729,34 @@
'returns': [ 'ObjectTypeInfo' ] }
##
+# @DevicePropertyInfo:
+#
+# Information about device properties.
+#
+# @name: the name of the property
+# @type: the typename of the property
+#
+# Since: 1.2
+##
+{ 'type': 'DevicePropertyInfo',
+ 'data': { 'name': 'str', 'type': 'str' } }
+
+##
+# @device-list-properties:
+#
+# List properties associated with a device.
+#
+# @typename: the type name of a device
+#
+# Returns: a list of DevicePropertyInfo describing a devices properties
+#
+# Since: 1.2
+##
+{ 'command': 'device-list-properties',
+ 'data': { 'typename': 'str'},
+ 'returns': [ 'DevicePropertyInfo' ] }
+
+##
# @migrate
#
# Migrates the current running guest to another Virtual Machine.
diff --git a/qmp-commands.hx b/qmp-commands.hx
index ac46638..52127a9 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2217,3 +2217,10 @@ EQMP
.args_type = "implements:s?,abstract:b?",
.mhandler.cmd_new = qmp_marshal_input_qom_list_types,
},
+
+ {
+ .name = "device-list-properties",
+ .args_type = "typename:s",
+ .mhandler.cmd_new = qmp_marshal_input_device_list_properties,
+ },
+
diff --git a/qmp.c b/qmp.c
index fee9fb2..254a32f 100644
--- a/qmp.c
+++ b/qmp.c
@@ -417,3 +417,53 @@ ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
return ret;
}
+
+DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
+ Error **errp)
+{
+ ObjectClass *klass;
+ Property *prop;
+ DevicePropertyInfoList *prop_list = NULL;
+
+ klass = object_class_by_name(typename);
+ if (klass == NULL) {
+ error_set(errp, QERR_DEVICE_NOT_FOUND, typename);
+ return NULL;
+ }
+
+ klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
+ if (klass == NULL) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE,
+ "name", TYPE_DEVICE);
+ return NULL;
+ }
+
+ do {
+ for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
+ DevicePropertyInfoList *entry;
+ DevicePropertyInfo *info;
+
+ /*
+ * TODO Properties without a parser are just for dirty hacks.
+ * qdev_prop_ptr is the only such PropertyInfo. It's marked
+ * for removal. This conditional should be removed along with
+ * it.
+ */
+ if (!prop->info->set) {
+ continue; /* no way to set it, don't show */
+ }
+
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(prop->name);
+ info->type = g_strdup(prop->info->legacy_name ?: prop->info->name);
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = prop_list;
+ prop_list = entry;
+ }
+ klass = object_class_get_parent(klass);
+ } while (klass != object_class_by_name(TYPE_DEVICE));
+
+ return prop_list;
+}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 2/7] qapi: mark QOM commands stable
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 1/7] qmp: introduce device-list-properties command Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-10 18:20 ` Eric Blake
2012-08-10 16:04 ` [Qemu-devel] [PATCH 3/7] qapi: add query-machines command Anthony Liguori
` (5 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
We've had a cycle to tweak. It is time to commit to supporting them.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
qapi-schema.json | 19 ++++---------------
1 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index 191a889..a938c8d 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1363,9 +1363,7 @@
# 4) A link type in the form 'link<subtype>' where subtype is a qdev
# device type name. Link properties form the device model graph.
#
-# Since: 1.1
-#
-# Notes: This type is experimental. Its syntax may change in future releases.
+# Since: 1.2
##
{ 'type': 'ObjectPropertyInfo',
'data': { 'name': 'str', 'type': 'str' } }
@@ -1382,10 +1380,7 @@
# Returns: a list of @ObjectPropertyInfo that describe the properties of the
# object.
#
-# Since: 1.1
-#
-# Notes: This command is experimental. It's syntax may change in future
-# releases.
+# Since: 1.2
##
{ 'command': 'qom-list',
'data': { 'path': 'str' },
@@ -1421,9 +1416,7 @@
# returns as #str pathnames. All integer property types (u8, u16, etc)
# are returned as #int.
#
-# Since: 1.1
-#
-# Notes: This command is experimental and may change syntax in future releases.
+# Since: 1.2
##
{ 'command': 'qom-get',
'data': { 'path': 'str', 'property': 'str' },
@@ -1442,9 +1435,7 @@
# @value: a value who's type is appropriate for the property type. See @qom-get
# for a description of type mapping.
#
-# Since: 1.1
-#
-# Notes: This command is experimental and may change syntax in future releases.
+# Since: 1.2
##
{ 'command': 'qom-set',
'data': { 'path': 'str', 'property': 'str', 'value': 'visitor' },
@@ -1721,8 +1712,6 @@
# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
#
# Since: 1.1
-#
-# Notes: This command is experimental and may change syntax in future releases.
##
{ 'command': 'qom-list-types',
'data': { '*implements': 'str', '*abstract': 'bool' },
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 2/7] qapi: mark QOM commands stable
2012-08-10 16:04 ` [Qemu-devel] [PATCH 2/7] qapi: mark QOM commands stable Anthony Liguori
@ 2012-08-10 18:20 ` Eric Blake
2012-08-10 18:27 ` Anthony Liguori
0 siblings, 1 reply; 18+ messages in thread
From: Eric Blake @ 2012-08-10 18:20 UTC (permalink / raw)
To: Anthony Liguori
Cc: Peter Maydell, qemu-devel, Markus Armbruster, Alexander Graf
[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]
On 08/10/2012 10:04 AM, Anthony Liguori wrote:
> We've had a cycle to tweak. It is time to commit to supporting them.
>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> ---
> qapi-schema.json | 19 ++++---------------
> 1 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 191a889..a938c8d 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -1363,9 +1363,7 @@
> # 4) A link type in the form 'link<subtype>' where subtype is a qdev
> # device type name. Link properties form the device model graph.
> #
> -# Since: 1.1
> -#
> -# Notes: This type is experimental. Its syntax may change in future releases.
> +# Since: 1.2
Per https://lists.gnu.org/archive/html/qemu-devel/2012-08/msg01416.html,
this should be 1.2.0 (throughout the series).
> @@ -1382,10 +1380,7 @@
> # Returns: a list of @ObjectPropertyInfo that describe the properties of the
> # object.
> #
> -# Since: 1.1
> -#
> -# Notes: This command is experimental. It's syntax may change in future
Yay, getting rid of bad grammar in the process (s/It's/Its/ if the
comment were to remain).
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 2/7] qapi: mark QOM commands stable
2012-08-10 18:20 ` Eric Blake
@ 2012-08-10 18:27 ` Anthony Liguori
0 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 18:27 UTC (permalink / raw)
To: Eric Blake; +Cc: Peter Maydell, qemu-devel, Markus Armbruster, Alexander Graf
Eric Blake <eblake@redhat.com> writes:
> On 08/10/2012 10:04 AM, Anthony Liguori wrote:
>> We've had a cycle to tweak. It is time to commit to supporting them.
>>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>> qapi-schema.json | 19 ++++---------------
>> 1 files changed, 4 insertions(+), 15 deletions(-)
>>
>> diff --git a/qapi-schema.json b/qapi-schema.json
>> index 191a889..a938c8d 100644
>> --- a/qapi-schema.json
>> +++ b/qapi-schema.json
>> @@ -1363,9 +1363,7 @@
>> # 4) A link type in the form 'link<subtype>' where subtype is a qdev
>> # device type name. Link properties form the device model graph.
>> #
>> -# Since: 1.1
>> -#
>> -# Notes: This type is experimental. Its syntax may change in future releases.
>> +# Since: 1.2
>
> Per https://lists.gnu.org/archive/html/qemu-devel/2012-08/msg01416.html,
> this should be 1.2.0 (throughout the series).
I'll do a follow up to fix this across the board for the entire file.
That's what I took away from your previous comment.
Regards,
Anthony Liguori
>
>> @@ -1382,10 +1380,7 @@
>> # Returns: a list of @ObjectPropertyInfo that describe the properties of the
>> # object.
>> #
>> -# Since: 1.1
>> -#
>> -# Notes: This command is experimental. It's syntax may change in future
>
> Yay, getting rid of bad grammar in the process (s/It's/Its/ if the
> comment were to remain).
>
> --
> Eric Blake eblake@redhat.com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 3/7] qapi: add query-machines command
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 1/7] qmp: introduce device-list-properties command Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 2/7] qapi: mark QOM commands stable Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 4/7] compiler: add macro for GCC weak symbols Anthony Liguori
` (4 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
This provides the same output as -M ? but in a structured way.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
qapi-schema.json | 28 ++++++++++++++++++++++++++++
qmp-commands.hx | 6 ++++++
vl.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index a938c8d..1eb0b0f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2216,3 +2216,31 @@
# Since: 0.14.0
##
{ 'command': 'closefd', 'data': {'fdname': 'str'} }
+
+##
+# @MachineInfo:
+#
+# Information describing a machine.
+#
+# @name: the name of the machine
+#
+# @alias: #optional an alias for the machine name
+#
+# @default: #optional whether the machine is default
+#
+# Since: 1.2.0
+##
+{ 'type': 'MachineInfo',
+ 'data': { 'name': 'str', '*alias': 'str',
+ '*is-default': 'bool' } }
+
+##
+# @query-machines:
+#
+# Return a list of supported machines
+#
+# Returns: a list of MachineInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 52127a9..f343772 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2224,3 +2224,9 @@ EQMP
.mhandler.cmd_new = qmp_marshal_input_device_list_properties,
},
+ {
+ .name = "query-machines",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_query_machines,
+ },
+
diff --git a/vl.c b/vl.c
index ad9b036..084d671 100644
--- a/vl.c
+++ b/vl.c
@@ -1213,6 +1213,37 @@ QEMUMachine *find_default_machine(void)
return NULL;
}
+MachineInfoList *qmp_query_machines(Error **errp)
+{
+ MachineInfoList *mach_list = NULL;
+ QEMUMachine *m;
+
+ for (m = first_machine; m; m = m->next) {
+ MachineInfoList *entry;
+ MachineInfo *info;
+
+ info = g_malloc0(sizeof(*info));
+ if (m->is_default) {
+ info->has_is_default = true;
+ info->is_default = true;
+ }
+
+ if (m->alias) {
+ info->has_alias = true;
+ info->alias = g_strdup(m->alias);
+ }
+
+ info->name = g_strdup(m->name);
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = mach_list;
+ mach_list = entry;
+ }
+
+ return mach_list;
+}
+
/***********************************************************/
/* main execution loop */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 4/7] compiler: add macro for GCC weak symbols
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
` (2 preceding siblings ...)
2012-08-10 16:04 ` [Qemu-devel] [PATCH 3/7] qapi: add query-machines command Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-12 21:30 ` Peter Maydell
2012-08-10 16:04 ` [Qemu-devel] [PATCH 5/7] qapi: add query-cpu-definitions command (v2) Anthony Liguori
` (3 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
This lets us provide a default implementation of a symbol which targets can
override.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
compiler.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/compiler.h b/compiler.h
index 736e770..f76921e 100644
--- a/compiler.h
+++ b/compiler.h
@@ -45,6 +45,7 @@
# define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
# endif
+#define GCC_WEAK __attribute__((weak))
#else
#define GCC_ATTR /**/
#define GCC_FMT_ATTR(n, m)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 4/7] compiler: add macro for GCC weak symbols
2012-08-10 16:04 ` [Qemu-devel] [PATCH 4/7] compiler: add macro for GCC weak symbols Anthony Liguori
@ 2012-08-12 21:30 ` Peter Maydell
2012-08-13 13:44 ` Anthony Liguori
0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2012-08-12 21:30 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Markus Armbruster, Eric Blake, qemu-devel, Alexander Graf
On 10 August 2012 17:04, Anthony Liguori <aliguori@us.ibm.com> wrote:
> This lets us provide a default implementation of a symbol which targets can
> override.
>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
I'm sure you'll be thrilled to hear that this doesn't seem to break MacOS
builds :-)
-- PMM
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 4/7] compiler: add macro for GCC weak symbols
2012-08-12 21:30 ` Peter Maydell
@ 2012-08-13 13:44 ` Anthony Liguori
0 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-13 13:44 UTC (permalink / raw)
To: Peter Maydell; +Cc: Markus Armbruster, Eric Blake, qemu-devel, Alexander Graf
Peter Maydell <peter.maydell@linaro.org> writes:
> On 10 August 2012 17:04, Anthony Liguori <aliguori@us.ibm.com> wrote:
>> This lets us provide a default implementation of a symbol which targets can
>> override.
>>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> I'm sure you'll be thrilled to hear that this doesn't seem to break MacOS
> builds :-)
Thank you for testing it. I neglected to mention that I did a fair bit
of investigation before hand and was able to confirm that all platforms
we care about (Windows, Linux/Unix, OS X) and all compilers we care
about (GCC, LLVM) support weak symbols.
There may be different attribute names across compilers--it wasn't very
clear to me, but they definitely all have the feature in some form.
Regards,
Anthony Liguori
>
> -- PMM
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 5/7] qapi: add query-cpu-definitions command (v2)
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
` (3 preceding siblings ...)
2012-08-10 16:04 ` [Qemu-devel] [PATCH 4/7] compiler: add macro for GCC weak symbols Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 6/7] target-i386: add implementation of query-cpu-definitions (v2) Anthony Liguori
` (2 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
This command attempts to map to the behavior of -cpu ?. Unfortunately, the
output of this command differs wildly across targets.
To accommodate this, we use a weak symbol to implement a default version of the
command that fails with a QERR_NOT_SUPPORTED error code. Targets can then
override and implement this command if it makes sense for them.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
- rename query-cpudefs -> query-cpu-definitions
---
qapi-schema.json | 23 +++++++++++++++++++++++
qmp-commands.hx | 6 ++++++
qmp.c | 6 ++++++
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index 1eb0b0f..f1da7ee 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -2244,3 +2244,26 @@
# Since: 1.2.0
##
{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
+
+##
+# @CpuDefinitionInfo:
+#
+# Virtual CPU definition.
+#
+# @name: the name of the CPU definition
+#
+# Since: 1.2.0
+##
+{ 'type': 'CpuDefinitionInfo',
+ 'data': { 'name': 'str' } }
+
+##
+# @query-cpu-definitions:
+#
+# Return a list of supported virtual CPU definitions
+#
+# Returns: a list of CpuDefInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'] }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index f343772..4da2b86 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2230,3 +2230,9 @@ EQMP
.mhandler.cmd_new = qmp_marshal_input_query_machines,
},
+ {
+ .name = "query-cpu-definitions",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_query_cpu_definitions,
+ },
+
diff --git a/qmp.c b/qmp.c
index 254a32f..6c1e4e8 100644
--- a/qmp.c
+++ b/qmp.c
@@ -467,3 +467,9 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
return prop_list;
}
+
+CpuDefinitionInfoList GCC_WEAK *qmp_query_cpu_definitions(Error **errp)
+{
+ error_set(errp, QERR_NOT_SUPPORTED);
+ return NULL;
+}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 6/7] target-i386: add implementation of query-cpu-definitions (v2)
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
` (4 preceding siblings ...)
2012-08-10 16:04 ` [Qemu-devel] [PATCH 5/7] qapi: add query-cpu-definitions command (v2) Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-10 16:04 ` [Qemu-devel] [PATCH 7/7] target-ppc: " Anthony Liguori
2012-08-13 17:16 ` [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Luiz Capitulino
7 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
- rename query-cpudefs -> query-cpu-definitions
---
target-i386/cpu.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 880cfea..6d5d0d6 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -28,6 +28,7 @@
#include "qemu-config.h"
#include "qapi/qapi-visit-core.h"
+#include "qmp-commands.h"
#include "hyperv.h"
@@ -1125,6 +1126,27 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
}
}
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+ CpuDefinitionInfoList *cpu_list = NULL;
+ x86_def_t *def;
+
+ for (def = x86_defs; def; def = def->next) {
+ CpuDefinitionInfoList *entry;
+ CpuDefinitionInfo *info;
+
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(def->name);
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = cpu_list;
+ cpu_list = entry;
+ }
+
+ return cpu_list;
+}
+
int cpu_x86_register(X86CPU *cpu, const char *cpu_model)
{
CPUX86State *env = &cpu->env;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 7/7] target-ppc: add implementation of query-cpu-definitions (v2)
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
` (5 preceding siblings ...)
2012-08-10 16:04 ` [Qemu-devel] [PATCH 6/7] target-i386: add implementation of query-cpu-definitions (v2) Anthony Liguori
@ 2012-08-10 16:04 ` Anthony Liguori
2012-08-13 17:16 ` [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Luiz Capitulino
7 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-10 16:04 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Anthony Liguori, Alexander Graf, Markus Armbruster,
Eric Blake
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
- rename query-cpudefs -> query-cpu-definitions
---
target-ppc/translate_init.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 5742229..6fe4168 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -27,6 +27,7 @@
#include "gdbstub.h"
#include <kvm.h>
#include "kvm_ppc.h"
+#include "qmp-commands.h"
//#define PPC_DUMP_CPU
//#define PPC_DEBUG_SPR
@@ -10345,6 +10346,31 @@ void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf)
}
}
+CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
+{
+ CpuDefinitionInfoList *cpu_list = NULL;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(ppc_defs); i++) {
+ CpuDefinitionInfoList *entry;
+ CpuDefinitionInfo *info;
+
+ if (!ppc_cpu_usable(&ppc_defs[i])) {
+ continue;
+ }
+
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(ppc_defs[i].name);
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = cpu_list;
+ cpu_list = entry;
+ }
+
+ return cpu_list;
+}
+
/* CPUClass::reset() */
static void ppc_cpu_reset(CPUState *s)
{
--
1.7.5.4
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2)
2012-08-10 16:04 [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Anthony Liguori
` (6 preceding siblings ...)
2012-08-10 16:04 ` [Qemu-devel] [PATCH 7/7] target-ppc: " Anthony Liguori
@ 2012-08-13 17:16 ` Luiz Capitulino
2012-08-13 19:18 ` Luiz Capitulino
2012-08-15 6:07 ` Stefan Weil
7 siblings, 2 replies; 18+ messages in thread
From: Luiz Capitulino @ 2012-08-13 17:16 UTC (permalink / raw)
To: Anthony Liguori
Cc: Peter Maydell, Eric Blake, qemu-devel, Markus Armbruster,
Alexander Graf
On Fri, 10 Aug 2012 11:04:08 -0500
Anthony Liguori <aliguori@us.ibm.com> wrote:
> This series implements the necessary commands to implements danpb's idea to
> remove -help parsing in libvirt. We would introduce all of these commands in
> 1.2 and then change the -help output starting in 1.3.
Applied to the qmp branch, thanks.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2)
2012-08-13 17:16 ` [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Luiz Capitulino
@ 2012-08-13 19:18 ` Luiz Capitulino
2012-08-13 19:37 ` Anthony Liguori
2012-08-15 6:07 ` Stefan Weil
1 sibling, 1 reply; 18+ messages in thread
From: Luiz Capitulino @ 2012-08-13 19:18 UTC (permalink / raw)
To: Anthony Liguori
Cc: Peter Maydell, Alexander Graf, Eric Blake, qemu-devel,
Markus Armbruster
On Mon, 13 Aug 2012 14:16:58 -0300
Luiz Capitulino <lcapitulino@redhat.com> wrote:
> On Fri, 10 Aug 2012 11:04:08 -0500
> Anthony Liguori <aliguori@us.ibm.com> wrote:
>
> > This series implements the necessary commands to implements danpb's idea to
> > remove -help parsing in libvirt. We would introduce all of these commands in
> > 1.2 and then change the -help output starting in 1.3.
>
> Applied to the qmp branch, thanks.
Hmm, this series broke ppc-softmmu for me:
In file included from /home/lcapitulino/work/src/qmp-unstable/target-ppc/translate_init.c:30:0,
from /home/lcapitulino/work/src/qmp-unstable/target-ppc/translate.c:9404:
../qmp-commands.h:23:1: error: unknown type name ‘QDict’
../qmp-commands.h:23:68: error: unknown type name ‘QObject’
But it's not its fault. The problem here is probably a patch in my error
series that is doing header cleanup and qmp-commands.h was probably relying
on qapi-types.h (or some of its include files) including qdict.h.
I'm going to include the following patch in my pull request:
Subject: [PATCH 36/48] scripts: qapi-commands.py: qmp-commands.h: include
qdict.h
qmp-commands.h declares several functions that have arguments of
type QDict. However, qdict.h is not included. This will cause a
build breakage when a file includes qmp-commands.h but doesn't
include qdict.h.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
scripts/qapi-commands.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 9eed40e..3c4678d 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -342,6 +342,7 @@ def gen_command_decl_prologue(header, guard, prefix=""):
#define %(guard)s
#include "%(prefix)sqapi-types.h"
+#include "qdict.h"
#include "error.h"
''',
--
1.7.11.2.249.g31c7954.dirty
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2)
2012-08-13 19:18 ` Luiz Capitulino
@ 2012-08-13 19:37 ` Anthony Liguori
0 siblings, 0 replies; 18+ messages in thread
From: Anthony Liguori @ 2012-08-13 19:37 UTC (permalink / raw)
To: Luiz Capitulino
Cc: Peter Maydell, Alexander Graf, Eric Blake, qemu-devel,
Markus Armbruster
Luiz Capitulino <lcapitulino@redhat.com> writes:
> On Mon, 13 Aug 2012 14:16:58 -0300
> Luiz Capitulino <lcapitulino@redhat.com> wrote:
>
>> On Fri, 10 Aug 2012 11:04:08 -0500
>> Anthony Liguori <aliguori@us.ibm.com> wrote:
>>
>> > This series implements the necessary commands to implements danpb's idea to
>> > remove -help parsing in libvirt. We would introduce all of these commands in
>> > 1.2 and then change the -help output starting in 1.3.
>>
>> Applied to the qmp branch, thanks.
>
> Hmm, this series broke ppc-softmmu for me:
Curious, I'll look into that. Thanks
Regards,
Anthony Liguori
>
> In file included from /home/lcapitulino/work/src/qmp-unstable/target-ppc/translate_init.c:30:0,
> from /home/lcapitulino/work/src/qmp-unstable/target-ppc/translate.c:9404:
> ../qmp-commands.h:23:1: error: unknown type name ‘QDict’
> ../qmp-commands.h:23:68: error: unknown type name ‘QObject’
>
> But it's not its fault. The problem here is probably a patch in my error
> series that is doing header cleanup and qmp-commands.h was probably relying
> on qapi-types.h (or some of its include files) including qdict.h.
>
> I'm going to include the following patch in my pull request:
>
> Subject: [PATCH 36/48] scripts: qapi-commands.py: qmp-commands.h: include
> qdict.h
>
> qmp-commands.h declares several functions that have arguments of
> type QDict. However, qdict.h is not included. This will cause a
> build breakage when a file includes qmp-commands.h but doesn't
> include qdict.h.
>
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
> scripts/qapi-commands.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
> index 9eed40e..3c4678d 100644
> --- a/scripts/qapi-commands.py
> +++ b/scripts/qapi-commands.py
> @@ -342,6 +342,7 @@ def gen_command_decl_prologue(header, guard, prefix=""):
> #define %(guard)s
>
> #include "%(prefix)sqapi-types.h"
> +#include "qdict.h"
> #include "error.h"
>
> ''',
> --
> 1.7.11.2.249.g31c7954.dirty
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2)
2012-08-13 17:16 ` [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2) Luiz Capitulino
2012-08-13 19:18 ` Luiz Capitulino
@ 2012-08-15 6:07 ` Stefan Weil
2012-08-15 16:53 ` Luiz Capitulino
1 sibling, 1 reply; 18+ messages in thread
From: Stefan Weil @ 2012-08-15 6:07 UTC (permalink / raw)
To: Luiz Capitulino
Cc: Peter Maydell, Anthony Liguori, Markus Armbruster, qemu-devel,
Alexander Graf, Eric Blake
Am 13.08.2012 19:16, schrieb Luiz Capitulino:
> On Fri, 10 Aug 2012 11:04:08 -0500
> Anthony Liguori <aliguori@us.ibm.com> wrote:
>
>> This series implements the necessary commands to implements danpb's idea to
>> remove -help parsing in libvirt. We would introduce all of these commands in
>> 1.2 and then change the -help output starting in 1.3.
>
> Applied to the qmp branch, thanks.
>
The series breaks cross compilation of QEMU for w32 on Debian Linux:
LINK arm-softmmu/qemu-system-armw.exe
../qmp-marshal.o: In function `qmp_marshal_input_query_cpu_definitions':
/home/stefan/w32/qmp-marshal.c:2585: undefined reference to
`_qmp_query_cpu_definitions'
Weak symbols obviously use a different name mangling, therefore
qmp_query_cpu_definitions
is not found by the linker.
Adding GCC_WEAK to the declaration of qmp_query_cpu_definitions in
generated file
qmp-commands.h fixes that.
Regards,
Stefan Weil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2)
2012-08-15 6:07 ` Stefan Weil
@ 2012-08-15 16:53 ` Luiz Capitulino
2012-08-16 11:58 ` Stefan Weil
0 siblings, 1 reply; 18+ messages in thread
From: Luiz Capitulino @ 2012-08-15 16:53 UTC (permalink / raw)
To: Stefan Weil
Cc: Peter Maydell, Anthony Liguori, Markus Armbruster, qemu-devel,
Alexander Graf, Eric Blake
On Wed, 15 Aug 2012 08:07:57 +0200
Stefan Weil <sw@weilnetz.de> wrote:
> Am 13.08.2012 19:16, schrieb Luiz Capitulino:
> > On Fri, 10 Aug 2012 11:04:08 -0500
> > Anthony Liguori <aliguori@us.ibm.com> wrote:
> >
> >> This series implements the necessary commands to implements danpb's idea to
> >> remove -help parsing in libvirt. We would introduce all of these commands in
> >> 1.2 and then change the -help output starting in 1.3.
> >
> > Applied to the qmp branch, thanks.
> >
>
>
> The series breaks cross compilation of QEMU for w32 on Debian Linux:
>
> LINK arm-softmmu/qemu-system-armw.exe
> ../qmp-marshal.o: In function `qmp_marshal_input_query_cpu_definitions':
> /home/stefan/w32/qmp-marshal.c:2585: undefined reference to
> `_qmp_query_cpu_definitions'
Does this patch fix it?
http://lists.gnu.org/archive/html/qemu-devel/2012-08/msg02676.html
>
> Weak symbols obviously use a different name mangling, therefore
> qmp_query_cpu_definitions
> is not found by the linker.
>
> Adding GCC_WEAK to the declaration of qmp_query_cpu_definitions in
> generated file
> qmp-commands.h fixes that.
>
> Regards,
>
> Stefan Weil
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] qapi: add commands to remove the need (v2)
2012-08-15 16:53 ` Luiz Capitulino
@ 2012-08-16 11:58 ` Stefan Weil
0 siblings, 0 replies; 18+ messages in thread
From: Stefan Weil @ 2012-08-16 11:58 UTC (permalink / raw)
To: Luiz Capitulino
Cc: Peter Maydell, Anthony Liguori, qemu-devel, Markus Armbruster,
Alexander Graf, Eric Blake
Am 15.08.2012 18:53, schrieb Luiz Capitulino:
> On Wed, 15 Aug 2012 08:07:57 +0200
> Stefan Weil <sw@weilnetz.de> wrote:
>
>> Am 13.08.2012 19:16, schrieb Luiz Capitulino:
>>> On Fri, 10 Aug 2012 11:04:08 -0500
>>> Anthony Liguori <aliguori@us.ibm.com> wrote:
>>>
>>>> This series implements the necessary commands to implements danpb's idea to
>>>> remove -help parsing in libvirt. We would introduce all of these commands in
>>>> 1.2 and then change the -help output starting in 1.3.
>>> Applied to the qmp branch, thanks.
>>>
>>
>> The series breaks cross compilation of QEMU for w32 on Debian Linux:
>>
>> LINK arm-softmmu/qemu-system-armw.exe
>> ../qmp-marshal.o: In function `qmp_marshal_input_query_cpu_definitions':
>> /home/stefan/w32/qmp-marshal.c:2585: undefined reference to
>> `_qmp_query_cpu_definitions'
> Does this patch fix it?
>
> http://lists.gnu.org/archive/html/qemu-devel/2012-08/msg02676.html
Yes, Anthony's patch fixes that. I just noticed that he already
applied it to git master.
The solution which I had suggested below would have been much
simpler. Using GCC_WEAK in the declaration worked for me with
gcc from Debian Lenny, too.
Which gcc requires different handling for w32 and non-w32?
> Weak symbols obviously use a different name mangling, therefore
> qmp_query_cpu_definitions is not found by the linker.
>
> Adding GCC_WEAK to the declaration of qmp_query_cpu_definitions in
> generated file
> qmp-commands.h fixes that.
>
> Regards,
>
> Stefan Weil
>
^ permalink raw reply [flat|nested] 18+ messages in thread