Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1116442imm; Wed, 1 Aug 2018 10:27:04 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfUUI5bWyzt994NNBkftvs5JRfBJgZYGhLNj3SCjyDSuRQZiJGN5uggOiCVPN3ZKU/6A7eC X-Received: by 2002:a63:ba10:: with SMTP id k16-v6mr25853375pgf.145.1533144424536; Wed, 01 Aug 2018 10:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533144424; cv=none; d=google.com; s=arc-20160816; b=bTm6xisMmAnZlFNMOSQz1crfDz9g4Up914S8kQv1X5AsftBLeXKy45wUgwc4/IK3J5 JB1G8q1bopagDgvEFTnlhIV8rYWaxhb9ebgCY3sW5qJqfWBw/f1ZbBNyNSPY1Qdwm9Lr Iie6wdPhZrEAZw7iIdQpGNkpRBOrzs+KVeTo3SmoiIMMK41jyoB0jIesYbEODdvyScBw ZCcKZC0WsxnzPygKIOKTHo79gj8Zo+QipWcra5cp2k3SMHM9gtR87/0Is5CjVmrm1K3z /ypRhw1ueQTeiByk5K8bMe7OHZJTGp4EMZ1CV+f4KIsyHViTYtDwocVonDSZX8FlbMU5 gcpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FcAsAKux4cPU/zZxvDIsLX7hCR8ZJku6SZjlvojKLAY=; b=DMtYchUIkxegGgdDIgKjGEA8Bz8RuzCPhqLnD53GfDhOUciGBLlKeAW7MNVBMqu3NL EaZMxNeoz+kQoWZbUFoPes1IjDYtOpssgMQQR+92BAtG1/eQpazfyT6FN4rSJHpa8DVS BJi/vfXcW0kNuTdp4xBeIameDuIWCDN5YHGhMrm49oo1eHaykOsPmXVo7Wh2RFbeAmYq Q4mgIDxaDlzVWfQioJdxxnDYmVdnaHyQOkYNBVnI4DjMNBMno/OKVk2TXauoI5SO3tRY cZ8uhZFGYAN76d7KIJvGHuygskXtWk/3JHl4CaQRFYsgdrlKyYDDDokzzN8eQfKn6U6s MDqA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17-v6si17376237pgk.135.2018.08.01.10.26.49; Wed, 01 Aug 2018 10:27:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406578AbeHATLM (ORCPT + 99 others); Wed, 1 Aug 2018 15:11:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51144 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405332AbeHATLM (ORCPT ); Wed, 1 Aug 2018 15:11:12 -0400 Received: from localhost (D57E6652.static.ziggozakelijk.nl [213.126.102.82]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 21D21CC9; Wed, 1 Aug 2018 17:24:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugeniy Paltsev , "David S. Miller" Subject: [PATCH 4.14 237/246] NET: stmmac: align DMA stuff to largest cache line length Date: Wed, 1 Aug 2018 18:52:27 +0200 Message-Id: <20180801165023.090411540@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180801165011.700991984@linuxfoundation.org> References: <20180801165011.700991984@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eugeniy Paltsev [ Upstream commit 9939a46d90c6c76f4533d534dbadfa7b39dc6acc ] 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -51,7 +51,7 @@ #include #include "dwmac1000.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 */