mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] clocksource: Add BE APIs support.
@ 2014-09-30  5:03 Xiubo Li
  2014-09-30  5:03 ` [PATCH v3 1/2] clocksource: Update to the newer memory functions Xiubo Li
  2014-09-30  5:03 ` [PATCH v3 2/2] clocksource: Add BE APIs support for clocksource counter reading Xiubo Li
  0 siblings, 2 replies; 4+ messages in thread
From: Xiubo Li @ 2014-09-30  5:03 UTC (permalink / raw)
  To: tglx, daniel.lezcano; +Cc: linux-kernel, john.stultz, Xiubo Li

Change in V3:
- Provide a separate patch for using newer memory accessors.

Change in V2:
- Using ioread{16,32}[be]() instead of readl_relaxed().
- Add clocksource_mmio_readX_Y_be() supports only.


Xiubo Li (2):
  clocksource: Update to the newer memory functions.
  clocksource: Add BE APIs support for clocksource counter reading.

 drivers/clocksource/mmio.c  | 28 ++++++++++++++++++++++++----
 include/linux/clocksource.h |  4 ++++
 2 files changed, 28 insertions(+), 4 deletions(-)

-- 
2.1.0.27.g96db324


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

* [PATCH v3 1/2] clocksource: Update to the newer memory functions.
  2014-09-30  5:03 [PATCH v3 0/2] clocksource: Add BE APIs support Xiubo Li
@ 2014-09-30  5:03 ` Xiubo Li
  2014-09-30 21:20   ` Thomas Gleixner
  2014-09-30  5:03 ` [PATCH v3 2/2] clocksource: Add BE APIs support for clocksource counter reading Xiubo Li
  1 sibling, 1 reply; 4+ messages in thread
From: Xiubo Li @ 2014-09-30  5:03 UTC (permalink / raw)
  To: tglx, daniel.lezcano; +Cc: linux-kernel, john.stultz, Xiubo Li

Use ioread{16,32} instead of read{w,l}_relaxed.

For read{w,l}_relaxed accessor, if one arch has its own defination,
then used it. Or will use the generic one, which will be read as LE
endian as default.

For some ARCHes, such PowerPC, if using the clocksource mmio, the
read{w,l}_relaxed will couldn't be used directly. There must be its
own BE accessor in its individual clocksource driver.

The ioread{16,32} will be read as LE endian as default if the arch
hasn't any defination of it too, like read{w,l}_relaxed do.

To prepare supporting the BE APIs and to be more unified with them,
using ioread{16,32}[be] is a good chioce here.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/mmio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index 1593ade..d3cbf70 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -22,22 +22,22 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
 
 cycle_t clocksource_mmio_readl_up(struct clocksource *c)
 {
-	return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
+	return (cycle_t)ioread32(to_mmio_clksrc(c)->reg);
 }
 
 cycle_t clocksource_mmio_readl_down(struct clocksource *c)
 {
-	return ~(cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
+	return ~(cycle_t)ioread32(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
 cycle_t clocksource_mmio_readw_up(struct clocksource *c)
 {
-	return (cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg);
+	return (cycle_t)ioread16(to_mmio_clksrc(c)->reg);
 }
 
 cycle_t clocksource_mmio_readw_down(struct clocksource *c)
 {
-	return ~(cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
+	return ~(cycle_t)ioread16(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
 /**
-- 
2.1.0.27.g96db324


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

* [PATCH v3 2/2] clocksource: Add BE APIs support for clocksource counter reading.
  2014-09-30  5:03 [PATCH v3 0/2] clocksource: Add BE APIs support Xiubo Li
  2014-09-30  5:03 ` [PATCH v3 1/2] clocksource: Update to the newer memory functions Xiubo Li
@ 2014-09-30  5:03 ` Xiubo Li
  1 sibling, 0 replies; 4+ messages in thread
From: Xiubo Li @ 2014-09-30  5:03 UTC (permalink / raw)
  To: tglx, daniel.lezcano; +Cc: linux-kernel, john.stultz, Xiubo Li

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/clocksource/mmio.c  | 20 ++++++++++++++++++++
 include/linux/clocksource.h |  4 ++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index d3cbf70..d35a407 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -20,21 +20,41 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
 	return container_of(c, struct clocksource_mmio, clksrc);
 }
 
+cycle_t clocksource_mmio_readl_up_be(struct clocksource *c)
+{
+	return (cycle_t)ioread32be(to_mmio_clksrc(c)->reg);
+}
+
 cycle_t clocksource_mmio_readl_up(struct clocksource *c)
 {
 	return (cycle_t)ioread32(to_mmio_clksrc(c)->reg);
 }
 
+cycle_t clocksource_mmio_readl_down_be(struct clocksource *c)
+{
+	return ~(cycle_t)ioread32be(to_mmio_clksrc(c)->reg) & c->mask;
+}
+
 cycle_t clocksource_mmio_readl_down(struct clocksource *c)
 {
 	return ~(cycle_t)ioread32(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
+cycle_t clocksource_mmio_readw_up_be(struct clocksource *c)
+{
+	return (cycle_t)ioread16be(to_mmio_clksrc(c)->reg);
+}
+
 cycle_t clocksource_mmio_readw_up(struct clocksource *c)
 {
 	return (cycle_t)ioread16(to_mmio_clksrc(c)->reg);
 }
 
+cycle_t clocksource_mmio_readw_down_be(struct clocksource *c)
+{
+	return ~(cycle_t)ioread16be(to_mmio_clksrc(c)->reg) & c->mask;
+}
+
 cycle_t clocksource_mmio_readw_down(struct clocksource *c)
 {
 	return ~(cycle_t)ioread16(to_mmio_clksrc(c)->reg) & c->mask;
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 653f0e2..931a037 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -327,9 +327,13 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
 
 extern int timekeeping_notify(struct clocksource *clock);
 
+extern cycle_t clocksource_mmio_readl_up_be(struct clocksource *);
 extern cycle_t clocksource_mmio_readl_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readl_down_be(struct clocksource *);
 extern cycle_t clocksource_mmio_readl_down(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_up_be(struct clocksource *);
 extern cycle_t clocksource_mmio_readw_up(struct clocksource *);
+extern cycle_t clocksource_mmio_readw_down_be(struct clocksource *);
 extern cycle_t clocksource_mmio_readw_down(struct clocksource *);
 
 extern int clocksource_mmio_init(void __iomem *, const char *,
-- 
2.1.0.27.g96db324


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

* Re: [PATCH v3 1/2] clocksource: Update to the newer memory functions.
  2014-09-30  5:03 ` [PATCH v3 1/2] clocksource: Update to the newer memory functions Xiubo Li
@ 2014-09-30 21:20   ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2014-09-30 21:20 UTC (permalink / raw)
  To: Xiubo Li; +Cc: daniel.lezcano, linux-kernel, john.stultz

On Tue, 30 Sep 2014, Xiubo Li wrote:

> Use ioread{16,32} instead of read{w,l}_relaxed.
> 
> For read{w,l}_relaxed accessor, if one arch has its own defination,
> then used it. Or will use the generic one, which will be read as LE
> endian as default.
>  
> For some ARCHes, such PowerPC, if using the clocksource mmio, the
> read{w,l}_relaxed will couldn't be used directly. There must be its
> own BE accessor in its individual clocksource driver.
>
> The ioread{16,32} will be read as LE endian as default if the arch
> hasn't any defination of it too, like read{w,l}_relaxed do.
> 
> To prepare supporting the BE APIs and to be more unified with them,
> using ioread{16,32}[be] is a good chioce here.

This is complete nonsense. I asked you to split this change out and
provide a very reasonable changelog for it in the hope that you would
start to think about what the difference between read*, read*_relaxed
and ioread* are.

I bet you did not even try to think about it for a split second.

You just mechanically split out the changes and dumped your completely
incompetent opinion how these interfaces work and why they are there
in the first place into a uncomprehensible changelog.

Try again, once you understood the semantics of the interfaces and a
proper explanation why inflicting a massive performance hit on most
existing users seems to be a brilliant idea.

Once you've done that use that acquired knowledge to look at your
proposed BE functions and figure out why they are wrong as well.

Thanks,

	tglx

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

end of thread, other threads:[~2014-09-30 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30  5:03 [PATCH v3 0/2] clocksource: Add BE APIs support Xiubo Li
2014-09-30  5:03 ` [PATCH v3 1/2] clocksource: Update to the newer memory functions Xiubo Li
2014-09-30 21:20   ` Thomas Gleixner
2014-09-30  5:03 ` [PATCH v3 2/2] clocksource: Add BE APIs support for clocksource counter reading Xiubo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®