Commit 2d761b12 authored by Eugeniy Paltsev's avatar Eugeniy Paltsev Committed by Kleber Sacilotto de Souza

NET: stmmac: align DMA stuff to largest cache line length

BugLink: https://bugs.launchpad.net/bugs/1791953

[ Upstream commit 9939a46d ]

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: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent ef1a81bb
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#define STMMAC_ALIGN(x) L1_CACHE_ALIGN(x) #define STMMAC_ALIGN(x) __ALIGN_KERNEL(x, SMP_CACHE_BYTES)
/* Module parameters */ /* Module parameters */
#define TX_TIMEO 5000 #define TX_TIMEO 5000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment