Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2377306lqp; Sun, 24 Mar 2024 16:40:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCULNudZPNiJ4mludXZ2MdRjuP5KpDSBRVZ+oNOiyqxxBLeBcJLkWDYEJT5ayFFt8K58GA5gJRoJqjXyHk0zAjrIWWUHOo8ArtVDtKzqbQ== X-Google-Smtp-Source: AGHT+IEwnCy+4WbByUjLYoQLIM/ckLVopT6UxbY8kIgEqCFklpZKys1N1bVWK2dOSXnWb0INbBnX X-Received: by 2002:a17:907:9958:b0:a46:7794:2c00 with SMTP id kl24-20020a170907995800b00a4677942c00mr3739527ejc.40.1711323638017; Sun, 24 Mar 2024 16:40:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711323638; cv=pass; d=google.com; s=arc-20160816; b=H8YTFXII+yzs41J/mx+CE4L03gAQ0ixB4hY3oTkn5fXB9imUKHC5jeEfDW+XnbcaH8 GNiGAoFMCTW/6jAdu8ytxnLSShMa8jCuWZXx9G4VXKuJJWX6P7bl7Mi24JUee+O/IFGn E3WL7p6hVKI7z2xhTWoyJ0KO3WO5FZv4a1sKpb4aNGHOsm+BXOWOMT07rxr1TiTbY8bh ENFxQcwXNkfzDvPe8XUrkwyF/qcEABw7MINE3x2r6LvWHt2+ISVDNf0tREGaJj/tk/cb ya/c25wfDSax+KmM2U157/v/Lhdco1yEHWci96D/Q/x6Gg3Ryb10lr+x5cqtDbocmj1O Vb6Q== 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=foSPommnLORorgIS+Hw9B57LiZu/WjibhCLI621m6Lw=; fh=/5s2GkpjZkZdVYuzgiU4iok3EiBCuQywL+upIups42Q=; b=X1jwRxutg74WGGuBwG2vaAe8pblQeEJ6n+5JraiOMdRTcVPQlM69pknOGrvB7NKXR+ VhKhRDkmpQO7FVWu7TWTmEFKhcfEWJvAcsxAbTaBhJH26zoU2wLCDlzEb4xJytRdzjGE VUrG1rDge0AZflqJx8Qfo3HVG4qOk1+L85AoJxY+RD45G6PI85rVBtkwQU3/vaMovtH1 nhg/FtrktZ04AaekV/XwqYzZ5J8zNZNmR5Se0/cDua2fdcvJ/3TYImvwc2RiFI6VgwOp sEsxSjfjJrhPJEzltzDeP+yWsJEoasxd5TqO2pCL2ig1ujCzeKYMzGBi4xpbpc9chRKY qTng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6tbMvvp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113191-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f10-20020a170906138a00b00a4752d76022si850433ejc.595.2024.03.24.16.40.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6tbMvvp; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113191-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113191-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 am.mirrors.kernel.org (Postfix) with ESMTPS id BC5921F21D45 for ; Sun, 24 Mar 2024 23:40:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CA02179FA7; Sun, 24 Mar 2024 22:39:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X6tbMvvp" 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 18DDD179674; Sun, 24 Mar 2024 22:39:54 +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=1711319995; cv=none; b=Wa4TwMv6LWwdGKsJVj72cMqsHbEVhZ7h3clVhV46Voy7PLyh8J+dFVKWPYMcJAD3QukqWcJv3nLAZaK1yPXRLLbikBBf64leCNorNRRrPVsHS8LpCs0ixvLfsSuV8EUxn5zf4Lh7z9B0YvKL7ntHLH4pwy+SYiqpLnQzInwP7cM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319995; c=relaxed/simple; bh=pAKBOIgC4EEXttjYElQekc9pn6L7DPK0ZU2LJdE5KMU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GfiszJT2DKhUeENmNGIyNHWapyT6bUwj2VpsdLkel9+DOyBcjvLt5DFeSe6VOUl0N+idHYVnOgi6iI9r2AYyposJZ+52Gy/wQpG6tgboIG9mL9jPAzKAx/W9T57F73EM4IW8wKJeNLaVw3AVej+q/mF1LF35PaKcsaSFBeRJILk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X6tbMvvp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8DA9C433C7; Sun, 24 Mar 2024 22:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319994; bh=pAKBOIgC4EEXttjYElQekc9pn6L7DPK0ZU2LJdE5KMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X6tbMvvpznLYlMnhweRMgGluhZNxz3Z0YEvROsCeqGlvbjRGgt1AkJGFnZDdZDddl kctywlI9MdOyFPt9Z3ut8guIV5erT/53j2d4Z+h6OPYwcn4L3L/2PloWp0Kxs+nxfb FscoGkEDVBSSmnQOTGAYjHmH4j7Yh7/Ev1ZJ7drSdxC3CRp9ApAMTVDhDJkS3O7OXU cqPzgn+DUoBkJn+YRY8LZUD0cW/pEsTACgKgquHe5yHkFeR0CkuDnLVmJJZ50brSQd YUqb33SYrEtO2dnPOUOYVkYe+Qli3WSUj9aCw9qmthuw0GpNyEu/7WKSUq8iOWd5/Q wUpalK9a4OtQw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vinicius Costa Gomes , Richard Cochran , Pucha Himasekhar Reddy , Tony Nguyen , Sasha Levin Subject: [PATCH 6.8 300/715] igb: Fix missing time sync events Date: Sun, 24 Mar 2024 18:27:59 -0400 Message-ID: <20240324223455.1342824-301-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-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: Vinicius Costa Gomes [ Upstream commit ee14cc9ea19ba9678177e2224a9c58cce5937c73 ] Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed. The E1000_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1. The following flow was used: 1. read E1000_TSIRC into 'tsicr'; 2. handle the interrupts present into 'tsirc' and mark them in 'ack'; 3. write 'ack' into E1000_TSICR; As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed. Remove the extra clear in (3). Fixes: 00c65578b47b ("igb: enable internal PPS for the i210") Acked-by: Richard Cochran Signed-off-by: Vinicius Costa Gomes Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index cebb44f51d5f5..7662c42e35c11 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6985,44 +6985,31 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt) static void igb_tsync_interrupt(struct igb_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; - u32 ack = 0, tsicr = rd32(E1000_TSICR); + u32 tsicr = rd32(E1000_TSICR); struct ptp_clock_event event; if (tsicr & TSINTR_SYS_WRAP) { event.type = PTP_CLOCK_PPS; if (adapter->ptp_caps.pps) ptp_clock_event(adapter->ptp_clock, &event); - ack |= TSINTR_SYS_WRAP; } if (tsicr & E1000_TSICR_TXTS) { /* retrieve hardware timestamp */ schedule_work(&adapter->ptp_tx_work); - ack |= E1000_TSICR_TXTS; } - if (tsicr & TSINTR_TT0) { + if (tsicr & TSINTR_TT0) igb_perout(adapter, 0); - ack |= TSINTR_TT0; - } - if (tsicr & TSINTR_TT1) { + if (tsicr & TSINTR_TT1) igb_perout(adapter, 1); - ack |= TSINTR_TT1; - } - if (tsicr & TSINTR_AUTT0) { + if (tsicr & TSINTR_AUTT0) igb_extts(adapter, 0); - ack |= TSINTR_AUTT0; - } - if (tsicr & TSINTR_AUTT1) { + if (tsicr & TSINTR_AUTT1) igb_extts(adapter, 1); - ack |= TSINTR_AUTT1; - } - - /* acknowledge the interrupts */ - wr32(E1000_TSICR, ack); } static irqreturn_t igb_msix_other(int irq, void *data) -- 2.43.0