From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH 1/3] net: macb: fix random memory corruption on RX with 64-bit DMA Date: Wed, 05 Dec 2018 12:32:45 -0800 (PST) Message-ID: <20181205.123245.1075111432564395434.davem@davemloft.net> References: <20181130182137.27974-1-anssi.hannula@bitwise.fi> <20181130182137.27974-2-anssi.hannula@bitwise.fi> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: nicolas.ferre@microchip.com, netdev@vger.kernel.org, harini.katakam@xilinx.com, michal.simek@xilinx.com To: anssi.hannula@bitwise.fi Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:44244 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727402AbeLEUeL (ORCPT ); Wed, 5 Dec 2018 15:34:11 -0500 In-Reply-To: <20181130182137.27974-2-anssi.hannula@bitwise.fi> Sender: netdev-owner@vger.kernel.org List-ID: From: Anssi Hannula Date: Fri, 30 Nov 2018 20:21:35 +0200 > @@ -682,6 +682,11 @@ static void macb_set_addr(struct macb *bp, struct macb_dma_desc *desc, dma_addr_ > if (bp->hw_dma_cap & HW_DMA_CAP_64B) { > desc_64 = macb_64b_desc(bp, desc); > desc_64->addrh = upper_32_bits(addr); > + /* The low bits of RX address contain the RX_USED bit, clearing > + * of which allows packet RX. Make sure the high bits are also > + * visible to HW at that point. > + */ > + dma_wmb(); > } I agree with that dma_wmb() is what should be used here. We are ordering CPU stores with DMA visibility, which is exactly what the dma_*() are for. If it doesn't work properly on some architecture's implementation of dma_*(), those should be fixed rather than papering over it in the drivers.