From patchwork Tue Feb 20 16:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 774275 Delivered-To: patch@linaro.org Received: by 2002:a5d:4943:0:b0:33b:4db1:f5b3 with SMTP id r3csp1730326wrs; Tue, 20 Feb 2024 08:08:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXMKKB2gm+EIdm1V+qdZFFUR1bBJQedZrmy6jUJBzLRC7ABiNiLCMqn7htBgL05ylzU3Y05s8Lwf3g+cyT97/GJ X-Google-Smtp-Source: AGHT+IEiJr+bE9SE6bxbS7nDc414BVGHvJi1wR770PFwtrFIlQAOSPlvlUe4bQ8ZgWrf5HaNOdpN X-Received: by 2002:ac8:5e52:0:b0:42d:bf79:52f with SMTP id i18-20020ac85e52000000b0042dbf79052fmr24023640qtx.48.1708445288645; Tue, 20 Feb 2024 08:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708445288; cv=none; d=google.com; s=arc-20160816; b=YDKOXYkVIauChPjDlgKerT1tXd/aJKhlgZG77epaMUjaeUqnx1QQK++LIh/mjrf0Ln 857SgpYSuwMnHP6uqpvk3OpCA3nDayxmQc4bAlTKlldfRjKKbf+u0cqXz35FgS0lt920 bm9hTu4dkiYll2QUvPazQu4J9dJdJcWzJAVdJsG3oYceR6FXM5oi/e/iaj1PBPHlkjnz HSuE6ZgKIoTDlwbZ4VRepB2k9mUyx91rMKXbMjqA0mcIThrY3bQOk/1kNAjyMktPAW8W z3KkTCfPR/37CriYl+N2vy2fqRHUDOGOCh+zGXaXz5EfPsPH4YoHNiIs/3w2sMW5B7Sr 8Ukw== 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:cc:to :from:dkim-signature; bh=6eEhRf5RLTQy0GPZo/ROl5SoGHEpglCPsB5KIAdpHko=; fh=dm0WNFmBzWrd+9ibIS2DbEOUrG4x0hquFjik6cek7jE=; b=WozISgL4c9LnZPvrCbM5BCsdZV5lTMdh/CoPeQ2ENhQQ5IidALXOM2I3Pp6X6jhdT7 8jZ/zCr7du02ExXums2PIRGlX/UNA9fYqDa95ww76YFDvy7Umbp2ckOBrIwzmdlR2+/U Yafi29UB0BNiJJxYIj8XmuCp2zgKzn1IILHpI2+MIk6YRT7WPIlKc+psessSFv4yPvPJ 3CmHxNLoPl6LfjtoLetp+A7L3ZMsUNCiHhqodisFGKrQm/7zZAOo+xEyHYJeOlZDPznG IBlrCO3FUS6NxDux4mnoRp20VzenZoCEGgL025Nv8lXgKsKNVbP/sKD9to3tJ5WdFP2d 8SnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iUJQQq00; 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 ay18-20020a05622a229200b0042e141fa5b4si4679102qtb.529.2024.02.20.08.08.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Feb 2024 08:08:08 -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=iUJQQq00; 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 1rcSdc-00026k-G0; Tue, 20 Feb 2024 11:06:32 -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 1rcSdb-00024v-5N for qemu-devel@nongnu.org; Tue, 20 Feb 2024 11:06:31 -0500 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rcSdZ-0005F5-8c for qemu-devel@nongnu.org; Tue, 20 Feb 2024 11:06:30 -0500 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2d247c31e1aso11086971fa.1 for ; Tue, 20 Feb 2024 08:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708445187; x=1709049987; 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=6eEhRf5RLTQy0GPZo/ROl5SoGHEpglCPsB5KIAdpHko=; b=iUJQQq00zo4oqxdp9VrlBNa2jQvbD0wkbfzIXNUCYCqLre5TuGcdM15+cPBoUMUmuY A8gYeMyc2bixHOD4CjttYCEhdA/OIEhXqqacWD3hR4y7IqhGz3LGnXBHY/cdVUtgXZ0R U0OVCSB7edOQP82oZEzhkGVW/JNyz5OjWq60xbGf3/wcgHv3G4HUeDH5mv8YfaCdHtkE jPv/Ja82Sb07dTHSwcqS158nVA7nma10kIx4FbHmNvrRpfHB2DEGvOdoU2XzcaGP9MIz ZS/AK91oUMDdjzqRBD5i5xiW0arVknT/MBXZsIBiRUHEygX41npUG8N0a+XatlW7AshJ 9BIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708445187; x=1709049987; 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=6eEhRf5RLTQy0GPZo/ROl5SoGHEpglCPsB5KIAdpHko=; b=iQoPBCYGU8V8f7Y88qBj4pDbz1qKZqoWDKzi0HtIROiBPXUpT+CFX3a9nstZ5DjWU6 jdQvC+xnIRA0lD4Xb4Op5m6bU943SO0u6klneQhjUtobNymKIuj3Wof5xSKKp75w4yhF qaw+L/Jv9CnzNJ/CObrS9R9TO9PRwCrQl+DEh4qo3P2V9LMsT+6/eK8XcEV0rUDyXmvx ElTdkEfQoN9OinYnOmnC2nUbpRdpJGsegdhH8DNNPHW/wU8B27GD20EhY8R4YtiWz4aj zvtB48gGy1brjXXQXD2nA2AfjDjKPC/u4LC3FqCMqbRU2hwQt9vC8WL+1NMYP/I5mDmt /5Rg== X-Gm-Message-State: AOJu0YxRKzkzwS6dar3O2/ENstQljRSoEKmDNU0Gd53rbcKdC/eElfwh xdNmVkXWZeq37fp97ASKQjGppdt9FNAtV9YzuppNB6dMRYob2YgsLQLLz4hUSX/aEpTvJynI2de M X-Received: by 2002:a2e:b165:0:b0:2d2:3ec0:29dd with SMTP id a5-20020a2eb165000000b002d23ec029ddmr3254741ljm.39.1708445187580; Tue, 20 Feb 2024 08:06:27 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f8-20020a05600c4e8800b0040f0219c371sm15299927wmq.19.2024.02.20.08.06.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 08:06:27 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , "Michael S. Tsirkin" , "Gonglei (Arei)" Subject: [PATCH 05/10] hw/core: Add documentation and license comments to reset.h Date: Tue, 20 Feb 2024 16:06:17 +0000 Message-Id: <20240220160622.114437-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220160622.114437-1-peter.maydell@linaro.org> References: <20240220160622.114437-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=peter.maydell@linaro.org; helo=mail-lj1-x230.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, T_SCC_BODY_TEXT_LINE=-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 Add the usual boilerplate license/copyright comment to reset.h (using the text from reset.c), and document the existing functions. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Reviewed-by: Zhao Liu --- include/sysemu/reset.h | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/include/sysemu/reset.h b/include/sysemu/reset.h index 609e4d50c26..6aa11846a69 100644 --- a/include/sysemu/reset.h +++ b/include/sysemu/reset.h @@ -1,3 +1,29 @@ +/* + * Reset handlers. + * + * Copyright (c) 2003-2008 Fabrice Bellard + * Copyright (c) 2016 Red Hat, Inc. + * Copyright (c) 2024 Linaro, Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + #ifndef QEMU_SYSEMU_RESET_H #define QEMU_SYSEMU_RESET_H @@ -5,9 +31,62 @@ typedef void QEMUResetHandler(void *opaque); +/** + * qemu_register_reset: Register a callback for system reset + * @func: function to call + * @opaque: opaque data to pass to @func + * + * Register @func on the list of functions which are called when the + * entire system is reset. The functions are called in the order in + * which they are registered. + * + * In general this function should not be used in new code where possible; + * for instance device model reset is better accomplished using the + * methods on DeviceState. + * + * It is not permitted to register or unregister reset functions from + * within the @func callback. + * + * We assume that the caller holds the BQL. + */ void qemu_register_reset(QEMUResetHandler *func, void *opaque); + +/** + * qemu_register_reset_nosnapshotload: Register a callback for system reset + * @func: function to call + * @opaque: opaque data to pass to @func + * + * This is the same as qemu_register_reset(), except that @func is + * not called if the reason that the system is being reset is to + * put it into a clean state prior to loading a snapshot (i.e. for + * SHUTDOWN_CAUSE_SNAPSHOT_LOAD). + */ void qemu_register_reset_nosnapshotload(QEMUResetHandler *func, void *opaque); + +/** + * qemu_unregister_reset: Unregister a system reset callback + * @func: function registered with qemu_register_reset() + * @opaque: the same opaque data that was passed to qemu_register_reset() + * + * Undo the effects of a qemu_register_reset(). The @func and @opaque + * must both match the arguments originally used with qemu_register_reset(). + * + * We assume that the caller holds the BQL. + */ void qemu_unregister_reset(QEMUResetHandler *func, void *opaque); + +/** + * qemu_devices_reset: Perform a complete system reset + * @reason: reason for the reset + * + * This function performs the low-level work needed to do a complete reset + * of the system (calling all the callbacks registered with + * qemu_register_reset()). It should only be called by the code in a + * MachineClass reset method. + * + * If you want to trigger a system reset from, for instance, a device + * model, don't use this function. Use qemu_system_reset_request(). + */ void qemu_devices_reset(ShutdownCause reason); #endif