From patchwork Wed Apr 23 07:35:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 883594 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2790387wrs; Wed, 23 Apr 2025 00:38:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVZ6Yj2eB9qPCaynnBZvoUfmT3ZGbpksTun1TEfto7ukZgkgwxbXlmZlA4qZLVUubmrPvDPjQ==@linaro.org X-Google-Smtp-Source: AGHT+IEeSbvunZOm+2nGPLC3QCEgZzu+msqzt2EeVIQnAw7H4189rj06DAz1+9yPDFcV8M4+L4Bj X-Received: by 2002:ad4:5f07:0:b0:6e5:a0fc:f65c with SMTP id 6a1803df08f44-6f2c4384fe5mr285468046d6.0.1745393889812; Wed, 23 Apr 2025 00:38:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745393889; cv=none; d=google.com; s=arc-20240605; b=EKaQ2LiYwxG55M7BZNIvNLxl1nBcGPyO6nVmO0daZPGY3nvVrh/Q1pLNNEZOjeXe8O eF0sKdcxGBw8Jf/SBq4N8AMFEkiVsVpZGpJlkOz1pMn+LCTi+pcDYghnumA4GBsmeIKh pzWhhCXwntZgixxJbjXBGuEQ+DIwcySBkheepKOrnnHMqqyTjzLMCf5djjBTK86ifjC2 YhTk83MCJG1resM05FVq39YDLL8dEMLvdniGR5NtYFNeapF2EmrtUOHfu3oayawAlZxE d9Y7WxVriC73PkNyo0rQ3fLGQhkaNaqbH1BJy5uY8jFRIQk4W4XLNxDcKg6o7sNfBM7p 9Ekg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6uodaUxX+9pfZchpCGRAUT/RxHshP2sI8myfmwd0ZYI=; fh=IZ2l8DLHLBNf1GWiSB9Jdu36OhlVFfVljxcBRywYfd0=; b=IXMvxYQsOJmSSLVbR9+zzdjYCw+YvFC4dAopJ7doMsCp38mOl1rYXO/+AsD7PvQVl7 XKV/7wR1iniGBkzODkiMsQiFDRTTzuVhBBarEeYPNpr69vzsSQRzLrVO/10piaJaTGox YVceqAqWXHwQ5k6DSpykOgXZwCcEjDxvmmNY4Af8+NkpkRePlr5XRsbBSbhy/tb8aoOo VnX4q4ENnZu2LdzafkNHr3gvS6+e822Rs1g3urhFaAAkVgCCRW4CZzmu7PCIrKJj4rjB wt0BtVvvQfKYwrR4ZNZnr6Nn1blVUysLAtDZ49geEkgzuExlyV0txonXCDToON2urkqG BJIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=atS+sfFS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6f2c2b02475si125835806d6.53.2025.04.23.00.38.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 00:38:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=atS+sfFS; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7UfJ-0003EB-6Q; Wed, 23 Apr 2025 03:37:06 -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 1u7Ueq-00035J-04 for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7Uel-0003Bm-2i for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745393790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6uodaUxX+9pfZchpCGRAUT/RxHshP2sI8myfmwd0ZYI=; b=atS+sfFSGgWsCBCKqJFj8tvBys5/jyFCEwAj/j183l9AonkJqW2jO6fTQZIJDUiOUjl7O8 Ktn+/7MO3zU0lwk3pUMbnMQBO0RGUYTmws8lPCZAuJJs6fkeIb4aHMFmQnvzvVNrq28zvR DM6YPGXWTC0v8p+GSoRURYTZHxC8wl4= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-LJ5eCiFOP6Kdnmaz8HaV9A-1; Wed, 23 Apr 2025 03:36:26 -0400 X-MC-Unique: LJ5eCiFOP6Kdnmaz8HaV9A-1 X-Mimecast-MFC-AGG-ID: LJ5eCiFOP6Kdnmaz8HaV9A_1745393785 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 345FD18001E0; Wed, 23 Apr 2025 07:36:25 +0000 (UTC) Received: from thuth-p1g4.str.redhat.com (dhcp-192-219.str.redhat.com [10.33.192.219]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 62D6D19560A3; Wed, 23 Apr 2025 07:36:23 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eric Farman Subject: [PULL 05/29] hw/s390x/skeys: Declare QOM types using DEFINE_TYPES() macro Date: Wed, 23 Apr 2025 09:35:45 +0200 Message-ID: <20250423073610.271585-6-thuth@redhat.com> In-Reply-To: <20250423073610.271585-1-thuth@redhat.com> References: <20250423073610.271585-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.411, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé When multiple QOM types are registered in the same file, it is simpler to use the the DEFINE_TYPES() macro. In particular because type array declared with such macro are easier to review. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Farman Reviewed-by: Thomas Huth Message-ID: <20250310151414.11550-2-philmd@linaro.org> Signed-off-by: Thomas Huth --- hw/s390x/s390-skeys.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 811d892122b..d50e71b927a 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -316,14 +316,6 @@ static void qemu_s390_skeys_class_init(ObjectClass *oc, void *data) dc->user_creatable = false; } -static const TypeInfo qemu_s390_skeys_info = { - .name = TYPE_QEMU_S390_SKEYS, - .parent = TYPE_S390_SKEYS, - .instance_size = sizeof(QEMUS390SKeysState), - .class_init = qemu_s390_skeys_class_init, - .class_size = sizeof(S390SKeysClass), -}; - static void s390_storage_keys_save(QEMUFile *f, void *opaque) { S390SKeysState *ss = S390_SKEYS(opaque); @@ -481,19 +473,22 @@ static void s390_skeys_class_init(ObjectClass *oc, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); } -static const TypeInfo s390_skeys_info = { - .name = TYPE_S390_SKEYS, - .parent = TYPE_DEVICE, - .instance_size = sizeof(S390SKeysState), - .class_init = s390_skeys_class_init, - .class_size = sizeof(S390SKeysClass), - .abstract = true, +static const TypeInfo s390_skeys_types[] = { + { + .name = TYPE_S390_SKEYS, + .parent = TYPE_DEVICE, + .instance_size = sizeof(S390SKeysState), + .class_init = s390_skeys_class_init, + .class_size = sizeof(S390SKeysClass), + .abstract = true, + }, + { + .name = TYPE_QEMU_S390_SKEYS, + .parent = TYPE_S390_SKEYS, + .instance_size = sizeof(QEMUS390SKeysState), + .class_init = qemu_s390_skeys_class_init, + .class_size = sizeof(S390SKeysClass), + }, }; -static void qemu_s390_skeys_register_types(void) -{ - type_register_static(&s390_skeys_info); - type_register_static(&qemu_s390_skeys_info); -} - -type_init(qemu_s390_skeys_register_types) +DEFINE_TYPES(s390_skeys_types) From patchwork Wed Apr 23 07:35:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 883592 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2790211wrs; Wed, 23 Apr 2025 00:37:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXL/73Q9Zbv+v1b1rAAbm7VGvQgyMu39aCGAvU5kin9axYJ/fjZ/gK2e9qGy48kPgNoY0yPGw==@linaro.org X-Google-Smtp-Source: AGHT+IFPRPkPaZk0sMCyi+Up1TEQyOelzFuQHmd4rCRTdPD+YGn0u/o5wXwgAB173yu1aNkx7wjI X-Received: by 2002:a05:622a:14e:b0:474:e255:db2c with SMTP id d75a77b69052e-47aec3e2b1amr325615461cf.26.1745393854463; Wed, 23 Apr 2025 00:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745393854; cv=none; d=google.com; s=arc-20240605; b=Tf+mBqf11OiQ2h0oTcXgVzm4aY+2SX6WodChiJic7elqLkDeWZ/LkbIo5aV0PX9p4s g+YmIyuT/djuVLhGnXxYd/j2dg7cygG7Vos3bOeKxIYs+EQecTJpr3dKpjswLl89Riav HKkeraTDEVBqbdHs94uZ4+O52XlLrCML3G7pvS63TcCTFsGHqbqkOZoaWNipu9P1AFYJ LBwMms3ip8fhvZ59IFj2dJfiw7GKnnvFfTWlQFqtohRwIagOaEjC6w9z5HJfj7ij2nha lbKb3CJbHXXOTuC1n1G42pJSLR/A/F3OM2bWvf/K5d0iLy9lBwPM8jqEUKoXQlJFcmCo Glhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MJOyC9lDbMysueFAZdSuaIrVtPn30IdXqR8iPqB2+sU=; fh=IZ2l8DLHLBNf1GWiSB9Jdu36OhlVFfVljxcBRywYfd0=; b=TDhO7d2uYntgNpWWtfpk2hHTIv51OApyxFdCcPDbnljhG3O+eXFz8e+i8Zway/8URX 3fzDkM71O1jaUIRRV3UlJgCGs2AO4SA9M7zHqw5lNRNvNqddo2RBXwS3IuElKgYto3Wy oCYoe2O7cpUhXClGQ7/v8/bCt1SV0nf3VXXu4a36Sm5HnOgTIM4c2CsqjzXZHMjnL/zZ /tbLVE6ngShxOy9Alg/sVX7PPthR5Qfd0BG4xjp6B+7OLYKq5gR8+TXYMgIH2761FZyp aeXeHF8Rr4ANBWb0YtlpJZrsvIOK2ygW9X8ITuHs4fqIpwb10i+WYJq7Oq04nm+f8C2n ffDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iYD0rJ0e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47ae9cd883bsi135820441cf.513.2025.04.23.00.37.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 00:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iYD0rJ0e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7Uez-00039Q-NO; Wed, 23 Apr 2025 03:36:45 -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 1u7Uer-00035i-Sx for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7Uen-0003C9-R5 for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745393792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MJOyC9lDbMysueFAZdSuaIrVtPn30IdXqR8iPqB2+sU=; b=iYD0rJ0eiLp21z749hYE1VOin7MbzQMGuVSmlMd1sM1nTP+77zFld2pwAOZP36OuRvKhPS xmcW8uDl45sQQiRnrexgC0e+vbby1d1XcaEiJ3sGWoMuKYi9oW3zgU4VoOuX+P/Yr+IoKx PhgaE5A4AelqIrBenAppzx4Hq+WM3PA= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-dt-iXGYHP0KJYRYS5w1Ong-1; Wed, 23 Apr 2025 03:36:28 -0400 X-MC-Unique: dt-iXGYHP0KJYRYS5w1Ong-1 X-Mimecast-MFC-AGG-ID: dt-iXGYHP0KJYRYS5w1Ong_1745393787 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6ECE6180048E; Wed, 23 Apr 2025 07:36:27 +0000 (UTC) Received: from thuth-p1g4.str.redhat.com (dhcp-192-219.str.redhat.com [10.33.192.219]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9D63119560A3; Wed, 23 Apr 2025 07:36:25 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eric Farman Subject: [PULL 06/29] hw/s390x/skeys: Introduce TYPE_DUMP_SKEYS_INTERFACE Date: Wed, 23 Apr 2025 09:35:46 +0200 Message-ID: <20250423073610.271585-7-thuth@redhat.com> In-Reply-To: <20250423073610.271585-1-thuth@redhat.com> References: <20250423073610.271585-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.411, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé The storage keys are part of the machine memory. Introduce the TYPE_DUMP_SKEYS_INTERFACE type, allowing machine using storage keys to dump them when a DumpSKeysInterface::qmp_dump_skeys() callback is provided. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Farman Reviewed-by: Thomas Huth Message-ID: <20250310151414.11550-3-philmd@linaro.org> Signed-off-by: Thomas Huth --- include/hw/s390x/storage-keys.h | 15 +++++++++++++++ hw/s390x/s390-skeys.c | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h index 408d2815d4d..fb766d4631b 100644 --- a/include/hw/s390x/storage-keys.h +++ b/include/hw/s390x/storage-keys.h @@ -125,4 +125,19 @@ S390SKeysState *s390_get_skeys_device(void); void hmp_dump_skeys(Monitor *mon, const QDict *qdict); void hmp_info_skeys(Monitor *mon, const QDict *qdict); +#define TYPE_DUMP_SKEYS_INTERFACE "dump-skeys-interface" + +typedef struct DumpSKeysInterface DumpSKeysInterface; +DECLARE_CLASS_CHECKERS(DumpSKeysInterface, DUMP_SKEYS_INTERFACE, + TYPE_DUMP_SKEYS_INTERFACE) + +struct DumpSKeysInterface { + InterfaceClass parent_class; + + /** + * @qmp_dump_skeys: Callback to dump guest's storage keys to @filename. + */ + void (*qmp_dump_skeys)(const char *filename, Error **errp); +}; + #endif /* S390_STORAGE_KEYS_H */ diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index d50e71b927a..0d3d4f74b4c 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -474,6 +474,11 @@ static void s390_skeys_class_init(ObjectClass *oc, void *data) } static const TypeInfo s390_skeys_types[] = { + { + .name = TYPE_DUMP_SKEYS_INTERFACE, + .parent = TYPE_INTERFACE, + .class_size = sizeof(DumpSKeysInterface), + }, { .name = TYPE_S390_SKEYS, .parent = TYPE_DEVICE, From patchwork Wed Apr 23 07:35:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 883593 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2790262wrs; Wed, 23 Apr 2025 00:37:45 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjfXaJVL2J2nAqUCSwe2I+5KCkS+vzGjYGeXF2v+fs4ZKb2g22Yx/PNldXX8SjO2QgyYkdYw==@linaro.org X-Google-Smtp-Source: AGHT+IFLIc42mdQ1MIgSSUxJ9U84O6O8Pyiipm4U1XFpAvvFuMMUzRv/zaqBr1oWF7DgqUvgOheD X-Received: by 2002:ac8:7d4f:0:b0:477:e70:6664 with SMTP id d75a77b69052e-47aec492ca7mr290238311cf.36.1745393865228; Wed, 23 Apr 2025 00:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745393865; cv=none; d=google.com; s=arc-20240605; b=czfeOW1X0v684pJThlyv55kyxwvZBoNBYX4ijQWrWtO+Jmc1n6S+3E/wHBi8lPIeIQ Wj7FPMDjFggV5edcSCalCwZbWQVAt5bG3zCXRZtoaFXk9q9q7Puz/RJv6+cf0T361X4L v+d7eNVSKf5xRu9wtH6c3cU7nEsqWhwNJNMTpaBTDLLu55ayamKxEYdQ0jhVI7NtOY7T i5yIHgOmLf/t+EBksLvBh+ixaXyxf4mM1GOVeiy3GtSHLV8iXNEI6GojVuZ+3S+yqrDa tXQ4XS+KADOo7yKFcP293XXVL917Us82gyPaNsiPOABnapa5dRUzB8AP263JSzFoRONm HfoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BZ/eXcpCCsGiVTk4N5coU9eooUkh5nCsv6FjPS3I6To=; fh=IZ2l8DLHLBNf1GWiSB9Jdu36OhlVFfVljxcBRywYfd0=; b=Bocgp/mXxlVNhxaJvThsInFSaCzdodlhKvZLA+3WENN9F6OQC6W+hb5tEw+GFROGKr i5xN5syoX4M6XSNJHkcb2HYXYBftgY0L5HZjpTipKvFCCgCK2pOfwPNFRrfhz8p6Kb2u huFZzkqMWcKVpFkg9e9/dx02KVN+WFxmc8FPr1EBAa1Qx0M2kLhvANbqcQmLKz8B4jPW KYeyvZK87dZNBqnRk1Of2K1A8oPXMWpBntX2N068eVCbvnYOouzoxoSgC9bH28QyKCCD cKo6dhLKRbpin5Zl7jyF9H82Rcc6OKrVQNpEIEKKWDSP0gjx7lByX3p4+6WQjeSn/JFT czCg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CzAWrfnH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47ae9cf1a43si132536831cf.634.2025.04.23.00.37.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 00:37:45 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CzAWrfnH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7Uez-000399-ID; Wed, 23 Apr 2025 03:36:45 -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 1u7Uet-00035r-TD for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7Uer-0003D5-Ks for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745393796; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZ/eXcpCCsGiVTk4N5coU9eooUkh5nCsv6FjPS3I6To=; b=CzAWrfnHzbrt7lO+y9nMDt4zhFI5nFGo0sa7sp7HcCK0or3jg564ZQ4PT96rrOiK0N1IEw wK7t9U8N+v3nMxxW3P4ply1njMyeQ+4jE9s24gR4BMy9bcRc/7xlht92EuR/icOFSptNPU 8eZAeeTaFCcNqF2filpoQE6LjwVRU8A= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-KphQ_9pFNX6U97b4_WrgIw-1; Wed, 23 Apr 2025 03:36:32 -0400 X-MC-Unique: KphQ_9pFNX6U97b4_WrgIw-1 X-Mimecast-MFC-AGG-ID: KphQ_9pFNX6U97b4_WrgIw_1745393791 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 83366180034A; Wed, 23 Apr 2025 07:36:31 +0000 (UTC) Received: from thuth-p1g4.str.redhat.com (dhcp-192-219.str.redhat.com [10.33.192.219]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 79D331955BCB; Wed, 23 Apr 2025 07:36:27 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Eric Farman Subject: [PULL 07/29] hw/s390x/ccw: Have CCW machine implement a qmp_dump_skeys() callback Date: Wed, 23 Apr 2025 09:35:47 +0200 Message-ID: <20250423073610.271585-8-thuth@redhat.com> In-Reply-To: <20250423073610.271585-1-thuth@redhat.com> References: <20250423073610.271585-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.411, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé In preparation to make @dump-skeys command generic, extract s390_qmp_dump_skeys() out of qmp_dump_skeys(). Register it as CCW qmp_dump_skeys() callback. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Reviewed-by: Eric Farman Message-ID: <20250310151414.11550-4-philmd@linaro.org> Signed-off-by: Thomas Huth --- include/hw/s390x/storage-keys.h | 1 + hw/s390x/s390-skeys.c | 7 ++++++- hw/s390x/s390-virtio-ccw.c | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h index fb766d4631b..ac303001f57 100644 --- a/include/hw/s390x/storage-keys.h +++ b/include/hw/s390x/storage-keys.h @@ -122,6 +122,7 @@ int s390_skeys_set(S390SKeysState *ks, uint64_t start_gfn, S390SKeysState *s390_get_skeys_device(void); +void s390_qmp_dump_skeys(const char *filename, Error **errp); void hmp_dump_skeys(Monitor *mon, const QDict *qdict); void hmp_info_skeys(Monitor *mon, const QDict *qdict); diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 0d3d4f74b4c..fd1123b0f35 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -142,7 +142,7 @@ void hmp_dump_skeys(Monitor *mon, const QDict *qdict) } } -void qmp_dump_skeys(const char *filename, Error **errp) +void s390_qmp_dump_skeys(const char *filename, Error **errp) { S390SKeysState *ss = s390_get_skeys_device(); S390SKeysClass *skeyclass = S390_SKEYS_GET_CLASS(ss); @@ -219,6 +219,11 @@ out: fclose(f); } +void qmp_dump_skeys(const char *filename, Error **errp) +{ + s390_qmp_dump_skeys(filename, errp); +} + static bool qemu_s390_skeys_are_enabled(S390SKeysState *ss) { QEMUS390SKeysState *skeys = QEMU_S390_SKEYS(ss); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 72de2bd8dc9..910dab08319 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -810,6 +810,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) NMIClass *nc = NMI_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); + DumpSKeysInterface *dsi = DUMP_SKEYS_INTERFACE_CLASS(oc); s390mc->hpage_1m_allowed = true; s390mc->max_threads = 1; @@ -835,6 +836,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) nc->nmi_monitor_handler = s390_nmi; mc->default_ram_id = "s390.ram"; mc->default_nic = "virtio-net-ccw"; + dsi->qmp_dump_skeys = s390_qmp_dump_skeys; object_class_property_add_bool(oc, "aes-key-wrap", machine_get_aes_key_wrap, @@ -876,6 +878,7 @@ static const TypeInfo ccw_machine_info = { .interfaces = (InterfaceInfo[]) { { TYPE_NMI }, { TYPE_HOTPLUG_HANDLER}, + { TYPE_DUMP_SKEYS_INTERFACE}, { } }, }; From patchwork Wed Apr 23 07:35:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 883595 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2791008wrs; Wed, 23 Apr 2025 00:40:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXxV/kAjg6JEjg3HpFONNdT+88fAcywokgWJX7sOAzuxOp0hpL/Vjm51+71Wb5qI8aKFXqGCg==@linaro.org X-Google-Smtp-Source: AGHT+IEUaybDxeZnmcCkNzfmu9tI2SJ+33NvDXNhoA5eeRaEc8+dYxU9NKFQPwO1GXOYmaS8x41l X-Received: by 2002:a05:622a:112:b0:472:1225:bd98 with SMTP id d75a77b69052e-47aec4cf614mr358345411cf.50.1745394029934; Wed, 23 Apr 2025 00:40:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745394029; cv=none; d=google.com; s=arc-20240605; b=HDGWJum6YoPPVmHGTBxLG2zEvaIfU0NTetDTS42Atc4AxEGVaW4/VxQVuo8KZGdVuI XoS+4iiDFHsmoKz2pBhurfFNoGb61HWMO1ppGAs5OwsYOA2Y8T0KQsrsI7S+WAsQocZa 6uZ0KLq5WsFCPLg1utBXzmt54g0wv6HfHNNJHeU5eJGqEySigvUPzFOcXC+HAimVa6HJ gSusgkaQ2pP7yglC+Hrt18bs4eDKy7sULyhN4eMqrK8a+NvxGSBWda9WH3eiejH2s5GM aMX86fWzCHIsfTSi/GBmbbbB1xcnjaHiysmOXK+0lUgJ6AtssPeX6QLPbuaZg1GHelqF fBrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ubksxwnn3dIlQGpMZRKeufkjtSTvTnQ8+cVCN30GioI=; fh=uUybORmyqgmd5t3RD7/Pe4Qd+vxIyAbT6h8JsmI0Z38=; b=K48+kvwYx3+3fv1x464QKZ8yq0V+Qp3XUL2hzaFbEjANVwsQ0U1PengCBGW8IpFc2e EhYccAadoq9/GDO0Rlm4Jmda+sHytVhUBmRCk+I8YF4lMUVSYtxt7auoIBvCAH5OqH3+ TwStZTbmO/p6RRDJpFIM4J/meSxA/AqiAfrjfvzY0E5sTog+L6ms19Ejdu8bwqaPsPvc stzk3Ph4hHNJVpLDtPeWNLhc+x3NpVIZHSYLzE9aBxQjGq9szcTmvLsboyfDLdwrLpUD pd4relZIv+VcI0iDpxdHWk9Zh8/VDH4vODWitpG3ImKnDtzDoByhf7hx1UKjXTUeTPHP 8w1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KWtlGEjO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47ae9cb9945si127285971cf.463.2025.04.23.00.40.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 00:40:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KWtlGEjO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7UfN-0003JO-Fu; Wed, 23 Apr 2025 03:37:09 -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 1u7Uez-00039C-Gq for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u7Uex-0003Dq-CG for qemu-devel@nongnu.org; Wed, 23 Apr 2025 03:36:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1745393800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ubksxwnn3dIlQGpMZRKeufkjtSTvTnQ8+cVCN30GioI=; b=KWtlGEjOybUpjr9ZycAp5sFG99+vym6mm+XCybs5JASBPWDiPN5WnyIr5MX0I+ITbYHEJV mNZ7/KJ9uIWIfgZ6sbMEg6iFRM43dYdInJOb5EPQbTA2BIF2lE0qgjhapq5g1l2a3u6jTt n+Y0u5mCmczX+3DpdkF7EEWthgEaWjo= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-121-9ssyua85NtyWGIIb4xbZzA-1; Wed, 23 Apr 2025 03:36:34 -0400 X-MC-Unique: 9ssyua85NtyWGIIb4xbZzA-1 X-Mimecast-MFC-AGG-ID: 9ssyua85NtyWGIIb4xbZzA_1745393793 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 85C941956048; Wed, 23 Apr 2025 07:36:33 +0000 (UTC) Received: from thuth-p1g4.str.redhat.com (dhcp-192-219.str.redhat.com [10.33.192.219]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EC4F71955BCB; Wed, 23 Apr 2025 07:36:31 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Peter Maydell , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PULL 08/29] qapi/machine: Make @dump-skeys command generic Date: Wed, 23 Apr 2025 09:35:48 +0200 Message-ID: <20250423073610.271585-9-thuth@redhat.com> In-Reply-To: <20250423073610.271585-1-thuth@redhat.com> References: <20250423073610.271585-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.411, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Reduce misc-target.json by one target specific command. Error message is returned for machines not implementing TYPE_DUMP_SKEYS_INTERFACE: $ qemu-system-aarch64 -M virt -S -qmp stdio {"QMP": {"version": {"qemu": {"micro": 50, "major": 9}}, "capabilities": ["oob"]}} { "execute": "qmp_capabilities" } {"return": {}} { "execute": "dump-skeys", "arguments": { "filename": "/tmp/foo" } } {"error": {"class": "GenericError", "desc": "Storage keys information not available for this architecture"}} Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-ID: <20250310151414.11550-5-philmd@linaro.org> Signed-off-by: Thomas Huth --- qapi/machine.json | 18 ++++++++++++++++++ qapi/misc-target.json | 19 ------------------- hw/core/machine-qmp-cmds.c | 14 ++++++++++++++ hw/s390x/s390-skeys.c | 6 +----- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index a6b8795b09e..a9ff8076317 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1898,3 +1898,21 @@ { 'command': 'x-query-interrupt-controllers', 'returns': 'HumanReadableText', 'features': [ 'unstable' ]} + +## +# @dump-skeys: +# +# Dump the storage keys for an s390x guest +# +# @filename: the path to the file to dump to +# +# Since: 2.5 +# +# .. qmp-example:: +# +# -> { "execute": "dump-skeys", +# "arguments": { "filename": "/tmp/skeys" } } +# <- { "return": {} } +## +{ 'command': 'dump-skeys', + 'data': { 'filename': 'str' } } diff --git a/qapi/misc-target.json b/qapi/misc-target.json index 8d70bd24d8c..42e4a7417dc 100644 --- a/qapi/misc-target.json +++ b/qapi/misc-target.json @@ -274,25 +274,6 @@ 'returns': 'SevAttestationReport', 'if': 'TARGET_I386' } -## -# @dump-skeys: -# -# Dump guest's storage keys -# -# @filename: the path to the file to dump to -# -# Since: 2.5 -# -# .. qmp-example:: -# -# -> { "execute": "dump-skeys", -# "arguments": { "filename": "/tmp/skeys" } } -# <- { "return": {} } -## -{ 'command': 'dump-skeys', - 'data': { 'filename': 'str' }, - 'if': 'TARGET_S390X' } - ## # @GICCapability: # diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 3130c5cd456..fd8b4e0b44c 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -25,6 +25,7 @@ #include "system/numa.h" #include "system/runstate.h" #include "system/system.h" +#include "hw/s390x/storage-keys.h" /* * fast means: we NEVER interrupt vCPU threads to retrieve @@ -406,3 +407,16 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp) info->guid = qemu_uuid_unparse_strdup(&vms->guid); return info; } + +void qmp_dump_skeys(const char *filename, Error **errp) +{ + ObjectClass *mc = object_get_class(qdev_get_machine()); + ObjectClass *oc = object_class_dynamic_cast(mc, TYPE_DUMP_SKEYS_INTERFACE); + + if (!oc) { + error_setg(errp, "Storage keys information not available" + " for this architecture"); + return; + } + DUMP_SKEYS_INTERFACE_CLASS(oc)->qmp_dump_skeys(filename, errp); +} diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index fd1123b0f35..067ea037268 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -15,6 +15,7 @@ #include "hw/qdev-properties.h" #include "hw/s390x/storage-keys.h" #include "qapi/error.h" +#include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc-target.h" #include "qobject/qdict.h" #include "qemu/error-report.h" @@ -219,11 +220,6 @@ out: fclose(f); } -void qmp_dump_skeys(const char *filename, Error **errp) -{ - s390_qmp_dump_skeys(filename, errp); -} - static bool qemu_s390_skeys_are_enabled(S390SKeysState *ss) { QEMUS390SKeysState *skeys = QEMU_S390_SKEYS(ss);