From patchwork Thu Jul 26 12:05:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 949601 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lkAMVgfX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="ma+DC0Bv"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41brQv3DZJz9ryl for ; Thu, 26 Jul 2018 22:05:59 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=GDr1GB+SvfpkmDQomNTImz7kQcyPrbRx6MN7Cf2SxdY=; b=lkA MVgfXf4L9Rss/AmGAm5o6AMrchpcAG7ycaSQM28V0icWiHo9L6Co9I3K3hsFr9LYH7u1SezrM7WMW rjicEXE8x91RITNXhE7VOnl7U5SNRTjUV/Gky1StsEQdv0IQcLQI5FhGNUpZAn00Vwcd1Zk25InvM eNO9So/CLIbHxSMIPzl59+gHdvoF3PsgxTlduGry1aFamzhnrv3/zU2nZPY01dgG4JaQkWDcCjWyy VGll1Y76WoxaonPrb9BC5D16T4KtAbKOI3+wrofe4aSxo/LM7g1NBQt5iHs0SjkyjaW7dC31oeuZR FkYBimHwa8OyzyYbTBPM/Ui8/Vdq5yw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fif1p-0003jj-Bc; Thu, 26 Jul 2018 12:05:57 +0000 Received: from smtprelay2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fif1m-0003iK-Fp for linux-snps-arc@lists.infradead.org; Thu, 26 Jul 2018 12:05:55 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id DBABB10C1058; Thu, 26 Jul 2018 05:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1532606743; bh=BJbcTjXXv9GeS0h8cmCwzPh3zo7XQ0RmAYG3l19c++g=; h=From:To:Cc:Subject:Date:From; b=ma+DC0BvYE5YC9zjUuJXgkLFahFcdhaaWYFAw5+cKHtOa7vcjEZloSJgY6MMDGwWY 9fG6zSw2Xmq6OKaOrSD2SS0NUT8J8z4opT1SojIUAGGqq0/EAloSf2YHSjEtphXd52 9fvk6ZmkGy7glJ384c0lShtXsBIc+518pWo9MrTHEga8pFbb2WcjT0ErsmRSsUOmjx +j4jzoIoit7SXnn9jCHGIo/4pI1DZgxJcO+cw/1xTIDhYd3cheS5eC+6iBIrn0Ll3k EMDR2KHtJwR6sJfwHHvpHdg7yLFvjUaH9zBYK+OCLffsMh1WpR+o/y0jiB7hr//fVW 0su0OUMTrv2+A== Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.8.86]) by mailhost.synopsys.com (Postfix) with ESMTP id 5BF0058CC; Thu, 26 Jul 2018 05:05:41 -0700 (PDT) From: Eugeniy Paltsev To: netdev@vger.kernel.org Subject: [PATCH] NET: stmmac: align DMA stuff to largest cache line length Date: Thu, 26 Jul 2018 15:05:37 +0300 Message-Id: <20180726120537.4664-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180726_050554_537821_C8F4E1EC X-CRM114-Status: UNSURE ( 9.45 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jose Abreu , Alexandre Torgue , linux-kernel@vger.kernel.org, Giuseppe Cavallaro , linux-snps-arc@lists.infradead.org, Eugeniy Paltsev , "David S . Miller" MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org As for today STMMAC_ALIGN macro (which is used to align DMA stuff) relies on L1 line length (L1_CACHE_BYTES). This isn't correct in case of system with several cache levels which might have L1 cache line length smaller than L2 line. This can lead to sharing one cache line between DMA buffer and other data, so we can lose this data while invalidate DMA buffer before DMA transaction. Fix that by using SMP_CACHE_BYTES instead of L1_CACHE_BYTES for aligning. Signed-off-by: Eugeniy Paltsev --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 60f59abab009..ef6a8d39db2f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -53,7 +53,7 @@ #include "dwmac1000.h" #include "hwif.h" -#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x) +#define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES) #define TSO_MAX_BUFF_SIZE (SZ_16K - 1) /* Module parameters */