qapi: make s390x specific CPU commands unconditionally available

This removes the TARGET_S390X and CONFIG_KVM conditions from the
CPU commands that are conceptually specific to s390x. Top level
stubs are provided to cope with non-s390x targets, or builds
without KVM.

The removal of CONFIG_KVM is justified by the fact there is no
conceptual difference between running 'qemu-system-s390x -accel tcg'
on a build with and without KVM built-in, so apps only using TCG
can't rely on the CONFIG_KVM in the schema.

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>
Message-ID: <20250522190542.588267-11-pierrick.bouvier@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2025-05-22 12:05:37 -07:00
committed by Markus Armbruster
parent d6758495d8
commit f8d41d0511
8 changed files with 35 additions and 15 deletions
+2 -2
View File
@@ -23,8 +23,8 @@
#include "target/s390x/cpu.h" #include "target/s390x/cpu.h"
#include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/s390-virtio-ccw.h"
#include "hw/s390x/cpu-topology.h" #include "hw/s390x/cpu-topology.h"
#include "qapi/qapi-commands-machine-target.h" #include "qapi/qapi-commands-machine-s390x.h"
#include "qapi/qapi-events-machine-target.h" #include "qapi/qapi-events-machine-s390x.h"
/* /*
* s390_topology is used to keep the topology information. * s390_topology is used to keep the topology information.
+1 -1
View File
@@ -13,7 +13,7 @@
#include "qemu/queue.h" #include "qemu/queue.h"
#include "hw/boards.h" #include "hw/boards.h"
#include "qapi/qapi-types-machine-target.h" #include "qapi/qapi-types-machine-s390x.h"
#define S390_TOPOLOGY_CPU_IFL 0x03 #define S390_TOPOLOGY_CPU_IFL 0x03
@@ -1,6 +1,7 @@
# -*- Mode: Python -*- # -*- Mode: Python -*-
# vim: filetype=python # vim: filetype=python
# #
# SPDX-License-Identifier: GPL-2.0-or-later
# This work is licensed under the terms of the GNU GPL, version 2 or later. # This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory. # See the COPYING file in the top-level directory.
@@ -15,8 +16,7 @@
# Since: 8.2 # Since: 8.2
## ##
{ 'enum': 'S390CpuPolarization', { 'enum': 'S390CpuPolarization',
'data': [ 'horizontal', 'vertical' ], 'data': [ 'horizontal', 'vertical' ]
'if': 'TARGET_S390X'
} }
## ##
@@ -54,8 +54,7 @@
'*entitlement': 'S390CpuEntitlement', '*entitlement': 'S390CpuEntitlement',
'*dedicated': 'bool' '*dedicated': 'bool'
}, },
'features': [ 'unstable' ], 'features': [ 'unstable' ]
'if': { 'all': [ 'TARGET_S390X' , 'CONFIG_KVM' ] }
} }
## ##
@@ -90,8 +89,7 @@
## ##
{ 'event': 'CPU_POLARIZATION_CHANGE', { 'event': 'CPU_POLARIZATION_CHANGE',
'data': { 'polarization': 'S390CpuPolarization' }, 'data': { 'polarization': 'S390CpuPolarization' },
'features': [ 'unstable' ], 'features': [ 'unstable' ]
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
} }
## ##
@@ -104,8 +102,7 @@
# Since: 8.2 # Since: 8.2
## ##
{ 'struct': 'CpuPolarizationInfo', { 'struct': 'CpuPolarizationInfo',
'data': { 'polarization': 'S390CpuPolarization' }, 'data': { 'polarization': 'S390CpuPolarization' }
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
} }
## ##
@@ -120,6 +117,5 @@
# Since: 8.2 # Since: 8.2
## ##
{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo', { 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
'features': [ 'unstable' ], 'features': [ 'unstable' ]
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
} }
+1 -1
View File
@@ -39,7 +39,7 @@ qapi_all_modules = [
'job', 'job',
'machine-common', 'machine-common',
'machine', 'machine',
'machine-target', 'machine-s390x',
'migration', 'migration',
'misc', 'misc',
'net', 'net',
+1 -1
View File
@@ -57,7 +57,7 @@
{ 'include': 'qdev.json' } { 'include': 'qdev.json' }
{ 'include': 'machine-common.json' } { 'include': 'machine-common.json' }
{ 'include': 'machine.json' } { 'include': 'machine.json' }
{ 'include': 'machine-target.json' } { 'include': 'machine-s390x.json' }
{ 'include': 'replay.json' } { 'include': 'replay.json' }
{ 'include': 'yank.json' } { 'include': 'yank.json' }
{ 'include': 'misc.json' } { 'include': 'misc.json' }
+1
View File
@@ -84,6 +84,7 @@ if have_system
stub_ss.add(files('monitor-i386-xen.c')) stub_ss.add(files('monitor-i386-xen.c'))
stub_ss.add(files('monitor-cpu.c')) stub_ss.add(files('monitor-cpu.c'))
stub_ss.add(files('monitor-cpu-s390x.c')) stub_ss.add(files('monitor-cpu-s390x.c'))
stub_ss.add(files('monitor-cpu-s390x-kvm.c'))
endif endif
if have_system or have_user if have_system or have_user
+22
View File
@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-machine-s390x.h"
void qmp_set_cpu_topology(uint16_t core,
bool has_socket, uint16_t socket,
bool has_book, uint16_t book,
bool has_drawer, uint16_t drawer,
bool has_entitlement, S390CpuEntitlement entitlement,
bool has_dedicated, bool dedicated,
Error **errp)
{
error_setg(errp, "CPU topology change is not supported on this target");
}
CpuPolarizationInfo *qmp_query_s390x_cpu_polarization(Error **errp)
{
error_setg(errp, "CPU polarization is not supported on this target");
return NULL;
}
+1
View File
@@ -100,6 +100,7 @@ static bool query_is_ignored(const char *cmd)
/* Success depends on target arch: */ /* Success depends on target arch: */
"query-cpu-definitions", /* arm, i386, ppc, s390x */ "query-cpu-definitions", /* arm, i386, ppc, s390x */
"query-gic-capabilities", /* arm */ "query-gic-capabilities", /* arm */
"query-s390x-cpu-polarization", /* s390x */
/* Success depends on target-specific build configuration: */ /* Success depends on target-specific build configuration: */
"query-pci", /* CONFIG_PCI */ "query-pci", /* CONFIG_PCI */
"x-query-virtio", /* CONFIG_VIRTIO */ "x-query-virtio", /* CONFIG_VIRTIO */