All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 23/27] clocksource: sh_cmt: Add DT support
Date: Mon, 17 Feb 2014 01:45:22 +0000	[thread overview]
Message-ID: <35710038.vGLtzuIoLe@avalon> (raw)
In-Reply-To: <CANqRtoROALpUqi8rKWRpQk7LGc0BqU14AKg-2MgYBMNoEFGA4Q@mail.gmail.com>

Hi Magnus,

On Saturday 15 February 2014 02:22:00 Magnus Damm wrote:
> On Sat, Feb 15, 2014 at 1:12 AM, Laurent Pinchart wrote:
> > On Saturday 15 February 2014 01:01:30 Magnus Damm wrote:
> >> On Sat, Feb 15, 2014 at 12:53 AM, Laurent Pinchart wrote:
> >> > On Friday 14 February 2014 10:58:22 Mark Rutland wrote:
> >> >> On Fri, Feb 14, 2014 at 01:00:01AM +0000, Laurent Pinchart wrote:
> >> >> > +Channels Optional Properties:
> >> >> > +
> >> >> > +  - clock-source-rating: rating of the timer as a clock source
> >> >> > device.
> >> >> > +  - clock-event-rating: rating of the timer as a clock event
> >> >> > device.
> >> >> 
> >> >> This feels like a leak of Linux internals. Why do you need this?
> >> > 
> >> > You're right, it is. The clock source and clock event ratings are
> >> > currently configured through platform data, I'll need to find a way to
> >> > compute them in the driver instead.
> >> 
> >> That would be very good!
> > 
> > Any pointer would be appreciated :-) How did you compute the various
> > ratings used in platform data all over the place ?
> 
> Historically we used the rating to select between CMT and TMU. For
> clock sources I suppose you also have the jiffy rating to consider.
> And for the SMP parts we have ARM IP for TWD and arch timers that have
> their ratings too. So you need to check all the timers on a particular
> system and consider what you want to have operating by default. The
> ARM IP timers should be preferred if available. For clock sources the
> rule is probably the higher resolution the better.
> 
> >> > There's still one piece of Linux-specific data I need though, as I need
> >> > to specify for each channel whether to use it as a clock source device,
> >> > a clock event device, both of them or none. That's configuration
> >> > information that needs to be provided somehow.
> >> 
> >> I think you can decide clock source or clock event assignment based on
> >> number of channels available. If you have only a single channel then both
> >> clock event and clock source need to be supported. Otherwise use one
> >> channel for clock source and the rest for clock events.
> > 
> > That won't match the current situation. Look at CMT0 in r8a7790 for
> > instance. There's two hardware channels available, and we only use the
> > first one, for clock events only.
> 
> You are correct. The reason for that is that the CMT driver today is
> optimized for combined clock event and clock source operation.
> 
> Historically the hardware it initially was written for (sh-mobile on
> the SH arch) only had a single timer channel so combined operation was
> required for tickless to work. But since you're asking how to allocate
> channels then I propose checking numbers of channels available and go
> from there. With that the r8a7790 support can only get better. =)
> 
> >> This is probably out of scope for this DT conversion, but it would be
> >> neat if you somehow could specify the CPU affinity for a channel to tie a
> >> clock event to an individual CPU core. This would make a a per-cpu timer
> >> unless I'm mistaken. But that's more of a software policy than anything
> >> else.
> > 
> > Yes, that's a configuration that needs to be specified somewhere. I don't
> > know where though.
> 
> As long as you have per-channel interrupts described in DT you can
> probably handle this in a generic way in the driver.

But how do we decide whether to use a single timer channel or one channel per 
CPU ? Will the kernel use one clock event device per CPU automatically ? I 
have to confess I have no idea how this works.

-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 23/27] clocksource: sh_cmt: Add DT support
Date: Mon, 17 Feb 2014 02:45:22 +0100	[thread overview]
Message-ID: <35710038.vGLtzuIoLe@avalon> (raw)
In-Reply-To: <CANqRtoROALpUqi8rKWRpQk7LGc0BqU14AKg-2MgYBMNoEFGA4Q@mail.gmail.com>

Hi Magnus,

On Saturday 15 February 2014 02:22:00 Magnus Damm wrote:
> On Sat, Feb 15, 2014 at 1:12 AM, Laurent Pinchart wrote:
> > On Saturday 15 February 2014 01:01:30 Magnus Damm wrote:
> >> On Sat, Feb 15, 2014 at 12:53 AM, Laurent Pinchart wrote:
> >> > On Friday 14 February 2014 10:58:22 Mark Rutland wrote:
> >> >> On Fri, Feb 14, 2014 at 01:00:01AM +0000, Laurent Pinchart wrote:
> >> >> > +Channels Optional Properties:
> >> >> > +
> >> >> > +  - clock-source-rating: rating of the timer as a clock source
> >> >> > device.
> >> >> > +  - clock-event-rating: rating of the timer as a clock event
> >> >> > device.
> >> >> 
> >> >> This feels like a leak of Linux internals. Why do you need this?
> >> > 
> >> > You're right, it is. The clock source and clock event ratings are
> >> > currently configured through platform data, I'll need to find a way to
> >> > compute them in the driver instead.
> >> 
> >> That would be very good!
> > 
> > Any pointer would be appreciated :-) How did you compute the various
> > ratings used in platform data all over the place ?
> 
> Historically we used the rating to select between CMT and TMU. For
> clock sources I suppose you also have the jiffy rating to consider.
> And for the SMP parts we have ARM IP for TWD and arch timers that have
> their ratings too. So you need to check all the timers on a particular
> system and consider what you want to have operating by default. The
> ARM IP timers should be preferred if available. For clock sources the
> rule is probably the higher resolution the better.
> 
> >> > There's still one piece of Linux-specific data I need though, as I need
> >> > to specify for each channel whether to use it as a clock source device,
> >> > a clock event device, both of them or none. That's configuration
> >> > information that needs to be provided somehow.
> >> 
> >> I think you can decide clock source or clock event assignment based on
> >> number of channels available. If you have only a single channel then both
> >> clock event and clock source need to be supported. Otherwise use one
> >> channel for clock source and the rest for clock events.
> > 
> > That won't match the current situation. Look at CMT0 in r8a7790 for
> > instance. There's two hardware channels available, and we only use the
> > first one, for clock events only.
> 
> You are correct. The reason for that is that the CMT driver today is
> optimized for combined clock event and clock source operation.
> 
> Historically the hardware it initially was written for (sh-mobile on
> the SH arch) only had a single timer channel so combined operation was
> required for tickless to work. But since you're asking how to allocate
> channels then I propose checking numbers of channels available and go
> from there. With that the r8a7790 support can only get better. =)
> 
> >> This is probably out of scope for this DT conversion, but it would be
> >> neat if you somehow could specify the CPU affinity for a channel to tie a
> >> clock event to an individual CPU core. This would make a a per-cpu timer
> >> unless I'm mistaken. But that's more of a software policy than anything
> >> else.
> > 
> > Yes, that's a configuration that needs to be specified somewhere. I don't
> > know where though.
> 
> As long as you have per-channel interrupts described in DT you can
> probably handle this in a generic way in the driver.

But how do we decide whether to use a single timer channel or one channel per 
CPU ? Will the kernel use one clock event device per CPU automatically ? I 
have to confess I have no idea how this works.

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	"linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 23/27] clocksource: sh_cmt: Add DT support
Date: Mon, 17 Feb 2014 02:45:22 +0100	[thread overview]
Message-ID: <35710038.vGLtzuIoLe@avalon> (raw)
In-Reply-To: <CANqRtoROALpUqi8rKWRpQk7LGc0BqU14AKg-2MgYBMNoEFGA4Q@mail.gmail.com>

Hi Magnus,

On Saturday 15 February 2014 02:22:00 Magnus Damm wrote:
> On Sat, Feb 15, 2014 at 1:12 AM, Laurent Pinchart wrote:
> > On Saturday 15 February 2014 01:01:30 Magnus Damm wrote:
> >> On Sat, Feb 15, 2014 at 12:53 AM, Laurent Pinchart wrote:
> >> > On Friday 14 February 2014 10:58:22 Mark Rutland wrote:
> >> >> On Fri, Feb 14, 2014 at 01:00:01AM +0000, Laurent Pinchart wrote:
> >> >> > +Channels Optional Properties:
> >> >> > +
> >> >> > +  - clock-source-rating: rating of the timer as a clock source
> >> >> > device.
> >> >> > +  - clock-event-rating: rating of the timer as a clock event
> >> >> > device.
> >> >> 
> >> >> This feels like a leak of Linux internals. Why do you need this?
> >> > 
> >> > You're right, it is. The clock source and clock event ratings are
> >> > currently configured through platform data, I'll need to find a way to
> >> > compute them in the driver instead.
> >> 
> >> That would be very good!
> > 
> > Any pointer would be appreciated :-) How did you compute the various
> > ratings used in platform data all over the place ?
> 
> Historically we used the rating to select between CMT and TMU. For
> clock sources I suppose you also have the jiffy rating to consider.
> And for the SMP parts we have ARM IP for TWD and arch timers that have
> their ratings too. So you need to check all the timers on a particular
> system and consider what you want to have operating by default. The
> ARM IP timers should be preferred if available. For clock sources the
> rule is probably the higher resolution the better.
> 
> >> > There's still one piece of Linux-specific data I need though, as I need
> >> > to specify for each channel whether to use it as a clock source device,
> >> > a clock event device, both of them or none. That's configuration
> >> > information that needs to be provided somehow.
> >> 
> >> I think you can decide clock source or clock event assignment based on
> >> number of channels available. If you have only a single channel then both
> >> clock event and clock source need to be supported. Otherwise use one
> >> channel for clock source and the rest for clock events.
> > 
> > That won't match the current situation. Look at CMT0 in r8a7790 for
> > instance. There's two hardware channels available, and we only use the
> > first one, for clock events only.
> 
> You are correct. The reason for that is that the CMT driver today is
> optimized for combined clock event and clock source operation.
> 
> Historically the hardware it initially was written for (sh-mobile on
> the SH arch) only had a single timer channel so combined operation was
> required for tickless to work. But since you're asking how to allocate
> channels then I propose checking numbers of channels available and go
> from there. With that the r8a7790 support can only get better. =)
> 
> >> This is probably out of scope for this DT conversion, but it would be
> >> neat if you somehow could specify the CPU affinity for a channel to tie a
> >> clock event to an individual CPU core. This would make a a per-cpu timer
> >> unless I'm mistaken. But that's more of a software policy than anything
> >> else.
> > 
> > Yes, that's a configuration that needs to be specified somewhere. I don't
> > know where though.
> 
> As long as you have per-channel interrupts described in DT you can
> probably handle this in a generic way in the driver.

But how do we decide whether to use a single timer channel or one channel per 
CPU ? Will the kernel use one clock event device per CPU automatically ? I 
have to confess I have no idea how this works.

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2014-02-17  1:45 UTC|newest]

Thread overview: 168+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  0:59 [PATCH 00/27] Renesas CMT (Compare Match Timer) DT bindings Laurent Pinchart
2014-02-14  0:59 ` Laurent Pinchart
2014-02-14  0:59 ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 01/27] clocksource: sh_cmt: Split channel fields from sh_cmt_priv Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 02/27] clocksource: sh_cmt: Rename struct sh_cmt_priv to sh_cmt_device Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 03/27] clocksource: sh_cmt: Split channel setup to separate function Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 04/27] clocksource: sh_cmt: Rename mapbase/mapbase_str to mapbase_ch/mapbase Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 05/27] clocksource: sh_cmt: Add memory base to sh_cmt_channel structure Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 06/27] clocksource: sh_cmt: Add index to struct sh_cmt_channel Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 07/27] clocksource: sh_cmt: Replace kmalloc + memset with kzalloc Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 08/27] clocksource: sh_cmt: Allocate channels dynamically Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 09/27] clocksource: sh_cmt: Split static information from sh_cmt_device Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 10/27] clocksource: sh_cmt: Replace hardcoded register values with macros Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 11/27] clocksource: sh_cmt: Add support for multiple channels per device Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-15 12:46   ` Thomas Gleixner
2014-02-15 12:46     ` Thomas Gleixner
2014-02-15 12:46     ` Thomas Gleixner
2014-02-16 18:18     ` Laurent Pinchart
2014-02-16 18:18       ` Laurent Pinchart
2014-02-16 18:18       ` Laurent Pinchart
2014-02-17  1:41       ` Magnus Damm
2014-02-17  1:41         ` Magnus Damm
2014-02-17  1:41         ` Magnus Damm
2014-02-17  1:48         ` Laurent Pinchart
2014-02-17  1:48           ` Laurent Pinchart
2014-02-17  1:48           ` Laurent Pinchart
2014-02-17  2:07           ` Magnus Damm
2014-02-17  2:07             ` Magnus Damm
2014-02-17  2:07             ` Magnus Damm
2014-02-17  9:58             ` Laurent Pinchart
2014-02-17  9:58               ` Laurent Pinchart
2014-02-17  9:58               ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 12/27] clocksource: sh_cmt: Acquire default clock in the non-legacy case Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 13/27] clocksource: sh_cmt: Remove FSF mail address from GPL notice Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 14/27] clocksource: sh_cmt: Sort headers alphabetically Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 15/27] sh: Switch to new style CMT device Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 16/27] ARM: shmobile: sh7372: " Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 17/27] ARM: shmobile: sh73a0: " Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 18/27] ARM: shmobile: r8a73a4: " Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 19/27] ARM: shmobile: r8a7740: " Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 20/27] ARM: shmobile: r8a7790: " Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59 ` [PATCH 21/27] ARM: shmobile: r8a7791: " Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  0:59   ` Laurent Pinchart
2014-02-14  1:00 ` [PATCH 22/27] clocksource: sh_cmt: Drop support for legacy platform data Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00 ` [PATCH 23/27] clocksource: sh_cmt: Add DT support Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  9:18   ` Geert Uytterhoeven
2014-02-14  9:18     ` Geert Uytterhoeven
2014-02-14  9:18     ` Geert Uytterhoeven
2014-02-14 14:35     ` Laurent Pinchart
2014-02-14 14:35       ` Laurent Pinchart
2014-02-14 14:35       ` Laurent Pinchart
2014-02-14 10:58   ` Mark Rutland
2014-02-14 10:58     ` Mark Rutland
2014-02-14 10:58     ` Mark Rutland
2014-02-14 15:53     ` Laurent Pinchart
2014-02-14 15:53       ` Laurent Pinchart
2014-02-14 15:53       ` Laurent Pinchart
2014-02-14 15:59       ` Josh Cartwright
2014-02-14 15:59         ` Josh Cartwright
2014-02-14 15:59         ` Josh Cartwright
2014-02-14 16:15         ` Laurent Pinchart
2014-02-14 16:15           ` Laurent Pinchart
2014-02-14 16:15           ` Laurent Pinchart
2014-02-14 16:01       ` Magnus Damm
2014-02-14 16:01         ` Magnus Damm
2014-02-14 16:01         ` Magnus Damm
2014-02-14 16:12         ` Laurent Pinchart
2014-02-14 16:12           ` Laurent Pinchart
2014-02-14 16:12           ` Laurent Pinchart
2014-02-14 17:22           ` Magnus Damm
2014-02-14 17:22             ` Magnus Damm
2014-02-14 17:22             ` Magnus Damm
2014-02-17  1:45             ` Laurent Pinchart [this message]
2014-02-17  1:45               ` Laurent Pinchart
2014-02-17  1:45               ` Laurent Pinchart
2014-02-17  1:48               ` Magnus Damm
2014-02-17  1:48                 ` Magnus Damm
2014-02-17  1:48                 ` Magnus Damm
2014-02-17 21:43                 ` Laurent Pinchart
2014-02-17 21:43                   ` Laurent Pinchart
2014-02-17 21:43                   ` Laurent Pinchart
2014-02-18  0:51                   ` Magnus Damm
2014-02-18  0:51                     ` Magnus Damm
2014-02-18  0:51                     ` Magnus Damm
2014-02-18 11:45                     ` Laurent Pinchart
2014-02-18 11:45                       ` Laurent Pinchart
2014-02-18 11:45                       ` Laurent Pinchart
2014-02-14  1:00 ` [PATCH 24/27] ARM: shmobile: r8a7790: Add CMT devices to DT Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00 ` [PATCH 25/27] ARM: shmobile: r8a7791: " Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00 ` [PATCH 26/27] ARM: shmobile: lager-reference: Enable CMT0 in device tree Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14 13:45   ` Sergei Shtylyov
2014-02-14 13:45     ` Sergei Shtylyov
2014-02-14 13:45     ` Sergei Shtylyov
2014-02-14 13:48     ` Laurent Pinchart
2014-02-14 13:48       ` Laurent Pinchart
2014-02-14 13:48       ` Laurent Pinchart
2014-02-14 14:13       ` Sergei Shtylyov
2014-02-14 14:13         ` Sergei Shtylyov
2014-02-14 14:13         ` Sergei Shtylyov
2014-02-14 14:22         ` Laurent Pinchart
2014-02-14 14:22           ` Laurent Pinchart
2014-02-14 14:22           ` Laurent Pinchart
2014-02-14 14:36           ` Sergei Shtylyov
2014-02-14 14:36             ` Sergei Shtylyov
2014-02-14 14:36             ` Sergei Shtylyov
2014-02-14 16:26             ` Laurent Pinchart
2014-02-14 16:26               ` Laurent Pinchart
2014-02-14 16:26               ` Laurent Pinchart
2014-02-14 18:56               ` Sergei Shtylyov
2014-02-14 19:56                 ` Sergei Shtylyov
2014-02-14 19:56                 ` Sergei Shtylyov
2014-02-14  1:00 ` [PATCH 27/27] ARM: shmobile: koelsch-reference: " Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14  1:00   ` Laurent Pinchart
2014-02-14 13:47   ` Sergei Shtylyov
2014-02-14 13:47     ` Sergei Shtylyov
2014-02-14 13:47     ` Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35710038.vGLtzuIoLe@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.