Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

0 views
Skip to first unread message

Stephen Boyd

unread,
Nov 15, 2013, 6:50:01 PM11/15/13
to
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.

Cc: Maxime Ripard <maxime...@free-electrons.com>
Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
---
drivers/clocksource/sun4i_timer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 2fb4695..932d685 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -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);

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

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

Stephen Boyd

unread,
Nov 15, 2013, 6:50:01 PM11/15/13
to
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 <stuart...@st.com>
Cc: Srinivas Kandagatla <srinivas....@st.com>
Cc: Soren Brinkmann <soren.b...@xilinx.com>
Cc: Michal Simek <mon...@monstr.eu>
Cc: Maxime Ripard <maxime...@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian....@gmail.com>

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(-)

Stephen Boyd

unread,
Nov 15, 2013, 6:50:01 PM11/15/13
to
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 <soren.b...@xilinx.com>
Cc: Michal Simek <mon...@monstr.eu>
Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
---
drivers/clocksource/cadence_ttc_timer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c
index b2bb3a4b..b865b4e 100644
--- a/drivers/clocksource/cadence_ttc_timer.c
+++ b/drivers/clocksource/cadence_ttc_timer.c
@@ -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);

Stephen Boyd

unread,
Nov 15, 2013, 6:50:02 PM11/15/13
to
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 <stuart...@st.com>
Cc: Srinivas Kandagatla <srinivas....@st.com>
Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
---
drivers/clocksource/arm_global_timer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index c639b1a..0fc31d0 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -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);

Stephen Boyd

unread,
Nov 15, 2013, 6:50:02 PM11/15/13
to
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 <sebastian....@gmail.com>
Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
---
drivers/clocksource/time-orion.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c
index 9c7f018..2006622 100644
--- a/drivers/clocksource/time-orion.c
+++ b/drivers/clocksource/time-orion.c
@@ -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))

Sören Brinkmann

unread,
Nov 15, 2013, 7:10:02 PM11/15/13
to
On Fri, Nov 15, 2013 at 03:48:33PM -0800, Stephen Boyd wrote:
> 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 <soren.b...@xilinx.com>
> Cc: Michal Simek <mon...@monstr.eu>
> Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
Tested-by: Soren Brinkmann <soren.b...@xilinx.com>

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

Thanks,
Sören

Sebastian Hesselbarth

unread,
Nov 16, 2013, 8:40:02 AM11/16/13
to
On 11/16/2013 12:48 AM, Stephen Boyd wrote:
> 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 <sebastian....@gmail.com>
> Signed-off-by: Stephen Boyd <sb...@codeaurora.org>

Tested-by: Sebastian Hesselbarth <sebastian....@gmail.com>

Thanks!

> ---
> drivers/clocksource/time-orion.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c
> index 9c7f018..2006622 100644
> --- a/drivers/clocksource/time-orion.c
> +++ b/drivers/clocksource/time-orion.c
> @@ -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))
>

--

srinivas kandagatla

unread,
Nov 18, 2013, 5:00:02 AM11/18/13
to
On 15/11/13 23:48, Stephen Boyd wrote:
> 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 <stuart...@st.com>
> Cc: Srinivas Kandagatla <srinivas....@st.com>
> Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
> ---
> drivers/clocksource/arm_global_timer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
> index c639b1a..0fc31d0 100644
> --- a/drivers/clocksource/arm_global_timer.c
> +++ b/drivers/clocksource/arm_global_timer.c
> @@ -202,7 +202,7 @@ static struct clocksource gt_clocksource = {

Thankyou for the patch.

Acked-by: Srinivas Kandagatla <srinivas....@st.com>

Stuart MENEFY

unread,
Nov 18, 2013, 1:30:02 PM11/18/13
to
Looks good, thanks.

Acked-by: Stuart Menefy <stuart...@st.com>

On 15/11/13 23:48, Stephen Boyd wrote:

Daniel Lezcano

unread,
Nov 19, 2013, 9:00:02 AM11/19/13
to
On 11/16/2013 12:48 AM, Stephen Boyd wrote:
> 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.
>
> Cc: Maxime Ripard <maxime...@free-electrons.com>
> Signed-off-by: Stephen Boyd <sb...@codeaurora.org>
> ---

Hi Maxime,

could you have look to this patch ?

Thanks
-- Daniel

> drivers/clocksource/sun4i_timer.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
> index 2fb4695..932d685 100644
> --- a/drivers/clocksource/sun4i_timer.c
> +++ b/drivers/clocksource/sun4i_timer.c
> @@ -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);


--
<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

Maxime Ripard

unread,
Nov 19, 2013, 11:10:02 AM11/19/13
to
On Fri, Nov 15, 2013 at 03:48:34PM -0800, Stephen Boyd wrote:
> 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.
>
> Cc: Maxime Ripard <maxime...@free-electrons.com>
> Signed-off-by: Stephen Boyd <sb...@codeaurora.org>

Acked-by: Maxime Ripard <maxime...@free-electrons.com>

Thanks!
Maxime

--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
signature.asc

Daniel Lezcano

unread,
Nov 19, 2013, 7:00:02 PM11/19/13
to
On 11/16/2013 12:48 AM, Stephen Boyd wrote:
> 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 <stuart...@st.com>
> Cc: Srinivas Kandagatla <srinivas....@st.com>
> Cc: Soren Brinkmann <soren.b...@xilinx.com>
> Cc: Michal Simek <mon...@monstr.eu>
> Cc: Maxime Ripard <maxime...@free-electrons.com>
> Cc: Sebastian Hesselbarth <sebastian....@gmail.com>
>
> 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(-)

Hi Stephen,

applied to my tree for 3.14.

Thanks !


--
<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

0 new messages