From nobody Thu Apr 3 10:05:07 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741620119; cv=none; d=zohomail.com; s=zohoarc; b=JeIkqziB46ZqAtDtUrpwxiXpYSsGGdQptINW7GSMaLmj9dozI3J7NsD72KZjQyT0nI02OBMqxlG2HFCiHyGb1VYodHMhib0hjg3iijrM3wYoeW1mZqeMtPO5h8dEpV2+QCefGqskii7LYC46qrzK7461awVbkYlnMZEeFk3jpko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741620119; h=Content-Type: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=sImUXKvBXnYM+CsDBIniM9RjnRK8G5r/o0WxM6GDvAY=; b=JuUHc1Az4UvRCRN+PZAyTJEk9IqoQzH5iIfiIypz4FpIf4gRIhZ1r4QloHx+nAoLomANV15pJPMtnX2fH0945dPlC6HDxQZN1187LekWk87WbkvUpRTa4bqwtBAjvjamUyryABbnEQUYQZyqkJiW/5S9O1r5eQLlbgPjQ066+ww= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741620119017175.55912346059927; Mon, 10 Mar 2025 08:21:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1treqN-0007Ym-1F; Mon, 10 Mar 2025 11:15:03 -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 1treq4-0007Dy-CW for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:14:46 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1trepr-00083n-TJ for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:14:40 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-39149bccb69so1023888f8f.2 for ; Mon, 10 Mar 2025 08:14:25 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43cfd5082ccsm19268625e9.32.2025.03.10.08.14.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Mar 2025 08:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741619663; x=1742224463; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sImUXKvBXnYM+CsDBIniM9RjnRK8G5r/o0WxM6GDvAY=; b=XCzhktQ2SbHDdZVmDjOaldo9atLl0GXTI/GXK0LRNYV76aHjRRW5NyKJCySGHHexdh 9AWsRWTfaMydZsdpSnFdkrmUKYZGmdfL/BpYbKcP25rD+o+K6iEArkGEzzsPAY9r0qIE nvGBwvhsfeYzaBpZ3SHe4SvCItVYmU8Ft7pFXOspGxnmN6OpwtEWdsCTg8VAkAxgjeek QsVvmJ+7Y0F8QJu1L64040qbhgI2c+Cw2NcNIJMneAc0q8L6DAudsTNDbNrtOl7BglM8 OxGltMwgonzkBUskr/fAdeSOpLpFpVnjZCm5wVhjGwlbMh4xX2lt7yWQ44o5Z5Q8CFr7 YLew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741619663; x=1742224463; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sImUXKvBXnYM+CsDBIniM9RjnRK8G5r/o0WxM6GDvAY=; b=d/9RJJKa9DukBLKmEgmjWnsnCMNivc6Qi8fAjPJsusml9kyf+0Iq1DGdPgrr1RZN7B s4vyvmhE1X62wmwnn5I/ogdrMbKTW6N/yIyirl0u+XhU8QPS73Gc647MUBINRL7DpXrI vuCfXdIXSn22J5eT8nKJ6QkeJWlEZru+IcwsBrEJaRJUhziDlUpkBSiKijbcvW0HvxVd 4fET5mhmQQrg096WU5ZOSLa0L96aMGdM7gyraoibZoJBPVaJMaRIHVYtBtTWB4TnJWre KE2Jtc2jeo+In99XUkjUGSrtg5ioeKa2uGahdsPaTzfL+anwLn3OOUGPcOY/2bUfLLfj USqA== X-Gm-Message-State: AOJu0YxpUqI2aFiUkTf5YzHkP0rywIYHdJfDlq2jkZqshrD1GE8bmBJp vUrgRhM6aChUC6J3CBmhWWq2SyaMR8McvLH3ukqyRDF5EI9ULYW6Wd+w/Rgt9D2kalWbnTU758z lwNE= X-Gm-Gg: ASbGnctY5txC34mG8Ec/ihZGHAeUOCL6i8b+swN6rtvVdEnXvPqhBUgI47kQwjI/ep7 L/ssxW/IlhfWyyMUmIGoe0kJ8PXT98Vhvv6BUv7/MdpzEr10OPW+jzMtoNQIN3LxVDj+GOn8mlB x4yjfnS7fqxdtLSB/Hh0W//aBdOclui/Iijoqa4TR4o2HpiDgTLzLxRiySR5MW/R3wdw+IQJtsQ 4b5TmZOyXPxTqeMJ3MWZ2L7+IpRE0PfY/ZF9RKm/kYAHos8Ma/XK3NlWPusC5pe8aZg1ZEPO46q vnlUc4eYTn7k3Nb7/jsxgLtozKDVSfGT4cWq4dJ82T6sJie8dh6Tqpx0mu+iCXn4xiXc8oFRXXB jVQkDfQxkLQI/WBsT/mc= X-Google-Smtp-Source: AGHT+IFxYz8EXqxp8drd5ZiYlRr9cZz/0WweD1TtcVB0TxR6fCC0KjkVLV1otsdGV4pgQ+8Xt8wkqA== X-Received: by 2002:a5d:5f8f:0:b0:38d:d0ca:fbad with SMTP id ffacd0b85a97d-39132d1f8b7mr9176876f8f.14.1741619663264; Mon, 10 Mar 2025 08:14:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Thomas Huth , David Hildenbrand , Anton Johansson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Marcel Apfelbaum , Zhao Liu , Christian Borntraeger , Ilya Leoshkevich , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , "Dr. David Alan Gilbert" , Halil Pasic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Eric Farman Subject: [PATCH v3 1/4] hw/s390x/skeys: Declare QOM types using DEFINE_TYPES() macro Date: Mon, 10 Mar 2025 16:14:11 +0100 Message-ID: <20250310151414.11550-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310151414.11550-1-philmd@linaro.org> References: <20250310151414.11550-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1741620120626019000 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=C3=A9 Reviewed-by: Eric Farman Reviewed-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 =3D false; } =20 -static const TypeInfo qemu_s390_skeys_info =3D { - .name =3D TYPE_QEMU_S390_SKEYS, - .parent =3D TYPE_S390_SKEYS, - .instance_size =3D sizeof(QEMUS390SKeysState), - .class_init =3D qemu_s390_skeys_class_init, - .class_size =3D sizeof(S390SKeysClass), -}; - static void s390_storage_keys_save(QEMUFile *f, void *opaque) { S390SKeysState *ss =3D S390_SKEYS(opaque); @@ -481,19 +473,22 @@ static void s390_skeys_class_init(ObjectClass *oc, vo= id *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); } =20 -static const TypeInfo s390_skeys_info =3D { - .name =3D TYPE_S390_SKEYS, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(S390SKeysState), - .class_init =3D s390_skeys_class_init, - .class_size =3D sizeof(S390SKeysClass), - .abstract =3D true, +static const TypeInfo s390_skeys_types[] =3D { + { + .name =3D TYPE_S390_SKEYS, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(S390SKeysState), + .class_init =3D s390_skeys_class_init, + .class_size =3D sizeof(S390SKeysClass), + .abstract =3D true, + }, + { + .name =3D TYPE_QEMU_S390_SKEYS, + .parent =3D TYPE_S390_SKEYS, + .instance_size =3D sizeof(QEMUS390SKeysState), + .class_init =3D qemu_s390_skeys_class_init, + .class_size =3D sizeof(S390SKeysClass), + }, }; =20 -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) --=20 2.47.1 From nobody Thu Apr 3 10:05:07 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741619845; cv=none; d=zohomail.com; s=zohoarc; b=EaWkdDUQiWia6gvwSKwnuJCO7v5DPY/MZa0brYCrWiCEYrecXTdBEFDLMWQwvY/Xwc27/wkZMoflS3Qh5CLb7ghQ+eFhkcSIYNf02rmc3Hj/GguZqdRQLsUSWuvYduMGhrjyb8wDdxaUVN49IOb9Vhx6dg0n7ft0GMuOX8yYyFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741619845; h=Content-Type: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=WDJL7i+c1E6l5ov//Lc/b1BwrtAv+NZufrTUDULsf10=; b=TMIZjvBvGhvqvPNb5/SYtu+zZwCDeHUTK+4dnKBaYzucG0nrph5S1eQjhFF8iUsEMDekNxfZC/ntS0a3rYCBdDYi7FgECuyu0YUJ1KEAV8TZ0ICM2QfGneZp4tS97JhFHctezKb3HN/+bPMnOZPzZvkxuTEGSEExTkpaNE8cMvw= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741619845083613.267600958542; Mon, 10 Mar 2025 08:17:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1treqP-0007j1-UU; Mon, 10 Mar 2025 11:15: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 1treqB-0007SZ-Cy for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:14:54 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1treq5-000856-5Z for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:14:50 -0400 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-39149bccb69so1024218f8f.2 for ; Mon, 10 Mar 2025 08:14:40 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912c102b62sm14947780f8f.84.2025.03.10.08.14.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Mar 2025 08:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741619678; x=1742224478; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDJL7i+c1E6l5ov//Lc/b1BwrtAv+NZufrTUDULsf10=; b=IrmRlbK2dWqQmGaRbpyyTTCoCJWfiC/5kAmdT7ZPwC/CrPvuxA35GW1HYHPT5HbRP2 63dYrjBDAHANidJ/5aECG1P73W6dPzcxNnIL8pkAOf3YV6QlCp8psV9Qe80wUcmfPu1H 9MjTPt/2WwfsHbK1mDsG+53+4bEMMPS7L5OO3HYmaWuFmcPIBRUJ3NKYKf11eY/ZF9HQ nOS7HHNeYk0Pg9UYX2/pA4OrjQQzlMoBqhc974nB9FRsxglDUbVpxyX9PYrbkpEG3WWL hW/vl45KTFhV/j6xa0W93xDuM50xncXmasvX6sN9oN2Gl2YPJoP541ff/+et1b/T1gf7 6Hpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741619678; x=1742224478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WDJL7i+c1E6l5ov//Lc/b1BwrtAv+NZufrTUDULsf10=; b=jyam2fepbgifrVTMIOuFFCcPYgv3VlVfPSvRrMRQTrWzSEuGMzen71DqnUfiQuyj2X KKVSiC5QCrCII1Fu/3SSU1k46BZ7dgo8UUy8F7t8PPhMBqpgX//EIkZxx0/BVdaIJn9R VvAsfb/9LCavfzborrx5lxMsqpNmrmYeLoovgs9J1ApEr3RTqRVKa/URwOE2shh/w1x3 aNHdcMr7A8WYZbJyBeU/O/ZASspgvk0KwVqFxbQeeHF4d1DEjQQxyM2obAeXUesta1As HZJ/1A1nd5fwjehtgNKpgVq4EEau+9WowPjZmEZjVtLERy/3XKdZoB5n8+gAVBMWJ/rA /fJA== X-Gm-Message-State: AOJu0YwyY2p4CRnFzJRWeVG/ryEZDU4DusJAeczrqvdLIvsxrtv0zkuY OvPaeP2g1O8thq6KpARH26Pi3KAN4BpVu+w6h5iNaVhoglvGZp4Ur78eiz3rKct9pOnBAZ1DCXd ewv4= X-Gm-Gg: ASbGncvck+BNUHsimVaJXhjXkbJi7iIhYUs/AumpqUh/XjC7tQEi2V2CiJwfrRirh6T FG6dEQf9E+vNSzEmrN4G7fVTXvADPX9xqeBPGwHxmmU/mkjrG32W9F49sMAZFW4iA6afax3Yc4M Zmz1hZpUkhMPzCSlPg81I8FRbsnWbVtWIeTkKtdoU92SW/Ap20aK2yvjDHgX4j9W4A+dzmjjVt2 WBQ5tu7DpVEUnBl0iczV2ExE5wikc01sM2PLV/n4mGYjslK9mOByXHU5iUSVFjH+1d6asXuzMTm NcQtTdCO/QPoc0H+5nkroroe/L9jtxdJ6A4wCWGSOTp4BFZOVlCOsxSV90Q0dVaG6/njqVBakWk uE1WLduGAblNLSrbYVAs= X-Google-Smtp-Source: AGHT+IFsyguKP2GMT8eYs2RSgRt0j4AYcapjlVVCRaQjDMms6aY99J17kWTso8GmmPXpxAFz/9ayrQ== X-Received: by 2002:a05:6000:1fab:b0:390:e8e4:7e3e with SMTP id ffacd0b85a97d-39132d07284mr7971050f8f.6.1741619678009; Mon, 10 Mar 2025 08:14:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Thomas Huth , David Hildenbrand , Anton Johansson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Marcel Apfelbaum , Zhao Liu , Christian Borntraeger , Ilya Leoshkevich , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , "Dr. David Alan Gilbert" , Halil Pasic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Eric Farman Subject: [PATCH v3 2/4] hw/s390x/skeys: Introduce TYPE_DUMP_SKEYS_INTERFACE Date: Mon, 10 Mar 2025 16:14:12 +0100 Message-ID: <20250310151414.11550-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310151414.11550-1-philmd@linaro.org> References: <20250310151414.11550-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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 @linaro.org) X-ZM-MESSAGEID: 1741619847410019100 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=C3=A9 Reviewed-by: Eric Farman Reviewed-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-key= s.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); =20 +#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, voi= d *data) } =20 static const TypeInfo s390_skeys_types[] =3D { + { + .name =3D TYPE_DUMP_SKEYS_INTERFACE, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(DumpSKeysInterface), + }, { .name =3D TYPE_S390_SKEYS, .parent =3D TYPE_DEVICE, --=20 2.47.1 From nobody Thu Apr 3 10:05:07 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741619851; cv=none; d=zohomail.com; s=zohoarc; b=Yz+Iiut0tBD5JudnrkTBFX7pqhyJhelx8r/UmAgMLVwZvdO3DSgsH9kqmlKLU7bMYFY6FT3IVOVCiJh1aSc2dBUbG8PzwkzNG0a26C9cHRTaLZbB1EhxxLYXtXw9jXq3I0OS2KEyChx3xosXNnI3JuA1fmOhDfEFrrcpchsKr9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741619851; h=Content-Type: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=IjyeW5Nt8o0UjpeWcNjmceOtbUr0M3LV9xv1HVnRIgs=; b=d/B1pp26++Qx0cepqg5zQUd4nTZjFOE2PowHPY7Bqj7cFk+rxJ5fQefMtw+mqXs7i8iI2yOLi+APXKbdxhBJx0DPVuDboxoR5OjXGkBUs5CwPJh+k6TOyYkCiKCog8vnWMfscAONGSadOY/DUCkHzWguWhS/cvGT2Sh73CEoDG4= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741619851970223.78194371593042; Mon, 10 Mar 2025 08:17:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1treqY-0008MW-43; Mon, 10 Mar 2025 11:15:14 -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 1treqU-000841-A2 for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:15:10 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1treqQ-000879-6u for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:15:08 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-390effd3e85so3838778f8f.0 for ; Mon, 10 Mar 2025 08:15:00 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3912c103f41sm15004792f8f.85.2025.03.10.08.14.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Mar 2025 08:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741619698; x=1742224498; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IjyeW5Nt8o0UjpeWcNjmceOtbUr0M3LV9xv1HVnRIgs=; b=mLZ143dBTnh7gSPOcy1JkJ/9Sb+Rvc+HZWxiJcxg9Dhf3tU+viYaiKCSdfHxzjuMnv X4JN/VyFqwshP0679Q8sklqGOk2otUF/TsajHYKLeqCP+lLdCfEZ5WhfqPfAc5orhfty dndpwkyimf6eo62lIktKJLlZ4WiKjrg81SuyJkXXlEHxJ5bsJlEZQNw1Fi15s5lQqirK aIY4RF4Hinv0rTla/5pDNPCgquvD3kZIkcfqboqW6eUewqKcwx7eoVMOE+JmJnq5k6hT fE+arY4Mflx9mix1XmWpIGPdtTVzVynBvSdN0bB7xVCxI2QgaVC+5592R0MMvNjHyxhe wXfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741619698; x=1742224498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IjyeW5Nt8o0UjpeWcNjmceOtbUr0M3LV9xv1HVnRIgs=; b=OiheI8QD3kzTdf/rWJXCNwh+82hYZW2K2rDid4SeJGz7rPHXFZOMvzZ1YiPU9Od0iu RsgGBEAyV53xvp04TKXOsUqYvn+ZpMtJII1NV8txoMevfClzsJjRl89bE1HzjEiAJuyn H6+1OMyzTxpFEcsAuGPZ2VbZK2o4C0X4F/1r5MKjCxqv+DdE/QtntImego0EG9IM4f9f gskeSLqvRANtR7Dfb+BoGsRX7Uz16Rq9exgaU0IfigKWevLdfrouiTHK3/pxLGD0NJiq /7VMPKfJyQ/09sjs4Mc0SZ8GhIdzQuvi9q2wMiQr3P51eYhq6KzX9b5P474YTGWUg1uf E4ag== X-Gm-Message-State: AOJu0YzAscUeTU6av0wFXD1D+DWHuj5b0UyQOjWgUJVEoG9v26YF4nSc 4QLCnn4017jrVJpvg/JxZfO6EnUW/wxyswiExkFqSupzGqGPcKsQnqyHqbbsNZ/xRoUbZOAq2ZM 6xt8= X-Gm-Gg: ASbGncs7Glw2Lh1ojJAEIbbEb/7Kw+Cf/+b/97Dld0Xeo5C7POc+BPgwKrq1qv9v4jG L/MSj0a6wcJPXhJlGQuNRatjDsgNTylI8Ds2dwSg6FZn3IyB5SM9KgvYP0nEggM1OhOSrxeylgU 14BT1u3U2FyxxVGaDyWgFeskZGcVc5ZGpqpF6WU1pMwVyi0qPgzQfFPzGf4XrGu0cuE+SRQA1ME OTMaYPb/ZEVDk2XoAksjd9qutuYYozOiRaYSkIsi2C5YvdglMo8EgN9ydIAkWQRKGmhGcF4Uh1u 37pKjRc/tJhLhm/wXAbx5ezEW4fyjwiCjS3H1QBKSjkU9wJA1pVk17DYgKTyV23wRK/CS/hnmQq vcNA4U91h37o+m45OGB4= X-Google-Smtp-Source: AGHT+IE1w7dyWCtAPeN1pjwXeUw1lyJH9uz35BpvIAACms6Ibp24qpioddKGgCf87iLeWmMsLxCaSg== X-Received: by 2002:a5d:5f4e:0:b0:391:fcc:9ee8 with SMTP id ffacd0b85a97d-39132d6bc06mr8314088f8f.23.1741619696600; Mon, 10 Mar 2025 08:14:56 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Thomas Huth , David Hildenbrand , Anton Johansson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Marcel Apfelbaum , Zhao Liu , Christian Borntraeger , Ilya Leoshkevich , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , "Dr. David Alan Gilbert" , Halil Pasic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Eric Farman Subject: [PATCH v3 3/4] hw/s390x/ccw: Have CCW machine implement a qmp_dump_skeys() callback Date: Mon, 10 Mar 2025 16:14:13 +0100 Message-ID: <20250310151414.11550-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310151414.11550-1-philmd@linaro.org> References: <20250310151414.11550-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 @linaro.org) X-ZM-MESSAGEID: 1741619853277019000 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=C3=A9 Reviewed-by: Eric Farman Reviewed-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-key= s.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_g= fn, =20 S390SKeysState *s390_get_skeys_device(void); =20 +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); =20 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) } } =20 -void qmp_dump_skeys(const char *filename, Error **errp) +void s390_qmp_dump_skeys(const char *filename, Error **errp) { S390SKeysState *ss =3D s390_get_skeys_device(); S390SKeysClass *skeyclass =3D S390_SKEYS_GET_CLASS(ss); @@ -219,6 +219,11 @@ out: fclose(f); } =20 +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 =3D QEMU_S390_SKEYS(ss); diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index a9b3db19f63..104cd1c79eb 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -809,6 +809,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) NMIClass *nc =3D NMI_CLASS(oc); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); S390CcwMachineClass *s390mc =3D S390_CCW_MACHINE_CLASS(mc); + DumpSKeysInterface *dsi =3D DUMP_SKEYS_INTERFACE_CLASS(oc); =20 s390mc->hpage_1m_allowed =3D true; s390mc->max_threads =3D 1; @@ -834,6 +835,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) nc->nmi_monitor_handler =3D s390_nmi; mc->default_ram_id =3D "s390.ram"; mc->default_nic =3D "virtio-net-ccw"; + dsi->qmp_dump_skeys =3D s390_qmp_dump_skeys; =20 object_class_property_add_bool(oc, "aes-key-wrap", machine_get_aes_key_wrap, @@ -875,6 +877,7 @@ static const TypeInfo ccw_machine_info =3D { .interfaces =3D (InterfaceInfo[]) { { TYPE_NMI }, { TYPE_HOTPLUG_HANDLER}, + { TYPE_DUMP_SKEYS_INTERFACE}, { } }, }; --=20 2.47.1 From nobody Thu Apr 3 10:05:07 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1741619945; cv=none; d=zohomail.com; s=zohoarc; b=U5haUXv9UHBGaqd0aE7cF+WKVaieYbt0+Lp6pAMlZ7LhVlcc5Bz865IMkRhuPow6PFqDul5SaVVtY81Ovzn8l/kdH+gna6tuycmPVz3PfXJdwVYat9PMXnkSibmKTXLG0tLQNK58Rzn5uvDx04d3GNgGe6PQPN0+VRxV4RCeAqY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741619945; h=Content-Type: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=z7J8UWUXia4S/l3hOcieA10+PUQa1P2XxB/lqNf2FKU=; b=CzWkFilqzbHFN3loGPnN15IkpwS9VDRuUFictGJ2OcPLgSJjrJ8FhWy7Q0SFqDadsVYaLIowln+9EQOSc8B8nSiNJvidj1kH/J6USH7jCURVK9ONXxgmZ7HMP+lymy1PL+ihNXmerp3L0G0YBO7OT7Nd0UniSjINzJvqNWyYYGY= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1741619945660264.1233075876761; Mon, 10 Mar 2025 08:19:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1treqd-0000NM-H4; Mon, 10 Mar 2025 11:15:19 -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 1treqa-00007d-1w for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:15:16 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1treqQ-0008D3-OQ for qemu-devel@nongnu.org; Mon, 10 Mar 2025 11:15:15 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-43bb6b0b898so37035345e9.1 for ; Mon, 10 Mar 2025 08:15:05 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43cea7f2afasm42638805e9.3.2025.03.10.08.15.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 10 Mar 2025 08:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741619704; x=1742224504; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z7J8UWUXia4S/l3hOcieA10+PUQa1P2XxB/lqNf2FKU=; b=u2edDDQoQ+k8qevtx2BHo65gs2nyKwVFcmOSVYAV/8/yZVbWOT+cSXlKF9HE/m1Fht gW5dN84HT1V0flxNPaGXfQVO+QzA8rKkMz3Ac1tYadVFlXgmyjwL7V+S8rOrzmUP2IUb RdAryFKHkfjMnmdpk6+VzXDJC1tDRQIhiArzrYTab8JCRZLVCrc+USo/72cic1KOD76O d/jtpoj/nNdWedkb9YgzfjM/l+N9V0yw00KW2Pos+f+cTjIV6RylN6phLHm0FJZhjZPA 5wIW4bSZ9pYqS21l1pS2lE/tojv2akCEZRIPLvfszASMjooXoz+t47/ffBP5Sh9BBE4n j0JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741619704; x=1742224504; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z7J8UWUXia4S/l3hOcieA10+PUQa1P2XxB/lqNf2FKU=; b=LMJ48om12HZaFUUxOOkr2WWUxVWyg2Tcri+vkN8vhqKIwgZUNuKX+x+xuIsIb8H6j4 QZEd9/iyAWd3Yc3/1glRaSFkOUx3EIcUYn7c0KxY+vptezWhJXNjWHSKn8vWTAYrDIU/ 3B7O3ZkqhopD0AN51YISJHqdZ1dwGQSnjoqb46rtk6RJ/DxrEpAIIcyiSxNJurl9W4PM Jj6gaPAGvqWZxjN0fdn08VhkEbSHShJn2wRpbQ7fmsMy3/O7w/QK/6UQPFj9LEwJWRw8 SxlZzwZMVxiyxGtgXmlrrzVYoemthfbZR23zEsQBYyjPCjnVnb4u50kjAAHIoA9C0VEw 5YbQ== X-Gm-Message-State: AOJu0Yxo/3Q//R1CI/c5TWZquwelfxtY4kdqeQZtvEfga6aaSAD6z7PS nSKGqXuHUT1eDdBVMVQLZoRydNcmNjU8E+ae0aH03QosdJiAgN6gQS2JHI62yymdF2nkaLnOJgp Dec8= X-Gm-Gg: ASbGncvphAjFB4ocA3IpoQ6JiLDUH7aG9ORx1U8pU/DlKFGXxoxOUyOCLJO1rb6CWbA 9w6uTgn7tMiWVvTxmUHhTEgyrhuZXZa5FO0lIzCHMqWv89WnqNFFwiINL/kgO2keuOF7yG6upQE WQwqfxIXLmQuyNFUwD42R7oE/dv2i1EgwGD+/lH565F3mvjsc5ugWtkqOzaJkHuUD27FlIYEi2O PEcqwahnOhI0MqIhGX4EPS26ZEUIDFIMq4Ckjqy5OecstZJtTcbHHjR7MHiArVkU7Ef+yXAvEcS cNgP4sZH6FCQIBOFUzsBnotb1qVffkuX6qpQSfquitfdMUf6eVhDW2cYzMjZeLcCMs4jFgyOBRm Tx4Frmzcl4I6XmLak/uQ= X-Google-Smtp-Source: AGHT+IHNn3qDhQ1EQFcHNEdBrWFTofR5+myaotDnj7aa1BD6sSCoZc72fTRPLUuYlXdw43o1f/awkQ== X-Received: by 2002:a05:600c:4710:b0:43c:f470:7605 with SMTP id 5b1f17b1804b1-43cf470795dmr34821045e9.12.1741619703758; Mon, 10 Mar 2025 08:15:03 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, Richard Henderson , Thomas Huth , David Hildenbrand , Anton Johansson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Marcel Apfelbaum , Zhao Liu , Christian Borntraeger , Ilya Leoshkevich , Eduardo Habkost , Yanan Wang , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , "Dr. David Alan Gilbert" , Halil Pasic , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Eric Farman Subject: [PATCH v3 4/4] qapi/machine: Make @dump-skeys command generic Date: Mon, 10 Mar 2025 16:14:14 +0100 Message-ID: <20250310151414.11550-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250310151414.11550-1-philmd@linaro.org> References: <20250310151414.11550-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1741619947517019100 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=C3=A9 Reviewed-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' } =20 -## -# @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" =20 /* * fast means: we NEVER interrupt vCPU threads to retrieve @@ -406,3 +407,16 @@ GuidInfo *qmp_query_vm_generation_id(Error **errp) info->guid =3D qemu_uuid_unparse_strdup(&vms->guid); return info; } + +void qmp_dump_skeys(const char *filename, Error **errp) +{ + ObjectClass *mc =3D object_get_class(qdev_get_machine()); + ObjectClass *oc =3D object_class_dynamic_cast(mc, TYPE_DUMP_SKEYS_INTE= RFACE); + + 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); } =20 -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 =3D QEMU_S390_SKEYS(ss); --=20 2.47.1