Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3610957yba; Mon, 29 Apr 2019 05:41:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcuMjQZI9gwFdyv04d9MLkRy8Jq3sCJNe96p5GK7c1v2hBw2hdG+kOj6Flbp+JwjtETlJy X-Received: by 2002:a63:5720:: with SMTP id l32mr29301205pgb.438.1556541671221; Mon, 29 Apr 2019 05:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556541671; cv=none; d=google.com; s=arc-20160816; b=mTm9EhcnbUiQN4OzcdOqsUSh9URnkR1jyOLIG0EvCBnztTlefphJdE4V21XhcuGVAR XNVj5iwUnPPLveADFitfUYPqk7cC4jpbpnDPfIgjvVyfvnKQ8KR2BH5pQ/SOeVvBQ0wY 22bjUuqxT65NbwwiZsYl9jKzrF591H7DA7ArMSiZl9KjjWTv7Zy4kNftiqar8ryk1o9/ OmbyDCPprEEajqJwSTN+gCGQGqJ0uFlWd55WnVHahG/Jp/p1TGuFuDu5fvPygrMKU5wF Uuq7CuUNdY7FWPH/ofbCtndgtlU9yR8L25SLcOq6k3HHkawx7HISo0CJxx+A2CHNIKPz UG/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=GbAr6/WdYzJlIzTH+NuMw5/VW9YuLHZKFQ/V9ucbt+8=; b=OwapAXEHDCpfdw8G2vr2LSlCAcZfM52L+RvhXWoHzIjqs5HK8w4QDsgUjmVmLCRq1c bB2VK4vGXG3naPpNGCYFtf77IYfqR67yovPu6r9f7tLiSu+B07c73ojS8HjlI8QMNRnR F1j25gq7M6wnBlXRj6097uvj+cyUFFXhZMmKGOJzoe74psNsf4X5Qa51V/1Zjf0QnkmB cPFa6zLVmBxOpwGqZ5V++QaPRupxRBTSkMT7KLv0ZH9350fKeJkq5GCjCy0t9DTDg6IP dTHSgE7MIn+G+3tgJNkRAD7qEmO2dgFE3Geit58wMYxeZvoq44W1UGXVVqDX9v7JreeF VqSg== 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 195si31608580pga.312.2019.04.29.05.40.55; Mon, 29 Apr 2019 05:41:11 -0700 (PDT) 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 S1728188AbfD2MkH (ORCPT + 99 others); Mon, 29 Apr 2019 08:40:07 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:38721 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728054AbfD2MkF (ORCPT ); Mon, 29 Apr 2019 08:40:05 -0400 Received: by mail-qt1-f196.google.com with SMTP id d13so11628187qth.5 for ; Mon, 29 Apr 2019 05:40:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GbAr6/WdYzJlIzTH+NuMw5/VW9YuLHZKFQ/V9ucbt+8=; b=ifCw3KNUmszAaiPtKjEHYgsd4taolTC1vOPxMGLZnk423VFZZSvItESD1fuutRThEl cWwSajAD7g4TLLKUzt0rCYqzehzXiWna4RL5hhjK5tN+bWeGOIfofyKA7L3ErVFg7DiN OO+7rAtv13/NlxfcEWRzmmB09kp+e4gs3Hn1oVu7gYz3aaThDpWijXmxNfERb+9czsOJ z8H/FOEQDhASvnhAEW2pKeS3VI0X5RqQaz6YagHSobPGR2lbKAcIvh4AbzMPvmgwGuxP 9lR7o8ENY8o/kF48onpVmsbD2tUkrgbxlKCJuDim8Z5VM0WzavGJFxuoQqzzrngdC7AU znvQ== X-Gm-Message-State: APjAAAXgmLt157F+viNPxYw1cvHSnRqwOyj0+OwZgdS4wjNZtRnzFWR4 r/DTVhse7Kbem4tuIS3NF8hYCWmVF2X08kGRQvg= X-Received: by 2002:ac8:3f38:: with SMTP id c53mr38245305qtk.152.1556541604080; Mon, 29 Apr 2019 05:40:04 -0700 (PDT) MIME-Version: 1.0 References: <20190429081937.7544-1-geert@linux-m68k.org> In-Reply-To: <20190429081937.7544-1-geert@linux-m68k.org> From: Arnd Bergmann Date: Mon, 29 Apr 2019 14:39:47 +0200 Message-ID: Subject: Re: [PATCH] m68k: io: Fix io{read,write}{16,32}be() for Coldfire peripherals To: Geert Uytterhoeven Cc: Greg Ungerer , Angelo Dureghello , Logan Gunthorpe , linux-m68k , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 29, 2019 at 10:19 AM Geert Uytterhoeven wrote: > > The generic definitions of mmio_{read,write}{16,32}be() in lib/iomap.c > assume that the {read,write}[wl]() I/O accessors always use little > endian accesses, and swap the result. > > However, the Coldfire versions of the {read,write}[wl]() I/O accessors are > special, in that they use native big endian instead of little endian for > accesses to the on-SoC peripheral block, thus violating the assumption. > > Fix this by providing our own variants, using the raw accessors, > reinstating the old behavior. This is fine on m68k, as no special > barriers are needed, and also avoids swapping data twice. > > Reported-by: Angelo Dureghello > Fixes: aecc787c06f4300f ("iomap: Use non-raw io functions for io{read|write}XXbe") > Signed-off-by: Geert Uytterhoeven > --- > This can be reverted later, after this oddity of the Coldfire I/O > support has been fixed, and drivers have been updated. > --- > arch/m68k/include/asm/io.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h > index aabe6420ead2a599..d47e7384681ab1cd 100644 > --- a/arch/m68k/include/asm/io.h > +++ b/arch/m68k/include/asm/io.h > @@ -8,6 +8,12 @@ > #include > #endif > > +#define mmio_read16be(addr) __raw_readw(addr) > +#define mmio_read32be(addr) __raw_readl(addr) > + > +#define mmio_write16be(val, port) __raw_writew((val), (port)) > +#define mmio_write32be(val, port) __raw_writel((val), (port)) > + > #include This looks correct to me, but there are two points that stick out to me: - why do you only do this for mmio and not for pio? - why do you even use the generic_iomap wrappers rather than the trivial asm-generic versions of those functions? Arnd