Skip to contentSkip to conversation

Convert setup_sched_clock() users in drivers/clocksource

PATCH Applied Stephen Boyd 7 participants 12 messages Nov 15, 2013 – Nov 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Convert setup_sched_clock() users in drivers/clocksource

Daniel,

These patches convert the remaining few users in drivers/clocksource to the new sched_clock_register() API. These were new drivers to this directory after I sent out the sched_clock conversion patches a few months back. Patches are based on Linus' tip, compile tested only.

Cc Stuart Menefy <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc Soren Brinkmann <[email protected]>
Cc Michal Simek <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>

Stephen Boyd (4):
clocksource: arm_global_timer: Switch to sched_clock_register()
clocksource: cadence_ttc_timer: Switch to sched_clock_register()
clocksource: sun4i: Switch to sched_clock_register()
clocksource: orion: Switch to sched_clock_register()

 drivers/clocksource/arm_global_timer.c  | 4 ++--
 drivers/clocksource/cadence_ttc_timer.c | 4 ++--
 drivers/clocksource/sun4i_timer.c       | 4 ++--
 drivers/clocksource/time-orion.c        | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

PATCH 1/4 clocksource: arm_global_timer: Switch to sched_clock_register()

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface. While we're here increase the number of bits that sched_clock can handle to 64 to make full use of the counter.

Cc Stuart Menefy <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
 drivers/clocksource/arm_global_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/arm_global_timer.c +2 -2
index c639b1a..0fc31d0 100644
@@ -202,7 +202,7 @@ static struct clocksource gt_clocksource = {
 };
 
 #ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-static u32 notrace gt_sched_clock_read(void)
+static u64 notrace gt_sched_clock_read(void)
 {
 	return gt_counter_read();
 }
@@ -217,7 +217,7 @@ static void __init gt_clocksource_init(void)
 	writel(GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL);
 
 #ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-	setup_sched_clock(gt_sched_clock_read, 32, gt_clk_rate);
+	sched_clock_register(gt_sched_clock_read, 64, gt_clk_rate);
 #endif
 	clocksource_register_hz(&gt_clocksource, gt_clk_rate);
 }
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] clocksource: arm_global_timer: Switch to sched_clock_register()

drivers/clocksource/arm_global_timer.c static struct clocksource gt_clocksource = {

Quoted 17 lines · Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface. While we're here increase the number of bits that sched_clock can handle to 64 to make full use of the counter.

Cc Stuart Menefy <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
 drivers/clocksource/arm_global_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/arm_global_timer.c +0 -0
index c639b1a..0fc31d0 100644
@@ -202,7 +202,7 @@ static struct clocksource gt_clocksource = {

Thankyou for the patch.

Acked-by on v1 1/4
#3 lore raw

Re: [PATCH 1/4] clocksource: arm_global_timer: Switch to sched_clock_register()

In reply to Stephen Boyd

Looks good, thanks.

Quoted 35 lines · Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface. While we're here increase the number of bits that sched_clock can handle to 64 to make full use of the counter.

Cc Stuart Menefy <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
---
 drivers/clocksource/arm_global_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/arm_global_timer.c +2 -2
index c639b1a..0fc31d0 100644
@@ -202,7 +202,7 @@ static struct clocksource gt_clocksource = {
 };
 
 #ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-static u32 notrace gt_sched_clock_read(void)
+static u64 notrace gt_sched_clock_read(void)
 {
 	return gt_counter_read();
 }
@@ -217,7 +217,7 @@ static void __init gt_clocksource_init(void)
 	writel(GT_CONTROL_TIMER_ENABLE, gt_base + GT_CONTROL);
 
 #ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
-	setup_sched_clock(gt_sched_clock_read, 32, gt_clk_rate);
+	sched_clock_register(gt_sched_clock_read, 64, gt_clk_rate);
 #endif
 	clocksource_register_hz(&gt_clocksource, gt_clk_rate);
 }
#4 lore raw

PATCH 2/4 clocksource: cadence_ttc_timer: Switch to sched_clock_register()

In reply to Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface.

Cc Soren Brinkmann <[email protected]>
Cc Michal Simek <[email protected]>
---
 drivers/clocksource/cadence_ttc_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/cadence_ttc_timer.c +2 -2
index b2bb3a4b..b865b4e 100644
@@ -158,7 +158,7 @@ static cycle_t __ttc_clocksource_read(struct clocksource *cs)
 				TTC_COUNT_VAL_OFFSET);
 }
 
-static u32 notrace ttc_sched_clock_read(void)
+static u64 notrace ttc_sched_clock_read(void)
 {
 	return __raw_readl(ttc_sched_clock_val_reg);
 }
@@ -306,7 +306,7 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base)
 	}
 
 	ttc_sched_clock_val_reg = base + TTC_COUNT_VAL_OFFSET;
-	setup_sched_clock(ttc_sched_clock_read, 16,
+	sched_clock_register(ttc_sched_clock_read, 16,
 			clk_get_rate(ttccs->ttc.clk) / PRESCALE);
 }
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Tested-by on v1 2/4
#5 lore raw

Re: [PATCH 2/4] clocksource: cadence_ttc_timer: Switch to sched_clock_register()

Quoted 7 lines · Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface.

Cc Soren Brinkmann <[email protected]>
Cc Michal Simek <[email protected]>

Small enough of a change to quickly test. Works fine.

Thanks,
Sören

#6 lore raw

PATCH 3/4 clocksource: sun4i: Switch to sched_clock_register()

In reply to Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface. While we're here, mark the sched_clock function as notrace to prevent ftrace recursion crashes.

---
 drivers/clocksource/sun4i_timer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/sun4i_timer.c +2 -2
index 2fb4695..932d685 100644
@@ -138,7 +138,7 @@ static struct irqaction sun4i_timer_irq = {
 	.dev_id = &sun4i_clockevent,
 };
 
-static u32 sun4i_timer_sched_read(void)
+static u64 notrace sun4i_timer_sched_read(void)
 {
 	return ~readl(timer_base + TIMER_CNTVAL_REG(1));
 }
@@ -170,7 +170,7 @@ static void __init sun4i_timer_init(struct device_node *node)
 	       TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
 	       timer_base + TIMER_CTL_REG(1));
 
-	setup_sched_clock(sun4i_timer_sched_read, 32, rate);
+	sched_clock_register(sun4i_timer_sched_read, 32, rate);
 	clocksource_mmio_init(timer_base + TIMER_CNTVAL_REG(1), node->name,
 			      rate, 300, 32, clocksource_mmio_readl_down);
 
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#7 lore raw

Re: [PATCH 3/4] clocksource: sun4i: Switch to sched_clock_register()

Quoted 8 lines · Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface. While we're here, mark the sched_clock function as notrace to prevent ftrace recursion crashes.

---

Hi Maxime,

could you have look to this patch ?

Thanks
-- Daniel

Quoted 24 lines
  drivers/clocksource/sun4i_timer.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/sun4i_timer.c +2 -2
index 2fb4695..932d685 100644
@@ -138,7 +138,7 @@ static struct irqaction sun4i_timer_irq = {
  	.dev_id = &sun4i_clockevent,
  };
 
-static u32 sun4i_timer_sched_read(void)
+static u64 notrace sun4i_timer_sched_read(void)
  {
  	return ~readl(timer_base + TIMER_CNTVAL_REG(1));
  }
@@ -170,7 +170,7 @@ static void __init sun4i_timer_init(struct device_node *node)
  	       TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
  	       timer_base + TIMER_CTL_REG(1));
 
-	setup_sched_clock(sun4i_timer_sched_read, 32, rate);
+	sched_clock_register(sun4i_timer_sched_read, 32, rate);
  	clocksource_mmio_init(timer_base + TIMER_CNTVAL_REG(1), node->name,
  			      rate, 300, 32, clocksource_mmio_readl_down);
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Acked-by on v1 3/4
#8 lore raw

Re: [PATCH 3/4] clocksource: sun4i: Switch to sched_clock_register()

In reply to Stephen Boyd
Quoted 7 lines · Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface. While we're here, mark the sched_clock function as notrace to prevent ftrace recursion crashes.

Thanks!
Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

PATCH 4/4 clocksource: orion: Switch to sched_clock_register()

In reply to Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface.

Cc Sebastian Hesselbarth <[email protected]>
---
 drivers/clocksource/time-orion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/time-orion.c +2 -2
index 9c7f018..2006622 100644
@@ -53,7 +53,7 @@ EXPORT_SYMBOL(orion_timer_ctrl_clrset);
 /*
  * Free-running clocksource handling.
  */
-static u32 notrace orion_read_sched_clock(void)
+static u64 notrace orion_read_sched_clock(void)
 {
 	return ~readl(timer_base + TIMER0_VAL);
 }
@@ -135,7 +135,7 @@ static void __init orion_timer_init(struct device_node *np)
 	clocksource_mmio_init(timer_base + TIMER0_VAL, "orion_clocksource",
 			      clk_get_rate(clk), 300, 32,
 			      clocksource_mmio_readl_down);
-	setup_sched_clock(orion_read_sched_clock, 32, clk_get_rate(clk));
+	sched_clock_register(orion_read_sched_clock, 32, clk_get_rate(clk));
 
 	/* setup timer1 as clockevent timer */
 	if (setup_irq(irq, &orion_clkevt_irq))
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
Tested-by on v1 4/4
#10 lore raw

Re: [PATCH 4/4] clocksource: orion: Switch to sched_clock_register()

Quoted 6 lines · Stephen Boyd

The 32 bit sched_clock interface now supports 64 bits. Upgrade to the 64 bit function to allow us to remove the 32 bit registration interface.

Cc Sebastian Hesselbarth <[email protected]>

Thanks!

Quoted 27 lines
---
  drivers/clocksource/time-orion.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clocksource/time-orion.c +2 -2
index 9c7f018..2006622 100644
@@ -53,7 +53,7 @@ EXPORT_SYMBOL(orion_timer_ctrl_clrset);
  /*
   * Free-running clocksource handling.
   */
-static u32 notrace orion_read_sched_clock(void)
+static u64 notrace orion_read_sched_clock(void)
  {
  	return ~readl(timer_base + TIMER0_VAL);
  }
@@ -135,7 +135,7 @@ static void __init orion_timer_init(struct device_node *np)
  	clocksource_mmio_init(timer_base + TIMER0_VAL, "orion_clocksource",
  			      clk_get_rate(clk), 300, 32,
  			      clocksource_mmio_readl_down);
-	setup_sched_clock(orion_read_sched_clock, 32, clk_get_rate(clk));
+	sched_clock_register(orion_read_sched_clock, 32, clk_get_rate(clk));
 
  	/* setup timer1 as clockevent timer */
  	if (setup_irq(irq, &orion_clkevt_irq))
#11 lore raw
In reply to Stephen Boyd
Quoted 20 lines · Stephen Boyd

Daniel,

These patches convert the remaining few users in drivers/clocksource to the new sched_clock_register() API. These were new drivers to this directory after I sent out the sched_clock conversion patches a few months back. Patches are based on Linus' tip, compile tested only.

Cc Stuart Menefy <[email protected]>
Cc Srinivas Kandagatla <[email protected]>
Cc Soren Brinkmann <[email protected]>
Cc Michal Simek <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sebastian Hesselbarth <[email protected]>

Stephen Boyd (4):
clocksource: arm_global_timer: Switch to sched_clock_register()
clocksource: cadence_ttc_timer: Switch to sched_clock_register()
clocksource: sun4i: Switch to sched_clock_register()
clocksource: orion: Switch to sched_clock_register()

Quoted 5 lines
  drivers/clocksource/arm_global_timer.c  | 4 ++--
  drivers/clocksource/cadence_ttc_timer.c | 4 ++--
  drivers/clocksource/sun4i_timer.c       | 4 ++--
  drivers/clocksource/time-orion.c        | 4 ++--
  4 files changed, 8 insertions(+), 8 deletions(-)

Hi Stephen,

applied to my tree for 3.14.

Thanks !

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog