From mboxrd@z Thu Jan 1 00:00:00 1970 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 91E41C46CD2 for ; Tue, 2 Jan 2024 09:56:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rKbUR-0001kg-IG; Tue, 02 Jan 2024 04:55: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 1rKbUP-0001kO-LN for qemu-devel@nongnu.org; Tue, 02 Jan 2024 04:55:13 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rKbUO-0003uY-5k for qemu-devel@nongnu.org; Tue, 02 Jan 2024 04:55:13 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40d604b4b30so24378675e9.1 for ; Tue, 02 Jan 2024 01:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704189310; x=1704794110; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=s6sOi38o/SqF7CiDtVKhEvCBZFji1LtubOV01ywXIog=; b=A4+3dIvaODFN1fx041FYK55gN/dW4Jra2PMHIFE7IrD3/IzSiWWUkSQ9fwGfHGMMqc wzzCo/sA07+hZGgiQFyj0N3qYq//FfvNJc6fuMkvl0/geae9JaqK6999CueiaqJqqKVR ptxgPI/3nH94uZ2dQBaVq99E4zj4qOLF//viDOaFAzHQfhvF8K+eHXMdkFXpxcbWma+j eL57YKvusx1cdn9HnREomAdONJ8vpjgis2vCuPiHCEFa+ML3kraQEJDqe11qoLCtwSVH +buJnwm9m40pLj7vzuJltDAcrvtQkf7pH6ucgl4Eh5KipgK5y6C6khwP9nBRD3y84RbX VUSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704189310; x=1704794110; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s6sOi38o/SqF7CiDtVKhEvCBZFji1LtubOV01ywXIog=; b=C1MSJSXbq5tUDsSrLpRT2bN/RN7Cx+4wgjy7j6smnbgR2kaAd8o9bPdbhsKcRftJqT D1SOF7zb2jnrGNJ4lbGQfYmKDJjGpgRt24Mvc5lcRYEZuG47ci8HiAnUo5DB07YKajY/ 1Hnbir0NWxX+SKhNjNtPIi9vimj5/68CnkPOm1Br2NI0FUQA+PHbamkbI2hSxFARTQA3 tgeQLD1ckv5064aAAjnhrBXOcIljSvgkTmtHGNvcqbZZPgk/phwisxTMwsBqVgBmGUO9 /SQdqRjEE4UOhtYD1ZZKWO4eRnMpY03XjgHoJJ5vEqW0HeonZgG2b6cW2iDF2/KsmtFx 2k/Q== X-Gm-Message-State: AOJu0YwnMrl/AmoD5/bO4DrtGzVKB3l95VKn1MtjUU2C0otFVBFvjm1J uGfnRD0Mr2ekFPyIYoBzlo7eU7+EzLTDlg== X-Google-Smtp-Source: AGHT+IHKVKnpDRXwJg2Ucwb9TUFSQIf63rJiYG1UqExbZirnMwu41K58XcluNhNxZjjo5pNydbdTIQ== X-Received: by 2002:a7b:c347:0:b0:40d:70c4:ff7c with SMTP id l7-20020a7bc347000000b0040d70c4ff7cmr3600114wmj.77.1704189310192; Tue, 02 Jan 2024 01:55:10 -0800 (PST) Received: from [192.168.69.100] (sal63-h02-176-184-16-71.dsl.sta.abo.bbox.fr. [176.184.16.71]) by smtp.gmail.com with ESMTPSA id a6-20020adffb86000000b003372befd19bsm9132875wrr.104.2024.01.02.01.55.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jan 2024 01:55:09 -0800 (PST) Message-ID: <4b157d2b-9b5c-4131-a06b-d964664f9576@linaro.org> Date: Tue, 2 Jan 2024 10:55:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] vfio/migration: Add helper function to set state or reset device Content-Language: en-US To: Avihai Horon , qemu-devel@nongnu.org Cc: Alex Williamson , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= References: <20231231104818.17666-1-avihaih@nvidia.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= In-Reply-To: <20231231104818.17666-1-avihaih@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 31/12/23 11:48, Avihai Horon wrote: > There are several places where failure in setting the device state leads > to a device reset, which is done by setting ERROR as the recover state. > > Add a helper function that sets the device state and resets the device > in case of failure. This will make the code cleaner and remove duplicate > comments. > > Signed-off-by: Avihai Horon > --- > hw/vfio/migration.c | 41 +++++++++++++++++------------------------ > 1 file changed, 17 insertions(+), 24 deletions(-) Reviewed-by: Philippe Mathieu-Daudé