From patchwork Thu Dec 19 15:38:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C799E7718A for ; Thu, 19 Dec 2024 16:20:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJFf-0001qg-5N; Thu, 19 Dec 2024 11:19:51 -0500 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 1tOIcM-0004WT-17 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:14 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIcJ-0004QG-Hb for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:13 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4362f61757fso9311835e9.2 for ; Thu, 19 Dec 2024 07:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622747; x=1735227547; 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=fVQZDG1ZHCW9mRIskC0RqnL4zCyCfhO/N0NweSAMjGE=; b=Y4ZfcXTetdNH6WatVKekB018rKG+7CF0Yjj4uL1UgXEDHITsm6D2a8LWPvCbpOQmBu 1R33jTnjMuQLhA1p1YTRKjVmjs6Q9XoTUBTTRA0/3JfjloBubh0ivwENj0gnZTjbK9aN KePPgQXMACpcGRN7ARK4COwUo344wyl708ete5ftQRhxEsrqx4hRNBIou8cDjHRMNuRH X4uF1TTnGbETe944Q3doBjg1OXKGtflOocIuLnS8K0OzPJCXnwfH+wLrtt/0m64Anajq qFIM5t/Bg1HH6jbC7K+Nyo4MG0P8p/HDQ56MOBcjo7qtB1zKhigjbdXlfcQjU1t0oJFn vebg== 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=LlLzjsv1QpgziADdkHoeZaHpH/8+WPXblaAmtHrQVdwOBrmrx+xB+YW1GyEdbkzj3m JTdUuxgfYC0+e7MlyrHTuFj3SK8rkYnImTVjgOC9fipfh++yfo3ypQn4WW5ELCAZdRAP S/HW+qMj77LGYgehdFj9J15zEtrR2adT76MMtV/Y/bLLG2OopZVWxQtjhuCOSq6I5vj2 8jqAg2RVLxAmFKG9nKUnA28Rcy7EksKhcflFH4mig2baMVNzexdhHGO7NhqsQc7yJIuw DP7kJbMU1UsqHUfVXaR61tUNRKcYm3OjS4Bl7Wcu0rgHDzHJlXsjzeNn/Nj9c1FtEbcO vhBw== X-Gm-Message-State: AOJu0YyR4tbT4j3XOd9z+dpaZya2O0pcA52xTPdPchMriDP7ncUw25ep ly/CuK11ct2yAcIPc3OduZslUi0hnekpy4COKgB4XCDGuY2ZpRkEaeWIgqkzhc3bs1nYedkYLRw 5 X-Gm-Gg: ASbGncuULhf6/If4gseNm7eyBZ15ZG8JKjFGIxWZ/OjUs4geDH4Ch/a2mbLugcHeM2a GDEqmZrMQdIIV6kpuQJqDrcFBvY+ed9VgWvdXtC6s3k/saslA2w72Mf8wy+gyyQKRTF2IJlZ3IO AiM/fMYjEF8ziujYXrPI8SoGzE7YMmPBW+s9qnCZo2Rk8wP5XT+x1JDwBlu6NB3SjAA70mqVlf5 LbcVzLdKUBxbF1DThzfuwY3jvMmUTapukmiTLCXI6HIWZLumIMn1I5/m6BrxZ2qx7b+Yuvkke5Z Hyfl 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé --- 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 *klass, void *data) set_bit(DEVICE_CATEGORY_MISC, dc->categories); } -static const TypeInfo vmcoreinfo_device_info = { - .name = VMCOREINFO_DEVICE, - .parent = TYPE_DEVICE, - .instance_size = sizeof(VMCoreInfoState), - .class_init = vmcoreinfo_device_class_init, +static const TypeInfo vmcoreinfo_types[] = { + { + .name = VMCOREINFO_DEVICE, + .parent = TYPE_DEVICE, + .instance_size = sizeof(VMCoreInfoState), + .class_init = vmcoreinfo_device_class_init, + } }; -static void vmcoreinfo_register_types(void) -{ - type_register_static(&vmcoreinfo_device_info); -} - -type_init(vmcoreinfo_register_types) +DEFINE_TYPES(vmcoreinfo_types) From patchwork Thu Dec 19 15:38:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D405E77184 for ; Thu, 19 Dec 2024 16:26:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJIO-00087t-PF; Thu, 19 Dec 2024 11:22:42 -0500 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 1tOIcN-0004Wl-Np for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:16 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIcM-0004R4-Al for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:15 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4361f664af5so10658095e9.1 for ; Thu, 19 Dec 2024 07:39:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622752; x=1735227552; 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=9A6H1EuKRU8oSMUlfiyYQGgNe/t50Uq0zCTd6hbC9F8=; b=gxKPGZixvGdMAumjI1jZ/COXjOdcpgB3HW6dXG6p7C60JYziRAjLKPDphpO+C/iTTH O2DWADs8e1MGjCqbuqyiUDYjNmvdgXSXhziZ+DiTz2Lb4gcmUWIdqufpzUjFRhmKZRlF 5r6V0pVIvlXIxRHBm/ZQDdLeR+G7tkjqZhnZOrwbKlThUgCdiIuigW2uNt+pnbQqSN3Y i+74dvYuU4eWRWrx+YPxl6arWd5USwm9L9DNmloNmlpAVy4G1iPTbpsOLW9/HEmSRvRN V93mt7wxIfbdTGXJsUt057wXXTaQWZ0CRoTgZL288CHvUjGuWcAVh4FK8xg8I0NnfyxF 91zw== 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=rLtGEF+/ajHpetBNtiShfleCgyROyW12c2iQ9JmlA/eAt8EUQeAc8ZbzyyEQ6y9YPc rGUBmJ+G/MmLgSjkFQQolDUh3wTwpERPIIDMIA2p3dTp+dZVQS8J8yW6xRdpXE8lD+qQ y4n/4fDAx7Z3HRByReG75oacVHI0AeiV1MJbm4lXDUgG+A4bbybWMabz6ecbybFIJNis RA3JOxiZK+OyvJtZeJNg2+RsuO5kZo3Obkl1aS/3XnsH3asnUJXVjTGAN5jUH2JcnGdJ //lbXOlvf7dHRibIHbDSfDSMdctn1JRX5vyPeq57J4MdIz+haOiqOp47oHMGMh8V/sSl 880w== X-Gm-Message-State: AOJu0YyBHFocT/LfQAExV1awliwWKMcBq+NV1y4apccd5KZqkL+sZ013 HddPr1w+WAunjDeGpXSnZqI5taav1NuYtBVRO+rKnwipEnlOYovdUPFc5uDiOKKWfwovALAtS5W 6 X-Gm-Gg: ASbGncurar/zAtT0By5N17NfGDJtm3jDIrEhU4ytC6h+JfX7cvCj1sAzqouf+Udqhe+ uUNkd3NO1ZA5howH0Mad6UYU4Y+uqNxtMfpol3ga2pr0Qm3Q2KgTCRzsid3Wge/Xjz26WxM6IPt Hg8FRXd5hRQz30WdknBIuKhO6xhLuqhtauHFGEjhTfUS/7lvewqs5tXhyidQu32fzB6UKh9snuR pR+1Y3BIzeCfTH22pPutRx1tGdYcE0BvLjranrj60Qb4M6RTZQbKt9lbrCUcZxBkfdqPYc2XzUQ FJcW 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Both QEMUResetHandler and FWCfgWriteCallback take an opaque pointer argument, no need to cast. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé --- 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" -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 = VMCOREINFO(dev); + VMCoreInfoState *s = opaque; s->has_vmcoreinfo = offset == 0 && len == sizeof(s->vmcoreinfo) && s->vmcoreinfo.guest_format != FW_CFG_VMCOREINFO_FORMAT_NONE; } -static void vmcoreinfo_reset(void *dev) +static void vmcoreinfo_reset(void *opaque) { - VMCoreInfoState *s = VMCOREINFO(dev); + VMCoreInfoState *s = opaque; s->has_vmcoreinfo = 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 = s; } From patchwork Thu Dec 19 15:38:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE682E77184 for ; Thu, 19 Dec 2024 16:28:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJFR-0001mS-Oh; Thu, 19 Dec 2024 11:19:37 -0500 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 1tOIcT-0004bQ-85 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:21 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIcR-0004Rg-OP for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:21 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4361fe642ddso9578555e9.2 for ; Thu, 19 Dec 2024 07:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622758; x=1735227558; 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=fSUrXqY3vKb6Y+xc3NUnoWjHDPec55tB8oXd/H8ApGI=; b=LgDSwqTUptkWoSEP2LpMySbEDAwN/XC0aVneMvdtHhMW23R2273cc0aw4AewyrNgzS nKM7vSR+W0EDxCt9l1BpYmVAjziPpNghuB5acCVxzugll8LlsDC4LfDWi06iFTzj3sOP b7I1mazZNPNqLsBdteXm21rANWMJNs282K97gqIBzREANRNN2+rjeSB+QiM6IkPzmjKy mYynOY1dL+k7uz2SvAnjt7YmJWYiIvT5sers7pU4i5pgiGaFwP0nkoX9ixflhwX+XBgq DvCr5tAIJpX21Ylkcw/rdf9+CROkj3rVagJSUuhQsQPJq9xLViNniVbXg60rRQWUOWqn 1L2A== 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=kfKMe8IrksycSkXzZWbV147lxJ47Onv8+mIFsnR080AbW12OMqWFYV0Kf1/fm7Saqr 8+PqSDR0nOfIWc06XJIiBFFbQQDF3Ypmb/SPpkkF+FHpw2D8wq8BoITV8Ol0FF3YSwtw ql57U/CmeDTMOEPXdMtJXJB+1Bm7DuHZgurFT4xPvIxuJTjlbjpPBebHn2mbli1J6R9Q CgQVIvLcA47FREhdru9LXcHbt/GMPCvrpVmlmbaDRWrR8CQ9C0J8Yu7dopboJ0kBhjcx uQWeucjKglSI9BLwC4zzGObGqzxbhDZrZzbqEMTWWqf1WRKoJOkGRkdEOD6DtOGpZcSa NmXA== X-Gm-Message-State: AOJu0YzDwxytzi8o6ekx+OBLr6pjaeAcnjEBJ3FVgzVf1IbmCt/3QsTe GOABZYrVX8QNhdvkm1DxQmCqDV/fxdGAK5PejO7130knppCVJJBwEXo4KJPz/d2l1JGjnoZPkZK p X-Gm-Gg: ASbGncvtjiscO1KorKguCYve6OTA+ipZWEf6ZQJJ/bk2w2tvmW1kxLjzVus7JqakAZn GsyxwFj5QetSHs0MeIqONJswv5lTPT0gfFd1uOyrsz/1rmjjhN+VFZ1gFf8B/nHun+D4c9uBa/P Z6slMiLsyUttj6YnKZxVWsww9aHwfCwmUGMnoZuHZd6MBV+FxhH+KeSyOCjl7JGEKP9gzMBtxgX 0nqXb0FWzKx4QyTf5IF9R2qeQfSfoWfWQxggLo35H2rozDZvnwOBBRKiobKYXyVfvfxysFoPh/0 +vn9 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Reviewed-by: Daniel P. Berrangé --- 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; }; -/* returns NULL unless there is exactly one device */ -static inline VMCoreInfoState *vmcoreinfo_find(void) -{ - Object *o = 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); #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; - /* Given that this function is executing, there is at least one VMCOREINFO - * 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[] = { }; DEFINE_TYPES(vmcoreinfo_types) + +VMCoreInfoState *vmcoreinfo_find(void) +{ + Object *obj; + + obj = object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); + + return obj ? (VMCoreInfoState *)obj : NULL; +} From patchwork Thu Dec 19 15:38:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA75EE7718E for ; Thu, 19 Dec 2024 16:33:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJGp-0003qh-SF; Thu, 19 Dec 2024 11:21:04 -0500 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 1tOIcY-0004c0-Rk for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:26 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIcX-0004SO-Ei for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:26 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43623f0c574so6770955e9.2 for ; Thu, 19 Dec 2024 07:39:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622764; x=1735227564; 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=ltkM6wv4nnewbtt7Wl7DzeFeRkwimvs0bnn2crm+6CQ=; b=jPuJDHxmUdmGyU9OLHk8iuTuWp3JW2kZ4F9XDyzMqxyINfVIknTQPoHkYTrYXozAJE 5qEmr1yfKyi0tpM0jGMNHEYyfgcPOAegg4FTTn8wQPu8tKjRWKG4iagGIDjynnnNVoYM 3V1Vl/cpHItfxvi0Nq2L3nHcTBb2ndMFSms2e7A2v8y30LUl43HYeuX1WrR+UDu+gPIC nwNrsaEcDNG72AcNNEWlGiIpuvpEABniF0LExBtgDtlnb8YVLWgTGwAnbZxeHzTguW/d T/zGsvel3qRG3gRJXqmO9DkjzQTbJN6ni3+p87swLx4qW4gtmmUHQC7Z4YtEyyqUNyrI VSWw== 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=Bc1G66UmBj20OlKRnrUP5zqijg4Ktx5IMjhRpHpCrvu7JbtnOhub3wJJX17wy1udR0 3lVmUmfwmIqXnxj8Cf1M3Pitcg6VBrTIfnZ1ij6KKHmkh5PauRqHq0mjL4340Fci+vo0 0xY7RL7TnkRcLvVMfx/WNkBExKG8tMIwhXnQYfNGbnsIwH7Dyhgb6TYQp2+WJ+Xos69R efyU3Y32Z0TPnbQK6DCKaCmOIcRtxfNMk90CzMQJ8tWYn7GpJ7Zvfd7j05779jCRVLta HNM0zC4itnj5L9CyAuqt9staprqKHeJkGun9yiL3Tk3F5Tdu2ms5+D3wlrRIPbOzivg5 pSTQ== X-Gm-Message-State: AOJu0Yzx8d2C8te2mGoKgmDIf20EcSdaARgkMQ+9N58ZLc6sG9Ej28eB pFP9Br9pR/SmDeXFOPqQuM1+W4i1wy8TutZNNkpCLTX9SCgmEzh1BAYXE457RmfD1tiM3zMuEsO J X-Gm-Gg: ASbGncvnT6HdgiD8hKMWhLyR5/cOEqo/gPnEler+GKOVPSKEhvXVpjq7c3O7A3nY+DF xfX7CEo7lx8N0SRtDZ1qjXD/wD9BvWOQn2wcWtakfO0w3XvL8hLd8BAMxIbCuBKTQoWBLaq9n/y wv6tE0Lbyu8EXRxdnO0NRG2JItjVywE4gZoxSAxhk/y03BFclPig8RWI76BZh0TxPlLv2lqRtJZ D2zBs95FeS11GVqnHSKdCq/I8yWVWfq5DlIBRcqf/CHmRWUYv1NEXg+Ig20138PQCz68FB4214c Hrq6 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Follow the assumed QOM type definition style, prefixing with 'TYPE_'. Signed-off-by: Philippe Mathieu-Daudé --- 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" -#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) typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo; 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) static void vmcoreinfo_realize(DeviceState *dev, Error **errp) { - VMCoreInfoState *s = VMCOREINFO(dev); + VMCoreInfoState *s = VMCOREINFO_DEVICE(dev); FWCfgState *fw_cfg = 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; } if (!fw_cfg || !fw_cfg->dma_enabled) { error_setg(errp, "%s device requires fw_cfg with DMA", - VMCOREINFO_DEVICE); + TYPE_VMCOREINFO_DEVICE); return; } @@ -96,7 +96,7 @@ static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) static const TypeInfo vmcoreinfo_types[] = { { - .name = VMCOREINFO_DEVICE, + .name = TYPE_VMCOREINFO_DEVICE, .parent = TYPE_DEVICE, .instance_size = sizeof(VMCoreInfoState), .class_init = vmcoreinfo_device_class_init, From patchwork Thu Dec 19 15:38:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915224 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59DA4E7718B for ; Thu, 19 Dec 2024 16:21:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJGr-00045U-JK; Thu, 19 Dec 2024 11:21:05 -0500 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 1tOIcg-0004mb-0K for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:34 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIce-0004Ua-8B for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:33 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-436202dd730so7005455e9.2 for ; Thu, 19 Dec 2024 07:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622770; x=1735227570; 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=JH+rg8jdfzKs8XOz5Rmt45E6mRet+pe4gCab1lfs0FM=; b=D7ZXeJZr5ofKw59jv923DLm0oi9TxTVRjwHOuUCuCd/YqgzIymoprjT5TVnDPbq+Wv RmI3mU3WVN1T8G24KwVcbzp6EfnWqFnmg+gDQfYS7DJDnI6A0Z/SEVEUk+4Dyzc+5lUK D0RZRNsLV3WjUA6HN0ZFT+ndzSV9cDPcSeYF6cRuYiW5hFCgr5tmGqQYlRhjCLJPXdke 7Ywo1+hMvYJxLjxKHQjTdR15nPK8BCvQs1pMA/vMCL5xOy58D99M4rT6hH7wkc6h30Vu k1+zv7ooSz4RPtGFITrbMxQofG4eYwvDVjL2Y+UC+brgXTQuiHng0PyJQurypv+u2MT7 pBuA== 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=M0NFEJ9eWEFCrHkXq1Zso69xPEFlPdiVQ20sxOHsjz/GI61LA5/quXEckwUBijC2Fs HbO8Nx34IYbZoBPSn3cL7vA/ukwUSPxIZdWhsH9NY5JfNB+C+D9PavOFsiz2GMe3HPLK E0AuvmvOmP8B5MB2iEf0tSAVWAzMVgnytgjdLFT3IciNkgOGhX2r+MCbLor+sdWZuh0i 1Z6uGwY4sz6/xKLfhrfPMfiG7GQNjDmODonFddQteeNfs+uF02A6cHxbcM/DM4qwleBp cpTIieYLHE9nPkTJAM86Z454IMAVhaJmha0rto7eAzUDk9+L+KPN8wPeBPKkT+fdP9o3 jvhA== X-Gm-Message-State: AOJu0YwywFCig8R9IbnNitZJqtbfkauk/RAfJl8tCMmrgkpE5d7rQOro bftSWp1NiF2q6e98AT3cchauSTUd52/FMxGMwCbMYVvyhAzlcPBB2z+X4hXmFRius7IB1QG6YOS x X-Gm-Gg: ASbGnctPC/iVSRxoa9HjEA2MtLbCAyedA1sGl95QdvxyXhdesLKiIAM9HNVKPrS3cyc gQR2xsK3A7LWtYMjbXAOnHlk7wLNEVTwNRVYrEDWO2V7np511j0OKgb3qFRWVCxeMSW4en6g0y6 8WUJzWhLiQGpcKf7iLAhUm82FyqlXlA1h/gOycsIsFDs0P/lC106P0hQOHjAWgVW1ujHqHeQ2nH xU7D1Rs/oR4XAIK1unG9UvY64BMRy1LY2IS6PCijPVAMiD9a1IEDZ+9ZDB+mbMO6vFRkf7zOYA3 cCvu 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé --- 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 != FW_CFG_VMCOREINFO_FORMAT_NONE; } -static void vmcoreinfo_reset(void *opaque) +static void vmcoreinfo_reset_hold(Object *obj, ResetType type) { - VMCoreInfoState *s = opaque; + VMCoreInfoState *s = (VMCoreInfoState *)obj; s->has_vmcoreinfo = 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 = s; } @@ -87,11 +87,13 @@ static const VMStateDescription vmstate_vmcoreinfo = { static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); + ResettableClass *rc = RESETTABLE_CLASS(klass); dc->vmsd = &vmstate_vmcoreinfo; dc->realize = vmcoreinfo_realize; dc->hotpluggable = false; set_bit(DEVICE_CATEGORY_MISC, dc->categories); + rc->phases.hold = vmcoreinfo_reset_hold; } static const TypeInfo vmcoreinfo_types[] = { From patchwork Thu Dec 19 15:38:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC669E77184 for ; Thu, 19 Dec 2024 16:37:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJIT-0000EH-4C; Thu, 19 Dec 2024 11:22:45 -0500 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 1tOIck-0004pC-0I for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:38 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIci-0004Vo-B9 for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:37 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4361a50e337so6978315e9.0 for ; Thu, 19 Dec 2024 07:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622774; x=1735227574; 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=RMGv7qvi3m/JTiz7jQ63fQU4SttU7iapPs3aSHWSfWE=; b=h4cTGGIAoYun2ASXFD9Je9JoqpR0sujEsWKg6rtpwHMN5ZqE4nM1yuqLRbgiKszQe3 l5McV6Arp9LIsCHfCeBbJGz2qj/wVdDICbu8zTt5wWUUMrX6m4pXGLKaS481Q99G3CQH 5D1iRlwnCzH5za0YdopyByt5xVz/W247unu2z1+UGihBe2EQBpuPe+MuvuqAiYNiBsN9 TZldclw0cBlCdM4DzdN25YK4jvD1x1KRv5k/O3YWSidPKS+Y85rZsxfdbiWT0DREeUSU 3fURLdIF1Aw6+HUj1pu7MsbgusJE/NSEYJJy82ckwLJtd5JffcIc9lnw8BJvn4AI4wfO yQNQ== 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=pB5n4ngxJIkLSg3JNtIlUUzdpPLCWn2NH20s8xraQ67Jvsc+eS/3zPa37kK2MYYCtS n6KE3rbEOvHmhDlrYjIfmBnohRh9dHOuKAhIOP4kbfHx3GJwfnrDMqVCjtF1mTUhRRw2 vFLsNxr1LZSgB7B90rvlQcs/sq7a0WqyJlXOxnxHNWALhgPr8TG7ssyPRNvPD/yk9C0K 55jzLCXq5x+Twlnr5Kv+Q4m1KEHSeLsCaiXFmYhWnUVYBKF/PhT4tHwuYJyMwkVqaBkr j/zrSgBfIisXQDA1xkaOLFyU696Bwy7Sk8r9Bg1b+6knIxLwHXIk6HRNB2Gx067HTx25 uytA== X-Gm-Message-State: AOJu0YyA+zuK1/ZwExSU7Vou1iggOJstkyOTeG5yP58MCD67ICVXjRXJ CMTiy5reKWGv/wM7EkxABDfQujOgzogtpzj/BV3OueIzq67yrH/eHmPhWsCWIcgN9+J11oR1/DS W X-Gm-Gg: ASbGncvQeAmk+EaL3tyivB9muC2qJ+skKAFK3UdouWNr425Al7a206ks2EjkYpHLmMh zl8mzFTSNw5nr289HjjRAkCdBUYkEdTW19V7q6DDa+s2ivnl+J4XOGx9teAJF/qL5YISMa8sLPa upwEnr6AJfmy1DsAsPTZekaRdqVw6nVOLKXtagAP3gI3W2lV7K6GDvGib4pfSxpIyeWvavBNqLR ZqPsJ3YwJzrSV36WQe4r6q1o0xlqADH2P4sWE7N8wTTlQzY8qWwMEX7lxBBhhq5UQH28U388CfK POj0 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In order to simplify the next commit, move vmstate_vmcoreinfo[] around. Signed-off-by: Philippe Mathieu-Daudé --- 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" +static const VMStateDescription vmstate_vmcoreinfo = { + .name = "vmcoreinfo", + .version_id = 1, + .minimum_version_id = 1, + .fields = (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 = opaque; @@ -70,20 +84,6 @@ static void vmcoreinfo_realize(DeviceState *dev, Error **errp) vmcoreinfo_state = s; } -static const VMStateDescription vmstate_vmcoreinfo = { - .name = "vmcoreinfo", - .version_id = 1, - .minimum_version_id = 1, - .fields = (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 = DEVICE_CLASS(klass); From patchwork Thu Dec 19 15:38:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5C1CE7718A for ; Thu, 19 Dec 2024 16:33:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJFZ-0001nw-1p; Thu, 19 Dec 2024 11:19:45 -0500 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 1tOIcp-0004pZ-5Z for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:43 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIcn-0004X8-Is for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:42 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-385deda28b3so664779f8f.0 for ; Thu, 19 Dec 2024 07:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622780; x=1735227580; 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=W5xIB6Q3xpywMwriwl34zxXU4p+OU3fl2Ms6nSvvP3g=; b=IF0sZ6imUo0Nt32KEIsnrsr2lESHBCWmAsxIV35rEbfrceUSyspSG1EZ3M0dzc4k4D yBo1AxEy/NvVjrNNOSPj8bqGFuc9EDMIBS6VZsFEphCbMZdbZNY16zpa2g9JJfRMTEMY 742kYi+dypjb32BY0NIJemHhJ6+BSrCQwVypGl7qM9vXYrmYWmLYDexEoV7DRiDwyjYp hsaYHFXks0ABcpDjuLTq7G8nNFgNQRejEkIwyNrvNBITNcfSlYEckCWTyiR4M355ln1z oWPP1v82GcXNT004Zs+KQzJFfga2UEAjnMdG8gLrOFiTfLSLo+CSlAYalGTpRzCNVLIy +yzg== 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=kqznLITWAKWEf0ObBi+jOniOECPi/JNMg6N071PBiA9jMEF8px52PR2Kch/BlmPy1O DCZsA2VwJZDuEKwn2Uiq4LViacWIsRnSlxAtpTG45p6T73erhI4mhdS8zcNAPRBuRI6F ugx/gP91UGB8DSesu+pm/F79NiJkw5MCyu8v/+C5jvHsAcFT0+nFfQzMWBcg6SjPBja3 Y84jwIgPeq2EfM+iedizA57UkX9s9sByuDhQ6con1fpW63a3/ZUr7UzuaEM1zcKEjW6o oxlJ6uQLTkpYzJa94mE4MVm5CCgcQ3nLayANQ70xJgo/k2/hB5YVjLMG3FleRjSdTHz2 bEag== X-Gm-Message-State: AOJu0YyBAPgF98uPPRPC+yvyx+Pcpf/nTtVEfiOGOEmegrtYxkHjaz32 slRo04JK1DbnOvM7XFlbtpAf3s5fvZP7jHYQxbBdPu/Sdp3h2HEJPbxZ9wBIBOh4LXrwJX6WziB d X-Gm-Gg: ASbGncuCQ7W2fCp/3YbWjxOVXyFhLQoMrDLahnAy32PuK98y+S9E0Q9LOKHxR0sXIsx 1uRfiC4J9bn2ibcu6zoqYrJJ4zIRCZJMOUvpoY/3XgK3PAcI0KjEiPqmpbsFsv4+/bRwv4RDwkW G9e64L9KDx56rYza0esjD1/Y4m6Iw0tbCZhjf3t6Poq4aT2fIRR99unuCcc7pSLnGs4JZuyL8/R 0qP8mXQ3IEhJN5r1JYJ9IlCSv0m/W6WiPsNl8pQ/AttrXAtdD/44gM5WZjWC7KExm0M38z9n+/U zrIV 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In preparation of implementing a UserCreatable callback in the next commit, factor vmcoreinfo_device_realize() out. Signed-off-by: Philippe Mathieu-Daudé --- 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 = cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF); } -static void vmcoreinfo_realize(DeviceState *dev, Error **errp) +static void vmcoreinfo_realize(VMCoreInfoState *s, Error **errp) { - VMCoreInfoState *s = VMCOREINFO_DEVICE(dev); FWCfgState *fw_cfg = 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 = s; } +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 = DEVICE_CLASS(klass); ResettableClass *rc = RESETTABLE_CLASS(klass); dc->vmsd = &vmstate_vmcoreinfo; - dc->realize = vmcoreinfo_realize; + dc->realize = vmcoreinfo_device_realize; dc->hotpluggable = false; set_bit(DEVICE_CATEGORY_MISC, dc->categories); rc->phases.hold = vmcoreinfo_reset_hold; From patchwork Thu Dec 19 15:38:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48360E7718A for ; Thu, 19 Dec 2024 16:32:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJIX-0000cC-5e; Thu, 19 Dec 2024 11:22:49 -0500 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 1tOIcu-0004q4-LG for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:48 -0500 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 1tOIcs-0004Y4-SQ for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:48 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-385deda28b3so664876f8f.0 for ; Thu, 19 Dec 2024 07:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622785; x=1735227585; 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=ISSyZu80+Z0LOt9qrMxsW+Lah1hE0o+0ErPwOcAlXN4=; b=tV/VXglmIF027UnmiObX02RWTvIWB2IeOErnf+nEh3k42wAvXhQi+BHvFReGtE4o2d NUhDZ8FVj3foKFXkkMOGKu9Df5EyfNUndrH82+4hHgTXylTckZpyBuN65tSM2Ef26Eon 8FLbB5ibhC34D0R7glNGhaI4fqHxCxkMKqDkBaUoRgBKrRuBEaWD8YN5MJob6QcHhO5r nf7h6EwCUTj2QLt6Nvj9ggxxLo5g9f9kkX6joCauID8Lf1i0MDkKdd3+bme7j9/tQon0 +j/txj/NXVPBZrCQl11wSTH64Jb/Exc9XKgfeuHKtTN5k1wHR8GGmO75Oc8s/8OSKtvS mVgQ== 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=XrYs17oe17u4lgcptoAzm028K0y7p7iiYbjD2iaslakhSuqMoDCXb5sHu+grkqoBK2 PDca/OSq25OcOgK47OV6jHlKGNsRu1crFGMIqaWx9jCzLQdRqinU6VfUZmzAdz9lXwMc ZKikpNdqnQuaDUawtnYqTC/sahrJ8bLSyOSblZvbErz2N/C+mSkGytr24uTT+/l7sFgZ Smst/G4xvGPwxYm17je59yFR6squGM9NFTCGcgvEqEUkAAGyWhbDjrYRlypTisYrMDCG HZ/CRc0wX/vLUzdEP/qQRNwWbXyxcNtMysM/qin46YlRIyiwPtVSwCOFaTbDMtTosray ApqA== X-Gm-Message-State: AOJu0YxcjUQAV/4uAOED6eb9Du2vi2zDr80J8UzjSoFjs1GgLdiCMAh4 XVbSsCGOSihlOqDuW0C3hdu4/RLvTdtx5egR26giqLLBmZw5edavvBO9sgEald0o5kQNfqwHt0E + X-Gm-Gg: ASbGncukkxq8h+eaLnG5e4kcvSlEK4MIB7FcWu5zoCL8gxTeGVWkXMFh+XF03TK+jG9 PFJJ/ZZHcq2gDXN7iWKoDl1fA1//G5WxqKvGKkSeUvsyathUBSv3VvZw6O3otTRj/XEaAm6bTlE 6EYxEw3AiaWPs2Z8Zz5DUDqJ4uqMUPHXNYbTrVOahm6V5DZoAdYhjC/6rIgfUhPvD6IxtFmxKXH 1gP131pEiWSs3RL0ykuPES+VjAxr6iyQHylupqcagEvRY0fuZnem+gmtMKRqQ36iyYGcdFzGTKG v/OF 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org '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é --- 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" +#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) 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 @@ #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" static const VMStateDescription vmstate_vmcoreinfo = { .name = "vmcoreinfo", @@ -32,6 +32,11 @@ static const VMStateDescription vmstate_vmcoreinfo = { }, }; +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 = opaque; @@ -88,6 +93,32 @@ 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; +} + +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 = USER_CREATABLE_CLASS(oc); + VMStateIfClass *vc = VMSTATE_IF_CLASS(oc); + ResettableClass *rc = RESETTABLE_CLASS(oc); + + ucc->complete = vmcoreinfo_complete; + ucc->can_be_deleted = vmcoreinfo_can_be_deleted; + vc->get_id = vmcoreinfo_get_vmstate_id; + rc->phases.hold = vmcoreinfo_reset_hold; +} + static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -106,6 +137,18 @@ static const TypeInfo vmcoreinfo_types[] = { .parent = TYPE_DEVICE, .instance_size = sizeof(VMCoreInfoState), .class_init = vmcoreinfo_device_class_init, + }, + { + .name = TYPE_VMCOREINFO, + .parent = TYPE_OBJECT, + .instance_size = sizeof(VMCoreInfoState), + .class_init = vmcoreinfo_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_RESETTABLE_INTERFACE }, + { TYPE_USER_CREATABLE }, + { TYPE_VMSTATE_IF }, + { } + } } }; @@ -116,6 +159,9 @@ VMCoreInfoState *vmcoreinfo_find(void) Object *obj; obj = object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); + if (!obj) { + obj = object_resolve_path_type("", TYPE_VMCOREINFO, NULL); + } return obj ? (VMCoreInfoState *)obj : NULL; } From patchwork Thu Dec 19 15:38:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6751E77184 for ; Thu, 19 Dec 2024 16:30:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJFg-0001re-Af; Thu, 19 Dec 2024 11:19:52 -0500 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 1tOIcz-0004qW-Uq for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:53 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOIcy-0004Yr-Kl for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:53 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4361815b96cso6828635e9.1 for ; Thu, 19 Dec 2024 07:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622791; x=1735227591; 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=upFpBaO8cptavFRp1HZ7mKtcy+0BbSMhQQtCEJtj5Yg=; b=W4S47rPQjwyXvMsCuO1l1H7SSANpv3E3UMfbtLNCKIp5XtnmbeENAQuFLbh+wTZjw3 /Biuh/CzGZ/BtRdmodlsVsI4rE5qliBsj3/lbo+BapZn6U8bMQ8yt+gZK3TABYVCfIVu BQHDJwAwc1rb5kS0xzl+4wFdZj6pC1YN95eHDJE2Ax8xHHU9z3BDEKvUTwMIQNO3Jsnw aQ+fLRw2LcAxCqPl9RP2nzQnv+tpASOp1E7q/cvxWqskGIER7avMZW/QDtNCO1SFQz56 G1rpPrQc0uTvd/l0EnmdPFniCYu/UZa5nFXRGE7ZYyB0rWCBHKE6ZiXksVOFdbhhWF/d qhRg== 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=BvlVp4ydOaT4xsToEpbV7Hhk2H/YysuZ3Glc+0wvUWzy8UzGws8BF4/yawUdo0/dj/ 1PPk0KnooShoFEMXVm4t4Vob1XbUEB6l+OktAKzLs+3T8FdegiVAIFqFrqUHo1bBR2pr X/ZDBflwER7CmKCArP56oJ4YRy5iqQOZQ8pF6WwQfzE1EI3gkaZYDvlnol837BVnJeGj +WU4AuVCFma8XgGH2FFWt1l8xL2dddPqrsNOfuqG4v6MGXCZgtXdjmPvEvgeuflaC2mV 6rh7fBfSQogC/gSUw3woJV+8t6ooqKVJx0Ft7e6LW/Qx4DEtQjF/hznPzVABv7p9tmQ1 BSyQ== X-Gm-Message-State: AOJu0YzA5adQRrwuafJQiAXPhaQw8SbkVSiSkomJpdlPZc9q08eJKECQ bFBlDGX4J7lc91x24QiUMi0TIuJ/pg8cFyPXRP5CWcnpPIcBP+AI1xfEZQXty11Cbv2LqkkWz6q Z X-Gm-Gg: ASbGnct5ev6AEBf0Sq+G2bAhzEP9vUtSugOGPs33iyQ/kK8sW0QsTniVJ3BrWAXFZ+F tfww1L8TtygB7puTjyxOFbyBU+pWtkge26d0axl51+MrXJTq11PsmXvnFESll2Wh2rdZkZnhnue mWRbnZU8q3cIXbAzRRz9KYIixdkscwAMItCXrIvQ84Na8k0umLq2Wt5pSPIjpULZkP0j2yv6eRY aj3GeqFiMF/BMg2Z/LGkXnvBb3rGXKjp3lY+bX0E8JxnD0YX439yReA5E5viOCM/2ooZixjMQ79 HnHi 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org '-device vmcoreinfo' is replaced by '-object vmcore-info'. Signed-off-by: Philippe Mathieu-Daudé --- 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. Use ``-run-with user=..`` instead. +``-device vmcoreinfo`` (since 10.0) +''''''''''''''''''''''''''''''''''' + +Use ``-object vmcore-info`` instead. + User-mode emulator command line arguments ----------------------------------------- From patchwork Thu Dec 19 15:38:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 13915254 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4B1EE7718A for ; Thu, 19 Dec 2024 16:32:58 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOJIp-0002Be-BE; Thu, 19 Dec 2024 11:23:07 -0500 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 1tOId5-0004vb-5X for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:59 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOId3-0004ZZ-Cj for qemu-devel@nongnu.org; Thu, 19 Dec 2024 10:39:58 -0500 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-38632b8ae71so741999f8f.0 for ; Thu, 19 Dec 2024 07:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734622795; x=1735227595; 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=8jM7iK7CzjLBlq0GL2o2lmBr4BfhFWF4uDH24qr2bSs=; b=iqajmz2Tx9hR5muu1ccV6gqGBpBLH6QT5nNHZiqcYXc28xWOQq9toGzfqrOjACuTd0 T4bZGS0RQ7ClcCMJIlh/IxNrdiGI7WicqHLj0tnvvRKyYunz2P65J6ZZV8nv4CBd3beB HRx7gQ4/fSQV/5ZXXtKadvEiAjbhM+ZPsekUaN14LY9YtdvTSGQ94RnbEq9dAmavgoeN bt3YsYtFBt3vDOy0zUagKiUhX+Nn2BqKSXW5MTxETBhQl7FSF14tVaYfuJoeTGcZaDQ2 DrlzlUrZha1+Roj9p2ukXTM30nts2wJSCithlp+lmkQbOxVliVszkXOLpVTzvprXNtpu KZ8A== 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=hVFtiE/5ionemynn5AgUyUL+8X4Ez+2OTHu1Y5kj3UKWBR9g4YqccD1qfDG3G7eASN HknC2HgscIKCQFTdTeV4rYTxDkj/KOfsg2XggA9KWVFlzrdlcUrQgYYYVZSutnDY8hF2 E57IZ/JUgpb2kD8sSw/lAnMXe8GyCMKvXvNDoo1rki5OkppizSMmqpGB/a5Y79ID1hgw Kpa4MCVDu+VLWjsbZixFGXg7dDUJzJk1SBwZ+vGiH8zqSsZRp8dyxlGVhPW2ckCtx8oj y2Nu1S+oeejPAJqEs97si2Ct27+XPqcfJVhpb4xamUCRt2rD6YcxvpDBCC8U3HYJQbso eWeA== X-Gm-Message-State: AOJu0Yx10wCowDmu0D4H7kwKqkL4phT2mYlOVgD5K+1Io4SOcfBrutOg T6156hyCUODe7elcTbU7yuxs18i/AIp7UGUp4/7qE7MEe+uJ30hqyFnX7xqjRe/6RXHl4AmV1hG q X-Gm-Gg: ASbGnctqKeMN/yAVg5aSelYk89fHdkgZanivYKCdCaeCwxy5cU6Rg2xFDtLg3rU3tix +GEexLDyciPCBANR1gJc4AYxL/jrOmPhahmm306ynaJHtsLSh9j/7zs2KapVtvwfHNdU2u4Vty1 0P8YdfoH7hBITsQbUndTcavUsPNhPmflTjJ5ICOuQjglG/PfEb45xJJUY9HPLus7Lb7VggQXJgn +EbxvPZVSw/RLZke0k52ITdrCWTnhqBno6NN7ZKAZaK/msfv8ow74r2SWav0/WDGpG1Bln8bjsk McoP 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Ani Sinha , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , devel@lists.libvirt.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= 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 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé --- 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. Use ``-run-with user=..`` instead. -``-device vmcoreinfo`` (since 10.0) -''''''''''''''''''''''''''''''''''' - -Use ``-object vmcore-info`` instead. - 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 display output). But this was never intended or documented behaviour, so we have dropped the options along with the machine models they were intended for. +``-device vmcoreinfo`` (removed in 10.2) +'''''''''''''''''''''''''''''''''''''''' + +``-device vmcoreinfo`` has been replaced by ``-object vmcore-info``. + User-mode emulator command line arguments ----------------------------------------- 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 -#include "hw/qdev-core.h" #include "standard-headers/linux/qemu_fw_cfg.h" #include "qom/object.h" @@ -26,7 +25,7 @@ DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO_DEVICE, typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo; struct VMCoreInfoState { - DeviceState parent_obj; + Object parent_obj; 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 = cpu_to_le16(FW_CFG_VMCOREINFO_FORMAT_ELF); } -static void vmcoreinfo_realize(VMCoreInfoState *s, Error **errp) +static void vmcoreinfo_complete(UserCreatable *uc, Error **errp) { + VMCoreInfoState *s = VMCOREINFO(uc); FWCfgState *fw_cfg = 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; } + 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, Error **errp) vmcoreinfo_state = s; } -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; } -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 = USER_CREATABLE_CLASS(oc); @@ -119,25 +110,7 @@ static void vmcoreinfo_class_init(ObjectClass *oc, void *data) rc->phases.hold = vmcoreinfo_reset_hold; } -static void vmcoreinfo_device_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc = DEVICE_CLASS(klass); - ResettableClass *rc = RESETTABLE_CLASS(klass); - - dc->vmsd = &vmstate_vmcoreinfo; - dc->realize = vmcoreinfo_device_realize; - dc->hotpluggable = false; - set_bit(DEVICE_CATEGORY_MISC, dc->categories); - rc->phases.hold = vmcoreinfo_reset_hold; -} - static const TypeInfo vmcoreinfo_types[] = { - { - .name = TYPE_VMCOREINFO_DEVICE, - .parent = TYPE_DEVICE, - .instance_size = sizeof(VMCoreInfoState), - .class_init = vmcoreinfo_device_class_init, - }, { .name = TYPE_VMCOREINFO, .parent = TYPE_OBJECT, @@ -158,10 +131,7 @@ VMCoreInfoState *vmcoreinfo_find(void) { Object *obj; - obj = object_resolve_path_type("", TYPE_VMCOREINFO_DEVICE, NULL); - if (!obj) { - obj = object_resolve_path_type("", TYPE_VMCOREINFO, NULL); - } + obj = object_resolve_path_type("", TYPE_VMCOREINFO, NULL); return obj ? (VMCoreInfoState *)obj : NULL; }