From nobody Mon Feb 9 17:59:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150003132245741.505745991286176; Fri, 14 Jul 2017 04:22:02 -0700 (PDT) Received: from localhost ([::1]:37085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVyfX-0007Bi-OL for importer@patchew.org; Fri, 14 Jul 2017 07:21:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVyPE-0008Tq-F2 for qemu-devel@nongnu.org; Fri, 14 Jul 2017 07:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVyP8-00041b-Gd for qemu-devel@nongnu.org; Fri, 14 Jul 2017 07:05:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36360 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVyP8-000419-Bc for qemu-devel@nongnu.org; Fri, 14 Jul 2017 07:05:02 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6EB4lDC084265 for ; Fri, 14 Jul 2017 07:05:01 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpuk7tr24-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 14 Jul 2017 07:05:01 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Jul 2017 12:04:59 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 14 Jul 2017 12:04:56 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6EB4oks29229128; Fri, 14 Jul 2017 11:04:55 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ADB752A70; Fri, 14 Jul 2017 10:37:26 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 83F1252A6F; Fri, 14 Jul 2017 10:37:26 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id B8BBD20F69C; Fri, 14 Jul 2017 12:41:08 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Fri, 14 Jul 2017 12:40:31 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500028867-134709-1-git-send-email-borntraeger@de.ibm.com> References: <1500028867-134709-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071411-0008-0000-0000-0000048121DE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071411-0009-0000-0000-00001E0C76B5 Message-Id: <1500028867-134709-5-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707140183 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PULL 04/40] s390x/migration: Monitor commands for storage attributes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Graf , Thomas Huth , Cornelia Huck , qemu-devel , Claudio Imbrenda , Christian Borntraeger , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Claudio Imbrenda Add an "info" monitor command to non-destructively inspect the state of the storage attributes of the guest, and a normal command to toggle migration mode (useful for debugging). Signed-off-by: Claudio Imbrenda Acked-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- hmp-commands-info.hx | 16 +++++++++ hmp-commands.hx | 16 +++++++++ hw/s390x/s390-stattrib.c | 62 +++++++++++++++++++++++++++++++= ++++ include/hw/s390x/storage-attributes.h | 4 +++ monitor.c | 1 + 5 files changed, 99 insertions(+) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 07500ef..d9df238 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -777,6 +777,22 @@ STEXI Display the value of a storage key (s390 only) ETEXI =20 +#if defined(TARGET_S390X) + { + .name =3D "cmma", + .args_type =3D "addr:l,count:l?", + .params =3D "address [count]", + .help =3D "Display the values of the CMMA storage attributes= for a range of pages", + .cmd =3D hmp_info_cmma, + }, +#endif + +STEXI +@item info cmma @var{address} +@findex cmma +Display the values of the CMMA storage attributes for a range of pages (s3= 90 only) +ETEXI + { .name =3D "dump", .args_type =3D "", diff --git a/hmp-commands.hx b/hmp-commands.hx index 75f8bac..f93bc15 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1153,6 +1153,22 @@ STEXI Save guest storage keys to a file. ETEXI =20 +#if defined(TARGET_S390X) + { + .name =3D "migration_mode", + .args_type =3D "mode:i", + .params =3D "mode", + .help =3D "Enables or disables migration mode\n", + .cmd =3D hmp_migrationmode, + }, +#endif + +STEXI +@item migration_mode @var{mode} +@findex migration_mode +Enables or disables migration mode. +ETEXI + { .name =3D "snapshot_blkdev", .args_type =3D "reuse:-n,device:B,snapshot-file:s?,format:s?", diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index 922b756..d14923f 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -11,6 +11,7 @@ =20 #include "qemu/osdep.h" #include "hw/boards.h" +#include "qmp-commands.h" #include "migration/qemu-file.h" #include "migration/register.h" #include "hw/s390x/storage-attributes.h" @@ -26,6 +27,15 @@ #define STATTR_FLAG_ERROR 0x04ULL #define STATTR_FLAG_DONE 0x08ULL =20 +static S390StAttribState *s390_get_stattrib_device(void) +{ + S390StAttribState *sas; + + sas =3D S390_STATTRIB(object_resolve_path_type("", TYPE_S390_STATTRIB,= NULL)); + assert(sas); + return sas; +} + void s390_stattrib_init(void) { Object *obj; @@ -42,6 +52,58 @@ void s390_stattrib_init(void) qdev_init_nofail(DEVICE(obj)); } =20 +/* Console commands: */ + +void hmp_migrationmode(Monitor *mon, const QDict *qdict) +{ + S390StAttribState *sas =3D s390_get_stattrib_device(); + S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); + uint64_t what =3D qdict_get_int(qdict, "mode"); + int r; + + r =3D sac->set_migrationmode(sas, what); + if (r < 0) { + monitor_printf(mon, "Error: %s", strerror(-r)); + } +} + +void hmp_info_cmma(Monitor *mon, const QDict *qdict) +{ + S390StAttribState *sas =3D s390_get_stattrib_device(); + S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); + uint64_t addr =3D qdict_get_int(qdict, "addr"); + uint64_t buflen =3D qdict_get_try_int(qdict, "count", 8); + uint8_t *vals; + int cx, len; + + vals =3D g_try_malloc(buflen); + if (!vals) { + monitor_printf(mon, "Error: %s\n", strerror(errno)); + return; + } + + len =3D sac->peek_stattr(sas, addr / TARGET_PAGE_SIZE, buflen, vals); + if (len < 0) { + monitor_printf(mon, "Error: %s", strerror(-len)); + goto out; + } + + monitor_printf(mon, " CMMA attributes, " + "pages %" PRIu64 "+%d (0x%" PRIx64 "):\n", + addr / TARGET_PAGE_SIZE, len, addr & ~TARGET_PAGE_MASK); + for (cx =3D 0; cx < len; cx++) { + if (cx % 8 =3D=3D 7) { + monitor_printf(mon, "%02x\n", vals[cx]); + } else { + monitor_printf(mon, "%02x", vals[cx]); + } + } + monitor_printf(mon, "\n"); + +out: + g_free(vals); +} + /* Migration support: */ =20 static int cmma_load(QEMUFile *f, void *opaque, int version_id) diff --git a/include/hw/s390x/storage-attributes.h b/include/hw/s390x/stora= ge-attributes.h index 678df95..9be954d 100644 --- a/include/hw/s390x/storage-attributes.h +++ b/include/hw/s390x/storage-attributes.h @@ -13,6 +13,7 @@ #define S390_STORAGE_ATTRIBUTES_H =20 #include +#include "monitor/monitor.h" =20 #define TYPE_S390_STATTRIB "s390-storage_attributes" #define TYPE_QEMU_S390_STATTRIB "s390-storage_attributes-qemu" @@ -74,4 +75,7 @@ static inline Object *kvm_s390_stattrib_create(void) } #endif =20 +void hmp_info_cmma(Monitor *mon, const QDict *qdict); +void hmp_migrationmode(Monitor *mon, const QDict *qdict); + #endif /* S390_STORAGE_ATTRIBUTES_H */ diff --git a/monitor.c b/monitor.c index 12935a7..6a7c988 100644 --- a/monitor.c +++ b/monitor.c @@ -81,6 +81,7 @@ =20 #if defined(TARGET_S390X) #include "hw/s390x/storage-keys.h" +#include "hw/s390x/storage-attributes.h" #endif =20 /* --=20 2.7.4