All of lore.kernel.org
 help / color / mirror / Atom feed
* use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
@ 2014-02-14  7:54 ` Jisheng Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2014-02-14  7:54 UTC (permalink / raw)
  To: linux-i2c, linux-arm-kernel, LKML

Hi all,

The writel/readl is too expensive especially on Cortex A9 w/ outer L2 cache. This
introduce i2c read/write error on Marvell Berlin SoCs when there are L2 cache
maintenance operations at the same time.

In our internal berlin bsp, we just replaced readl/writel with the relaxed
version. But AFAIK, the "relaxed" version doesn't exist on all architectures. How
to handle this issue? 

Any suggestions are appreciated.

Thanks in advance,
Jisheng

^ permalink raw reply	[flat|nested] 8+ messages in thread

* use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
@ 2014-02-14  7:54 ` Jisheng Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2014-02-14  7:54 UTC (permalink / raw)
  To: linux-i2c, linux-arm-kernel, LKML

Hi all,

The writel/readl is too expensive especially on Cortex A9 w/ outer L2 cache. This
introduce i2c read/write error on Marvell Berlin SoCs when there are L2 cache
maintenance operations at the same time.

In our internal berlin bsp, we just replaced readl/writel with the relaxed
version. But AFAIK, the "relaxed" version doesn't exist on all architectures. How
to handle this issue? 

Any suggestions are appreciated.

Thanks in advance,
Jisheng

^ permalink raw reply	[flat|nested] 8+ messages in thread

* use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
@ 2014-02-14  7:54 ` Jisheng Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2014-02-14  7:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

The writel/readl is too expensive especially on Cortex A9 w/ outer L2 cache. This
introduce i2c read/write error on Marvell Berlin SoCs when there are L2 cache
maintenance operations at the same time.

In our internal berlin bsp, we just replaced readl/writel with the relaxed
version. But AFAIK, the "relaxed" version doesn't exist on all architectures. How
to handle this issue? 

Any suggestions are appreciated.

Thanks in advance,
Jisheng

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
  2014-02-14  7:54 ` Jisheng Zhang
@ 2014-02-14  9:09   ` Arnd Bergmann
  -1 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2014-02-14  9:09 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Jisheng Zhang, linux-i2c, LKML

On Friday 14 February 2014 15:54:38 Jisheng Zhang wrote:
> Hi all,
> 
> The writel/readl is too expensive especially on Cortex A9 w/ outer L2 cache. This
> introduce i2c read/write error on Marvell Berlin SoCs when there are L2 cache
> maintenance operations at the same time.
> 
> In our internal berlin bsp, we just replaced readl/writel with the relaxed
> version. But AFAIK, the "relaxed" version doesn't exist on all architectures. How
> to handle this issue? 

In case of i2c-designware, this is safe because that driver does not perform
DMA. In other drivers, you may have to be more careful, to ensure that all MMIO
is serialized with DMA operations performed by the driver.

> Any suggestions are appreciated.

I would definitely welcome a patch that adds a default  _relaxed implementation
to include/linux/io.h, like this:

#ifndef readb_relaxed
#define readb_relaxed(p) readb(p)
#endif

and then adds "#define readb_relaxed(p) readb_relaxed(p)" etc. to all
architectures that have a non-macro definition for readb.

Alternatively, we could have a CONFIG_ARCH_MMIO_RELAXED configuration
symbol that gets selected by any architecture that provides the _relaxed
accessors, and get linux/io.h to define all of them for the other
architectures.

	Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
@ 2014-02-14  9:09   ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2014-02-14  9:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 14 February 2014 15:54:38 Jisheng Zhang wrote:
> Hi all,
> 
> The writel/readl is too expensive especially on Cortex A9 w/ outer L2 cache. This
> introduce i2c read/write error on Marvell Berlin SoCs when there are L2 cache
> maintenance operations at the same time.
> 
> In our internal berlin bsp, we just replaced readl/writel with the relaxed
> version. But AFAIK, the "relaxed" version doesn't exist on all architectures. How
> to handle this issue? 

In case of i2c-designware, this is safe because that driver does not perform
DMA. In other drivers, you may have to be more careful, to ensure that all MMIO
is serialized with DMA operations performed by the driver.

> Any suggestions are appreciated.

I would definitely welcome a patch that adds a default  _relaxed implementation
to include/linux/io.h, like this:

#ifndef readb_relaxed
#define readb_relaxed(p) readb(p)
#endif

and then adds "#define readb_relaxed(p) readb_relaxed(p)" etc. to all
architectures that have a non-macro definition for readb.

Alternatively, we could have a CONFIG_ARCH_MMIO_RELAXED configuration
symbol that gets selected by any architecture that provides the _relaxed
accessors, and get linux/io.h to define all of them for the other
architectures.

	Arnd

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
  2014-02-14  9:09   ` Arnd Bergmann
  (?)
@ 2014-02-14 11:14     ` Jisheng Zhang
  -1 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2014-02-14 11:14 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linux-arm-kernel, linux-i2c, LKML

Dear Arnd,

On Fri, 14 Feb 2014 01:09:44 -0800
Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday 14 February 2014 15:54:38 Jisheng Zhang wrote:
> > Hi all,
> > 
> > The writel/readl is too expensive especially on Cortex A9 w/ outer L2
> > cache. This introduce i2c read/write error on Marvell Berlin SoCs when
> > there are L2 cache maintenance operations at the same time.
> > 
> > In our internal berlin bsp, we just replaced readl/writel with the relaxed
> > version. But AFAIK, the "relaxed" version doesn't exist on all
> > architectures. How to handle this issue? 
> 
> In case of i2c-designware, this is safe because that driver does not perform
> DMA. In other drivers, you may have to be more careful, to ensure that all
> MMIO is serialized with DMA operations performed by the driver.
> 
> > Any suggestions are appreciated.
> 
> I would definitely welcome a patch that adds a default  _relaxed
> implementation to include/linux/io.h, like this:
> 
> #ifndef readb_relaxed
> #define readb_relaxed(p) readb(p)
> #endif
> 
> and then adds "#define readb_relaxed(p) readb_relaxed(p)" etc. to all
> architectures that have a non-macro definition for readb.

Thanks for the suggestions. I'll try to send out one RFC patch.

Thanks,
Jisheng

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
@ 2014-02-14 11:14     ` Jisheng Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2014-02-14 11:14 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, LKML

Dear Arnd,

On Fri, 14 Feb 2014 01:09:44 -0800
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:

> On Friday 14 February 2014 15:54:38 Jisheng Zhang wrote:
> > Hi all,
> > 
> > The writel/readl is too expensive especially on Cortex A9 w/ outer L2
> > cache. This introduce i2c read/write error on Marvell Berlin SoCs when
> > there are L2 cache maintenance operations at the same time.
> > 
> > In our internal berlin bsp, we just replaced readl/writel with the relaxed
> > version. But AFAIK, the "relaxed" version doesn't exist on all
> > architectures. How to handle this issue? 
> 
> In case of i2c-designware, this is safe because that driver does not perform
> DMA. In other drivers, you may have to be more careful, to ensure that all
> MMIO is serialized with DMA operations performed by the driver.
> 
> > Any suggestions are appreciated.
> 
> I would definitely welcome a patch that adds a default  _relaxed
> implementation to include/linux/io.h, like this:
> 
> #ifndef readb_relaxed
> #define readb_relaxed(p) readb(p)
> #endif
> 
> and then adds "#define readb_relaxed(p) readb_relaxed(p)" etc. to all
> architectures that have a non-macro definition for readb.

Thanks for the suggestions. I'll try to send out one RFC patch.

Thanks,
Jisheng

^ permalink raw reply	[flat|nested] 8+ messages in thread

* use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ?
@ 2014-02-14 11:14     ` Jisheng Zhang
  0 siblings, 0 replies; 8+ messages in thread
From: Jisheng Zhang @ 2014-02-14 11:14 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Arnd,

On Fri, 14 Feb 2014 01:09:44 -0800
Arnd Bergmann <arnd@arndb.de> wrote:

> On Friday 14 February 2014 15:54:38 Jisheng Zhang wrote:
> > Hi all,
> > 
> > The writel/readl is too expensive especially on Cortex A9 w/ outer L2
> > cache. This introduce i2c read/write error on Marvell Berlin SoCs when
> > there are L2 cache maintenance operations at the same time.
> > 
> > In our internal berlin bsp, we just replaced readl/writel with the relaxed
> > version. But AFAIK, the "relaxed" version doesn't exist on all
> > architectures. How to handle this issue? 
> 
> In case of i2c-designware, this is safe because that driver does not perform
> DMA. In other drivers, you may have to be more careful, to ensure that all
> MMIO is serialized with DMA operations performed by the driver.
> 
> > Any suggestions are appreciated.
> 
> I would definitely welcome a patch that adds a default  _relaxed
> implementation to include/linux/io.h, like this:
> 
> #ifndef readb_relaxed
> #define readb_relaxed(p) readb(p)
> #endif
> 
> and then adds "#define readb_relaxed(p) readb_relaxed(p)" etc. to all
> architectures that have a non-macro definition for readb.

Thanks for the suggestions. I'll try to send out one RFC patch.

Thanks,
Jisheng

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-02-14 11:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  7:54 use {readl|writel}_relaxed instead of readl/writel in i2c-designware-core ? Jisheng Zhang
2014-02-14  7:54 ` Jisheng Zhang
2014-02-14  7:54 ` Jisheng Zhang
2014-02-14  9:09 ` Arnd Bergmann
2014-02-14  9:09   ` Arnd Bergmann
2014-02-14 11:14   ` Jisheng Zhang
2014-02-14 11:14     ` Jisheng Zhang
2014-02-14 11:14     ` Jisheng Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.