From nobody Sun Nov 16 04:16:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1743429757; cv=none; d=zohomail.com; s=zohoarc; b=IEVm0eEsC7vK2PurIAIzoi127MGztQw5OdEEaY03Biz54jngNFATOiltoinkEKUMtk019S5hSBW6zKQu+vINg7jP/Gxt6xUps3oNwi/YJLIF8sjbKEXkn4UzJhSB09GH0lROQ5Wb8KE++M+iULpUkKq0QnIbyNTSL191H7Aak/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743429757; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TEU03YAzqAwt6bXIxteVjovSLEeYTfXGzJZ9yTp0LRk=; b=ScSDYnlsoGpWVv7A3snB8xQ3VUSYy3iP4CiT1kamF87N0+J4j0M2Lw3+b6aqPN/pen/V/023UX4v9s5JqPXP9iF43WNm9tyAHjmQbEJ6ylYY/99AbmNl6ixm10k7fg9QGt7xHb/bmzyXSgxSDtDcJwzq9+jZoC+x3rGm4I1ETW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 174342975769515.099110946683368; Mon, 31 Mar 2025 07:02:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzFho-0007G6-3W; Mon, 31 Mar 2025 10:01:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFhj-0007Eo-EU; Mon, 31 Mar 2025 10:01:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFhg-0002z8-Md; Mon, 31 Mar 2025 10:01:31 -0400 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52V8hr0T029367; Mon, 31 Mar 2025 14:01:25 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 45qa4wv0vy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:24 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 52VA554m014568; Mon, 31 Mar 2025 14:01:24 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 45pvpkwy7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:24 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 52VE1K2B18809164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Mar 2025 14:01:20 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1553220043; Mon, 31 Mar 2025 14:01:20 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E0CE020040; Mon, 31 Mar 2025 14:01:19 +0000 (GMT) Received: from a46lp68.lnxne.boe (unknown [9.152.108.100]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 31 Mar 2025 14:01:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=TEU03YAzqAwt6bXIx teVjovSLEeYTfXGzJZ9yTp0LRk=; b=TV3uPJIIhl3LAdMbOsC6OcgyWDGO5mG8O 9TQCDqfPzFO3JmyWDmp937ZxeFsRsOZe/TAAIkuGUMO32YT9KsbQFyo4X5sDh3AQ y+ht2wHmBs9CmP+B78ETp18iYc7oFG0axZH0nAVIlWgTW6yzIAvRp5Iup7n9pxD5 jSYP9FpSG9olKakBMgkVmjzgMF6Ifc5LLZBzGMH6fljrsbhr1truISRMGpNZsrgn bMKgJPTPIvWNysAfXrwGpphOkpPzGWVU5D4H/jF8l04uCafg7nt06KjQDnmoRy3q mjtVQDK/wez/Nm0vq/xMdEwVhdzSBa0LRng1xXnSGOg4Y5hrPKfKw== From: Shalini Chellathurai Saroja To: qemu-s390x mailing list , Thomas Huth , Daniel Berrange Cc: qemu-devel mailing list , Nina Schoetterl-Glausch , Hendrik Brueckner , Shalini Chellathurai Saroja Subject: [PATCH v3 1/4] hw/s390x: add SCLP event type CPI Date: Mon, 31 Mar 2025 16:00:38 +0200 Message-ID: <20250331140041.3133621-2-shalini@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250331140041.3133621-1-shalini@linux.ibm.com> References: <20250331140041.3133621-1-shalini@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1bnmy-D0rlY78GQkLpqL2ZkNr5j0VZiH X-Proofpoint-ORIG-GUID: 1bnmy-D0rlY78GQkLpqL2ZkNr5j0VZiH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-31_06,2025-03-27_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503310100 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=shalini@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1743429759308019000 Content-Type: text/plain; charset="utf-8" Implement the Service-Call Logical Processor (SCLP) event type Control-Program Identification (CPI) in QEMU. This event is used to send CPI identifiers from the guest to the host. The CPI identifiers are: system type, system name, system level and sysplex name. System type: operating system of the guest (e.g. "LINUX"). System name: user configurable name of the guest (e.g. "TESTVM"). System level: distribution and kernel version, if the system type is Linux (e.g. 0x50e00). Sysplex name: name of the cluster which the guest belongs to (if any) (e.g. "PLEX"). Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Nina Schoetterl-Glausch Reviewed-by: Thomas Huth --- hw/s390x/event-facility.c | 12 ++- hw/s390x/meson.build | 1 + hw/s390x/sclpcpi.c | 133 ++++++++++++++++++++++++++++++ include/hw/s390x/event-facility.h | 3 + 4 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 hw/s390x/sclpcpi.c diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 2b0332c20e..c0fb6e098c 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -39,7 +39,7 @@ typedef struct SCLPEventsBus { struct SCLPEventFacility { SysBusDevice parent_obj; SCLPEventsBus sbus; - SCLPEvent quiesce, cpu_hotplug; + SCLPEvent quiesce, cpu_hotplug, cpi; /* guest's receive mask */ union { uint32_t receive_mask_pieces[2]; @@ -436,6 +436,10 @@ static void init_event_facility(Object *obj) object_initialize_child(obj, TYPE_SCLP_CPU_HOTPLUG, &event_facility->cpu_hotplug, TYPE_SCLP_CPU_HOTPLUG); + + object_initialize_child(obj, TYPE_SCLP_CPI, + &event_facility->cpi, + TYPE_SCLP_CPI); } =20 static void realize_event_facility(DeviceState *dev, Error **errp) @@ -451,6 +455,12 @@ static void realize_event_facility(DeviceState *dev, E= rror **errp) qdev_unrealize(DEVICE(&event_facility->quiesce)); return; } + if (!qdev_realize(DEVICE(&event_facility->cpi), + BUS(&event_facility->sbus), errp)) { + qdev_unrealize(DEVICE(&event_facility->quiesce)); + qdev_unrealize(DEVICE(&event_facility->cpu_hotplug)); + return; + } } =20 static void reset_event_facility(DeviceState *dev) diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build index 3bbebfd817..eb7950489c 100644 --- a/hw/s390x/meson.build +++ b/hw/s390x/meson.build @@ -13,6 +13,7 @@ s390x_ss.add(files( 's390-skeys.c', 's390-stattrib.c', 'sclp.c', + 'sclpcpi.c', 'sclpcpu.c', 'sclpquiesce.c', 'tod.c', diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c new file mode 100644 index 0000000000..7ace5dd64e --- /dev/null +++ b/hw/s390x/sclpcpi.c @@ -0,0 +1,133 @@ + /* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * SCLP event type 11 - Control-Program Identification (CPI): + * CPI is used to send program identifiers from the guest to the + * Service-Call Logical Processor (SCLP). It is not sent by the SCLP. = The + * program identifiers are: system type, system name, system level and + * sysplex name. They provide data about the guest operating system. + * + * System type, system name, and sysplex name use EBCDIC characters fr= om + * this set: capital A-Z, 0-9, $, @, #, and blank. The system level is= a hex + * value. In Linux, the system type, system name and sysplex name are + * arbitrary free-form texts. In Linux, all the control-program identi= fiers + * are user configurable. + * + * System-type: operating system (e.g. "LINUX ") + * + * System-name: user configurable name of the VM (e.g. "TESTVM ") + * + * System-level: distribution and kernel version, if the system-type is + * Linux. On Linux OS, the 8-byte hexadecimal system-level has the for= mat + * 0x
, where: + * : is one hexadecimal byte, its most significant bit indicates + * hypervisor use + * : is one digit that represents Linux distributions as follows + * 0: generic Linux + * 1: Red Hat Enterprise Linux + * 2: SUSE Linux Enterprise Server + * 3: Canonical Ubuntu + * 4: Fedora + * 5: openSUSE Leap + * 6: Debian GNU/Linux + * 7: Red Hat Enterprise Linux CoreOS + * : are two digits for a distribution-specific encoding of the ma= jor + * version of the distribution + *
: are two digits for a distribution-specific encoding of the mi= nor + * version of the distribution + * : are four digits for the patch level of the distribution + * : are two digits for the major version of the kernel + * : are two digits for the minor version of the kernel + * : are two digits for the stable version of the kernel + * (e.g. 0x010a000000060b00). On machines prior to z16, some of the va= lues + * are not available to display. + * + * Sysplex-name: sysplex refers to a cluster of logical partitions that + * communicates and co-operates with each other. Sysplex name is the n= ame of + * the cluster which the guest belongs to (if any). (e.g. "PLEX ") + * + * Copyright IBM, Corp. 2024 + * + * Authors: + * Shalini Chellathurai Saroja + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at= your + * option) any later version. See the COPYING file in the top-level dire= ctory. + * + */ + +#include "qemu/osdep.h" +#include "hw/s390x/sclp.h" +#include "hw/s390x/event-facility.h" + +typedef struct Data { + uint8_t id_format; + uint8_t reserved0; + uint8_t system_type[8]; + uint64_t reserved1; + uint8_t system_name[8]; + uint64_t reserved2; + uint64_t system_level; + uint64_t reserved3; + uint8_t sysplex_name[8]; + uint8_t reserved4[16]; +} QEMU_PACKED Data; + +typedef struct ControlProgramIdMsg { + EventBufferHeader ebh; + Data data; +} QEMU_PACKED ControlProgramIdMsg; + +static bool can_handle_event(uint8_t type) +{ + return type =3D=3D SCLP_EVENT_CPI; +} + +static sccb_mask_t send_mask(void) +{ + return 0; +} + +/* Enable SCLP to accept buffers of event type CPI from the control-progra= m. */ +static sccb_mask_t receive_mask(void) +{ + return SCLP_EVENT_MASK_CPI; +} + +static int write_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_h= dr) +{ + ControlProgramIdMsg *cpim =3D container_of(evt_buf_hdr, ControlProgram= IdMsg, + ebh); + + cpim->ebh.flags =3D SCLP_EVENT_BUFFER_ACCEPTED; + return SCLP_RC_NORMAL_COMPLETION; +} + +static void cpi_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + SCLPEventClass *k =3D SCLP_EVENT_CLASS(klass); + + dc->user_creatable =3D false; + + k->can_handle_event =3D can_handle_event; + k->get_send_mask =3D send_mask; + k->get_receive_mask =3D receive_mask; + k->write_event_data =3D write_event_data; +} + +static const TypeInfo sclp_cpi_info =3D { + .name =3D TYPE_SCLP_CPI, + .parent =3D TYPE_SCLP_EVENT, + .instance_size =3D sizeof(SCLPEvent), + .class_init =3D cpi_class_init, + .class_size =3D sizeof(SCLPEventClass), +}; + +static void sclp_cpi_register_types(void) +{ + type_register_static(&sclp_cpi_info); +} + +type_init(sclp_cpi_register_types) + diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-fac= ility.h index ff874e792d..f445d2f9f5 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -25,6 +25,7 @@ #define SCLP_EVENT_MESSAGE 0x02 #define SCLP_EVENT_CONFIG_MGT_DATA 0x04 #define SCLP_EVENT_PMSGCMD 0x09 +#define SCLP_EVENT_CPI 0x0b #define SCLP_EVENT_ASCII_CONSOLE_DATA 0x1a #define SCLP_EVENT_SIGNAL_QUIESCE 0x1d =20 @@ -35,6 +36,7 @@ #define SCLP_EVENT_MASK_MSG SCLP_EVMASK(SCLP_EVENT_MESSAGE) #define SCLP_EVENT_MASK_CONFIG_MGT_DATA SCLP_EVMASK(SCLP_EVENT_CONFIG_MGT_= DATA) #define SCLP_EVENT_MASK_PMSGCMD SCLP_EVMASK(SCLP_EVENT_PMSGCMD) +#define SCLP_EVENT_MASK_CPI SCLP_EVMASK(SCLP_EVENT_CPI) #define SCLP_EVENT_MASK_MSG_ASCII SCLP_EVMASK(SCLP_EVENT_ASCII_CONSO= LE_DATA) #define SCLP_EVENT_MASK_SIGNAL_QUIESCE SCLP_EVMASK(SCLP_EVENT_SIGNAL_QUIE= SCE) =20 @@ -46,6 +48,7 @@ OBJECT_DECLARE_TYPE(SCLPEvent, SCLPEventClass, SCLP_EVENT) =20 #define TYPE_SCLP_CPU_HOTPLUG "sclp-cpu-hotplug" +#define TYPE_SCLP_CPI "sclpcpi" #define TYPE_SCLP_QUIESCE "sclpquiesce" =20 #define SCLP_EVENT_MASK_LEN_MAX 1021 --=20 2.47.0 From nobody Sun Nov 16 04:16:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1743429808; cv=none; d=zohomail.com; s=zohoarc; b=ZDOx7uTQFV2cQ7nLpDkWlx1syThAjGB5Mxp6skiN6srCZYedZUOA3usI80dTGQazsmO54m2X+3trl+wZ6fTo8NtvkeDL9nHWGsuMaRW1hE9OHQgo7ZFbQVVJtMWhuN3PzVsVbtEPBcTyxaBen9fcneW+yx+aBkwVUK/hJHJ02fY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743429808; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pGz7E8dyg/dBFQdT8KG0w7LeUQrO6Gdqeeau2u5ger4=; b=m6sUurtEkBMKCFB0J7rDNKSTZRil68ZY7j9UpSjHe4kns9Dwo8AWKLsyeYfr+45vn/DasYbrE492Bhk0gGWl2EKjC4jHBKkNW4ziKZcW49w7dUUb/qJmpoLtrdw0sr/AjLomq5T4RD4ecN2/4bxtRarAVRcdDLV+YM52Wcc9MEc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17434298081281003.3152970448722; Mon, 31 Mar 2025 07:03:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzFiK-0007LI-Ez; Mon, 31 Mar 2025 10:02:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFht-0007HL-HW; Mon, 31 Mar 2025 10:01:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFhn-00030d-VZ; Mon, 31 Mar 2025 10:01:40 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52V3811f005616; Mon, 31 Mar 2025 14:01:34 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 45q7cpvk0f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:33 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 52VDvQRs004829; Mon, 31 Mar 2025 14:01:32 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 45pujyp6r3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:32 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 52VE1SN541157098 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Mar 2025 14:01:28 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8567820043; Mon, 31 Mar 2025 14:01:28 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 644DC20040; Mon, 31 Mar 2025 14:01:28 +0000 (GMT) Received: from a46lp68.lnxne.boe (unknown [9.152.108.100]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 31 Mar 2025 14:01:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=pGz7E8dyg/dBFQdT8 KG0w7LeUQrO6Gdqeeau2u5ger4=; b=LqaRg30cqXj6legcNjL2QlO2zjSZJEHkl WN5cnGL52hOAN9ZYGeh34opFBPaP4YAKhnmAZjdGyZHKVtpHy8nhACwMHajPqwF/ eDM3kBAmWBn2lNG17vtWrmcmY4WxoNR9C45Qg4sF4KsZR0Xd561qAK5w4O+8sp54 coY1XK1GLb2VWI0o95X6NUH4EFmXv8dvGnOilBBeUOFnDUNCgikXTNtS4lgEGkj9 0FZLGgh2HYrYcv03f3mk59G+2L1X3xZUUsRzuz9u0i5F5fXQeWHqlZwzf4G49MCM 4pquFNKhMq9sxWeCftckdkuaPFjW/cNP2VDpTU6tCS8MnXhIQIjPQ== From: Shalini Chellathurai Saroja To: qemu-s390x mailing list , Thomas Huth , Daniel Berrange Cc: qemu-devel mailing list , Nina Schoetterl-Glausch , Hendrik Brueckner , Shalini Chellathurai Saroja Subject: [PATCH v3 2/4] hw/s390x: add Control-Program Identification to QOM Date: Mon, 31 Mar 2025 16:00:39 +0200 Message-ID: <20250331140041.3133621-3-shalini@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250331140041.3133621-1-shalini@linux.ibm.com> References: <20250331140041.3133621-1-shalini@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: wmHu0VRHIhI5THlp-UoPffBIekDEH4z0 X-Proofpoint-GUID: wmHu0VRHIhI5THlp-UoPffBIekDEH4z0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-31_06,2025-03-27_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 phishscore=0 spamscore=0 priorityscore=1501 suspectscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503310100 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=shalini@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1743429809681019100 Content-Type: text/plain; charset="utf-8" Add Control-Program Identification data to the QEMU Object Model (QOM), along with the timestamp in which the data was received. Example: virsh # qemu-monitor-command vm --pretty '{ "execute": "qom-get", "arguments": { "path": "/machine/sclp/s390-sclp-event-facility/sclpcpi", "property": "control-program-id" }}' { "return": { "timestamp": 1742390410685762000, "system-level": 74872343805430528, "sysplex-name": "PLEX ", "system-name": "TESTVM ", "system-type": "LINUX " }, "id": "libvirt-15" } Signed-off-by: Shalini Chellathurai Saroja --- hw/s390x/sclpcpi.c | 38 ++++++++++++++++++++ include/hw/s390x/event-facility.h | 9 +++++ qapi/machine.json | 58 +++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c index 7ace5dd64e..969c15e43d 100644 --- a/hw/s390x/sclpcpi.c +++ b/hw/s390x/sclpcpi.c @@ -57,8 +57,11 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/timer.h" #include "hw/s390x/sclp.h" #include "hw/s390x/event-facility.h" +#include "hw/s390x/ebcdic.h" +#include "qapi/qapi-visit-machine.h" =20 typedef struct Data { uint8_t id_format; @@ -99,10 +102,37 @@ static int write_event_data(SCLPEvent *event, EventBuf= ferHeader *evt_buf_hdr) ControlProgramIdMsg *cpim =3D container_of(evt_buf_hdr, ControlProgram= IdMsg, ebh); =20 + ascii_put(event->cpi.system_type, (char *)cpim->data.system_type, 8); + ascii_put(event->cpi.system_name, (char *)cpim->data.system_name, 8); + ascii_put(event->cpi.sysplex_name, (char *)cpim->data.sysplex_name, 8); + event->cpi.system_level =3D ldq_be_p(&cpim->data.system_level); + event->cpi.timestamp =3D qemu_clock_get_ns(QEMU_CLOCK_HOST); + cpim->ebh.flags =3D SCLP_EVENT_BUFFER_ACCEPTED; return SCLP_RC_NORMAL_COMPLETION; } =20 +static void get_control_program_id(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + SCLPEvent *event =3D (SCLPEvent *)(obj); + S390ControlProgramId *cpi; + + cpi =3D &(S390ControlProgramId){ + .system_type =3D g_strndup((char *) event->cpi.system_type, + sizeof(event->cpi.system_type)), + .system_name =3D g_strndup((char *) event->cpi.system_name, + sizeof(event->cpi.system_name)), + .system_level =3D event->cpi.system_level, + .sysplex_name =3D g_strndup((char *) event->cpi.sysplex_name, + sizeof(event->cpi.sysplex_name)), + .timestamp =3D event->cpi.timestamp + }; + + visit_type_S390ControlProgramId(v, name, &cpi, errp); +} + static void cpi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -114,6 +144,14 @@ static void cpi_class_init(ObjectClass *klass, void *d= ata) k->get_send_mask =3D send_mask; k->get_receive_mask =3D receive_mask; k->write_event_data =3D write_event_data; + + object_class_property_add(klass, "control-program-id", + "S390ControlProgramId", + get_control_program_id, + NULL, NULL, NULL); + object_class_property_set_description(klass, "control-program-id", + "Control-program identifiers provide data about the guest " + "operating system"); } =20 static const TypeInfo sclp_cpi_info =3D { diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-fac= ility.h index f445d2f9f5..39e589ed44 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -169,10 +169,19 @@ typedef struct ReadEventData { }; } QEMU_PACKED ReadEventData; =20 +typedef struct ControlProgramId { + uint8_t system_type[8]; + uint8_t system_name[8]; + uint64_t system_level; + uint8_t sysplex_name[8]; + uint64_t timestamp; +} QEMU_PACKED ControlProgramId; + struct SCLPEvent { DeviceState qdev; bool event_pending; char *name; + ControlProgramId cpi; }; =20 struct SCLPEventClass { diff --git a/qapi/machine.json b/qapi/machine.json index a6b8795b09..cd2bcd2d13 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1898,3 +1898,61 @@ { 'command': 'x-query-interrupt-controllers', 'returns': 'HumanReadableText', 'features': [ 'unstable' ]} + +## +# @S390ControlProgramId: +# +# Control-program identifiers provide data about the guest operating syste= m. +# The control-program identifiers are: system type, system name, system le= vel +# and sysplex name. +# +# In Linux, all the control-program identifiers are user configurable. The +# system type, system name, and sysplex name use EBCDIC characters from +# this set: capital A-Z, 0-9, $, @, #, and blank. In Linux, the system ty= pe, +# system name and sysplex name are arbitrary free-form texts. +# +# In Linux, the 8-byte hexadecimal system-level has the format +# 0x
, where: +# : is one hexadecimal byte, its most significant bit indicates hypervi= sor +# use +# : is one digit that represents Linux distributions as follows +# 0: generic Linux +# 1: Red Hat Enterprise Linux +# 2: SUSE Linux Enterprise Server +# 3: Canonical Ubuntu +# 4: Fedora +# 5: openSUSE Leap +# 6: Debian GNU/Linux +# 7: Red Hat Enterprise Linux CoreOS +# : are two digits for a distribution-specific encoding of the major v= ersion +# of the distribution +#
: are two digits for a distribution-specific encoding of the minor v= ersion +# of the distribution +# : are four digits for the patch level of the distribution +# : are two digits for the major version of the kernel +# : are two digits for the minor version of the kernel +# : are two digits for the stable version of the kernel +# (e.g. 74872343805430528, when converted to hex is 0x010a000000060b00). On +# machines prior to z16, some of the values are not available to display. +# +# Sysplex refers to a cluster of logical partitions that communicates and +# co-operates with each other. +# +# @system-type: operating system (e.g. "LINUX ") +# +# @system-name: user configurable name of the VM (e.g. "TESTVM ") +# +# @system-level: distribution and kernel version in Linux +# +# @sysplex-name: sysplex which the VM belongs to, if any (e.g. "PLEX ") +# +# @timestamp: latest update of CPI data in nanoseconds since the UNIX EPOCH +# +# Since: 10.0 +## +{ 'struct': 'S390ControlProgramId', 'data': { + 'system-type': 'str', + 'system-name': 'str', + 'system-level': 'uint64', + 'sysplex-name': 'str', + 'timestamp': 'uint64' } } --=20 2.47.0 From nobody Sun Nov 16 04:16:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1743429785; cv=none; d=zohomail.com; s=zohoarc; b=PRx0L8FOYhsw90VK+ixSKot04oCCDxEZR2pNWQi8iEQhN0NV3cmOTfYzn91d7iazaqJh2y3OUMa5SoBynIDLsKg9Q4Q/rDCUHaECRaiKmGdbx5QFJPO3O3sWlQuDM8CTK39A0ptGyAZLvSzlK2tOabLVXigPixyMdzXaLYm+bYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743429785; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xUsQByUUEazXMjWzd/z/mqEsKquik4uF9QG5VN/snzQ=; b=JR3iEs7e9038xBkbXvcO1Ce0vIArurdtlEk4ZHSdNKhcVQ2QbJZu6mKlRF0taRtfK78oeFlR6uGWbNrFkXmo9xrUyiqa56MIgiBU+ZepM0HdBwF+EKEEwNcQmoKC3/OG0L8P3r0X3qfVq2daEC0Jy3+pmudcu5HXQJwzVA/09Ps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1743429785131119.0789814314877; Mon, 31 Mar 2025 07:03:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzFiK-0007Kb-6P; Mon, 31 Mar 2025 10:02:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFht-0007HM-Hg; Mon, 31 Mar 2025 10:01:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFhp-00030v-Sz; Mon, 31 Mar 2025 10:01:39 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52VCSWqA027981; Mon, 31 Mar 2025 14:01:35 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 45qu328ewc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:35 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 52VBNXG0005421; Mon, 31 Mar 2025 14:01:34 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 45pww25r94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:34 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 52VE1VJF12058900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Mar 2025 14:01:31 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44B3E2004B; Mon, 31 Mar 2025 14:01:31 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23CEF20043; Mon, 31 Mar 2025 14:01:31 +0000 (GMT) Received: from a46lp68.lnxne.boe (unknown [9.152.108.100]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 31 Mar 2025 14:01:31 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=xUsQByUUEazXMjWzd /z/mqEsKquik4uF9QG5VN/snzQ=; b=f5jdFDVIuGvPLVh4EzUo2RZ0Cb9GbO0+s qs+oQZQcIG02fDoWZybRSWZNxH3D3U5MSD2iufvPKg27m9EBEG+B30zOwHIDmtAA //NXQM6pF31vK0ZTBi7f4rlQdLamf5wUlg+iW0Tk9zyRSKuUBYQAMJT2mjGgZpnb O5jC+PBfZgiBUOsK4u/DU2qlHSvaVNpBLw1sLj/x1jWwNicgpja+MgYfPOfNb77k uinYL8hbka4j8CymTrQRJLbAQpzXPiGaFjlXg9WFgdVlmiunx32NkNqNUPbbyA/4 oWqoawl2BYbkFawfoLDmdtCBgMf2nrH3EpMSmRvYjuhm874XGGKKg== From: Shalini Chellathurai Saroja To: qemu-s390x mailing list , Thomas Huth , Daniel Berrange Cc: qemu-devel mailing list , Nina Schoetterl-Glausch , Hendrik Brueckner , Shalini Chellathurai Saroja Subject: [PATCH v3 3/4] hw/s390x: support migration of CPI data Date: Mon, 31 Mar 2025 16:00:40 +0200 Message-ID: <20250331140041.3133621-4-shalini@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250331140041.3133621-1-shalini@linux.ibm.com> References: <20250331140041.3133621-1-shalini@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: W0KXMKCmGOVCEnQh0cKvE3lMzQlzgpEe X-Proofpoint-ORIG-GUID: W0KXMKCmGOVCEnQh0cKvE3lMzQlzgpEe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-31_06,2025-03-27_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503310100 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=shalini@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1743429787361019100 Content-Type: text/plain; charset="utf-8" Register Control-Program Identification data with the live migration infrastructure. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Nina Schoetterl-Glausch --- hw/s390x/sclpcpi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/s390x/sclpcpi.c b/hw/s390x/sclpcpi.c index 969c15e43d..0b1b5293ea 100644 --- a/hw/s390x/sclpcpi.c +++ b/hw/s390x/sclpcpi.c @@ -62,6 +62,7 @@ #include "hw/s390x/event-facility.h" #include "hw/s390x/ebcdic.h" #include "qapi/qapi-visit-machine.h" +#include "migration/vmstate.h" =20 typedef struct Data { uint8_t id_format; @@ -133,12 +134,38 @@ static void get_control_program_id(Object *obj, Visit= or *v, visit_type_S390ControlProgramId(v, name, &cpi, errp); } =20 +static const VMStateDescription vmstate_control_program_id =3D { + .name =3D "s390_control_program_id", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT8_ARRAY(system_type, ControlProgramId, 8), + VMSTATE_UINT8_ARRAY(system_name, ControlProgramId, 8), + VMSTATE_UINT64(system_level, ControlProgramId), + VMSTATE_UINT8_ARRAY(sysplex_name, ControlProgramId, 8), + VMSTATE_UINT64(timestamp, ControlProgramId), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_sclpcpi =3D { + .name =3D "s390_sclpcpi", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (const VMStateField[]) { + VMSTATE_STRUCT(cpi, SCLPEvent, 0, vmstate_control_program_id, + ControlProgramId), + VMSTATE_END_OF_LIST() + } +}; + static void cpi_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); SCLPEventClass *k =3D SCLP_EVENT_CLASS(klass); =20 dc->user_creatable =3D false; + dc->vmsd =3D &vmstate_sclpcpi; =20 k->can_handle_event =3D can_handle_event; k->get_send_mask =3D send_mask; --=20 2.47.0 From nobody Sun Nov 16 04:16:11 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1743429758; cv=none; d=zohomail.com; s=zohoarc; b=Saf1ovFtpAfCzzgcz1V3yXR0z/Sdf4mOtLJk+Mh8impZuDv9K6JVFrEzae/jkEta3pn2Ut2aElZjjBs5Ixey4VOSfUQZ+GPcKYB7mnRXht2kTimJpxzXTBr2IO/R+mFGz+KVMVnVITc+bV5lRBT83bU4EWm4atkbCaa+uwsZos0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743429758; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aIhpVug6hP+IkMG8WYvx8nUnsdz9WMIs7yr2+KgjD/c=; b=hd1USlz4aAgSIvWcvBXWcMjgS3iurF42Po5EMX9KEKu6JSrOkFxp55SZNGoG2R2YMnn1w49Ey0sGp+GsYz35awhIlrtgpy0WNTeDU4osZZho9WGs0yCa9Wddo1nQ9A0I23TmndpTAyIibMhtoDmSME2/WsPIz2+9CuuUVnPszT4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1743429758789588.91063094892; Mon, 31 Mar 2025 07:02:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tzFiW-0007OQ-29; Mon, 31 Mar 2025 10:02:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFhx-0007IK-9a; Mon, 31 Mar 2025 10:01:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tzFht-00031K-Ks; Mon, 31 Mar 2025 10:01:44 -0400 Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52V3mHCL024980; Mon, 31 Mar 2025 14:01:38 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 45qke9jbhx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:38 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 52VBHEqT005442; Mon, 31 Mar 2025 14:01:37 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 45pww25r9b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Mar 2025 14:01:37 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 52VE1YZS31654528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Mar 2025 14:01:34 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09E242004B; Mon, 31 Mar 2025 14:01:34 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCDA320043; Mon, 31 Mar 2025 14:01:33 +0000 (GMT) Received: from a46lp68.lnxne.boe (unknown [9.152.108.100]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 31 Mar 2025 14:01:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=aIhpVug6hP+IkMG8W Yvx8nUnsdz9WMIs7yr2+KgjD/c=; b=QWSkGsEqJANXh/rf789ZFnSXOp7TB2MBN UcdK3+K3JNGSIXqQifFLXBWqquu/JZx1DbZynqvCVp3tuhjF5LP0jLPKN0KXa4sQ 4fX2x5dnf8O8/9pvr/zcYrIXD23F28M4Er7W6+q2K75umVKqS34I8RUcw90vR59Z qzbVzYL4T84gBkjjjqwIDGlMO+mwiFU0A+C9ZTMpgski9LhjrvG1sfPxB+tB4EdF KKKIq8fR/PTrTlSgyTWAu2hUX0HeBAMNmwxK/4V5lQrqNN4TIOJWB2iIjNNzgL93 s5KFzxvxsQy3+mn9eNtsV/hvCFk3OaQwKndD3i93eNP2NkIAmhueA== From: Shalini Chellathurai Saroja To: qemu-s390x mailing list , Thomas Huth , Daniel Berrange Cc: qemu-devel mailing list , Nina Schoetterl-Glausch , Hendrik Brueckner , Shalini Chellathurai Saroja Subject: [PATCH v3 4/4] hw/s390x: compat handling for backward migration Date: Mon, 31 Mar 2025 16:00:41 +0200 Message-ID: <20250331140041.3133621-5-shalini@linux.ibm.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250331140041.3133621-1-shalini@linux.ibm.com> References: <20250331140041.3133621-1-shalini@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: gFLZBDIg01vhpFm9OonWk7KwgpZoozQ5 X-Proofpoint-ORIG-GUID: gFLZBDIg01vhpFm9OonWk7KwgpZoozQ5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-31_06,2025-03-27_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 malwarescore=0 clxscore=1015 spamscore=0 mlxlogscore=999 suspectscore=0 impostorscore=0 mlxscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503310100 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=shalini@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1743429761104019000 Content-Type: text/plain; charset="utf-8" Add Control-Program Identification (CPI) device to QOM only when the virtual machine supports CPI. CPI is supported from "s390-ccw-virtio-10.0" machine and higher. Signed-off-by: Shalini Chellathurai Saroja --- hw/s390x/event-facility.c | 27 ++++++++++++++++++++++----- hw/s390x/s390-virtio-ccw.c | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index c0fb6e098c..cb23bbc54b 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -22,6 +22,7 @@ #include "hw/s390x/sclp.h" #include "migration/vmstate.h" #include "hw/s390x/event-facility.h" +#include "hw/qdev-properties.h" =20 typedef struct SCLPEventsBus { BusState qbus; @@ -54,6 +55,7 @@ struct SCLPEventFacility { bool allow_all_mask_sizes; /* length of the receive mask */ uint16_t mask_length; + bool use_cpi; }; =20 /* return true if any child has event pending set */ @@ -455,11 +457,20 @@ static void realize_event_facility(DeviceState *dev, = Error **errp) qdev_unrealize(DEVICE(&event_facility->quiesce)); return; } - if (!qdev_realize(DEVICE(&event_facility->cpi), - BUS(&event_facility->sbus), errp)) { - qdev_unrealize(DEVICE(&event_facility->quiesce)); - qdev_unrealize(DEVICE(&event_facility->cpu_hotplug)); - return; + /* + * Add sclpcpi device to QOM only when the virtual machine supports + * Control-Program Identification. It is supported by "s390-ccw-virtio= -10.0" + * machine and higher. + */ + if (!event_facility->use_cpi) { + object_unparent(OBJECT(&event_facility->cpi)); + } else { + if (!qdev_realize(DEVICE(&event_facility->cpi), + BUS(&event_facility->sbus), errp)) { + qdev_unrealize(DEVICE(&event_facility->quiesce)); + qdev_unrealize(DEVICE(&event_facility->cpu_hotplug)); + return; + } } } =20 @@ -470,12 +481,18 @@ static void reset_event_facility(DeviceState *dev) sdev->receive_mask =3D 0; } =20 +static const Property qemu_event_facility_properties[] =3D { + DEFINE_PROP_BOOL("use-cpi", SCLPEventFacility, + use_cpi, true), +}; + static void init_event_facility_class(ObjectClass *klass, void *data) { SysBusDeviceClass *sbdc =3D SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(sbdc); SCLPEventFacilityClass *k =3D EVENT_FACILITY_CLASS(dc); =20 + device_class_set_props(dc, qemu_event_facility_properties); dc->realize =3D realize_event_facility; device_class_set_legacy_reset(dc, reset_event_facility); dc->vmsd =3D &vmstate_event_facility; diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 75b32182eb..c1001322e0 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -939,6 +939,7 @@ static void ccw_machine_9_2_class_options(MachineClass = *mc) { static GlobalProperty compat[] =3D { { TYPE_S390_PCI_DEVICE, "relaxed-translation", "off", }, + { TYPE_SCLP_EVENT_FACILITY, "use-cpi", "off", }, }; =20 ccw_machine_10_0_class_options(mc); --=20 2.47.0