From patchwork Fri Dec 16 21:42:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 634498 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1088240pvb; Fri, 16 Dec 2022 14:32:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4SZRnKkRDFcphtjFkMPpNZ/6olknkuW7yF+iEQWjo/d9sU3bLxzOm/CubyzDxa7KBE66ah X-Received: by 2002:ac8:7148:0:b0:3a8:faf:296a with SMTP id h8-20020ac87148000000b003a80faf296amr31978997qtp.54.1671229941054; Fri, 16 Dec 2022 14:32:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671229941; cv=none; d=google.com; s=arc-20160816; b=UMW94qPyVW20hGl8WJNVgYCqs3ybLAb8FXF33MxladEeo4//RQMcXsDYb5r5nqUKAK QWZB3RIBw3A9T4zr2vpIFURgBXpzvhsfmEEwLlzJQam/gXToh86daVvfoJYl+43mtAYa WA8OKdvqPkavf3XzjMfDS1REb0MPiY7XDPbawLwySOGp9W60e5SDcXIuVIIMWULKryNc wG+1iEQvN4c/0g3sjRQKwJTEh6SQFKcjZ+orHXaIOBUBXpqfrEa/7mEzavc7qRJVrwwI QOl1ASthwiZV9mKuqzxw4I3HZMc9+LNvGfFcRq459SkMWF7SyXgqh+mYtE/Rm5a8j/w2 7ziQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=W1JmqKacM9m8zOcJKdX5kBax+NSgUM13DsFDzRHKMZY=; b=0hNEJlPoSCAlY5oyuweuP2VYsKOakhyuKkRIVyQMNzYfv8XlzfeFUIJ5L9jACWSxs+ a4m63t8obOaNuaq1/+Yq0USzrbyDG9QBO8O1fQ4uEwoi+7ymxHpLSvKDGbcGgNIghmU9 UqX6xYjzdkag1Cl6kFws22kasVDZJyEJ6V9y1IwjJuDfqpIDue3CLMvhoTg9oENn3gBP f8AkVAC67fTnhFkoPXFqIpQST4pwJSuYqTr6i4PAPLFr2Gp7IZHIMcIlRDfz47YWm+Km +vgVyT9A6UT49416v+huAoXeL64Jh1R4amOHnLcFS/IZFjXrutAQOeDsM0JwjB3RMCNc XIZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IpRsAea5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fc20-20020a05622a489400b003a7f597c01asi1591678qtb.787.2022.12.16.14.32.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2022 14:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IpRsAea5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p6IV5-0006lL-0h; Fri, 16 Dec 2022 16:44:15 -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 1p6IUF-00066A-Dv for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:25 -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 1p6IUC-0000iy-GJ for qemu-devel@nongnu.org; Fri, 16 Dec 2022 16:43:23 -0500 Received: by mail-wm1-x335.google.com with SMTP id h8-20020a1c2108000000b003d1efd60b65so5041472wmh.0 for ; Fri, 16 Dec 2022 13:43:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=W1JmqKacM9m8zOcJKdX5kBax+NSgUM13DsFDzRHKMZY=; b=IpRsAea5we80r3KV7DT0PYJpVWBWz2DVg6RZjWbKAf1bVt3Qf0rOKuj13chZAgWnwX wdh2lNgpkduWKHJAJIDfzRjT6SMCFxQVCSrbLNvXAWwiUQBXKPJqlstI5m07q4c4Iqu5 a7vqxFdUthhoGXbkoQ3EXko9XFm/v6mAveRkMZTWNEHkgI7fcpkJnPBjrkMjNmXD80HJ 7IdVkM4YnEYkkvAdoDpMFggNEqLyn3rz2KkeO78BEH/Gcx+oegbGOg6EkyxVk+BTxWOG TNzOiv/dfvhCGYKK7cf0ohzM9VuBkZ6IagxeH+78/swV/r/5FaDNQIcFt3ATOnI5dQLe W4Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W1JmqKacM9m8zOcJKdX5kBax+NSgUM13DsFDzRHKMZY=; b=ca0m+8S4d2Rm/3LbCJZ8O3jxQePnDQI3zMLnYTWkzHGPC315a8TgPJ0yRHyR6/OkvG GiEkqItnhO6egUK7MsdXeFNHOAmUxN/TXGBoDELpG2wsLtE61WElVSlfNkQRudexRWKs eUqzyg/B5WlIhLBE0sptYW+hLnwaon0T2J0Bay9M0gVPqtj3XZEwIq1YGVRmoGrkoLg2 TbjdpNH6GygS4lKhqrmYjG1Qqp6fQed3otFc5nwcNvl4ELQNL+TS92sbtmqRy0RXawzg fLiXt5EfrVNI7shbSyJqatlrmKyDPskVKb+7gXeLXnuJcXSO7iWPcKhm41Wn8AapWDA6 9j/g== X-Gm-Message-State: AFqh2kooo3TXhrW5twRwaDszRjWvBgxbymYsvkdjV+m/x9OMJAodN27N 5p31jupEDytx/F6Yh1B0YAE6Kb9+k4v1qd8C X-Received: by 2002:a7b:c856:0:b0:3d3:4406:8a2e with SMTP id c22-20020a7bc856000000b003d344068a2emr3159801wml.15.1671226998129; Fri, 16 Dec 2022 13:43:18 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id y7-20020a05600c364700b003d33ab317dasm4135263wmq.14.2022.12.16.13.43.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 13:43:17 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 34/36] hw/intc/xics: Reset TYPE_ICS objects with device_cold_reset() Date: Fri, 16 Dec 2022 21:42:42 +0000 Message-Id: <20221216214244.1391647-35-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221216214244.1391647-1-peter.maydell@linaro.org> References: <20221216214244.1391647-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The realize method for the TYPE_ICS class uses qemu_register_reset() to register a reset handler, as a workaround for the fact that currently objects which directly inherit from TYPE_DEVICE don't get automatically reset. However, the reset function directly calls ics_reset(), which is the function that implements the legacy reset method. This means that only the parent class's data gets reset, and a subclass which also needs to handle reset, like TYPE_PHB3_MSI, has to register its own reset function. Make the TYPE_ICS reset function call device_cold_reset() instead: this will handle reset for both the parent class and the subclass, and will work whether the classes are using legacy reset or 3-phase reset. This allows us to remove the reset function that the subclass currently has to set up. Signed-off-by: Peter Maydell Tested-by: Daniel Henrique Barboza Reviewed-by: Cédric Le Goater Reviewed-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daudé Message-id: 20221125115240.3005559-6-peter.maydell@linaro.org --- hw/intc/xics.c | 2 +- hw/pci-host/pnv_phb3_msi.c | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index dcd021af668..dd130467ccc 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -593,7 +593,7 @@ static void ics_reset(DeviceState *dev) static void ics_reset_handler(void *dev) { - ics_reset(dev); + device_cold_reset(dev); } static void ics_realize(DeviceState *dev, Error **errp) diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c index 2f4112907b8..ae908fd9e41 100644 --- a/hw/pci-host/pnv_phb3_msi.c +++ b/hw/pci-host/pnv_phb3_msi.c @@ -239,11 +239,6 @@ static void phb3_msi_reset(DeviceState *dev) msi->rba_sum = 0; } -static void phb3_msi_reset_handler(void *dev) -{ - phb3_msi_reset(dev); -} - void pnv_phb3_msi_update_config(Phb3MsiState *msi, uint32_t base, uint32_t count) { @@ -272,8 +267,6 @@ static void phb3_msi_realize(DeviceState *dev, Error **errp) } msi->qirqs = qemu_allocate_irqs(phb3_msi_set_irq, msi, ics->nr_irqs); - - qemu_register_reset(phb3_msi_reset_handler, dev); } static void phb3_msi_instance_init(Object *obj)