From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622780377472.4566447306787; Thu, 19 Dec 2024 07:39:40 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 48758176E; Thu, 19 Dec 2024 10:39:39 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 64F0316DE; Thu, 19 Dec 2024 10:39:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6CA97169C; Thu, 19 Dec 2024 10:39:17 -0500 (EST) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5685C1758 for ; Thu, 19 Dec 2024 10:39:08 -0500 (EST) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4361f65ca01so9381715e9.1 for ; Thu, 19 Dec 2024 07:39:08 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b4471bsm55020455e9.44.2024.12.19.07.39.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:06 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622747; x=1735227547; darn=lists.libvirt.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=fVQZDG1ZHCW9mRIskC0RqnL4zCyCfhO/N0NweSAMjGE=; b=f3fdrFlzpXEdPc0URaFmQOrEUF+QKsu6NPB92GwObgtciKorwNwsKpXLc8xg2PlGqR RCqBhxjcKme6rqiu1d/P0SS+D4qlq8kCW3zSc0O/ZS6Swb0G4IYUDnq9kRqKvAP3jICO zskhlt/HznJHlSXLlBrj0kRcaJnVxZfnNWpn57gtjW4oegj0tts3Sq/hEQgMg8yJdxZQ EjCCkyUvCw42oOmyh2WTtccmdJvSaUrUbNv5wrYimFJ4k2OFY9yzpgvokoszj2GINI3Y 6vprEupO1RYxcbdi1OeV1jDNzm/wVb7xUmhkBGIFkO+IMjK94FagJpQz379KINM8DiTO ESOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622747; x=1735227547; 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=fVQZDG1ZHCW9mRIskC0RqnL4zCyCfhO/N0NweSAMjGE=; b=WSuCCvXG6gAo38889asnkWkVKiuG9HmZnfx9zJJkqWRq3uYdFqMdoNZA8/SCCaiE7h wHgLa2EBJFWBqyqBvxmWqr0W2OsQQ4KYLeGzjDT8DYuoohNisXMTQxlJ9Pyn3TygumoM oYAk/RiXcDqTnPpd3TPfEiyXids5FYgM95FKyJzfIa9lUkiH6ymYMylTFympMTXpe9vg cfCbxsnWkfle9if94YexS8wLtFTAiztZfzVUNAmYr0Drz3M7++Eqze7JFq+Ce8Z6/q08 UHaZlE4LJuErvXZv9byVHBvlqTqjmXZeVqMVwPXKUOek90UihTaOZnGOfLolCISe/kJw L++g== X-Forwarded-Encrypted: i=1; AJvYcCXH5Ww6UPXR1nh0Dq8c3z48IojVT82dciV8TmLCpGwFg2+q94Hi8eaizRtcwmICxkj2vD6shg==@lists.libvirt.org X-Gm-Message-State: AOJu0Yw9aQsTljODrJQw6Z1HQjlRmMPfVDsOjcFqLsXDa5EBYpwTijiw LfeQ1XGOjxYYchnWSxPaw8xMUeETmC9nwXN1YxpXQf4rHhplp+kZkAq9IcAg6JI= X-Gm-Gg: ASbGncuGbrjpSVqZdPiYGijRE1oq4dZeM0F+ulZ3oMeHCbpsDSd+o5aYiAULBkVGxP6 ksEJa5GSB4/rl+1fkhDJAqQeR8IiaNONx6vk3mVzf3Lv8IjX3In+68xKTBs2dn1H7rzgnsUy+AH hgV4wpxfoeGp89w2kGZs9XMPRu/x7xFNlob5v/YVpG0JCVTSKK0b28hDos/6bcllBEAjyFdWwvt Fcxev+KuzQ3sLBL36N0hzdrSnOw4SjW2Ck69YcnK9sYMMWHElUjfGujkTOcD4DbQssGDE3mu6a/ uD/r X-Google-Smtp-Source: AGHT+IE0ik88WSPrybKNxmPFssnUymLVzqFaMef4QHNfzZMSCJWXCCcqZjlj8Xe8OiJCq3TvE9ux7Q== X-Received: by 2002:a05:600c:4587:b0:435:fa90:f19f with SMTP id 5b1f17b1804b1-4365535b6eemr72094315e9.12.1734622747207; Thu, 19 Dec 2024 07:39:07 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 01/10] hw/misc/vmcoreinfo: Declare QOM type using DEFINE_TYPES macro Date: Thu, 19 Dec 2024 16:38:48 +0100 Message-ID: <20241219153857.57450-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TCBVLEP5STHYEVFNIMXKIULNQBTR52XV X-Message-ID-Hash: TCBVLEP5STHYEVFNIMXKIULNQBTR52XV X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622781294116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/misc/vmcoreinfo.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index 833773ade52..84b211e9117 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -93,16 +93,13 @@ static void vmcoreinfo_device_class_init(ObjectClass *k= lass, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); } =20 -static const TypeInfo vmcoreinfo_device_info =3D { - .name =3D VMCOREINFO_DEVICE, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(VMCoreInfoState), - .class_init =3D vmcoreinfo_device_class_init, +static const TypeInfo vmcoreinfo_types[] =3D { + { + .name =3D VMCOREINFO_DEVICE, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(VMCoreInfoState), + .class_init =3D vmcoreinfo_device_class_init, + } }; =20 -static void vmcoreinfo_register_types(void) -{ - type_register_static(&vmcoreinfo_device_info); -} - -type_init(vmcoreinfo_register_types) +DEFINE_TYPES(vmcoreinfo_types) --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622800525337.6559124145607; Thu, 19 Dec 2024 07:40:00 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 82817176D; Thu, 19 Dec 2024 10:39:59 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 25D8B16FD; Thu, 19 Dec 2024 10:39:26 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id B7D371705; Thu, 19 Dec 2024 10:39:21 -0500 (EST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BC2C51705 for ; Thu, 19 Dec 2024 10:39:13 -0500 (EST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-434b3e32e9dso10587015e9.2 for ; Thu, 19 Dec 2024 07:39:13 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c6ad3e3sm1905007f8f.0.2024.12.19.07.39.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:12 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622752; x=1735227552; darn=lists.libvirt.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=9A6H1EuKRU8oSMUlfiyYQGgNe/t50Uq0zCTd6hbC9F8=; b=b+ZxRQhjTWe9guqinap7ZyJLRl6wOGoZYyXST1VXGjRlAhK1CakHtffM9GntAEpUCW R0CXc0We3sw94Vw2zQlDwlHGnkfre6KIx3sTti2h1IHUKYVjZM19so8koM+KYsdm9azf xqENcxyZXy++lnyw9aYj/0Mx/qA+APSKJkMfSEK4ZKzdRKbbDlEVc8QPJwQGYm42lj5c 2AKtQ5hr9vdWK6EBWdDNz4Oi4c4V0k6JTC1j4utUVFdPOUCH3hxCaAUSDp6Scd9SfuK8 LRi2plCHs14W530lxXe5YAJiEr1yua3SPuaYv5qxsioy0jxIf9xQQiWnsShQvxa2pp/a ImFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622752; x=1735227552; 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=9A6H1EuKRU8oSMUlfiyYQGgNe/t50Uq0zCTd6hbC9F8=; b=KZCy1sM5/ptVhz9b1O15eAbN/R+dGhs+LDubaLJqODBiYNygwngnELE7GdGhs8Kxza NunjKh2CmwvCkDoQ+GuPIqc90TIXihVikKl/Gge3lTOC3i3/rwFtdmZ8zMWXymAwsX8N GVNacm7EL37u7QBrnU5ddtdZ0CJPSaQ4KIney5usLmCmfps+bPgZl/CcgRsP6hNDUp32 /yjCgtZNsvy90TIO8YJ9Nv+DglvKrUV3RJGIBKtHIv2suOaMFUrU6rYS4ZGnrGh2Kp6R MeuhACn7xJxU5kbkmBtxHEj2YDMGLgx4uNLTHrpiBDzNkz08hJQQk4UZaB3mwMwm6F8O QQMQ== X-Forwarded-Encrypted: i=1; AJvYcCUVxIg0eN2UtN07oEbjzb+teHKlfQ7DxGfQDWFhvEg+mD5gB9GzyWTCWYZHsOAWloXMN/vwPg==@lists.libvirt.org X-Gm-Message-State: AOJu0YwCa2L+GFIVRYSkXKP0h5nqGn39JztfzM1XKMiisTXLcMBa/9jo UgIKAXbCyrefe9V2f4wJ0zH/bq4KdpzmLWtB2g0UiXoezX5k5QN0zveHaD4YhYlSVMlLhnTmVZq 8 X-Gm-Gg: ASbGncvPYpBYpX0NBTC74rKQwx+DhNrU8eytnT4sAwKboVh5jnwqikWhzyRQze411GF jj6XJOnxWmb0Bev+XAt8S83YvQom/IeDSjKx1IRZq3IT3KXm5iuDnR/uwkPOA37ckID+C7IbxY4 xhUlp7boT4hJyUO8bzTl0327cjKGxGkvKJk0GLokz4eUddYhOXnsbgS+FDojUMwj1QPhKl++Ky7 tp1mxppPTO34ayhJnVUkfN4TUK0fMVkfo9IRzab/luIvLbb0y22THIib6+FzCCNFNB1BGzsPn/Y Pet3 X-Google-Smtp-Source: AGHT+IFzKBxvfmjWrlDelJBTG6nU9L+vDm54/jGMynxANDubLsuJTCkj8kZajXzdEoQ9aYX5XIGr1w== X-Received: by 2002:a05:6000:1faa:b0:385:f1bc:765c with SMTP id ffacd0b85a97d-388e4d2f7bbmr7033755f8f.6.1734622752611; Thu, 19 Dec 2024 07:39:12 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 02/10] hw/misc/vmcoreinfo: Rename opaque pointer as 'opaque' Date: Thu, 19 Dec 2024 16:38:49 +0100 Message-ID: <20241219153857.57450-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GJYB5EDNII7RM3GD3I6DTLQAIUVQ2TUJ X-Message-ID-Hash: GJYB5EDNII7RM3GD3I6DTLQAIUVQ2TUJ X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622801331116600 Content-Type: text/plain; charset="utf-8" Both QEMUResetHandler and FWCfgWriteCallback take an opaque pointer argument, no need to cast. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/misc/vmcoreinfo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index 84b211e9117..ad5a4dec596 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -18,17 +18,17 @@ #include "migration/vmstate.h" #include "hw/misc/vmcoreinfo.h" =20 -static void fw_cfg_vmci_write(void *dev, off_t offset, size_t len) +static void fw_cfg_vmci_write(void *opaque, off_t offset, size_t len) { - VMCoreInfoState *s =3D VMCOREINFO(dev); + VMCoreInfoState *s =3D opaque; =20 s->has_vmcoreinfo =3D offset =3D=3D 0 && len =3D=3D sizeof(s->vmcorein= fo) && s->vmcoreinfo.guest_format !=3D FW_CFG_VMCOREINFO_FORMAT_NONE; } =20 -static void vmcoreinfo_reset(void *dev) +static void vmcoreinfo_reset(void *opaque) { - VMCoreInfoState *s =3D VMCOREINFO(dev); + VMCoreInfoState *s =3D opaque; =20 s->has_vmcoreinfo =3D false; memset(&s->vmcoreinfo, 0, sizeof(s->vmcoreinfo)); @@ -65,7 +65,7 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **= errp) * This device requires to register a global reset because it is * not plugged to a bus (which, as its QOM parent, would reset it). */ - qemu_register_reset(vmcoreinfo_reset, dev); + qemu_register_reset(vmcoreinfo_reset, s); vmcoreinfo_state =3D s; } =20 --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17346228229793.886002251446712; Thu, 19 Dec 2024 07:40:22 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EE042177A; Thu, 19 Dec 2024 10:40:21 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 0535B179C; Thu, 19 Dec 2024 10:39:30 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4EAE016E8; Thu, 19 Dec 2024 10:39:22 -0500 (EST) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 2D0B61646 for ; Thu, 19 Dec 2024 10:39:19 -0500 (EST) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso9578375e9.2 for ; Thu, 19 Dec 2024 07:39:19 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8471dcsm1822152f8f.48.2024.12.19.07.39.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:17 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622758; x=1735227558; darn=lists.libvirt.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=fSUrXqY3vKb6Y+xc3NUnoWjHDPec55tB8oXd/H8ApGI=; b=gRybOoE4hYLn8tALJ/muEM6wGsOmGROvYFJkFCMMZD8n5yw4JwEmrkS8DLl09Z6EHH j4FTFYxmHnWeC94+R/ogctBwYru8fO+waThjDCttt2E9WMxhXlbINNawfJiAEVBq6diX Sf50EdRo8OcY0VFtHWUK7cw5yYz5y/ivwLcV9hYWlYNINLYs5xWSFv51wcI9qAQYMyAh 1zLNdy/Tpf22/jz82cVwcgpn8kqVAOeN3AX1j8BIpUEpz5euxpZERL9Qn/hHJQY8vLeA 67Hftwj7V5sF6sVLigVy2Fajy2wNM5pfS3PcdG0FgT9VuauYtzkAnlX1TZ3VWNmdyxxi mD9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622758; x=1735227558; 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=fSUrXqY3vKb6Y+xc3NUnoWjHDPec55tB8oXd/H8ApGI=; b=ih4xfgOmLDrQuog+7bC1JxXtiVObo4+0Bws/Kh2iZdia8XycS0msGhogZdm/MjrAY6 b0/WRXUyCpkq/6S1qdrlSkLfu+eJppHn/XTbcy70moPuHoQortUbJXq2/uUaqzz3Lp/e rlyOFg3v2Epr2Wxr6UKCmxvX9j9+pE5S+u20PMpY0aLlBJja2qo9tpNeJcwH6OUtDYPD 0fthCclI7GGMaZAejPmdNuIG2RMsOIEbsocIeP7R05jmv5UC160nhzmUwWqbHdMLSmbn sTRysws/gqLKd/zBBdT5xkPRSWmOnaJudLnNcKlxMAoxvhZFaat+2LxPvl2dayJAA4m4 HWKA== X-Forwarded-Encrypted: i=1; AJvYcCWr/4Wk8/qVdRDKM7SD7Nk4anHGzCRiRqrdDOINLdW1qvPtuKmxhcIvqhWw1RrtAQpD/qU4EQ==@lists.libvirt.org X-Gm-Message-State: AOJu0YygfjC9RQnSRepNZlYawyASEDUQKOYZhj1qBKFlnKa/pvJKehEo T7X+GblrQcGTZr4gqk6UIiNaqekcGqp8XZ6jxKjmaeA37WkgLZVv0QQHR0UxSNU= X-Gm-Gg: ASbGncs/GJ1Tn4VceRUJpC2qv2T8CS1cIB25zCRipE5S0geePSSd0RxJVcnIgD1Jk6G CbR3tb3n1Wc5GUSaNPrlYjn2dEXnKIIceQyQe8ap6UPuzHmn0ipgrdelEUw8y/9hUB+aJXRUW8y J172bTEEz4VJJnc6a0J0d2mC+Qb7rATZ/EwsDKxka+7fKKjcLAddXbR55wfHWrkd2ZxH7nCRtg6 /GXFbDK6dyiuALG/cvckSV7JoBCLTSz97ZljReTwPdogrqP6HXekKCLftExTOrLoPIhGl5rOS9L M99n X-Google-Smtp-Source: AGHT+IGvWED1Jq74g7NcAbgkQDk9YzBZGMpsFWZ3LtiDorAumzm0I2si7sK1vs6So0DMLBM16lnmYw== X-Received: by 2002:a05:600c:524f:b0:434:fddf:5c0a with SMTP id 5b1f17b1804b1-436553452d7mr74615505e9.3.1734622758007; Thu, 19 Dec 2024 07:39:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 03/10] hw/misc/vmcoreinfo: Un-inline vmcoreinfo_find() Date: Thu, 19 Dec 2024 16:38:50 +0100 Message-ID: <20241219153857.57450-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NZXUYWIZVSUUJ5P2ZCI2FAK77PWKL6CK X-Message-ID-Hash: NZXUYWIZVSUUJ5P2ZCI2FAK77PWKL6CK X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622823523116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- include/hw/misc/vmcoreinfo.h | 13 ++++++------- hw/misc/vmcoreinfo.c | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h index 0b7b55d400a..da1066d540c 100644 --- a/include/hw/misc/vmcoreinfo.h +++ b/include/hw/misc/vmcoreinfo.h @@ -30,12 +30,11 @@ struct VMCoreInfoState { FWCfgVMCoreInfo vmcoreinfo; }; =20 -/* returns NULL unless there is exactly one device */ -static inline VMCoreInfoState *vmcoreinfo_find(void) -{ - Object *o =3D object_resolve_path_type("", VMCOREINFO_DEVICE, NULL); - - return o ? VMCOREINFO(o) : NULL; -} +/** + * vmcoreinfo_find: + * + * Returns NULL unless there is exactly one instance. + */ +VMCoreInfoState *vmcoreinfo_find(void); =20 #endif diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index ad5a4dec596..c5bb5c9fa52 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -42,11 +42,12 @@ static void vmcoreinfo_realize(DeviceState *dev, Error = **errp) /* for gdb script dump-guest-memory.py */ static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; =20 - /* Given that this function is executing, there is at least one VMCORE= INFO - * device. Check if there are several. + /* + * Given that this function is executing, there is at least one + * VMCOREINFO instance. Check if there are several. */ if (!vmcoreinfo_find()) { - error_setg(errp, "at most one %s device is permitted", + error_setg(errp, "at most one %s instance is permitted", VMCOREINFO_DEVICE); return; } @@ -103,3 +104,12 @@ static const TypeInfo vmcoreinfo_types[] =3D { }; =20 DEFINE_TYPES(vmcoreinfo_types) + +VMCoreInfoState *vmcoreinfo_find(void) +{ + Object *obj; + + obj =3D object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); + + return obj ? (VMCoreInfoState *)obj : NULL; +} --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622850300886.8910939091538; Thu, 19 Dec 2024 07:40:50 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4733417BD; Thu, 19 Dec 2024 10:40:49 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 352D21502; Thu, 19 Dec 2024 10:39:41 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 284B716F2; Thu, 19 Dec 2024 10:39:36 -0500 (EST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id D891216F2 for ; Thu, 19 Dec 2024 10:39:24 -0500 (EST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-43625c4a50dso6878925e9.0 for ; Thu, 19 Dec 2024 07:39:24 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-436604e9c2csm22880975e9.43.2024.12.19.07.39.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:23 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622764; x=1735227564; darn=lists.libvirt.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=ltkM6wv4nnewbtt7Wl7DzeFeRkwimvs0bnn2crm+6CQ=; b=G7M4l7jNcbqXbVd8DfuDmVfrLbjBYbvvU0aTBsDVTwbnSBAR8wzJh2/+QBgVFC9d5P GU+elF9G2Hl0k9r2raCBg+Q7r9UisdWuQQ8SOfEMpvTKvT/lc8Cb0Hsu47LBYuamlsjL XIqCvKUrvumH9tOTatwFSvkTQASDYY0kMKqCNWU26CnDK/M8kq9HF0IgO/hxOrvKE0Za 9sDTnyZhAr75jhngLiAgA9q2/1zwkwoxeKCCxTf0uKBmTPGA2FuxGbqziuXeqPwqNxKF PqdF4wUH79g9Pmfp+7lavNvIuoRp8dB0UrO/u7QAJ7J+BAXMQG9pzWGUZfJX75AqwH/4 tUyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622764; x=1735227564; 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=ltkM6wv4nnewbtt7Wl7DzeFeRkwimvs0bnn2crm+6CQ=; b=e59v4Bo9I+4q1ROQ8RBNua8Exj+aca3eqg0fgGeaJwTV8gB/0zYMbcxOxJ/p3ql/hL jnxvEXZbsFk/FW/2Erd0gPL5hpK4+8N24UaiWaWF0Scu++7ExGk45VKeUEyihuiIA9HT gO+vmI2qtBV8KTdmF3ZivN4+W52tLPSBtXdfEZ/IA94lpeoP6xYIZqReIrzLBPGKNRh3 1v8b/qOwPRNa4Yjv2XAa8UG98QxlLkB/6XoHBtF0DKmXsYLS0hOLrLYApgbYg8kVRTd1 /nP/DBL5+/68NU3U1NwUDmloCMe2hJ2UY1DPFaHFmzBrys6gOHOtfrfY08gBgGpPOldH R69w== X-Forwarded-Encrypted: i=1; AJvYcCX4/Kl0+ZMtbzNXMJ21l4W7rq8138HL37fTti0mkEz0oF5Mp2zHZIhnZER4mpV72JfQzFLhnw==@lists.libvirt.org X-Gm-Message-State: AOJu0YwPRi1rEgKvBG2zk0zhPcgDwesZkCknbC8B5rsiC22hqXq4cu2p 2cbpPW3yoCecxAxIbCbqtQR5l/BLVp0C4GIWC2NedyUhxjFrtz9lvDYOpg85pF0= X-Gm-Gg: ASbGncviKllbJTaRuh9lvvthGV1v7wzfDnWVbGglW+Khxp1ZK2pNMOH5hrw8UcTU9y3 7y84NrY4Zu7Hb06uWkcZ3KW0pFpPV67krVIzcJtyMhtwnbJSbjLvLDzJ4X8Bv1UTR3mz6hKHsHn 7VHlK6Ppb4+QZsWVXD2W7pXmNi+CNyfW0OOxu1hGztoIxhUb9/OnSRKsVb4Z/RNHnlupPoY7h1x zU7vW9ZOqxJUafuyYJTtWxNa+3gwCUbYc2jJ11FdtpVFv/07mtnVrQWgi7woZGBByNqgt6/hHAT SRtK X-Google-Smtp-Source: AGHT+IHqT2aqNU6znhJmAnu6BPD6sDUBEfCZ/4rUkgoJAGrbRO4KYM8P8HUa1iOsstTrLxK5eACAcw== X-Received: by 2002:a05:600c:4586:b0:436:1c04:aa9a with SMTP id 5b1f17b1804b1-43655370395mr72815995e9.14.1734622763724; Thu, 19 Dec 2024 07:39:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 04/10] hw/misc/vmcoreinfo: Rename VMCOREINFO_DEVICE -> TYPE_VMCOREINFO_DEVICE Date: Thu, 19 Dec 2024 16:38:51 +0100 Message-ID: <20241219153857.57450-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ELOD2PKGCCSI5VQHRAMKS2CHID3CYDV3 X-Message-ID-Hash: ELOD2PKGCCSI5VQHRAMKS2CHID3CYDV3 X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622851644116600 Content-Type: text/plain; charset="utf-8" Follow the assumed QOM type definition style, prefixing with 'TYPE_'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/misc/vmcoreinfo.h | 6 +++--- hw/misc/vmcoreinfo.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h index da1066d540c..122c69686b0 100644 --- a/include/hw/misc/vmcoreinfo.h +++ b/include/hw/misc/vmcoreinfo.h @@ -16,10 +16,10 @@ #include "standard-headers/linux/qemu_fw_cfg.h" #include "qom/object.h" =20 -#define VMCOREINFO_DEVICE "vmcoreinfo" +#define TYPE_VMCOREINFO_DEVICE "vmcoreinfo" typedef struct VMCoreInfoState VMCoreInfoState; -DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO, - VMCOREINFO_DEVICE) +DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO_DEVICE, + TYPE_VMCOREINFO_DEVICE) =20 typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo; =20 diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index c5bb5c9fa52..9822615cfed 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -37,7 +37,7 @@ static void vmcoreinfo_reset(void *opaque) =20 static void vmcoreinfo_realize(DeviceState *dev, Error **errp) { - VMCoreInfoState *s =3D VMCOREINFO(dev); + VMCoreInfoState *s =3D VMCOREINFO_DEVICE(dev); FWCfgState *fw_cfg =3D fw_cfg_find(); /* for gdb script dump-guest-memory.py */ static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; @@ -48,13 +48,13 @@ static void vmcoreinfo_realize(DeviceState *dev, Error = **errp) */ if (!vmcoreinfo_find()) { error_setg(errp, "at most one %s instance is permitted", - VMCOREINFO_DEVICE); + TYPE_VMCOREINFO_DEVICE); return; } =20 if (!fw_cfg || !fw_cfg->dma_enabled) { error_setg(errp, "%s device requires fw_cfg with DMA", - VMCOREINFO_DEVICE); + TYPE_VMCOREINFO_DEVICE); return; } =20 @@ -96,7 +96,7 @@ static void vmcoreinfo_device_class_init(ObjectClass *kla= ss, void *data) =20 static const TypeInfo vmcoreinfo_types[] =3D { { - .name =3D VMCOREINFO_DEVICE, + .name =3D TYPE_VMCOREINFO_DEVICE, .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(VMCoreInfoState), .class_init =3D vmcoreinfo_device_class_init, --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622888463286.2272741467359; Thu, 19 Dec 2024 07:41:28 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9126417B2; Thu, 19 Dec 2024 10:41:13 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 5769D1788; Thu, 19 Dec 2024 10:39:49 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 64747176D; Thu, 19 Dec 2024 10:39:45 -0500 (EST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 77742176F for ; Thu, 19 Dec 2024 10:39:31 -0500 (EST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-436281c8a38so6995395e9.3 for ; Thu, 19 Dec 2024 07:39:31 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c89e2f9sm1844006f8f.81.2024.12.19.07.39.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:28 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622770; x=1735227570; darn=lists.libvirt.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=JH+rg8jdfzKs8XOz5Rmt45E6mRet+pe4gCab1lfs0FM=; b=erD1qmK3Vk8r5ACYthfOCIUmbFGynkV7talqA3qIb52MGlhhKDK9ePU9NpHosR+AH9 oveHWPpeBqV1wMuug1Z/lg0fdXAohqvreeEOdTLSOYAZQiX+M8Sj+tlGkDBxwpkYW5qP SxjrZMZCqJXsHkxsZ5aOSOkdhCB0/Q6FgDiI3GxKE1YQgIa3A2OoAS1avbFmZlx0A94V 5g8XKYyI0wCwVaErAtUGuT5eY2XJg1z5S5QO+lOcKK1GkA4CprrPAIdwE3HyLIRUJgvR nbqkAAIvXHZqaV1TNpR/Gjl/92d36reJcuPq8hMxhA9FNzIVxBOKU+nyZgHAFguNxA9e s+UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622770; x=1735227570; 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=JH+rg8jdfzKs8XOz5Rmt45E6mRet+pe4gCab1lfs0FM=; b=kSjPEm58kJ5XBb4iTeuTTc4mHgeRG8dXDO5l2BePawibS7xhc+imyt5sOyiSnObIJX 1RxCNRJHgzGA1HOm2DNhT22lLPA9ecTJiNNNI78LgnhfWA0Wtp5kKnEt89wddm/LY6E/ M0QvdVLjVotokDFCmeM8w7eH40FBKZJ2e/wlWnrsjpVm7lOh05ubyxUyxYQAZTnPbe2f j0iXRZ25Cjctezx17CaieQX6aTC1cvzkwSWvhFX9Cuw//TS9FCUzQnrpIM1v3hSFEuWK SJQ5HaWocnVOIDxv78lXpHf3f8L4xbLFKdFWBWBJhggnCGyBMaxgA1DEzjgp51CBKxni SezA== X-Forwarded-Encrypted: i=1; AJvYcCUYRoWtAew8aywon02BVQqAhQOJQkdepB5PFU14jYGTPUR4A9O93ZazsIqIcDIa8dZOT+YKPA==@lists.libvirt.org X-Gm-Message-State: AOJu0YyShSuOAc1+TKh3tyLOPgeqGve96dl9j91iGts+a2oTVkR9qR/a ot4vxumD+v+pfuRGzacZMzeiuvSCxFpdHC8t/TgweEmozLp6/bkU07F69YVcybE= X-Gm-Gg: ASbGncv4q/HINGmhKyG+dJuesCE9fG1TIV9vnVsr4W0PJhDbfBXfgLlgX4aRlbLwzlH s7BI+sNySS3mokDIcmoeEJqSgq6OllKiZ6A9arl15HIljC41T7BhnoSLIhGgd4G9eEYcnE8gwmj qR4Cq2Do5rQMi5i/5jq1ig4rIHp28O1guHK/jA9ziDX7Zo5e23W9EsvPrARUEgZTNXtr5FvsNIn 3qjyrafMM9nQWJ/dqLnjK/OeH8gZR8tmBRyyOxtVfbgAsd8oeknGiVRSodzimKlZlkRNCL8vARD 2J9N X-Google-Smtp-Source: AGHT+IG1cGibHjPdP6W9bW+3KhIZBCePkeSAzYBfsPOjgibfVlHnS9VHv0awtKPj3xaf0XpdaTrpng== X-Received: by 2002:a05:600c:468c:b0:433:c76d:d57e with SMTP id 5b1f17b1804b1-436553433ebmr67075135e9.5.1734622768851; Thu, 19 Dec 2024 07:39:28 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 05/10] hw/misc/vmcoreinfo: Convert to three-phase reset interface Date: Thu, 19 Dec 2024 16:38:52 +0100 Message-ID: <20241219153857.57450-6-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KMGM2PL2T6F7EXXWPCJKZKQK4A3TU3AA X-Message-ID-Hash: KMGM2PL2T6F7EXXWPCJKZKQK4A3TU3AA X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622889465116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/misc/vmcoreinfo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index 9822615cfed..093bede655e 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -26,9 +26,9 @@ static void fw_cfg_vmci_write(void *opaque, off_t offset,= size_t len) && s->vmcoreinfo.guest_format !=3D FW_CFG_VMCOREINFO_FORMAT_NONE; } =20 -static void vmcoreinfo_reset(void *opaque) +static void vmcoreinfo_reset_hold(Object *obj, ResetType type) { - VMCoreInfoState *s =3D opaque; + VMCoreInfoState *s =3D (VMCoreInfoState *)obj; =20 s->has_vmcoreinfo =3D false; memset(&s->vmcoreinfo, 0, sizeof(s->vmcoreinfo)); @@ -66,7 +66,7 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **= errp) * This device requires to register a global reset because it is * not plugged to a bus (which, as its QOM parent, would reset it). */ - qemu_register_reset(vmcoreinfo_reset, s); + qemu_register_resettable(OBJECT(s)); vmcoreinfo_state =3D s; } =20 @@ -87,11 +87,13 @@ static const VMStateDescription vmstate_vmcoreinfo =3D { static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 dc->vmsd =3D &vmstate_vmcoreinfo; dc->realize =3D vmcoreinfo_realize; dc->hotpluggable =3D false; set_bit(DEVICE_CATEGORY_MISC, dc->categories); + rc->phases.hold =3D vmcoreinfo_reset_hold; } =20 static const TypeInfo vmcoreinfo_types[] =3D { --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622893398634.0005369895756; Thu, 19 Dec 2024 07:41:33 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 57CA41644; Thu, 19 Dec 2024 10:41:32 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1C18A149B; Thu, 19 Dec 2024 10:39:52 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6359716E0; Thu, 19 Dec 2024 10:39:47 -0500 (EST) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C5D051677 for ; Thu, 19 Dec 2024 10:39:35 -0500 (EST) Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-436249df846so6846535e9.3 for ; Thu, 19 Dec 2024 07:39:35 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8474a9sm1805633f8f.52.2024.12.19.07.39.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:34 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622774; x=1735227574; darn=lists.libvirt.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=RMGv7qvi3m/JTiz7jQ63fQU4SttU7iapPs3aSHWSfWE=; b=wDQqzm9qVU3OrB1eofVK5VAqLUw0WorkJqTjDNuBp2it8P/Pm/fqlZ3HSNcS3Npv6s jRWJusCJ0rCaAtQIGbrBW1VOQhsf73CKTiOEsOsD7LRlJcp++WPgyvmIVFE/f9tOb6MH YA5mBnKaPfuObAoFxWu2/iZLgH9GTXRMMKqq8kxJwFGVrmHjAe1MAiMgipR74hxnJn+K 2dGNf3+7KXPcfoQNZ9E/Gmnp0iE7USexdDKrVp3B2A/eeolMEFn2u1UzFaWVUW/XSnxY hbNZFmvusEGLlMd7sbrFaIyHsuqOnqXu4R7Y4SnRIWeYpOfSEDxEl4wYD6iNW7aGgFBw n14A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622774; x=1735227574; 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=RMGv7qvi3m/JTiz7jQ63fQU4SttU7iapPs3aSHWSfWE=; b=vYjr2m+JP0YIvAK3h4wy+iOk+Col3D6758BRSNOOlb2fCtntnD36NqEmlahu2Czzvb dByQu/xMkdarUMD4njEvVoaNYQ++LgBzgGUw6qB34eKm0vz4f47Qh93WW7ecOktYWBUA P6MdD4Uy8r68ykz4vPgMTC5daQCMUKW/8dtI4cgnM2QbkooSPuLqEDtsiqXEFTLtjGpA SpNl1X62ElKHe0VFx1CZ+Y/woHhk18QCitOA1thFQFtwPzx/oZcEkFtyQlq8ztfdHjxm HplR2vdbPItrrPQ0S6qa8FFwXlSwD5X6yheZIdTm2O64CmTf4QyJTO2DhrXABhf+JQa+ OBTQ== X-Forwarded-Encrypted: i=1; AJvYcCWocjJ4FSa9djIWlltnXltU0KRLsNbEzqiSoFS92qqApdPXoI4nUUBctS8xy5g6unbo9D+bCg==@lists.libvirt.org X-Gm-Message-State: AOJu0Yw1fpilDIO4qwcl5vvRCza1vjyK8Xup1ivZXZLhkQjsRw814LnT 8/LMn4RuDFx2kQxt/7kolO8dKO6Ybc3CGF2b2ZgnyD2ejFdvOwqVKsK49TyUZEQ= X-Gm-Gg: ASbGncu8TvrFe+TFgTsKRmP9WgY+8FEJUNuxRCrQTcmNZvS98KV4nntqf0fygqmvHnO lP8zjzZZglC93E7ZPk1uknexIBSa9iRnZTTXU6U/e9NsYaFsC5EyK7CRpJQ7Bwe6E/UsMiAqYOO EAV4pq8MDUO9HCXsatGH7088393WFZ80UAeNuJzMSL+MZIfnYRlOUQoHhPkZpKmSMvHhy/Q/qm5 pApGFLCp0mA/G3Q2Y8WS74rzT3IdxKsysN9gmXYrDCOJ+HDly+4kMY2LoEJTDOrPW7SVfLHL97T g2zH X-Google-Smtp-Source: AGHT+IGh0eZIZPaxTiz7UGfEy8XHE6o5ObgLI9iwFFlqzABUoKuS/Dmnu9cBOUOHJL67G2wHfkMXog== X-Received: by 2002:a05:600c:4fd3:b0:436:346a:fa9b with SMTP id 5b1f17b1804b1-4365c7c9707mr27726955e9.20.1734622774615; Thu, 19 Dec 2024 07:39:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 06/10] hw/misc/vmcoreinfo: Move vmstate_vmcoreinfo[] around Date: Thu, 19 Dec 2024 16:38:53 +0100 Message-ID: <20241219153857.57450-7-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PI6N7PTKKKE5C5NRJDFF5BUWJ42IBO6E X-Message-ID-Hash: PI6N7PTKKKE5C5NRJDFF5BUWJ42IBO6E X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622895260116600 Content-Type: text/plain; charset="utf-8" In order to simplify the next commit, move vmstate_vmcoreinfo[] around. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/misc/vmcoreinfo.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index 093bede655e..55f9d437a94 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -18,6 +18,20 @@ #include "migration/vmstate.h" #include "hw/misc/vmcoreinfo.h" =20 +static const VMStateDescription vmstate_vmcoreinfo =3D { + .name =3D "vmcoreinfo", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_BOOL(has_vmcoreinfo, VMCoreInfoState), + VMSTATE_UINT16(vmcoreinfo.host_format, VMCoreInfoState), + VMSTATE_UINT16(vmcoreinfo.guest_format, VMCoreInfoState), + VMSTATE_UINT32(vmcoreinfo.size, VMCoreInfoState), + VMSTATE_UINT64(vmcoreinfo.paddr, VMCoreInfoState), + VMSTATE_END_OF_LIST() + }, +}; + static void fw_cfg_vmci_write(void *opaque, off_t offset, size_t len) { VMCoreInfoState *s =3D opaque; @@ -70,20 +84,6 @@ static void vmcoreinfo_realize(DeviceState *dev, Error *= *errp) vmcoreinfo_state =3D s; } =20 -static const VMStateDescription vmstate_vmcoreinfo =3D { - .name =3D "vmcoreinfo", - .version_id =3D 1, - .minimum_version_id =3D 1, - .fields =3D (const VMStateField[]) { - VMSTATE_BOOL(has_vmcoreinfo, VMCoreInfoState), - VMSTATE_UINT16(vmcoreinfo.host_format, VMCoreInfoState), - VMSTATE_UINT16(vmcoreinfo.guest_format, VMCoreInfoState), - VMSTATE_UINT32(vmcoreinfo.size, VMCoreInfoState), - VMSTATE_UINT64(vmcoreinfo.paddr, VMCoreInfoState), - VMSTATE_END_OF_LIST() - }, -}; - static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622913415442.3998418461448; Thu, 19 Dec 2024 07:41:53 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 6C76C1744; Thu, 19 Dec 2024 10:41:52 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D6489172B; Thu, 19 Dec 2024 10:39:59 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id A50A3176C; Thu, 19 Dec 2024 10:39:55 -0500 (EST) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E1EC01796 for ; Thu, 19 Dec 2024 10:39:40 -0500 (EST) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-436202dd7f6so10776435e9.0 for ; Thu, 19 Dec 2024 07:39:40 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43656b4274csm55636845e9.38.2024.12.19.07.39.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:39 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622780; x=1735227580; darn=lists.libvirt.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=W5xIB6Q3xpywMwriwl34zxXU4p+OU3fl2Ms6nSvvP3g=; b=fuquWfbGiA0gaJV7n/8wcNzNatwCCwJtAne8DvB68zGWk1SqUu8rqpQJwK2qulE+pU 08zhLoCZ/cs4/8xXMhI14vaZlJygA9fti5fh30o8bHlrdrdCCoeHRAZDo6vD82h/MK6T yQbvuf7qH5PbWZI+7z9a4uHkCC4EG1BFXaD7NXnZ3Z1xCmoR3QAkGGXCN0iEO3CHaefV sT8f04vLtbAUeqOf4PAw7ZFwmEJtWlW8DHb+ZS3E8qbgPwSdsKC5NdVOUEckl8X2woBh LXaTUrHbpewGJAy2urlajZv+xeExGPwj3WaxWIPWxHdI/ONLhcNesPmuq8TWiOOWPdWv amBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622780; x=1735227580; 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=W5xIB6Q3xpywMwriwl34zxXU4p+OU3fl2Ms6nSvvP3g=; b=jA8BIAG2ax/NYTxj917nII5dKamukEO6/CH4cf16yfv16Uw56Z4z+/DijqStYekgo6 ReW1wJ3FWRZQFKRhFarUphFMbCT7pZEbHzUINLnvLXQ93T1JvABEnT7LuTS+yOyg7aRb c31cPyJwLgemMswrXXKTSHNETzZDxO232vVCv2LHlbSgG7CxaY7VeYA3jvriS0I6N1N2 DztDb98lq6Iw3NZAYd/DIU6tIZVqs+pWcrYc+ugYdgVa9Y3kMemg7Y0ncEdLeQOFeBB0 lb1Cdg/vdOHVeTkuehJuD/RBC849VHDpkvtuRgkXw8kCOLoixs8wYnyN7nhv8maDMNPl 8ckg== X-Forwarded-Encrypted: i=1; AJvYcCWVE0AhQeXbx+uQI9QYMvsWqmbB1MwrEbzTf+Yd2vwR0CkVsQMkT+q/QrGa1w3iQ7/InlAX1w==@lists.libvirt.org X-Gm-Message-State: AOJu0YzrxXfW6d/WZEN5VgKVvh27nrrQLRtxOJNZPLTUSzG/vJUfDepw /V9AIMGU/giz9IAQpsj9W2w8887HTnVXoLLSe6HcyBZBdYCiPTW1VGxV254mbeBDR4lmnKj6UuX a X-Gm-Gg: ASbGnctU4d8qaOTQKEFfpyvHevnWVtMUK8yKIgp2z4UXACN1klwMlrZOreH/Nj8fCxD c1dG01l6hpZY5JxcQpy7bqOurjqaqqdByOOQiECeyhrgGBKRc1vgx17nQoCi9SlSXD1hNvh8SaB iD4zbzol1TuCfu7Mqe/JF89KK3t61yiETnd+YLxZj0IwNl3jM6TtPgfjQC7HKH/hPk7FoIXfPRq OoPC37I4QnUypffAhYrqn5q6AqxyJdbwaMNsVrPKlsbon+N47Wk47H1J466/cN1QIukRTsPzxAr Mt87 X-Google-Smtp-Source: AGHT+IGv5rd7ZLJrA7Ng7P1DhJdT3DlR3L1JZzaGzslknhJylDOfRM57TjnrYcXF/hgefogMGL1mfw== X-Received: by 2002:a5d:47cf:0:b0:385:d852:29ed with SMTP id ffacd0b85a97d-388e4d8e083mr6933410f8f.36.1734622779863; Thu, 19 Dec 2024 07:39:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 07/10] hw/misc/vmcoreinfo: Factor vmcoreinfo_device_realize() out Date: Thu, 19 Dec 2024 16:38:54 +0100 Message-ID: <20241219153857.57450-8-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: IRP3XTVKBKGDVDBZV3GDHF27JFAFHAQK X-Message-ID-Hash: IRP3XTVKBKGDVDBZV3GDHF27JFAFHAQK X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622915461116600 Content-Type: text/plain; charset="utf-8" In preparation of implementing a UserCreatable callback in the next commit, factor vmcoreinfo_device_realize() out. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/misc/vmcoreinfo.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index 55f9d437a94..a0511ea0da4 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -49,9 +49,8 @@ static void vmcoreinfo_reset_hold(Object *obj, ResetType = type) s->vmcoreinfo.host_format =3D cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF= ); } =20 -static void vmcoreinfo_realize(DeviceState *dev, Error **errp) +static void vmcoreinfo_realize(VMCoreInfoState *s, Error **errp) { - VMCoreInfoState *s =3D VMCOREINFO_DEVICE(dev); FWCfgState *fw_cfg =3D fw_cfg_find(); /* for gdb script dump-guest-memory.py */ static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; @@ -84,13 +83,18 @@ static void vmcoreinfo_realize(DeviceState *dev, Error = **errp) vmcoreinfo_state =3D s; } =20 +static void vmcoreinfo_device_realize(DeviceState *dev, Error **errp) +{ + vmcoreinfo_realize(VMCOREINFO_DEVICE(dev), errp); +} + static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 dc->vmsd =3D &vmstate_vmcoreinfo; - dc->realize =3D vmcoreinfo_realize; + dc->realize =3D vmcoreinfo_device_realize; dc->hotpluggable =3D false; set_bit(DEVICE_CATEGORY_MISC, dc->categories); rc->phases.hold =3D vmcoreinfo_reset_hold; --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622939691738.000788862681; Thu, 19 Dec 2024 07:42:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9991E1797; Thu, 19 Dec 2024 10:42:18 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E7B30171D; Thu, 19 Dec 2024 10:40:02 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id CCD26170A; Thu, 19 Dec 2024 10:39:57 -0500 (EST) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 375681717 for ; Thu, 19 Dec 2024 10:39:46 -0500 (EST) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-385f07cd1a4so633505f8f.1 for ; Thu, 19 Dec 2024 07:39:46 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c828ba0sm1802220f8f.14.2024.12.19.07.39.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:44 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622785; x=1735227585; darn=lists.libvirt.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=ISSyZu80+Z0LOt9qrMxsW+Lah1hE0o+0ErPwOcAlXN4=; b=OWkZPlRxbaW08NKyC/I3aUgBMSx3XY/dmddTq4t9ojqKbnfZWEccpHroo/oVmwODYQ 3fmUyfhEd5rGL5UBwfru4CO5rs5jtiK9c3/VGOfmWF8hhESWgGwCr4/D11pz6Xa1SxyX 5rr92yCV4k8pCALrgmABGSap4q7XFQixv+cq14PQP/dv2t2GDvyc8m7eHtR81pIpoW8q c2Q7Mbcrv2jl9xiLrSJEXRXCGiXIp9mMZKgouUCyg3nlfCZxooE33Irq8ImP5+ImYIpc 3wC+JFfMBUd1O/19aaCnVR+kXKB21ez/x1aV27Ci7VFeLMJRFhyr0h8XFS8qoVQWuj6Z Ns4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622785; x=1735227585; 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=ISSyZu80+Z0LOt9qrMxsW+Lah1hE0o+0ErPwOcAlXN4=; b=B7m/qGfK0VpheaxdKo9yhK49aBGpfUTUxu59GUbrTbUNA/pbkYRdBoWc9yHsQfQT6t yMByPVqHNhMD6c59lV9Ic159i6dQ9iIu9canF3rUjjNf20yaiQF4XObRxF7hWmL2c68w ztlLsRxbJHZl4IyS9JTQsCSHREjqlOLRv4RC9YcO8IlvjB5Jumh7/zVhmtMrPYH2MTX5 fbvBy69HiNYZXjHnf4Fl07MIoEe6SaIVCm+emQHNB/zczmQqth97W6aOSBe5Ew5T+NyT SC4rIv7Ky7ek7Q9t2Tj957nCLP9IwreGreTMbLDQE2fvRz8FlK3dCZcs/hUKhwQtadYD eLlA== X-Forwarded-Encrypted: i=1; AJvYcCVvp4QtbsPFmaC/B82c6ulzZOvaXMO92HP1pOhxslQ2v62fRz2EV2jqgPRiamb/Pb5KZ9ZO4w==@lists.libvirt.org X-Gm-Message-State: AOJu0YzZYUq1uvUI4Vr7pfgqSdCe/SJltEGFC9cyElt8D+niPHt7GyjU rW60LV/qtG9T8Q9vCOJC+fdM0H6+mNTlKSOzKYKmjtsxzjZ/e79o1K9eRTRLOHA= X-Gm-Gg: ASbGnctcuMjd5sHmtcbZWu3SqELRnuThsb9HRaWJZdC8Fn+AppvqB3o+r3KLzuT2I6x inXeEnoeHldS7qjDvQizkjAdExOjk/Tu4QNdct6wA5D5qaWYsGSBSV3Vgt5eHbGb3pBbzIYvbDG z6KXUdf6S+5nJMl+G1FGHhuB5EvG/fJXOWzTFVs1YMabw/YQRjCSljkzW8SqMX4v7QZk6klLfB5 tWUrgUajqjJcrKiDdQqOqfZB35KIgBrNyOppq3inAvsrQklG2xM+gMEIsDi6hkcTMIVRfP6pyG1 jjuH X-Google-Smtp-Source: AGHT+IGsBFx3gRdGZ8dbbmXiiGC5S8eUniiw7NRzNAZmFthEqd6n6t7RPGfaSDyl3FduFf+EbjAdGg== X-Received: by 2002:a5d:47c8:0:b0:382:3754:38fa with SMTP id ffacd0b85a97d-388e4d96c35mr8177590f8f.51.1734622785043; Thu, 19 Dec 2024 07:39:45 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 08/10] hw/misc/vmcoreinfo: Implement 'vmcore-info' object Date: Thu, 19 Dec 2024 16:38:55 +0100 Message-ID: <20241219153857.57450-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NWU75OD4BJHMLMYUWBN3MUNCX7KQUNGT X-Message-ID-Hash: NWU75OD4BJHMLMYUWBN3MUNCX7KQUNGT X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622941749116600 Content-Type: text/plain; charset="utf-8" 'vmcore-info' object allow to transition from '-device' to 'object', following the deprecation process. No need to modify VMCoreInfoState since DeviceState already inherits from Object state. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/misc/vmcoreinfo.h | 4 ++- hw/misc/vmcoreinfo.c | 48 +++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h index 122c69686b0..d4cce42cee6 100644 --- a/include/hw/misc/vmcoreinfo.h +++ b/include/hw/misc/vmcoreinfo.h @@ -16,8 +16,10 @@ #include "standard-headers/linux/qemu_fw_cfg.h" #include "qom/object.h" =20 +#define TYPE_VMCOREINFO "vmcore-info" +OBJECT_DECLARE_SIMPLE_TYPE(VMCoreInfoState, VMCOREINFO) + #define TYPE_VMCOREINFO_DEVICE "vmcoreinfo" -typedef struct VMCoreInfoState VMCoreInfoState; DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO_DEVICE, TYPE_VMCOREINFO_DEVICE) =20 diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index a0511ea0da4..e2258e08fb1 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -12,11 +12,11 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "qemu/module.h" #include "sysemu/reset.h" #include "hw/nvram/fw_cfg.h" #include "migration/vmstate.h" #include "hw/misc/vmcoreinfo.h" +#include "qom/object_interfaces.h" =20 static const VMStateDescription vmstate_vmcoreinfo =3D { .name =3D "vmcoreinfo", @@ -32,6 +32,11 @@ static const VMStateDescription vmstate_vmcoreinfo =3D { }, }; =20 +static char *vmcoreinfo_get_vmstate_id(VMStateIf *vmif) +{ + return g_strdup(TYPE_VMCOREINFO); +} + static void fw_cfg_vmci_write(void *opaque, off_t offset, size_t len) { VMCoreInfoState *s =3D opaque; @@ -88,6 +93,32 @@ static void vmcoreinfo_device_realize(DeviceState *dev, = Error **errp) vmcoreinfo_realize(VMCOREINFO_DEVICE(dev), errp); } =20 +static bool vmcoreinfo_can_be_deleted(UserCreatable *uc) +{ + return false; +} + +static void vmcoreinfo_complete(UserCreatable *uc, Error **errp) +{ + if (vmstate_register_any(VMSTATE_IF(uc), &vmstate_vmcoreinfo, uc) < 0)= { + error_setg(errp, "%s: Failed to register vmstate", TYPE_VMCOREINFO= ); + } + + vmcoreinfo_realize(VMCOREINFO(uc), errp); +} + +static void vmcoreinfo_class_init(ObjectClass *oc, void *data) +{ + UserCreatableClass *ucc =3D USER_CREATABLE_CLASS(oc); + VMStateIfClass *vc =3D VMSTATE_IF_CLASS(oc); + ResettableClass *rc =3D RESETTABLE_CLASS(oc); + + ucc->complete =3D vmcoreinfo_complete; + ucc->can_be_deleted =3D vmcoreinfo_can_be_deleted; + vc->get_id =3D vmcoreinfo_get_vmstate_id; + rc->phases.hold =3D vmcoreinfo_reset_hold; +} + static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -106,6 +137,18 @@ static const TypeInfo vmcoreinfo_types[] =3D { .parent =3D TYPE_DEVICE, .instance_size =3D sizeof(VMCoreInfoState), .class_init =3D vmcoreinfo_device_class_init, + }, + { + .name =3D TYPE_VMCOREINFO, + .parent =3D TYPE_OBJECT, + .instance_size =3D sizeof(VMCoreInfoState), + .class_init =3D vmcoreinfo_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_RESETTABLE_INTERFACE }, + { TYPE_USER_CREATABLE }, + { TYPE_VMSTATE_IF }, + { } + } } }; =20 @@ -116,6 +159,9 @@ VMCoreInfoState *vmcoreinfo_find(void) Object *obj; =20 obj =3D object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); + if (!obj) { + obj =3D object_resolve_path_type("", TYPE_VMCOREINFO, NULL); + } =20 return obj ? (VMCoreInfoState *)obj : NULL; } --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622968996498.6655823321113; Thu, 19 Dec 2024 07:42:48 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 1453F1700; Thu, 19 Dec 2024 10:42:48 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 832551661; Thu, 19 Dec 2024 10:40:10 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7504417BF; Thu, 19 Dec 2024 10:40:05 -0500 (EST) Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B2E4E17A4 for ; Thu, 19 Dec 2024 10:39:51 -0500 (EST) Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-432d86a3085so6780975e9.2 for ; Thu, 19 Dec 2024 07:39:51 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4366127c515sm21268325e9.30.2024.12.19.07.39.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:49 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622791; x=1735227591; darn=lists.libvirt.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=upFpBaO8cptavFRp1HZ7mKtcy+0BbSMhQQtCEJtj5Yg=; b=qhjSnrrQKI7MjbL2gQA6s4EVZ1JRHwwlIsPb3LsgGo548PJjkZtCTSRKiBprlXIlBx w/9m1IW8ItzvC2+/p2LNfe/WkS6h2eti0eglSTc2Xu4pq9Bcml9uUfA7JaxaCeoA1Y9Z 0DPAb1BVEhQbCa2zCkyoh3AkkbCOtMQpVpUFja0lp0t29eNFDedRTUIEUO92WaLAKwkJ 39tI2G/qQn6HSo6Uw9KMg2oWPqoW73Q0cjTSCshqSCOp+/9OLiZmeJ7+MSp8BspygLqh PXtspyk81+gleZHyFl6+kEJQWtmzWJZq6pe2abqm69JChg36T0UTli8PjtitB/BEpVwa gdtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622791; x=1735227591; 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=upFpBaO8cptavFRp1HZ7mKtcy+0BbSMhQQtCEJtj5Yg=; b=U0Egh1fADzRV12fl0xKtBun3yjaJpYVahrvhZHsq4x2YJBQpgIBLyLB0lkzpn75Ca1 Edx9XQ8zr/FudeHeP+9jevlDqdi5ixl8dbJpwINKPD8J+1YVXS0piwxVtZCkt4hNfv6L Ljr8oBKouVfTiCgWtc6+j+2fHsNRPLtsyMkMJ4zBvllbrI96pKU4GLt/VHVBAsZ80atP pB6okhIua6hGZla5+1t0XODtbdD9aqoM/sRbtyNnMoxPCIPPpDXmprP4pTkkPl7rrQS+ JsA6r7eeLI/6i5xRm1He26pMyeqIpLT+bDiVQ+uMrj9+QH8GOblYdLH/SxQX+kfkBLq1 MB4g== X-Forwarded-Encrypted: i=1; AJvYcCWu4v6/znwoSq0JZqp7qk+yVkUxPNXP3AEmSyodRJyDCVOgyZ05bebXFbqg0JH7NlSPqSR1+Q==@lists.libvirt.org X-Gm-Message-State: AOJu0Yyrq78o9QFGNmDHFJSV1luuZdKZ6z+WH6Lto02TOkaAYgPlhjTy o5i8mlpMNYVGAr9gEDdboEOoqAkRp1lU/lEdVt0bq20RXVscOzTgZFhq7yHozOs= X-Gm-Gg: ASbGncsGlDVm/KcgLORIQXzTv8tSYIzbMJOzHw+gIO9pwoq2mphbBYEKJ7sptEUoO9E Aa071dwDHzAr/9cDL+ICKeYCSmT4kPt2OmDlycAoYXm6kjSMArnx+vSPf6/HF+HW0JgYjbtGe4E ZfiZVNwYRKtFmFkrhbnJHCHVeebIU9Zrxwop5b7CbPtBCWiSMWdXbCfeV8owzBSQKOLFZs9hHXW ulif+6Ye5ptV1S75sOHUOllk0NEef3lieTyAqFGUeMJjvaR8Rvz3ERbXuWiwwNaBjWMLlkYtYyO TLj0 X-Google-Smtp-Source: AGHT+IErehxBq4obOaVRcaYCREXohUvSxM4e0g+hUo+WwFbrfvi4FJvxnGJYLGiEEC/HTEknmJKr/Q== X-Received: by 2002:a05:600c:4fd3:b0:434:a468:4a57 with SMTP id 5b1f17b1804b1-4365c7c83d7mr28882795e9.26.1734622790613; Thu, 19 Dec 2024 07:39:50 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 09/10] hw/misc/vmcoreinfo: Deprecate '-device vmcoreinfo' Date: Thu, 19 Dec 2024 16:38:56 +0100 Message-ID: <20241219153857.57450-10-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: UV66T6RAG5LHQR4D3E6UAXVX76MKBQS4 X-Message-ID-Hash: UV66T6RAG5LHQR4D3E6UAXVX76MKBQS4 X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622969655116600 Content-Type: text/plain; charset="utf-8" '-device vmcoreinfo' is replaced by '-object vmcore-info'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- docs/about/deprecated.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index d6809f94ea1..57a3d734081 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -79,6 +79,11 @@ described with -smp are supported by the target machine. =20 Use ``-run-with user=3D..`` instead. =20 +``-device vmcoreinfo`` (since 10.0) +''''''''''''''''''''''''''''''''''' + +Use ``-object vmcore-info`` instead. + =20 User-mode emulator command line arguments ----------------------------------------- --=20 2.47.1 From nobody Mon Dec 23 23:02:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1734622991906123.56895549326657; Thu, 19 Dec 2024 07:43:11 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id F1B6F16F4; Thu, 19 Dec 2024 10:43:10 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 57F9A178D; Thu, 19 Dec 2024 10:40:15 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 16F7816FD; Thu, 19 Dec 2024 10:40:11 -0500 (EST) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C34D11752 for ; Thu, 19 Dec 2024 10:39:56 -0500 (EST) Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-385e27c75f4so740531f8f.2 for ; Thu, 19 Dec 2024 07:39:56 -0800 (PST) Received: from localhost.localdomain ([78.196.4.158]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4364a376846sm79508525e9.0.2024.12.19.07.39.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Dec 2024 07:39:55 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622795; x=1735227595; darn=lists.libvirt.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=8jM7iK7CzjLBlq0GL2o2lmBr4BfhFWF4uDH24qr2bSs=; b=nUQpqFZJWzJjTKgCooOzHr230INLNThyJtIkrMLknhnWcoUbrP2RMcSq3A8ulZ+Wke EVAcJJjGx+J6Ly5tW4ak6cgPSR41UxV6LGT/YVSDAgWxg+U2M8Z4vzbNb6ObLXpxJMZH sdLoa6E3A45bKhTfM6NkKoFPek5x+6sbLIQj+OFDbjBQAFwogBK0+ZzXck9Bs4YGzECG TdHqR1SfZG9bN2V/HNIPjFFpL7KZ8rRcsh5+/v2B/q+d8Z5SpPi0h8ufCRxpzZXiWaaQ 0/QSkd7fbDe4wZR1wZNiF1eU/x0+Mhq1vHyz0oOIE4Imsvyu4nhWuye/wpQ1osXJWrsn XAyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734622795; x=1735227595; 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=8jM7iK7CzjLBlq0GL2o2lmBr4BfhFWF4uDH24qr2bSs=; b=PYtPTKDrRtQ/f7Vc/2AbTd/oQsgQIFmXPG9qk3fx/pZ0dQw6YyJMyY7ZIFIwfFHka0 3UPhBvwWm1AeC3IIzQbYRLuRy1UuR3I/YelRM0GKDL4PxE36dD7l6h+Q0s/eaAau7egN zWxDj/GjYdE8xu7omyQkUHC+SuJjzBRujT7ODjaVl7ryB2JF+t4jeKZuhqThtpqPHdAG XsZCGPPGo3YJx0na9dZVxnLD6x1xwlUeO5PgZzObs0wOl4jGiAyg63WG7GdAz+R0O4Mw oYPv22KxdIe0g5kx1XOgLbK1CfRb5Wl30OAZm8uQxOt7y7k862k9itq8d8ja0HaFu/z0 yfHw== X-Forwarded-Encrypted: i=1; AJvYcCUEYuhksZlVLoWpqVZZMQuIMH/aEC23Mw0kb/IrMWsHjG+u1rGsRuNGB8HzFGhoQ8KPcLgwQA==@lists.libvirt.org X-Gm-Message-State: AOJu0YwYuoHoaqDYLjJTvVLKQeYU8Mh4rPlssXOJ33E/JGD97QtPGoQ9 5pUSFsuZssf1ieP1o5JDpvudwfIfs8li9a6+3SjAc2avHESUv/1xxH86tRk+tsA= X-Gm-Gg: ASbGncuikMToN96/P4PffSGIKOP3vMKea3mRjRfTQQB+j3RXVLw1Qy3DMOjdDL49Xbk 1w7vCvbi2KTU6NqHW0zFDDDB2WP0yCdCtI/gavS/D2ypT9EQyPoqQZILnGjP6Y5qoQmwJu6w/oZ nBSF/FdW3POevvZdsrm9xb4GaNMedk0OjBWpN/6P9c9nguH6yUo3fGzaHUe0cVMDdjbCGVAs+/U yoiFXkvI/95mdwAPjrV1+5JKRrSMTPWIf5C7GRfsg60CDqUj+w9cLvk7J/45anJOjeGL3PRNwKB mfkN X-Google-Smtp-Source: AGHT+IFDP3fNJA6xBv/hfaKPgC0bZEnVC+6UMLDZJxil0bxoO2WYS57R0WmK+DgL2vSBssckSHhikA== X-Received: by 2002:a05:6000:178b:b0:386:3835:9fec with SMTP id ffacd0b85a97d-388e4d8fbc0mr7568848f8f.44.1734622795613; Thu, 19 Dec 2024 07:39:55 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH-for-10.2 10/10] hw/misc/vmcoreinfo: Remove legacy '-device vmcoreinfo' Date: Thu, 19 Dec 2024 16:38:57 +0100 Message-ID: <20241219153857.57450-11-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241219153857.57450-1-philmd@linaro.org> References: <20241219153857.57450-1-philmd@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GZOWYQRZNG33E6DGXPKD5KTRNHF722HH X-Message-ID-Hash: GZOWYQRZNG33E6DGXPKD5KTRNHF722HH X-MailFrom: philmd@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Ani Sinha , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , devel@lists.libvirt.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1734622993909116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- docs/about/deprecated.rst | 5 ---- docs/about/removed-features.rst | 5 ++++ include/hw/misc/vmcoreinfo.h | 3 +-- hw/misc/vmcoreinfo.c | 44 ++++++--------------------------- 4 files changed, 13 insertions(+), 44 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 57a3d734081..d6809f94ea1 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -79,11 +79,6 @@ described with -smp are supported by the target machine. =20 Use ``-run-with user=3D..`` instead. =20 -``-device vmcoreinfo`` (since 10.0) -''''''''''''''''''''''''''''''''''' - -Use ``-object vmcore-info`` instead. - =20 User-mode emulator command line arguments ----------------------------------------- diff --git a/docs/about/removed-features.rst b/docs/about/removed-features.= rst index cb1388049a8..6fedf13c133 100644 --- a/docs/about/removed-features.rst +++ b/docs/about/removed-features.rst @@ -555,6 +555,11 @@ to produce an odd effect (rotating input but not displ= ay output). But this was never intended or documented behaviour, so we have dropped the options along with the machine models they were intended for. =20 +``-device vmcoreinfo`` (removed in 10.2) +'''''''''''''''''''''''''''''''''''''''' + +``-device vmcoreinfo`` has been replaced by ``-object vmcore-info``. + User-mode emulator command line arguments ----------------------------------------- =20 diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h index d4cce42cee6..56af12d33a4 100644 --- a/include/hw/misc/vmcoreinfo.h +++ b/include/hw/misc/vmcoreinfo.h @@ -12,7 +12,6 @@ #ifndef VMCOREINFO_H #define VMCOREINFO_H =20 -#include "hw/qdev-core.h" #include "standard-headers/linux/qemu_fw_cfg.h" #include "qom/object.h" =20 @@ -26,7 +25,7 @@ DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO_DEVI= CE, typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo; =20 struct VMCoreInfoState { - DeviceState parent_obj; + Object parent_obj; =20 bool has_vmcoreinfo; FWCfgVMCoreInfo vmcoreinfo; diff --git a/hw/misc/vmcoreinfo.c b/hw/misc/vmcoreinfo.c index e2258e08fb1..36d1143722e 100644 --- a/hw/misc/vmcoreinfo.c +++ b/hw/misc/vmcoreinfo.c @@ -54,8 +54,9 @@ static void vmcoreinfo_reset_hold(Object *obj, ResetType = type) s->vmcoreinfo.host_format =3D cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF= ); } =20 -static void vmcoreinfo_realize(VMCoreInfoState *s, Error **errp) +static void vmcoreinfo_complete(UserCreatable *uc, Error **errp) { + VMCoreInfoState *s =3D VMCOREINFO(uc); FWCfgState *fw_cfg =3D fw_cfg_find(); /* for gdb script dump-guest-memory.py */ static VMCoreInfoState * volatile vmcoreinfo_state G_GNUC_UNUSED; @@ -76,6 +77,10 @@ static void vmcoreinfo_realize(VMCoreInfoState *s, Error= **errp) return; } =20 + if (vmstate_register_any(VMSTATE_IF(s), &vmstate_vmcoreinfo, s) < 0) { + error_setg(errp, "%s: Failed to register vmstate", TYPE_VMCOREINFO= ); + } + fw_cfg_add_file_callback(fw_cfg, FW_CFG_VMCOREINFO_FILENAME, NULL, fw_cfg_vmci_write, s, &s->vmcoreinfo, sizeof(s->vmcoreinfo), false); @@ -88,25 +93,11 @@ static void vmcoreinfo_realize(VMCoreInfoState *s, Erro= r **errp) vmcoreinfo_state =3D s; } =20 -static void vmcoreinfo_device_realize(DeviceState *dev, Error **errp) -{ - vmcoreinfo_realize(VMCOREINFO_DEVICE(dev), errp); -} - static bool vmcoreinfo_can_be_deleted(UserCreatable *uc) { return false; } =20 -static void vmcoreinfo_complete(UserCreatable *uc, Error **errp) -{ - if (vmstate_register_any(VMSTATE_IF(uc), &vmstate_vmcoreinfo, uc) < 0)= { - error_setg(errp, "%s: Failed to register vmstate", TYPE_VMCOREINFO= ); - } - - vmcoreinfo_realize(VMCOREINFO(uc), errp); -} - static void vmcoreinfo_class_init(ObjectClass *oc, void *data) { UserCreatableClass *ucc =3D USER_CREATABLE_CLASS(oc); @@ -119,25 +110,7 @@ static void vmcoreinfo_class_init(ObjectClass *oc, voi= d *data) rc->phases.hold =3D vmcoreinfo_reset_hold; } =20 -static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - ResettableClass *rc =3D RESETTABLE_CLASS(klass); - - dc->vmsd =3D &vmstate_vmcoreinfo; - dc->realize =3D vmcoreinfo_device_realize; - dc->hotpluggable =3D false; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - rc->phases.hold =3D vmcoreinfo_reset_hold; -} - static const TypeInfo vmcoreinfo_types[] =3D { - { - .name =3D TYPE_VMCOREINFO_DEVICE, - .parent =3D TYPE_DEVICE, - .instance_size =3D sizeof(VMCoreInfoState), - .class_init =3D vmcoreinfo_device_class_init, - }, { .name =3D TYPE_VMCOREINFO, .parent =3D TYPE_OBJECT, @@ -158,10 +131,7 @@ VMCoreInfoState *vmcoreinfo_find(void) { Object *obj; =20 - obj =3D object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); - if (!obj) { - obj =3D object_resolve_path_type("", TYPE_VMCOREINFO, NULL); - } + obj =3D object_resolve_path_type("", TYPE_VMCOREINFO, NULL); =20 return obj ? (VMCoreInfoState *)obj : NULL; } --=20 2.47.1