[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/12] qapi: expose query-gic-capability command unconditional
From: |
Pierrick Bouvier |
Subject: |
[PATCH v2 04/12] qapi: expose query-gic-capability command unconditionally |
Date: |
Thu, 15 May 2025 10:27:24 -0700 |
From: Daniel P. Berrangé <berrange@redhat.com>
This removes the TARGET_ARM condition from the query-gic-capability
command. This requires providing a QMP command stub for non-ARM targets.
This in turn requires moving the command out of misc-target.json, since
that will trigger symbol poisoning errors when built from target
independent code.
Following the earlier precedent, this creates a misc-arm.json file to
hold this ARM specific command.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
qapi/misc-arm.json | 49 +++++++++++++++++++++++++++++++++++++++
qapi/misc-target.json | 44 -----------------------------------
qapi/qapi-schema.json | 1 +
stubs/monitor-arm-gic.c | 12 ++++++++++
target/arm/arm-qmp-cmds.c | 2 +-
qapi/meson.build | 1 +
stubs/meson.build | 1 +
7 files changed, 65 insertions(+), 45 deletions(-)
create mode 100644 qapi/misc-arm.json
create mode 100644 stubs/monitor-arm-gic.c
diff --git a/qapi/misc-arm.json b/qapi/misc-arm.json
new file mode 100644
index 00000000000..f5341372f5a
--- /dev/null
+++ b/qapi/misc-arm.json
@@ -0,0 +1,49 @@
+# -*- Mode: Python -*-
+# vim: filetype=python
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+##
+# @GICCapability:
+#
+# The struct describes capability for a specific GIC (Generic
+# Interrupt Controller) version. These bits are not only decided by
+# QEMU/KVM software version, but also decided by the hardware that the
+# program is running upon.
+#
+# @version: version of GIC to be described. Currently, only 2 and 3
+# are supported.
+#
+# @emulated: whether current QEMU/hardware supports emulated GIC
+# device in user space.
+#
+# @kernel: whether current QEMU/hardware supports hardware accelerated
+# GIC device in kernel.
+#
+# Since: 2.6
+##
+{ 'struct': 'GICCapability',
+ 'data': { 'version': 'int',
+ 'emulated': 'bool',
+ 'kernel': 'bool' } }
+
+##
+# @query-gic-capabilities:
+#
+# It will return a list of GICCapability objects that describe its
+# capability bits.
+#
+# On non-ARM targets this command will report an error as the GIC
+# technology is not applicable.
+#
+# Returns: a list of GICCapability objects.
+#
+# Since: 2.6
+#
+# .. qmp-example::
+#
+# -> { "execute": "query-gic-capabilities" }
+# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
+# { "version": 3, "emulated": false, "kernel": true } ] }
+##
+{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'] }
diff --git a/qapi/misc-target.json b/qapi/misc-target.json
index ba4403a9241..d36292b3321 100644
--- a/qapi/misc-target.json
+++ b/qapi/misc-target.json
@@ -2,50 +2,6 @@
# vim: filetype=python
#
-##
-# @GICCapability:
-#
-# The struct describes capability for a specific GIC (Generic
-# Interrupt Controller) version. These bits are not only decided by
-# QEMU/KVM software version, but also decided by the hardware that the
-# program is running upon.
-#
-# @version: version of GIC to be described. Currently, only 2 and 3
-# are supported.
-#
-# @emulated: whether current QEMU/hardware supports emulated GIC
-# device in user space.
-#
-# @kernel: whether current QEMU/hardware supports hardware accelerated
-# GIC device in kernel.
-#
-# Since: 2.6
-##
-{ 'struct': 'GICCapability',
- 'data': { 'version': 'int',
- 'emulated': 'bool',
- 'kernel': 'bool' },
- 'if': 'TARGET_ARM' }
-
-##
-# @query-gic-capabilities:
-#
-# This command is ARM-only. It will return a list of GICCapability
-# objects that describe its capability bits.
-#
-# Returns: a list of GICCapability objects.
-#
-# Since: 2.6
-#
-# .. qmp-example::
-#
-# -> { "execute": "query-gic-capabilities" }
-# <- { "return": [{ "version": 2, "emulated": true, "kernel": false },
-# { "version": 3, "emulated": false, "kernel": true } ] }
-##
-{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
- 'if': 'TARGET_ARM' }
-
##
# @SGXEPCSection:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 96f6aa44133..e96bff8d38c 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -61,6 +61,7 @@
{ 'include': 'replay.json' }
{ 'include': 'yank.json' }
{ 'include': 'misc.json' }
+{ 'include': 'misc-arm.json' }
{ 'include': 'misc-i386.json' }
{ 'include': 'misc-target.json' }
{ 'include': 'audio.json' }
diff --git a/stubs/monitor-arm-gic.c b/stubs/monitor-arm-gic.c
new file mode 100644
index 00000000000..b3429243ef8
--- /dev/null
+++ b/stubs/monitor-arm-gic.c
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-misc-arm.h"
+
+
+GICCapabilityList *qmp_query_gic_capabilities(Error **errp)
+{
+ error_setg(errp, "GIC hardware is not available on this target");
+ return NULL;
+}
diff --git a/target/arm/arm-qmp-cmds.c b/target/arm/arm-qmp-cmds.c
index a1a944adb43..ef18c867ca4 100644
--- a/target/arm/arm-qmp-cmds.c
+++ b/target/arm/arm-qmp-cmds.c
@@ -27,7 +27,7 @@
#include "qapi/visitor.h"
#include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-commands-machine-target.h"
-#include "qapi/qapi-commands-misc-target.h"
+#include "qapi/qapi-commands-misc-arm.h"
#include "qobject/qdict.h"
#include "qom/qom-qobject.h"
diff --git a/qapi/meson.build b/qapi/meson.build
index 3a9bd061047..5e93e6b8cfd 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -64,6 +64,7 @@ if have_system
'qdev',
'pci',
'rocker',
+ 'misc-arm',
'misc-i386',
'tpm',
'uefi',
diff --git a/stubs/meson.build b/stubs/meson.build
index 9922ec7b88e..07e9d3799a5 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -77,6 +77,7 @@ if have_system
stub_ss.add(files('target-monitor-defs.c'))
stub_ss.add(files('win32-kbd-hook.c'))
stub_ss.add(files('xen-hw-stub.c'))
+ stub_ss.add(files('monitor-arm-gic.c'))
stub_ss.add(files('monitor-i386-rtc.c'))
stub_ss.add(files('monitor-i386-sev.c'))
endif
--
2.47.2
- [PATCH v2 00/12] qapi: remove all TARGET_* conditionals from the schema, Pierrick Bouvier, 2025/05/15
- [PATCH v2 01/12] qapi: expose rtc-reset-reinjection command unconditionally, Pierrick Bouvier, 2025/05/15
- [PATCH v2 02/12] qapi: expand docs for SEV commands, Pierrick Bouvier, 2025/05/15
- [PATCH v2 05/12] qapi: make SGX commands unconditionally available, Pierrick Bouvier, 2025/05/15
- [PATCH v2 06/12] qapi: make Xen event commands unconditionally available, Pierrick Bouvier, 2025/05/15
- [PATCH v2 04/12] qapi: expose query-gic-capability command unconditionally,
Pierrick Bouvier <=
- [PATCH v2 03/12] qapi: make SEV commands unconditionally available, Pierrick Bouvier, 2025/05/15
- [PATCH v2 09/12] qapi: make most CPU commands unconditionally available, Pierrick Bouvier, 2025/05/15
- [PATCH v2 07/12] qapi: remove the misc-target.json file, Pierrick Bouvier, 2025/05/15
- [PATCH v2 08/12] qapi: Make CpuModelExpansionInfo::deprecated-props optional and generic, Pierrick Bouvier, 2025/05/15
- [PATCH v2 10/12] qapi: make s390x specific CPU commands unconditionally available, Pierrick Bouvier, 2025/05/15
- [PATCH v2 12/12] qapi: make all generated files common, Pierrick Bouvier, 2025/05/15
- [PATCH v2 11/12] qapi: remove qapi_specific_outputs from meson.build, Pierrick Bouvier, 2025/05/15