Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp364185imm; Thu, 26 Jul 2018 05:06:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdLjjZlvg8RABgpAdz5Z3Z5wmZJiFm3fMn60I30RKURlzmK4N8Bv7rXwuBoATI4y675gXR5 X-Received: by 2002:a62:67c2:: with SMTP id t63-v6mr1881427pfj.204.1532606813816; Thu, 26 Jul 2018 05:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532606813; cv=none; d=google.com; s=arc-20160816; b=MbMzMK//6rBJ5J6i+WG7HlsGmiw/EHcPE1EUNU4G1mkv8ONqqZTk14qCRnpXd4fdPq O/y3Iidk9hJBCsuQ3Q1or2rw72fupge01WghapA1YZkNUBcj4ltjwxtQLmriVpz4dXtX Xjh160DPCwLqaP1CbfOdx/EHKvfmYKH52iwvmdHcOxzTPExAPqF7jiHPAz3eBSHgW3yW 5yIk2yk/oHrUp0+EBbL+LZvax5noh75Z/nwx1/SIT1jd5LTNJC+a5O3gdRcQZAB000QG 6AL0feu6go5+QTIZfOpiPT0Y1V6K5KhmORGpQivMcgzDdpmTlEiMxtjNCKuf/akUdNvY UiUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=s7jZfI2b5V9H1JEsKLCR8mI7ARV2iUKkeumezvEu0hg=; b=Gqin3vCPb+rMIsDnfPRyrmqfED+a+KPuEKIFW/mb6OwS/jIPxQ7szbuYep/tvVevzY dnk2nFIyAgMDiGLwkwtJpN1oYA01T2GPMo4+Ming+bMvJn9vtr5rFYpuuI1q94MD7qeV Mq3007U0kLJLTwBOrOGbiRG/ADtjJpUJwD9lspRkCvvei7kC42KXDLTm7JdwcknXynwV N0zTkrRgmN010MIUh8LQz0rFF8UzR7zXakg2sgIvp5ef4pDUvxb70YWM6tj79voRN4Vw nLXa3dhtsz36SRgDshcoJJ5iJQHIN5UAfswCdxx+RHkSCJxYKsESPKbxc6RrYpV1oKAN 8OmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=ma+DC0Bv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t90-v6si1224708pfi.221.2018.07.26.05.06.38; Thu, 26 Jul 2018 05:06:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=ma+DC0Bv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730036AbeGZNWP (ORCPT + 99 others); Thu, 26 Jul 2018 09:22:15 -0400 Received: from smtprelay2.synopsys.com ([198.182.60.111]:54391 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729399AbeGZNWP (ORCPT ); Thu, 26 Jul 2018 09:22:15 -0400 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 Cc: linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, "David S . Miller" , Jose Abreu , Alexandre Torgue , Giuseppe Cavallaro , Eugeniy Paltsev 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 */ -- 2.14.4