Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4164596ybl; Tue, 21 Jan 2020 14:14:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxi300btSL5Wbm1yMTCR6+HbfFz1pNK7NT2n+lr5DJvh6qTmX4FE2epDHHSir9GxffbMB1Y X-Received: by 2002:a9d:66ca:: with SMTP id t10mr5092959otm.352.1579644841275; Tue, 21 Jan 2020 14:14:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579644841; cv=none; d=google.com; s=arc-20160816; b=RfUBEj/hzgU+/vTBC0Oxisz4dWB5qUH/cMvY2163oun2XP4sBSZIVpY9lZoqX4ClsC G65xdeKZdkRALbRVgjvUO7jdPVq0X8NbvnOxXZmzS37yo6IOiC2GrxDsYGA4tF7QaYeJ VKlSfhhuxONZUqoFsR149LL5JXFr/WssI2LG7cMNv3VBOJlWxQtnWdIFoUJwumr71IIC I2rn7b3EauR/6pZ54s8ub3N0S8uXOWw2K5w5P4ctinf50qQjCsi50pqWmx/oL6blz6rB Kp2RfH09F/CCTasgTsEthu03Ci6RFTPcqWctDh1cXCYtOebDJtzqPNtmNpOXWL2+W1RT 6lMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=X1XHdt478TmCEEAHnbjJOsSkWJzm0Brd4Q10ftiowvg=; b=beXbYSHKlkaYPcwtOQoLR2Y0CAJ0ejmC7e6s3TP2H/qDlA2FAGgJibxoi3n/UWHUCH KLu0aSoPTy6omYvDof5s5dQqeI4L5qEq7XD0z8TzdoTKcRGWvzJVpX00HDG/8wjtxjlL fMivOECA1tu0OU9Cu1YlJOCiSckz5chDBM0yWpTwYo5m5oORU3srwO7nTXkHxV3MfCR7 O8RR1ub9TY99a7Vm++tuAIM8GWI2tYuSGAa6mdfvz+F3p8uHZCB41aacZAaOw5YogCkL wqKE+F/5FkiZdb9XvBdDASbZUOD7StQALCVyEam0td/yrJI3faVaWOmq6Gc7HuOlY6fL KxZg== 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 v6si22965722ota.19.2020.01.21.14.13.49; Tue, 21 Jan 2020 14:14:01 -0800 (PST) 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 S1729516AbgAUWL3 (ORCPT + 99 others); Tue, 21 Jan 2020 17:11:29 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:44734 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728609AbgAUWKh (ORCPT ); Tue, 21 Jan 2020 17:10:37 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 233FE29988; Tue, 21 Jan 2020 17:10:36 -0500 (EST) To: "David S. Miller" Cc: Thomas Bogendoerfer , Chris Zankel , Laurent Vivier , Geert Uytterhoeven , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <8a9a2a9bd56de82328b20e5234c56e48889eb016.1579641728.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH net v2 03/12] net/sonic: Use MMIO accessors Date: Wed, 22 Jan 2020 08:22:08 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver accesses descriptor memory which is simultaneously accessed by the chip, so the compiler must not be allowed to re-order CPU accesses. sonic_buf_get() used 'volatile' to prevent that. sonic_buf_put() should have done so too but was overlooked. Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update") Tested-by: Stan Johnson Signed-off-by: Finn Thain --- drivers/net/ethernet/natsemi/sonic.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/natsemi/sonic.h b/drivers/net/ethernet/natsemi/sonic.h index f9506863e9d1..fb160dfdf4ca 100644 --- a/drivers/net/ethernet/natsemi/sonic.h +++ b/drivers/net/ethernet/natsemi/sonic.h @@ -345,30 +345,30 @@ static void sonic_msg_init(struct net_device *dev); as far as we can tell. */ /* OpenBSD calls this "SWO". I'd like to think that sonic_buf_put() is a much better name. */ -static inline void sonic_buf_put(void* base, int bitmode, +static inline void sonic_buf_put(u16 *base, int bitmode, int offset, __u16 val) { if (bitmode) #ifdef __BIG_ENDIAN - ((__u16 *) base + (offset*2))[1] = val; + __raw_writew(val, base + (offset * 2) + 1); #else - ((__u16 *) base + (offset*2))[0] = val; + __raw_writew(val, base + (offset * 2) + 0); #endif else - ((__u16 *) base)[offset] = val; + __raw_writew(val, base + (offset * 1) + 0); } -static inline __u16 sonic_buf_get(void* base, int bitmode, +static inline __u16 sonic_buf_get(u16 *base, int bitmode, int offset) { if (bitmode) #ifdef __BIG_ENDIAN - return ((volatile __u16 *) base + (offset*2))[1]; + return __raw_readw(base + (offset * 2) + 1); #else - return ((volatile __u16 *) base + (offset*2))[0]; + return __raw_readw(base + (offset * 2) + 0); #endif else - return ((volatile __u16 *) base)[offset]; + return __raw_readw(base + (offset * 1) + 0); } /* Inlines that you should actually use for reading/writing DMA buffers */ -- 2.24.1