From patchwork Tue Feb 27 13:32:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 776221 Delivered-To: patch@linaro.org Received: by 2002:adf:a113:0:b0:33d:f458:43ce with SMTP id o19csp159931wro; Tue, 27 Feb 2024 05:44:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXvoB7nt5PKALm0wwS/3RsU2VsrQQVxSOK0oSy8JILnJfhibFLxIpcgi5Z/CF0J9FQ6SkFMJxbEMnxP2dZj5ISh X-Google-Smtp-Source: AGHT+IE0YZeEvXOrHnIWXcxnlZWloYCmzcGjqZaQWM4FRKNdcmJ3DvficCR93/4AzGo/ZwQvJkar X-Received: by 2002:a05:620a:29c8:b0:787:e5ed:4fb7 with SMTP id s8-20020a05620a29c800b00787e5ed4fb7mr1914314qkp.25.1709041452335; Tue, 27 Feb 2024 05:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709041452; cv=none; d=google.com; s=arc-20160816; b=Qr4ml5o3v9M8JKci+ze2eqaRw/n4CCxu0SmccJ0PfhWneqLuwKwPKDcP15fAxzMYth pDtXJZD0S0NMhSZpEMtzLIhsdf78cMEKNoVLE5WssornWMOlrSqq2cQFY/CtGCaaurr7 wjDb8o489jjucXLl8kRmAunFaLG0CAtlONrORb913Tqp+NQ9wKG7QWbts7N2gd/r+ggl roEjK8EH/xiRm5EllUDVZ5Npm4Djq5XW9ta2bsDWsaeLFIskV68jAa/RsFD0HPqpoo+T vfSeGh8gNDfPK3xHeWWVfFHiZuDWhzU6ttN3+apKpmPMW4CIAaxtheqZvfwENBxlOtgL 514g== 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=Ot/DCCzfEEMRuguhLsrlbJKXVHIQGJaIdaEMWlsQRG0=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=eYYorrnez42WrNTEWThBs7OVqq9VUWOEt+3hlC9ba7YP6ihrRZCE7U28sVDe8z++sl L6/k/GFSJJG3k0A02L7iVOb6ZGIKN2z37RoeayyurdTqCf2LodJRUxNXVElZxeGZD+g+ /OFWXM4N5i0V8FYp5+gV89AIkik4W3e/d356hNaqZHMDFBM3SUzjUJF7kkUaKDoS+DO9 vI/P80naqDtdhUdcEpOhO4NAJJMhy6TBuMr3Q2jI0bzu8vp8rdADI1m/kiijVf26x9hV xtoibdky8+RVJW1qcDs0zG2QxfX1fVxglPahgwPtdQFF55xKUq6h7Vse58Xhxa77HPx/ Dakg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pCudQqde; 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 c27-20020a05620a135b00b00787b9fa616bsi7445279qkl.441.2024.02.27.05.44.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2024 05:44:12 -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=pCudQqde; 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 1rexap-0000uD-7a; Tue, 27 Feb 2024 08:34:00 -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 1rexaO-0000ki-Os for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:33 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rexaJ-0002sv-QZ for qemu-devel@nongnu.org; Tue, 27 Feb 2024 08:33:32 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33aeb088324so2734232f8f.2 for ; Tue, 27 Feb 2024 05:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709040806; x=1709645606; darn=nongnu.org; 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=Ot/DCCzfEEMRuguhLsrlbJKXVHIQGJaIdaEMWlsQRG0=; b=pCudQqdelax8+ox6iak4SBF2V2rVDwKPaTxVXr9RY5xadj/CB6ho0uXE/HDno54h6Y JnX6EHnDq/+sAJXex5jfqET8cVs4vHy9bf5cMwy6FMyRpbOwqOpxyh+zn3HDHcuVkCmz 3Vji4VP1hGWHCC04Pi5drTwFE5c8cqEWkZP775wFMWvD+LPWCIBOlpblr8S83xIG9Ghh hG18Bi9JZH+01c8PkdrpcI1nPy7JDkWp8uuF9HJKrkk+nfV4MeenY3pBNclHwZ5C0DKi rWInY18FVkOJCPbB4eBwFQrBQOIA6FgHd/SFBdg+HhWIhKCm1fsLQRqtawIS7u0JFj7T FI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709040806; x=1709645606; 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=Ot/DCCzfEEMRuguhLsrlbJKXVHIQGJaIdaEMWlsQRG0=; b=UKfzFobq2Y5J1Syh1vet1IbP6KjX4o4JIxa9mxvydqgTHtS1NRqp+vAt/CKJUtrngj 8JfSh2kMWC6LBiXk5sovhGEessLS2qsJhyHLJwdeUc5+J+zTtqy+Wr9Ry5C5u3jHDW5z L/R0rNfx4eb6aBS9j5VdhS/WmAg1gMe2JsrAuX/mlT4urd7OcvmkYvo+YtgGoeaKR5DE c84p5IvkAcDnIhLrJ9zb9woyzKin0BPr1wRA7u1PInL9i/6e9FmG5k56+73weJADR4lh vioNzT+kNacnfroq+SkmTsv8xdaOULVbyyACgptouYtpygceyUGJpI8SeFL8Dvlpjxep aEwQ== X-Gm-Message-State: AOJu0YzvWqXamI0beG2XbSoZm6p3PqxUalbqXNJtqvGLApoSnkuAoH7+ 3YbvFlq5cjo+H40pVd+zlUBHTbjQjK+LsMER2g5xSG6zjNCVpyFc7yHg9jHTaf/msIR9w6xfMMh X X-Received: by 2002:adf:d1ca:0:b0:33d:f46f:6384 with SMTP id b10-20020adfd1ca000000b0033df46f6384mr994495wrd.23.1709040806229; Tue, 27 Feb 2024 05:33:26 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id i13-20020adfe48d000000b0033ae7d768b2sm11319552wrm.117.2024.02.27.05.33.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 05:33:26 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/45] hw/core/machine: Use qemu_register_resettable for sysbus reset Date: Tue, 27 Feb 2024 13:32:48 +0000 Message-Id: <20240227133314.1721857-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227133314.1721857-1-peter.maydell@linaro.org> References: <20240227133314.1721857-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42c.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move the reset of the sysbus (and thus all devices and buses anywhere on the qbus tree) from qemu_register_reset() to qemu_register_resettable(). This is a behaviour change: because qemu_register_resettable() is aware of three-phase reset, this now means that: * 'enter' phase reset methods of devices and buses are called before any legacy reset callbacks registered with qemu_register_reset() * 'exit' phase reset methods of devices and buses are called after any legacy qemu_register_reset() callbacks Put another way, a qemu_register_reset() callback is now correctly ordered in the 'hold' phase along with any other 'hold' phase methods. The motivation for doing this is that we will now be able to resolve some reset-ordering issues using the three-phase mechanism, because the 'exit' phase is always after the 'hold' phase, even when the 'hold' phase function was registered with qemu_register_reset(). Signed-off-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-id: 20240220160622.114437-10-peter.maydell@linaro.org Reviewed-by: Zhao Liu --- hw/core/machine.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index fb5afdcae4c..9ac5d5389a6 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -1577,14 +1577,13 @@ void qdev_machine_creation_done(void) /* TODO: once all bus devices are qdevified, this should be done * when bus is created by qdev.c */ /* - * TODO: If we had a main 'reset container' that the whole system - * lived in, we could reset that using the multi-phase reset - * APIs. For the moment, we just reset the sysbus, which will cause + * This is where we arrange for the sysbus to be reset when the + * whole simulation is reset. In turn, resetting the sysbus will cause * all devices hanging off it (and all their child buses, recursively) * to be reset. Note that this will *not* reset any Device objects * which are not attached to some part of the qbus tree! */ - qemu_register_reset(resettable_cold_reset_fn, sysbus_get_default()); + qemu_register_resettable(OBJECT(sysbus_get_default())); notifier_list_notify(&machine_init_done_notifiers, NULL);