* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI [not found] ` <20140120125436.GN17314@sirena.org.uk> @ 2014-01-20 13:19 ` Ben Dooks 2014-01-20 15:48 ` Laurent Pinchart 0 siblings, 1 reply; 7+ messages in thread From: Ben Dooks @ 2014-01-20 13:19 UTC (permalink / raw) To: linux-arm-kernel I've added linux-arm-kernel to the list to get a wider view from people who actively use the clock subsystem. On 20/01/14 12:54, Mark Brown wrote: > On Mon, Jan 20, 2014 at 12:01:00PM +0000, Ben Dooks wrote: >> On 20/01/14 11:47, Mark Brown wrote: > >>> I think that just makes things more complicated and isn't adding >>> anything over pm_runtime_enable(), it's just boilerplate code. In >>> theory essentially every driver running on platforms which don't have >>> explicit management of core IP clocks ought to be calling this since >>> potentially the IP might be deployed on another platform which does have >>> clock management (this does actually happen with things like the >>> DesignWare IPs) and it doesn't do anything like say which clocks are >>> expected to be managed in this way which is another thing that can come >>> up when moving devices between platforms. > >> That sounds like a real headache where you have two sets of code >> looking at possibly the same clocks, and behaving differently between >> different platforms. > > Yup, it's usually only one set of code on the client side but it's > annoying that platform integrations aren't done consistently in hardware > and that this flows through into software. > >>> I'm also struggling to see how it provides any sort of build time >>> protection, it would allow the generation of a warning at runtime at >>> best. > >> If you don't have the code it WILL NOT LINK. At the moment it is >> entirely possible to link a kernel which will produce a set of confusing >> errors as drivers fail to initialise at startup. > > How will this prevent the code linking? I would expect the "manage the > clocks via runtime PM" call to be a bit of core code, I wouldn't expect > it to be provided by a specific platform otherwise we're in for fail in > a multiplatform environment. Besides, if it fails to link there's some > missing Kconfig anyway since randconfig is supposed to work. > >> We've already had other people run into the issue where they do not >> know why a driver is failing to work (rcar-thermal is one) as the code >> that was managing the clock for it magically vanished during the >> development cycle. > > I agree there's a usability problem here, I just don't think that this > is the best fix for it, I think it's breaking abstractions. > >>> As far as I can tell the problem that Ben has seen here is that the >>> platform really, really needs the code for its power domains running to >>> be functional (this doesn't seem unreasonable and may not be related to >>> clocks, this may be required to have the IPs powered up at all). I'd >>> expect this is something for the platform to sort out rather than >>> something for individual drivers to have to carry code for. > >> What's power domains got to do with this? You keep bringing this up >> but the error is purely to do with clock management. The code happens >> to be sitting in the drivers/base/pm directory, but could easily sit >> elsewhere. > > What these platforms are saying is esssentially that the clocks are part > of the power domain - they're a fundamental part of getting the IP > available for use so there is no point in managing them separately. > This is where I think the abstraction problem is coming, to me it seems > like the platform isn't successfully ensuring that the code to manage > the power domain is there. The fact that part of what's missing is the > clocks shouldn't matter to the drivers, in doing things like this the > platform is trying to abstract that detail away from the drivers. > >>> If it was going to be drivers carrying code for this I would expect it >>> to be something like providing a list of clocks to be managed along with >>> runtime PM - this would also make the code more widely applicable since >>> it's quite common for the runtime PM callbacks to do nothing more than >>> just enable and disable clocks. > >> If we are really saying that bus clocks should not be managed >> by the drivers, then we should just enable this across the whole >> kernel and remove the management from any extant drivers (or make >> it so that any drivers that must manage their bus clocks have a >> call to do so). > > Yes, I think that would be a useful way to go since it would factor out > some common code patterns that keep cropping up (as I suggested to you > previously). It may not just be the main IP clocks that the drivers are > managing like this (some drivers end up managing other clocks at the > same time even if they could be more flexible) so if it was something > drivers could make use of themselves that'd be good. At the moment, the code to actually use the support is sitting in drivers/sh and gets initialised if it is built. This is the source of the original confusions. I think it would be ok if drivers could /opt out/ if the bus clock handling was done like this for all platforms and we simply noted that the pm code is doing it. At that point it would be nice just to build the code in drivers/base/power unconditionally. At the moment we could quite easily enable this code for all the ARM platforms as the clk framework should deal nicely with properly balanced clk_enable() and clk_disable() calls. Enabling it across the board would also remove any issues with changes in platform behaviour and find any bugs sooner rather than later. -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI 2014-01-20 13:19 ` [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI Ben Dooks @ 2014-01-20 15:48 ` Laurent Pinchart 2014-01-20 15:56 ` Mark Brown 0 siblings, 1 reply; 7+ messages in thread From: Laurent Pinchart @ 2014-01-20 15:48 UTC (permalink / raw) To: linux-arm-kernel On Monday 20 January 2014 13:19:07 Ben Dooks wrote: > I've added linux-arm-kernel to the list to get a wider view from > people who actively use the clock subsystem. > > On 20/01/14 12:54, Mark Brown wrote: > > On Mon, Jan 20, 2014 at 12:01:00PM +0000, Ben Dooks wrote: > >> On 20/01/14 11:47, Mark Brown wrote: > >>> I think that just makes things more complicated and isn't adding > >>> anything over pm_runtime_enable(), it's just boilerplate code. In > >>> theory essentially every driver running on platforms which don't have > >>> explicit management of core IP clocks ought to be calling this since > >>> potentially the IP might be deployed on another platform which does have > >>> clock management (this does actually happen with things like the > >>> DesignWare IPs) and it doesn't do anything like say which clocks are > >>> expected to be managed in this way which is another thing that can come > >>> up when moving devices between platforms. > >> > >> That sounds like a real headache where you have two sets of code > >> looking at possibly the same clocks, and behaving differently between > >> different platforms. > > > > Yup, it's usually only one set of code on the client side but it's > > annoying that platform integrations aren't done consistently in hardware > > and that this flows through into software. > > > >>> I'm also struggling to see how it provides any sort of build time > >>> protection, it would allow the generation of a warning at runtime at > >>> best. > >> > >> If you don't have the code it WILL NOT LINK. At the moment it is > >> entirely possible to link a kernel which will produce a set of confusing > >> errors as drivers fail to initialise at startup. > > > > How will this prevent the code linking? I would expect the "manage the > > clocks via runtime PM" call to be a bit of core code, I wouldn't expect > > it to be provided by a specific platform otherwise we're in for fail in > > a multiplatform environment. Besides, if it fails to link there's some > > missing Kconfig anyway since randconfig is supposed to work. > > > >> We've already had other people run into the issue where they do not > >> know why a driver is failing to work (rcar-thermal is one) as the code > >> that was managing the clock for it magically vanished during the > >> development cycle. > > > > I agree there's a usability problem here, I just don't think that this > > is the best fix for it, I think it's breaking abstractions. > > > >>> As far as I can tell the problem that Ben has seen here is that the > >>> platform really, really needs the code for its power domains running to > >>> be functional (this doesn't seem unreasonable and may not be related to > >>> clocks, this may be required to have the IPs powered up at all). I'd > >>> expect this is something for the platform to sort out rather than > >>> something for individual drivers to have to carry code for. > >> > >> What's power domains got to do with this? You keep bringing this up > >> but the error is purely to do with clock management. The code happens > >> to be sitting in the drivers/base/pm directory, but could easily sit > >> elsewhere. > > > > What these platforms are saying is esssentially that the clocks are part > > of the power domain - they're a fundamental part of getting the IP > > available for use so there is no point in managing them separately. > > This is where I think the abstraction problem is coming, to me it seems > > like the platform isn't successfully ensuring that the code to manage > > the power domain is there. The fact that part of what's missing is the > > clocks shouldn't matter to the drivers, in doing things like this the > > platform is trying to abstract that detail away from the drivers. > > > >>> If it was going to be drivers carrying code for this I would expect it > >>> to be something like providing a list of clocks to be managed along with > >>> runtime PM - this would also make the code more widely applicable since > >>> it's quite common for the runtime PM callbacks to do nothing more than > >>> just enable and disable clocks. > >> > >> If we are really saying that bus clocks should not be managed > >> by the drivers, then we should just enable this across the whole > >> kernel and remove the management from any extant drivers (or make > >> it so that any drivers that must manage their bus clocks have a > >> call to do so). > > > > Yes, I think that would be a useful way to go since it would factor out > > some common code patterns that keep cropping up (as I suggested to you > > previously). It may not just be the main IP clocks that the drivers are > > managing like this (some drivers end up managing other clocks at the > > same time even if they could be more flexible) so if it was something > > drivers could make use of themselves that'd be good. > > At the moment, the code to actually use the support is sitting in > drivers/sh and gets initialised if it is built. This is the source > of the original confusions. > > I think it would be ok if drivers could /opt out/ Most drivers have a single functional clock (if any) and only need it to be enabled/disabled in sync with runtime PM. As this requirements is common, making it the default sounds reasonable. Other drivers need to manage their clocks, or at least part of their clocks, manually. There are good and bad reasons for this, and some bad reasons come from driver code that should be fixed, but we can't ignore the problems for now. The simplest implementation would be a way to let a driver opt-out completely. Unless a driver opts out, the runtime PM core will get the default clock for the device (with a NULL con ID) and manage it automatically. I'm not sure what to do when the runtime PM core fails to get the clock, as this can be caused by various problems or non-problems. One particular problem that needs to be considered is deferred probing. An option would be to have all non-SoC devices opt-out from automatic clock management, but that will make the opt-out case the most common one. We also need to consider IP cores that can be present on-SoC or off-SoC in discrete chips. The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform-dependent, but we currently don't express it as such in DT. > if the bus clock handling was done like this for all platforms and we simply > noted that the pm code is doing it. At that point it would be nice just to > build the code in drivers/base/power unconditionally. > > At the moment we could quite easily enable this code for all the ARM > platforms as the clk framework should deal nicely with properly balanced > clk_enable() and clk_disable() calls. > > Enabling it across the board would also remove any issues with changes in > platform behaviour and find any bugs sooner rather than later. -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI 2014-01-20 15:48 ` Laurent Pinchart @ 2014-01-20 15:56 ` Mark Brown 2014-01-20 22:52 ` Laurent Pinchart 0 siblings, 1 reply; 7+ messages in thread From: Mark Brown @ 2014-01-20 15:56 UTC (permalink / raw) To: linux-arm-kernel On Mon, Jan 20, 2014 at 04:48:10PM +0100, Laurent Pinchart wrote: > The problem isn't as simple as it seems, and more advanced implementations > that would allow listing clocks that should be managed automatically (or the > other way around) would also add another level of complexity. The required > information is platform-dependent, but we currently don't express it as such > in DT. Well, the set of clocks an IP requires will tend to be the same - it's normally just that integrators may have done things like tie them together or decide to spread confusion by renaming them. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140120/4673e8f6/attachment.sig> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI 2014-01-20 15:56 ` Mark Brown @ 2014-01-20 22:52 ` Laurent Pinchart 2014-03-11 19:15 ` Geert Uytterhoeven 0 siblings, 1 reply; 7+ messages in thread From: Laurent Pinchart @ 2014-01-20 22:52 UTC (permalink / raw) To: linux-arm-kernel Hi Mark, On Monday 20 January 2014 15:56:43 Mark Brown wrote: > On Mon, Jan 20, 2014 at 04:48:10PM +0100, Laurent Pinchart wrote: > > The problem isn't as simple as it seems, and more advanced implementations > > that would allow listing clocks that should be managed automatically (or > > the other way around) would also add another level of complexity. The > > required information is platform-dependent, but we currently don't > > express it as such in DT. > > Well, the set of clocks an IP requires will tend to be the same - it's > normally just that integrators may have done things like tie them together > or decide to spread confusion by renaming them. That's the problem :-) How should the runtime PM core be given the list of clocks it needs to manage ? That information needs to come from somewhere. -- Regards, Laurent Pinchart -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140120/a2303b43/attachment.sig> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI 2014-01-20 22:52 ` Laurent Pinchart @ 2014-03-11 19:15 ` Geert Uytterhoeven 2014-03-12 14:18 ` Laurent Pinchart 0 siblings, 1 reply; 7+ messages in thread From: Geert Uytterhoeven @ 2014-03-11 19:15 UTC (permalink / raw) To: linux-arm-kernel Hi Laurent, On Mon, Jan 20, 2014 at 11:52 PM, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > On Monday 20 January 2014 15:56:43 Mark Brown wrote: >> On Mon, Jan 20, 2014 at 04:48:10PM +0100, Laurent Pinchart wrote: >> > The problem isn't as simple as it seems, and more advanced implementations >> > that would allow listing clocks that should be managed automatically (or >> > the other way around) would also add another level of complexity. The >> > required information is platform-dependent, but we currently don't >> > express it as such in DT. >> >> Well, the set of clocks an IP requires will tend to be the same - it's >> normally just that integrators may have done things like tie them together >> or decide to spread confusion by renaming them. > > That's the problem :-) How should the runtime PM core be given the list of > clocks it needs to manage ? That information needs to come from somewhere. Stirring the pot again... Which clocks a device needs is expressed in DT with CCF. In the simple case, the runtime PM core can just control them based on device use. In the complex case, the driver can regain control using its own pm callbacks, right? Probably I'm still missing something, as I haven't had enough exposure to runtime PM and CCF ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI 2014-03-11 19:15 ` Geert Uytterhoeven @ 2014-03-12 14:18 ` Laurent Pinchart 2014-03-12 15:28 ` Laurent Pinchart 0 siblings, 1 reply; 7+ messages in thread From: Laurent Pinchart @ 2014-03-12 14:18 UTC (permalink / raw) To: linux-arm-kernel Hi Geert, On Tuesday 11 March 2014 20:15:04 Geert Uytterhoeven wrote: > On Mon, Jan 20, 2014 at 11:52 PM, Laurent Pinchart wrote: > > On Monday 20 January 2014 15:56:43 Mark Brown wrote: > >> On Mon, Jan 20, 2014 at 04:48:10PM +0100, Laurent Pinchart wrote: > >> > The problem isn't as simple as it seems, and more advanced > >> > implementations that would allow listing clocks that should be managed > >> > automatically (or the other way around) would also add another level of > >> > complexity. The required information is platform-dependent, but we > >> > currently don't express it as such in DT. > >> > >> Well, the set of clocks an IP requires will tend to be the same - it's > >> normally just that integrators may have done things like tie them > >> together or decide to spread confusion by renaming them. > > > > That's the problem :-) How should the runtime PM core be given the list of > > clocks it needs to manage ? That information needs to come from somewhere. > > Stirring the pot again... > > Which clocks a device needs is expressed in DT with CCF. > In the simple case, the runtime PM core can just control them based on > device use. > In the complex case, the driver can regain control using its own pm > callbacks, right? Sure, the driver can of course control the clocks manually in its PM callbacks if it needs to. The point, however, is to control the clocks from core code whenever possible. We thus need to define exact semantics to make sure each side knows what tasks to perform, and what to expect from the other side. For instance, in the DT case, the runtime PM core can easily get the list of the clocks used by the device from its DT node, but how can it know which clock(s) it should manage automatically and which clock(s) it should leave for the driver to control ? > Probably I'm still missing something, as I haven't had enough exposure to > runtime PM and CCF ;-) -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI 2014-03-12 14:18 ` Laurent Pinchart @ 2014-03-12 15:28 ` Laurent Pinchart 0 siblings, 0 replies; 7+ messages in thread From: Laurent Pinchart @ 2014-03-12 15:28 UTC (permalink / raw) To: linux-arm-kernel Hi Geert, On Wednesday 12 March 2014 15:18:46 Laurent Pinchart wrote: > On Tuesday 11 March 2014 20:15:04 Geert Uytterhoeven wrote: > > On Mon, Jan 20, 2014 at 11:52 PM, Laurent Pinchart wrote: > > > On Monday 20 January 2014 15:56:43 Mark Brown wrote: > > >> On Mon, Jan 20, 2014 at 04:48:10PM +0100, Laurent Pinchart wrote: > > >> > The problem isn't as simple as it seems, and more advanced > > >> > implementations that would allow listing clocks that should be > > >> > managed automatically (or the other way around) would also add > > >> > another level of complexity. The required information is platform- > > >> > dependent, but we currently don't express it as such in DT. > > >> > > >> Well, the set of clocks an IP requires will tend to be the same - it's > > >> normally just that integrators may have done things like tie them > > >> together or decide to spread confusion by renaming them. > > > > > > That's the problem :-) How should the runtime PM core be given the list > > > of clocks it needs to manage ? That information needs to come from > > > somewhere. > > > > Stirring the pot again... > > > > Which clocks a device needs is expressed in DT with CCF. > > In the simple case, the runtime PM core can just control them based on > > device use. > > In the complex case, the driver can regain control using its own pm > > callbacks, right? > > Sure, the driver can of course control the clocks manually in its PM > callbacks if it needs to. The point, however, is to control the clocks from > core code whenever possible. We thus need to define exact semantics to make > sure each side knows what tasks to perform, and what to expect from the > other side. For instance, in the DT case, the runtime PM core can easily > get the list of the clocks used by the device from its DT node, but how can > it know which clock(s) it should manage automatically and which clock(s) it > should leave for the driver to control ? > > > Probably I'm still missing something, as I haven't had enough exposure to > > runtime PM and CCF ;-) If you haven't seen it already, https://lkml.org/lkml/2014/1/31/290 ("[RFC/PATCH] base: platform: add generic clock handling for platform-bus") might be related. -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-03-12 15:28 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1389707776-23306-1-git-send-email-ben.dooks@codethink.co.uk> [not found] ` <52D7B6A8.9000302@codethink.co.uk> [not found] ` <52D815F5.2080604@codethink.co.uk> [not found] ` <3417477.Rj26gCLKM2@avalon> [not found] ` <20140120114705.GL17314@sirena.org.uk> [not found] ` <52DD0FFC.8020307@codethink.co.uk> [not found] ` <20140120125436.GN17314@sirena.org.uk> 2014-01-20 13:19 ` [PATCH] ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI Ben Dooks 2014-01-20 15:48 ` Laurent Pinchart 2014-01-20 15:56 ` Mark Brown 2014-01-20 22:52 ` Laurent Pinchart 2014-03-11 19:15 ` Geert Uytterhoeven 2014-03-12 14:18 ` Laurent Pinchart 2014-03-12 15:28 ` Laurent Pinchart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).