clocksource: Add BE APIs support.
v3 cover clocksource: Add BE APIs support.
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(-)
Signature · 1 line
2.1.0.27.g96db324
PATCH v3 1/2 clocksource: Update to the newer memory functions.
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.
--- drivers/clocksource/mmio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clocksource/mmio.c +4 -4
@@ -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; }/**
Signature · 1 line
2.1.0.27.g96db324
Re: [PATCH v3 1/2] clocksource: Update to the newer memory functions.
Quoted 10 lines · 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.
Quoted 5 lines
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
PATCH v3 2/2 clocksource: Add BE APIs support for clocksource counter reading.
In reply to Xiubo Li--- drivers/clocksource/mmio.c | 20 ++++++++++++++++++++ include/linux/clocksource.h | 4 ++++ 2 files changed, 24 insertions(+)
drivers/clocksource/mmio.c +20 -0
@@ -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;
include/linux/clocksource.h +4 -0
@@ -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 *,
Signature · 1 line
2.1.0.27.g96db324