On 2025-01-24 18:49, Nina Schoetterl-Glausch wrote:
On Wed, 2025-01-15 at 14:31 +0100, Shalini Chellathurai Saroja wrote:
This commit adds the firmware control-program
identifiers received from a KVM guest via the
SCLP event type Control-Program Identification to QOM.
A timestamp in which the data is received is also
added to QOM.
Example:
virsh # qemu-monitor-command vm --pretty '{
"execute":"qom-get","arguments": {
"path": "/machine", "property": "s390-cpi"}}'
{
"return": {
"timestamp": 1711620874948254000,
"system-level": "0x50e00",
"sysplex-name": "SYSPLEX ",
"system-name": "TESTVM ",
"system-type": "LINUX "
},
"id": "libvirt-15"
}
Signed-off-by: Shalini Chellathurai Saroja <[email protected]>
---
hw/s390x/s390-virtio-ccw.c | 26 ++++++++++++++++++++++++++
hw/s390x/sclpcpi.c | 10 ++++++++++
include/hw/s390x/s390-virtio-ccw.h | 8 ++++++++
qapi/machine.json | 24 ++++++++++++++++++++++++
4 files changed, 68 insertions(+)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 38aeba14ee..35fb523af9 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -49,6 +49,7 @@
#include "hw/virtio/virtio-md-pci.h"
#include "hw/s390x/virtio-ccw-md.h"
#include CONFIG_DEVICES
+#include "qapi/qapi-visit-machine.h"
static Error *pv_mig_blocker;
@@ -773,6 +774,25 @@ static void machine_set_loadparm(Object *obj,
Visitor *v,
s390_ipl_fmt_loadparm(ms->loadparm, val, errp);
}
+static void machine_get_cpi(Object *obj, Visitor *v,
+ const char *name, void *opaque, Error
**errp)
+{
+ S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
+ S390Cpi *cpi;
+ cpi = &(S390Cpi){
+ .system_type = g_strndup((char *) ms->cpi.system_type,
+ sizeof(ms->cpi.system_type)),
+ .system_name = g_strndup((char *) ms->cpi.system_name,
+ sizeof(ms->cpi.system_name)),
+ .system_level = g_strdup_printf("0x%lx",
ms->cpi.system_level),
Is there any way in which it would make sense for the qmp caller to
interpret this as a number? If so exposing it as a number would be
preferable.
Hello Nina,
As discussed offline, when interpreted as a number the output was
'system-level': 74872343805430528
however, the desired output is
'system-level': '0x10a000000060b00'
So, this code is not changed in v2. Thank you.
+ .sysplex_name = g_strndup((char *) ms->cpi.sysplex_name,
+ sizeof(ms->cpi.sysplex_name)),
+ .timestamp = ms->cpi.timestamp
+ };
+
+ visit_type_S390Cpi(v, name, &cpi, &error_abort);
+}
+
--
Mit freundlichen Grüßen / Kind regards
Shalini Chellathurai Saroja
Software Developer
Linux on IBM Z & KVM Development
IBM Deutschland Research & Development GmbH
Dept 1419, Schoenaicher Str. 220, 71032 Boeblingen
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht
Stuttgart, HRB 243294