Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5308739ybl; Wed, 22 Jan 2020 14:27:07 -0800 (PST) X-Google-Smtp-Source: APXvYqy843c3AMeEAswik9GLAe15I28tLoCcyyR1AtTcWb0/91zpAyiSSPBwfkwc8iX7xt/y2rQg X-Received: by 2002:aca:72cd:: with SMTP id p196mr8032851oic.99.1579732027204; Wed, 22 Jan 2020 14:27:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579732027; cv=none; d=google.com; s=arc-20160816; b=mpqtiMRlXbsM4lrRWc7TqV/wmLg4TEfL1nwegNCYocRhZikc1UwtKm/qQjSgO6AkZ/ xI7JNkZwkD+78IBo89gF86rwRflx/lg9lQ6kjYTGcRkLv7QV/ZWEnyRysojojFiBQu9Y wxzd00hM/cnAPMorB2DtOl9AfaWgL2QEGxQYWb1ZpGGG5xE2U6NBH7VSnGSjVNAq11Mx nExLbGKjDckvXXQoYVaYCw39tzNSPSC3URUMS9pXyRm99s6ydculMGX9CHg2qKy0rmrd M/odE/HNwnQP3sxuO0gW9kuX1z0zD5cOlkiM/lfaavoYUY+JTAzD2J1RzaonMxirnqhz dRIQ== 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=sN5KDSJS8VJhXQdyzhXX4Te732kMw8HUSuPsnPTQYMAxofCACruLfoSmef/tHxhTY7 IWYZRE5EJiv68vV/PDtWuD0eYxsvUNchjPW6jFzaFON9udx8dHGkvhRal+Sd8jWqA9kx F05prOK171z+ciUI+hk3YNceBJCiz3jGXFBzUjQkFWZhn9i2labbEA/dI5nl/kN8p9kO Z9qYjtm2VxQby09Z3WQ7g6w+1TfP76IBRsqQocmdKS/BNoij2+KqqzfCItFtAQz0TT/O WpsDS9fQXFEPxdG2Q+1JXcLFz3hw+gRrbwlExaIQodTnXYO9nG57eRThrNwBtkGKj3cJ tQ3Q== 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 p83si21588227oih.198.2020.01.22.14.26.55; Wed, 22 Jan 2020 14:27:07 -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 S1727312AbgAVWYC (ORCPT + 99 others); Wed, 22 Jan 2020 17:24:02 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:47802 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgAVWYB (ORCPT ); Wed, 22 Jan 2020 17:24:01 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 539A3299A5; Wed, 22 Jan 2020 17:23:59 -0500 (EST) To: "David S. Miller" Cc: Thomas Bogendoerfer , Chris Zankel , Laurent Vivier , Geert Uytterhoeven , Eric Dumazet , Stephen Hemminger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: <440cbc1f97d5dff3ca3de53bc0fb35a308f96865.1579730846.git.fthain@telegraphics.com.au> In-Reply-To: References: From: Finn Thain Subject: [PATCH net v3 03/12] net/sonic: Use MMIO accessors Date: Thu, 23 Jan 2020 09:07:26 +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