Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1255610

Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite
Date 2015-10-26 02:30 +0100
Message-ID <qnELL-1Sy-11@gated-at.bofh.it> (permalink)
References <qmjgm-4Y3-11@gated-at.bofh.it> <qmjT4-5Ic-7@gated-at.bofh.it> <qnAf8-7yF-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sunday 25 October 2015, Marc Kleine-Budde wrote:
> On 10/22/2015 10:58 AM, Arnd Bergmann wrote:
> >>> The two should really do the same thing: iowrite32() is just a static inline
> >>> calling writel() on both ARM32 and ARM64. On which kernel version did you
> >>> observe the difference? It's possible that an older version used
> >>> CONFIG_GENERIC_IOMAP, which made this slightly more expensive.
> >>>
> >>> If there are barriers that you want to get rid of for performance reasons,
> >>> you should use writel_relaxed(), but be careful to synchronize them correctly
> >>> with regard to DMA. It should be fine in this driver, as it does not
> >>> perform any DMA, but be aware that there is no big-endian version of
> >>> writel_relaxed() at the moment.
> >>
> >> We don't have DMA in CAN drivers, but usually a certain write triggers
> >> sending. Do we need a barrier before triggering the sending?
> > 
> > No, the relaxed writes are not well-defined across architectures. On
> > ARM, the CPU guarantees that stores to an MMIO area are still in order
> > with respect to one another, the barrier is only needed for actual DMA,
> > so you are fine. I would expect the same to be true everywhere,
> > otherwise a lot of other drivers would be broken too.
> 
> And the relaxed functions seem not to be available on all archs. This
> driver should work on microblaze. Are __raw_writeX(), __raw_readX() an
> alternative here?

__raw_writeX() and __raw_readX()  are not safe to use in drivers in general.

readl_relaxed() should work on all architectures nowadays, and I've checked
that it does on microblaze.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite Arnd Bergmann <arnd@arndb.de> - 2015-10-22 10:20 +0200
  Re: [PATCH 1/2] can: xilinx: use readl/writel instead of  ioread/iowrite Marc Kleine-Budde <mkl@pengutronix.de> - 2015-10-22 10:30 +0200
    Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite Arnd Bergmann <arnd@arndb.de> - 2015-10-22 11:00 +0200
      Re: [PATCH 1/2] can: xilinx: use readl/writel instead of  ioread/iowrite Marc Kleine-Budde <mkl@pengutronix.de> - 2015-10-25 21:40 +0100
        Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite Arnd Bergmann <arnd@arndb.de> - 2015-10-26 02:30 +0100
  Re: [PATCH 1/2] can: xilinx: use readl/writel instead of ioread/iowrite Arnd Bergmann <arnd@arndb.de> - 2015-10-22 11:10 +0200

csiph-web