From: Arnd Bergmann <arnd@arndb.de>
To: John Garry <john.garry@huawei.com>
Cc: linux-arch <linux-arch@vger.kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Sinan Kaya <okaya@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
"xuwei \(O\)" <xuwei5@hisilicon.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Will Deacon <will@kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: About commit "io: change inX() to have their own IO barrier overrides"
Date: Fri, 6 Mar 2020 16:16:52 +0100 [thread overview]
Message-ID: <CAK8P3a2wdCrBP=a8ZypWoC=HyCU3oYYNeCddWM7oT+xM9gTPhw@mail.gmail.com> (raw)
In-Reply-To: <ae0a1bf1-948f-7df0-9efb-cd1e94e27d2d@huawei.com>
On Fri, Mar 6, 2020 at 11:40 AM John Garry <john.garry@huawei.com> wrote:
> On 06/03/2020 07:54, Arnd Bergmann wrote:
> > On Fri, Mar 6, 2020 at 4:44 AM Sinan Kaya <okaya@kernel.org> wrote:
> -- a/lib/logic_pio.c
> +++ b/lib/logic_pio.c
> @@ -229,13 +229,21 @@ unsigned long
> logic_pio_trans_cpuaddr(resource_size_t addr)
> }
>
> #if defined(CONFIG_INDIRECT_PIO) && defined(PCI_IOBASE)
> +
> +#define logic_in_to_cpu_b(x) (x)
> +#define logic_in_to_cpu_w(x) __le16_to_cpu(x)
> +#define logic_in_to_cpu_l(x) __le32_to_cpu(x)
> +
> #define BUILD_LOGIC_IO(bw, type) \
> type logic_in##bw(unsigned long addr) \
> { \
> type ret = (type)~0; \
> \
> if (addr < MMIO_UPPER_LIMIT) { \
> - ret = read##bw(PCI_IOBASE + addr); \
> + void __iomem *_addr = PCI_IOBASE + addr; \
> + __io_pbr(); \
> + ret = logic_in_to_cpu_##bw(__raw_read##bw(_addr)); \
> + __io_par(ret); \
> } else if (addr >= MMIO_UPPER_LIMIT && addr < IO_SPACE_LIMIT) {\
> struct logic_pio_hwaddr *entry = find_io_rang
>
> We could prob combine the le_to_cpu and __raw_read into a single macro.
What is the purpose of splitting out the byteswap rather than leaving the
open-coded rather than __le16_to_cpu(__raw_readw(PCI_IOBASE + addr))?
If this is needed to work across architectures, how about adding
an intermediate __raw_inw() etc in asm-generic/io.h like
#ifndef __raw_inw
#define __raw_inw(a) __raw_readw(PCI_IOBASE + addr));
#endif
#include <linux/logic_pio.h>
#ifndef inw
static inline u16 inw(unsigned long addr)
{
u16 val;
__io_pbr();
val = __le16_to_cpu(__raw_inw(addr));
__io_par(val);
return val;
}
#endif
Arnd
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-03-06 15:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2e80d7bc-32a0-cc40-00a9-8a383a1966c2@huawei.com>
[not found] ` <c1489f55-369d-2cff-ff36-b10fb5d3ee79@kernel.org>
[not found] ` <8207cd51-5b94-2f15-de9f-d85c9c385bca@huawei.com>
[not found] ` <6115fa56-a471-1e9f-edbb-e643fa4e7e11@kernel.org>
[not found] ` <7c955142-1fcb-d99e-69e4-1e0d3d9eb8c3@huawei.com>
2020-03-03 16:40 ` About commit "io: change inX() to have their own IO barrier overrides" Arnd Bergmann
2020-03-03 17:16 ` John Garry
2020-03-06 3:44 ` Sinan Kaya
2020-03-06 7:54 ` Arnd Bergmann
2020-03-06 10:39 ` John Garry
2020-03-06 15:16 ` Arnd Bergmann [this message]
2020-03-06 16:18 ` John Garry
2020-03-06 16:29 ` Arnd Bergmann
2020-03-06 16:43 ` John Garry
2020-03-11 16:12 ` John Garry
2020-03-06 21:15 ` Sinan Kaya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAK8P3a2wdCrBP=a8ZypWoC=HyCU3oYYNeCddWM7oT+xM9gTPhw@mail.gmail.com' \
--to=arnd@arndb.de \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=jiaxun.yang@flygoat.com \
--cc=john.garry@huawei.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=okaya@kernel.org \
--cc=will@kernel.org \
--cc=xuwei5@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).