Skip to content

sfc: Restrict PIO for 64bit arch in order to avoid data corruption

Shradha Shah netdev 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 4 repliesIn review
  2. v32 patches 1 replySuperseded
  3. v2 posting 2/22 patches 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/22 patches1 replySuperseded
v12 patches1 replySuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sfc: use 64-bit writes for PIO.drivers/net/ethernet/sfc/tx.c+19 -54 replies
2/2sfc: Restrict PIO to 64-bit architecturesdrivers/net/ethernet/sfc/io.h+8 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH net v4 0/2] sfc: Restrict PIO for 64bit arch in order to avoid data corruption

This patch series

Fixes ee45fd92c739("sfc: Use TX PIO for sufficiently small packets")

The linux net driver uses memcpy_toio() in order to copy into the PIO buffers.
Even on a 64bit machine this causes 32bit accesses to a write- combined memory region.
There are hardware limitations that mean that only
64bit naturally aligned accesses are safe in all cases. Due to being write-combined memory region two 32bit accesses may be coalesced to form a 64bit non 64bit aligned access.
Solution was to open-code the memory copy routines using pointers and to only enable PIO for x86_64 machines.

This bug fix applies to v3.13 and v3.14 stable branches.

Jon Cooper (2):
sfc: use 64-bit writes for PIO.
sfc: Restrict PIO to 64-bit architectures

 drivers/net/ethernet/sfc/io.h |  8 ++++++++
 drivers/net/ethernet/sfc/tx.c | 24 +++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)