Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2630271rdb; Wed, 15 Nov 2023 06:26:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfPp+IWG9loe33p96VYbiAuVntrckO2JJqBA7SOb5U0MqTquw7mZz3i08hI6NEv2OC7YLM X-Received: by 2002:a17:903:2448:b0:1cc:be6b:80fa with SMTP id l8-20020a170903244800b001ccbe6b80famr7693020pls.12.1700058390220; Wed, 15 Nov 2023 06:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700058390; cv=none; d=google.com; s=arc-20160816; b=Ek5C4nC+Tc274WbUSkiMg2D7lltrK75Z6uL4L6Kq2LuCfZsV3y9533vCO35rNVnquE F6aio9a4HcM66YK5a8ci1lJz3elOwychpoK/F3EoUJn3xGN9uA34fH9E1vprBk+jGscs BuEdWqSTDh6noS9KrpsNkqc6ob7SnrJ0dmEr0s+UqX1GOFw80ZQ+G47rnNS72nPKQvRG /FGTiPPUocMqh+j38w0udoMOS416SMUKIuAZkiCHhpSd1NRaHv+anaE9VUsg8rNawEaO IC4NWLsXg8RzFq+U/flNuP4QQUaPJt4IaT8PqG7k3+bpmzfgPv43cR3lEMEylzlxSgcG vV0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9vAuO/jfgQB1UhChgmKpQEPKWuu2SwX00yO6kwgCd+o=; fh=2BVmbSh63GhMRD/0hdfGfO/4pW5fGa+MSzM5zSgdv/w=; b=FUmSHqFMMdDfR7E2aYYoAmK8Rh+oNTt6vVRhjQOv35gK1eWQbnWYGiUeCWFG70TtKH KgX+cr2FR8PyN9h/XAu3CeI1atBrJMwJpQoi+cocAT0nk8dqnFCq5sY+YDCYcsKLk6fL F7bdt3RoXMBSdLyANUCRH7+GHz5UucHn9BS5rvWlPNYp85C29d9yBmAKSKoo8B7VAlqm 6QrOggQ7pXm/XyW22DwfC3bZmuCT7MsPd5tfEuyMweXWZkBWVGt70japdqddf0Nx6iI5 Ju9RkNASvhYg+rz4K7jsAykLPSz34Id5qQS16tAZT4ahcqYe9VhB2hBfvZ95JKesYMSv LVqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=R4lvU8ao; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u10-20020a170903124a00b001c9e890f42bsi10606173plh.78.2023.11.15.06.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 06:26:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=R4lvU8ao; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 12F288059E53; Wed, 15 Nov 2023 06:26:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344193AbjKOOZ5 (ORCPT + 99 others); Wed, 15 Nov 2023 09:25:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344116AbjKOOZ4 (ORCPT ); Wed, 15 Nov 2023 09:25:56 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050FCC8; Wed, 15 Nov 2023 06:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=9vAuO/jfgQB1UhChgmKpQEPKWuu2SwX00yO6kwgCd+o=; b=R4lvU8aoiGhmjKhmijiJcU0iOy cAFpoOGF6geENuGKG0YERvll8BorOKMgpETeDfOenRJ/baC0yUb/LPQ0bzEvibDeTEx8pg+UqzJZX DiXzYAyu6xh2RAcZXaVmLLSkf6ebbkDE7vk0n7xZsoLaCoCOF0NfWiYw7vHbCRCpaFkYy7OQpB8c5 dWL+bu3jjtB+rceCR1XlxEtTlIdNgmzKQDYzsPgxInn4wZHAlnohohCygd0SX3BRLblu85XHopmUc a4Lx7XLISx0Zxo2gBolM+cmym5uUH1Xzw+aDc+vdTdYCQ3oWa1BaofAM5/ulIgY9uU2e1ToyOux04 nclip+Sw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:50016) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1r3Gpl-0000md-0s; Wed, 15 Nov 2023 14:25:37 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1r3Gpl-0006ec-5X; Wed, 15 Nov 2023 14:25:37 +0000 Date: Wed, 15 Nov 2023 14:25:37 +0000 From: "Russell King (Oracle)" To: Serge Semin Cc: Jianheng Zhang , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Tan Tee Min , Ong Boon Leong , Voon Weifeng , Mohammad Athari Bin Ismail , "netdev@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] net: stmmac: fix FPE events losing Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 06:26:00 -0800 (PST) On Tue, Nov 14, 2023 at 02:59:57PM +0300, Serge Semin wrote: > On Tue, Nov 14, 2023 at 11:07:34AM +0000, Jianheng Zhang wrote: > > The 32-bit access of register MAC_FPE_CTRL_STS may clear the FPE status > > bits unexpectedly. Use 8-bit access for MAC_FPE_CTRL_STS control bits to > > avoid unexpected access of MAC_FPE_CTRL_STS status bits that can reduce > > the FPE handshake retries. > > > > The bit[19:17] of register MAC_FPE_CTRL_STS are status register bits. > > Those bits are clear on read (or write of 1 when RCWE bit in > > MAC_CSR_SW_Ctrl register is set). Using 32-bit access for > > MAC_FPE_CTRL_STS control bits makes side effects that clear the status > > bits. Then the stmmac interrupt handler missing FPE event status and > > leads to FPE handshake failure and retries. > > > > The bit[7:0] of register MAC_FPE_CTRL_STS are control bits or reserved > > that have no access side effects, so can use 8-bit access for > > MAC_FPE_CTRL_STS control bits. > > > > Fixes: 5a5586112b92 ("net: stmmac: support FPE link partner hand-shaking procedure") > > Signed-off-by: jianheng > > --- > > drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c > > index e95d35f..7333995 100644 > > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c > > @@ -716,11 +716,11 @@ void dwmac5_fpe_configure(void __iomem *ioaddr, u32 num_txq, u32 num_rxq, > > u32 value; > > > > if (!enable) { > > > - value = readl(ioaddr + MAC_FPE_CTRL_STS); > > + value = readb(ioaddr + MAC_FPE_CTRL_STS); > > Note this may break the platforms which don't support non-32 MMIOs for > some devices. None of the currently supported glue-drivers explicitly > state they have such peculiarity, but at the same time the STMMAC-core > driver at the present state uses the dword IO ops only. For instance > the PCIe subsystem has the special accessors for such cases: > pci_generic_config_read32() > pci_generic_config_write32() > which at the very least are utilized on the Tegra and Loongson > platforms to access the host CSR spaces. These platforms are also > equipped with the DW MACs. The problem might be irrelevant for all the > currently supported DW MAC controllers implementations though, but > still it worth to draw an attention to the problem possibility and in > order to prevent it before ahead it would be better to just avoid > using the byte-/word- IOs if it's possible. Yes, this exists for configuration accesses, and is damn annoying because the read-modify-write of these can end up clearing PCI status register bits that are W1C. I've never heard of that problem with MMIO though. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!