Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2617462lqp; Mon, 25 Mar 2024 04:43:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvXe2uXkr6ej0YUoBMcQWhoZYmXNx9CzGU8FpztZENpAU/wyu6dzS+ctcE2ieKeGRKY8ztTNPp4h3xaHA+ZPwedfKa0K86FtJymWOahQ== X-Google-Smtp-Source: AGHT+IGMSrx8FPB16IiRk0vqRinpDxJQwyJdGxar7qmGo6FspFHjSS3W/Eu5PZVYxKoa/QzdIPPK X-Received: by 2002:aa7:8893:0:b0:6e7:48e3:7895 with SMTP id z19-20020aa78893000000b006e748e37895mr8910211pfe.2.1711366984548; Mon, 25 Mar 2024 04:43:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711366984; cv=pass; d=google.com; s=arc-20160816; b=QQLuimQxHEHPiAN5BTiQzvIWF/wIB/il/s6bTg6HUVBB94crBh4xEKGokETp6A5sdN q1NOpSALuCfGihUnitX7kHn8HxqlZpJFtMAhEndBF/kSZz2PFdNN1GtR5apsHDSon1/9 oNpTJ775Ylyb0Z9jsI04Y6xHYB+3n6d9NUpEGyiAoBX3l4f1NAMNbUUznAYJMazy25Wi /dUaBDAIxefoBSusRLRh4/HxFgcro+HGToWWxaZtV0iwJcXlRu8Ord1Or5rO6k1UpS4m 4axZVxFntxFX45o3hpyriHJsKSx1JC1vDvDfQG2bly4FJgCypG/274SFPJYRtK7xpN87 NJPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Xz9DJVYrSx6uF1m+X2tG7e+x40zKckI7V95wDN569/I=; fh=FUJ31+7wm/lsAjQLPGsshg0GwF/LrZd9HYdeGt+rGY8=; b=l9Zp/QB5hT3FdhZcjvNG6aTO1pmskvf6bylKdhCFR5FSQd1gqtIWIt1PElE7vv4aYH MGDUYSekTKp0lHIUKVx+NvmHrRD6ppVmi2uRV89F7IGtDqK5HT+3/ov6wbU5P4YFxHvG SyzQs1vZOmQgZSc0xoTMILjhmU4GY/txentorJ+HlTn024wxvp/P7UhDif2EGRhLocPj Bs0jwJanx1R5YfKWt/jvEn3k2t0kYscUWHBFwWyozjvPM3XluvZvMeYqaIqD+Wa1j6sD Tdwv3E2/jYhKVSOPa3b9X4jSxXogUIGGIXZXwX24zbHc5oeHfAMjkGuDbGHrMvroKumj ViEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u1qsPxTe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115316-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115316-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id be8-20020a056a001f0800b006e64519650esi33654pfb.205.2024.03.25.04.43.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:43:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115316-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u1qsPxTe; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115316-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115316-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D72F6B391D6 for ; Mon, 25 Mar 2024 10:34:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 697221DE9F1; Mon, 25 Mar 2024 02:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u1qsPxTe" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29BD18002D; Sun, 24 Mar 2024 22:48:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320507; cv=none; b=eUdQZ9Tuv4fpjh9Irm0zIU7KlAU0wwYTpKNkBeHR9KdUd4d9OPMsu93ulY3Y2Buu0FLpMvcyO7Xcg7G+/Ljnobe0xh8VKtOck3p3MC5Ajmyb+skaRjNbGuArJdpQr7jg/rwrkXknTfh0SgLVo8K9UgIwueVCqi8abC6m09wDrxQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320507; c=relaxed/simple; bh=CIckCfCvElbP7qNZyEFS868bjqgWhDCd+IzI7ldl7Hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tSUHL9v/FHK13MY88jZIt1u5ZItYQlRb0Mu5QakCtJPugCTMlR0yMgbxZ8oFLg6B2Ue+QZtgjucFcDcGk5orRwQLxy+gG1fUUVOxx7aK9Y+B/Q5Z1RGac+yTj3TXH5IzIMShfC2OmZzt3+rV2wMKWPGeYHd3RGbllvs85oRZJkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u1qsPxTe; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A5C2C433C7; Sun, 24 Mar 2024 22:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320507; bh=CIckCfCvElbP7qNZyEFS868bjqgWhDCd+IzI7ldl7Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u1qsPxTeJdpdTOr57F4JhGP3GGhQbE7SJCQ/zIys+dN0O2Z7jsDJCkefo81fmI/h2 AbIC5NTO9eaJ3pKsBQnzlqFu6dvWcd4fdVp/fAUmKJefyg7hK/1LhpmAjIt+LYh8Ee Ff6yM6PDbg3YWDcEdNboGjrRO7uqaZuiMtse/+En1mvMQ62jdInoLwj6QYONZqr3U6 Wo3wtj0ueXkWzhS6UCli0itKXL/7qPv+Sdc6EUSx/oOmHCIzrVtGXypnte+NCktnwE JLQ1VFFXqFNOlDd6HxAvJXpFEyIsincNgrenoJQraz8n1+UxirlGld8FJFfHGixrM+ brNRnHyUwNm0w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Sakamoto , Adam Goldman , Sasha Levin Subject: [PATCH 6.7 067/713] firewire: core: use long bus reset on gap count error Date: Sun, 24 Mar 2024 18:36:33 -0400 Message-ID: <20240324224720.1345309-68-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324224720.1345309-1-sashal@kernel.org> References: <20240324224720.1345309-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Takashi Sakamoto [ Upstream commit d0b06dc48fb15902d7da09c5c0861e7f042a9381 ] When resetting the bus after a gap count error, use a long rather than short bus reset. IEEE 1394-1995 uses only long bus resets. IEEE 1394a adds the option of short bus resets. When video or audio transmission is in progress and a device is hot-plugged elsewhere on the bus, the resulting bus reset can cause video frame drops or audio dropouts. Short bus resets reduce or eliminate this problem. Accordingly, short bus resets are almost always preferred. However, on a mixed 1394/1394a bus, a short bus reset can trigger an immediate additional bus reset. This double bus reset can be interpreted differently by different nodes on the bus, resulting in an inconsistent gap count after the bus reset. An inconsistent gap count will cause another bus reset, leading to a neverending bus reset loop. This only happens for some bus topologies, not for all mixed 1394/1394a buses. By instead sending a long bus reset after a gap count inconsistency, we avoid the doubled bus reset, restoring the bus to normal operation. Signed-off-by: Adam Goldman Link: https://sourceforge.net/p/linux1394/mailman/message/58741624/ Signed-off-by: Takashi Sakamoto Signed-off-by: Sasha Levin --- drivers/firewire/core-card.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 8aaa7fcb2630d..401a77e3b5fa8 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c @@ -500,7 +500,19 @@ static void bm_work(struct work_struct *work) fw_notice(card, "phy config: new root=%x, gap_count=%d\n", new_root_id, gap_count); fw_send_phy_config(card, new_root_id, generation, gap_count); - reset_bus(card, true); + /* + * Where possible, use a short bus reset to minimize + * disruption to isochronous transfers. But in the event + * of a gap count inconsistency, use a long bus reset. + * + * As noted in 1394a 8.4.6.2, nodes on a mixed 1394/1394a bus + * may set different gap counts after a bus reset. On a mixed + * 1394/1394a bus, a short bus reset can get doubled. Some + * nodes may treat the double reset as one bus reset and others + * may treat it as two, causing a gap count inconsistency + * again. Using a long bus reset prevents this. + */ + reset_bus(card, card->gap_count != 0); /* Will allocate broadcast channel after the reset. */ goto out; } -- 2.43.0