linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Mark Rutland <mark.rutland@arm.com>, Dirk Behme <dirk.behme@gmail.com>
Cc: Dirk Behme <dirk.behme@de.bosch.com>,
	devicetree@vger.kernel.org,
	Stefano Stabellini <sstabellini@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	xen-devel@lists.xenproject.org, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [Xen-devel] [PATCH v2] xen/arm: register clocks used by the hypervisor
Date: Thu, 30 Jun 2016 16:33:19 +0100	[thread overview]
Message-ID: <57753BBF.5000004@arm.com> (raw)
In-Reply-To: <20160630151523.GA29700@leverpostej>

Hi,

On 30/06/16 16:18, Mark Rutland wrote:
> On Thu, Jun 30, 2016 at 04:56:40PM +0200, Dirk Behme wrote:
>> On 30.06.2016 16:21, Mark Rutland wrote:
>>> On Thu, Jun 30, 2016 at 12:32:32PM +0200, Dirk Behme wrote:
>>>> +- clocks: one or more clocks to be registered.
>>>> +  Xen hypervisor drivers might replace native drivers, resulting in
>>>> +  clocks not registered by these native drivers. To avoid that these
>>>> +  unregistered clocks are disabled, then, e.g. by clk_disable_unused(),
>>>> +  register them in the hypervisor node.
>>>> +  An example for this are the clocks of the serial driver. If the clocks
>>>> +  used by the serial hardware interface are not registered by the serial
>>>> +  driver the serial output might stop once clk_disable_unused() is called.
>>>
>>> This shouldn't be described in terms of the Linux implementation details
>>> like clk_disable_unused. Those can change at any time, and don't define
>>> the contract as such.
>>
>> Ok. I remove that from the description. Thanks!
>
> Great, thanks.
>
>>> What exactly is the contract here? I assume that you don't want the
>>> kernel to alter the state of these clocks in any way,
>>
>> I don't think so. I think what we want is that the kernel just don't
>> disable the (from kernel's point of view) "unused" clocks. I think
>> we get this from the fact that using 'clk_ignore_unused' is a
>> working workaround for this issue.
>
> What if the clock (or a parent thereof) is shared with another device?
>
> Surely you don't want that other driver to change the rate (changing the
> rate of the UART behind Xen's back)?
>
> I appreciate that clk_ignore_unused might work on platforms today, but
> that relies on the behaviour of drivers, which might change. It may also
> not work on other platforms in future, in cases like the above.
>
>>> e.g. the rate cannot be changed, they must be left always on, parent
>>> clocks cannot be altered if that would result in momentary jitter.
>>>
>>> I suspect it may be necessary to do more to ensure that, but I'm not
>>> familiar enough with the clocks subsystem to say.
>>>
>>> Are we likely to need to care about regulators, GPIOs, resets, etc? I
>>> worry that this may be the tip of hte iceberg
>>
>> I don't think so. If there is a user in the kernel of the clock,
>> fine. Then hopefully the user in the kernel knows what he is doing
>> with the clock and then he should do what ever he wants.
>
> I'm not sure that's true. A user of the clock may know nothing about
> other users. As far as I can see, nothing prevents it from changing the
> clock rate.
>
> While drivers in the same kernel can co-ordinate to avoid problems such
> as that, we can't do that if we know nothing about the user hidden by
> Xen.
>
>  From looking at the Xen bug tracker, it's not clear which
> platforms/devices this is necessary for, so it's still not clear to me
> if we need to care about regulators, GPIOs, resets, and so on.
>
> Do we know which platforms in particular we need this for?

I believe this is necessary for all the platforms where the UART has a 
clock described in the firmware.

This workaround was first required on the arndale. Note that UART on 
Juno r2 has a clock described but 'clk_ignore_unused' is not necessary. 
I am wondering why it is working.

The number of devices used by Xen is very limited (UART, timer and 
SMMU). However we may also want to consider device passthrough where a 
clock would be handled by another guest.

Regards,

-- 
Julien Grall

  reply	other threads:[~2016-06-30 15:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 10:32 [PATCH v2] xen/arm: register clocks used by the hypervisor Dirk Behme
2016-06-30 14:21 ` Mark Rutland
2016-06-30 14:56   ` [Xen-devel] " Dirk Behme
2016-06-30 15:18     ` Mark Rutland
2016-06-30 15:33       ` Julien Grall [this message]
2016-07-05 13:53 ` Stefano Stabellini
2016-07-05 13:54   ` Julien Grall
2016-07-05 14:02     ` Julien Grall
2016-07-05 14:04     ` Stefano Stabellini
2016-07-05 14:08       ` Julien Grall
2016-07-05 14:37         ` Stefano Stabellini
2016-07-06  1:34 ` Michael Turquette
2016-07-06 13:10   ` Julien Grall
2016-07-06 13:16     ` Stefano Stabellini
2016-07-06 13:26       ` Julien Grall
2016-07-06 13:48       ` Mark Rutland
2016-07-06 20:42     ` Michael Turquette
2016-07-07  7:32       ` Dirk Behme
2016-07-08  2:50         ` Michael Turquette
2016-07-08  5:51           ` [Xen-devel] " Dirk Behme
2016-07-08  9:21             ` Julien Grall
2016-07-08  6:48   ` Dirk Behme
2016-07-08  9:35     ` Julien Grall

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=57753BBF.5000004@arm.com \
    --to=julien.grall@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dirk.behme@de.bosch.com \
    --cc=dirk.behme@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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 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).